summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorHanhui <sylixos@gmail.com>2019-05-05 12:05:51 (GMT)
committer Hanhui <sylixos@gmail.com>2019-04-18 15:49:44 (GMT)
commiteec84604ce101227b604960bf1056dfd5b85d1cf (patch)
treefeb1b11b1b33d5df3ed3f0e6c4c8a7cdb34cb6b1
parent22f71dd69255a87462e317f0b349c12b04d9aa38 (diff)
downloadAIC-OS-eec84604ce101227b604960bf1056dfd5b85d1cf.zip
Make some kernel object with GLOBAL flag and improving bridge, bonding interface usability.
-rw-r--r--SylixOS/arch/x86/acpi/x86AcpiSylixOS.c1
-rw-r--r--SylixOS/include/net/if_bonding.h4
-rw-r--r--SylixOS/include/net/if_bridge.h2
-rw-r--r--SylixOS/net/lwip/bonding/netbonding.c73
-rw-r--r--SylixOS/net/lwip/bonding/netbonding.h14
-rw-r--r--SylixOS/net/lwip/bridge/netbridge.c56
-rw-r--r--SylixOS/net/lwip/bridge/netbridge.h10
-rw-r--r--SylixOS/net/lwip/lwip_bonding.c38
-rw-r--r--SylixOS/net/lwip/lwip_bridge.c26
-rw-r--r--SylixOS/net/lwip/lwip_route.c2
-rw-r--r--SylixOS/posix/pthread/pthread_cond.c1
-rw-r--r--SylixOS/posix/pthread/pthread_mutex.c1
-rw-r--r--SylixOS/posix/pthread/pthread_rwlock.c1
-rw-r--r--SylixOS/posix/semaphore/semaphore.c1
14 files changed, 136 insertions, 94 deletions
diff --git a/SylixOS/arch/x86/acpi/x86AcpiSylixOS.c b/SylixOS/arch/x86/acpi/x86AcpiSylixOS.c
index b721fc1..0a3e084 100644
--- a/SylixOS/arch/x86/acpi/x86AcpiSylixOS.c
+++ b/SylixOS/arch/x86/acpi/x86AcpiSylixOS.c
@@ -846,6 +846,7 @@ ACPI_STATUS AcpiOsExecute (ACPI_EXECUTE_TYPE Type,
if (LW_SYS_STATUS_IS_RUNNING()) {
LW_CLASS_THREADATTR threadattr = API_ThreadAttrGetDefault();
+ threadattr.THREADATTR_ulOption |= LW_OPTION_OBJECT_GLOBAL;
threadattr.THREADATTR_pvArg = Context;
API_ThreadCreate("t_acpi", (PTHREAD_START_ROUTINE)Function, &threadattr, LW_NULL);
diff --git a/SylixOS/include/net/if_bonding.h b/SylixOS/include/net/if_bonding.h
index e19d96d..af77df8 100644
--- a/SylixOS/include/net/if_bonding.h
+++ b/SylixOS/include/net/if_bonding.h
@@ -45,7 +45,7 @@ extern "C" {
bd_interval 只针对 NETBD_MON_MODE_ARP 监控模式有效.
*********************************************************************************************************/
struct net_bonding_ctl {
- int bd_index; /* Only for NETBD_CTL_ADD return */
+ int bd_index; /* NETBD_CTL_ADD return */
int bd_mode; /* Only for NETBD_CTL_ADD set */
int bd_mon_mode; /* Only for NETBD_CTL_ADD set */
int bd_interval; /* ARP detect period (milliseconds) mode 1 */
@@ -72,6 +72,7 @@ struct net_bonding_ctl {
Bonding 网络设置 MASTER 网卡. (NETBD_MODE_ACTIVE_BACKUP mode only!)
*********************************************************************************************************/
struct net_bonding_device {
+ int bd_index;
char bd_dev[IFNAMSIZ]; /* Bonding device name */
char eth_dev[IFNAMSIZ]; /* Sub ethernet device name */
};
@@ -83,6 +84,7 @@ struct net_bonding_device {
Bonding 网络监控目标. (NETBD_MODE_ACTIVE_BACKUP mode only!)
*********************************************************************************************************/
struct net_bonding_arp {
+ int bd_index;
char bd_dev[IFNAMSIZ]; /* Bonding device name */
char arp_ip_target[64];
};
diff --git a/SylixOS/include/net/if_bridge.h b/SylixOS/include/net/if_bridge.h
index 6924b88..a474434 100644
--- a/SylixOS/include/net/if_bridge.h
+++ b/SylixOS/include/net/if_bridge.h
@@ -40,7 +40,7 @@ extern "C" {
网桥控制参数.
*********************************************************************************************************/
struct net_bridge_ctl {
- int br_index; /* Only for NETBR_CTL_ADD return */
+ int br_index; /* NETBR_CTL_ADD return */
char br_dev[IFNAMSIZ]; /* Bridge device name */
char eth_dev[IFNAMSIZ]; /* Sub ethernet device name */
};
diff --git a/SylixOS/net/lwip/bonding/netbonding.c b/SylixOS/net/lwip/bonding/netbonding.c
index 089a7ea..84175cd 100644
--- a/SylixOS/net/lwip/bonding/netbonding.c
+++ b/SylixOS/net/lwip/bonding/netbonding.c
@@ -462,7 +462,7 @@ static void netbd_proc (void *arg)
'subdev' sub ethernet device name
sub_is_ifname == 0: dev name
sub_is_ifname == 1: if name */
-int netbd_add_dev (const char *bddev, const char *sub, int sub_is_ifname)
+int netbd_add_dev (const char *bddev, int bdindex, const char *sub, int sub_is_ifname)
{
int found, flags, need_up = 0;
struct netif *netif;
@@ -473,14 +473,18 @@ int netbd_add_dev (const char *bddev, const char *sub, int sub_is_ifname)
netdev_t *netdev;
struct ifreq ifreq;
- if (!bddev || !sub) {
+ if (!sub) {
errno = EINVAL;
return (-1);
}
LWIP_IF_LIST_LOCK(FALSE);
found = 0;
- netdev_bd = netdev_find_by_devname(bddev);
+ if (bddev && bddev[0]) {
+ netdev_bd = netdev_find_by_devname(bddev);
+ } else {
+ netdev_bd = netdev_find_by_index(bdindex);
+ }
if (netdev_bd && (netdev_bd->drv->transmit == netbd_transmit)) {
netbd = (netbd_t *)netdev_bd->priv;
if (netbd && netbd->magic_no == NETBONDING_MAGIC) {
@@ -608,7 +612,7 @@ int netbd_add_dev (const char *bddev, const char *sub, int sub_is_ifname)
'subdev' sub ethernet device name
sub_is_ifname == 0: dev name
sub_is_ifname == 1: if name */
-int netbd_delete_dev (const char *bddev, const char *sub, int sub_is_ifname)
+int netbd_delete_dev (const char *bddev, int bdindex, const char *sub, int sub_is_ifname)
{
int i, found, flags;
char subif[IFNAMSIZ];
@@ -619,14 +623,18 @@ int netbd_delete_dev (const char *bddev, const char *sub, int sub_is_ifname)
netdev_t *netdev;
struct ifreq ifreq;
- if (!bddev || !sub) {
+ if (!sub) {
errno = EINVAL;
return (-1);
}
LWIP_IF_LIST_LOCK(FALSE);
found = 0;
- netdev_bd = netdev_find_by_devname(bddev);
+ if (bddev && bddev[0]) {
+ netdev_bd = netdev_find_by_devname(bddev);
+ } else {
+ netdev_bd = netdev_find_by_index(bdindex);
+ }
if (netdev_bd && (netdev_bd->drv->transmit == netbd_transmit)) {
netbd = (netbd_t *)netdev_bd->priv;
if (netbd && netbd->magic_no == NETBONDING_MAGIC) {
@@ -733,7 +741,7 @@ int netbd_delete_dev (const char *bddev, const char *sub, int sub_is_ifname)
}
/* net bonding set master device */
-int netbd_master_dev (const char *bddev, const char *sub, int sub_is_ifname)
+int netbd_master_dev (const char *bddev, int bdindex, const char *sub, int sub_is_ifname)
{
int i, found;
char subif[IFNAMSIZ];
@@ -742,14 +750,18 @@ int netbd_master_dev (const char *bddev, const char *sub, int sub_is_ifname)
netdev_t *netdev_bd;
netdev_t *netdev;
- if (!bddev || !sub) {
+ if (!sub) {
errno = EINVAL;
return (-1);
}
LWIP_IF_LIST_LOCK(FALSE);
found = 0;
- netdev_bd = netdev_find_by_devname(bddev);
+ if (bddev && bddev[0]) {
+ netdev_bd = netdev_find_by_devname(bddev);
+ } else {
+ netdev_bd = netdev_find_by_index(bdindex);
+ }
if (netdev_bd && (netdev_bd->drv->transmit == netbd_transmit)) {
netbd = (netbd_t *)netdev_bd->priv;
if (netbd && netbd->magic_no == NETBONDING_MAGIC) {
@@ -796,7 +808,7 @@ int netbd_master_dev (const char *bddev, const char *sub, int sub_is_ifname)
}
/* add a arp detect target to net bonding virtual device */
-int netbd_add_arp (const char *bddev, const char *ip)
+int netbd_add_arp (const char *bddev, int bdindex, const char *ip)
{
int found;
netbd_t *netbd;
@@ -804,7 +816,7 @@ int netbd_add_arp (const char *bddev, const char *ip)
netbd_arp_t *netbd_arp;
ip4_addr_t ipaddr;
- if (!bddev || !ip) {
+ if (!ip) {
errno = EINVAL;
return (-1);
}
@@ -816,7 +828,11 @@ int netbd_add_arp (const char *bddev, const char *ip)
LWIP_IF_LIST_LOCK(FALSE);
found = 0;
- netdev_bd = netdev_find_by_devname(bddev);
+ if (bddev && bddev[0]) {
+ netdev_bd = netdev_find_by_devname(bddev);
+ } else {
+ netdev_bd = netdev_find_by_index(bdindex);
+ }
if (netdev_bd && (netdev_bd->drv->transmit == netbd_transmit)) {
netbd = (netbd_t *)netdev_bd->priv;
if (netbd && netbd->magic_no == NETBONDING_MAGIC) {
@@ -847,7 +863,7 @@ int netbd_add_arp (const char *bddev, const char *ip)
}
/* delete a arp detect target to net bonding virtual device */
-int netbd_delete_arp (const char *bddev, const char *ip)
+int netbd_delete_arp (const char *bddev, int bdindex, const char *ip)
{
int found;
netbd_t *netbd;
@@ -856,7 +872,7 @@ int netbd_delete_arp (const char *bddev, const char *ip)
ip4_addr_t ipaddr;
LW_LIST_LINE *pline;
- if (!bddev || !ip) {
+ if (!ip) {
errno = EINVAL;
return (-1);
}
@@ -868,7 +884,11 @@ int netbd_delete_arp (const char *bddev, const char *ip)
LWIP_IF_LIST_LOCK(FALSE);
found = 0;
- netdev_bd = netdev_find_by_devname(bddev);
+ if (bddev && bddev[0]) {
+ netdev_bd = netdev_find_by_devname(bddev);
+ } else {
+ netdev_bd = netdev_find_by_index(bdindex);
+ }
if (netdev_bd && (netdev_bd->drv->transmit == netbd_transmit)) {
netbd = (netbd_t *)netdev_bd->priv;
if (netbd && netbd->magic_no == NETBONDING_MAGIC) {
@@ -1024,7 +1044,7 @@ int netbd_add (const char *bddev, const char *ip,
/* delete net bonding
'bddev' bonding device name (not ifname) */
-int netbd_delete (const char *bddev)
+int netbd_delete (const char *bddev, int bdindex)
{
int found, flags;
struct netif *netif;
@@ -1034,14 +1054,13 @@ int netbd_delete (const char *bddev)
netdev_t *netdev;
struct ifreq ifreq;
- if (!bddev) {
- errno = EINVAL;
- return (-1);
- }
-
LWIP_IF_LIST_LOCK(FALSE);
found = 0;
- netdev_bd = netdev_find_by_devname(bddev);
+ if (bddev && bddev[0]) {
+ netdev_bd = netdev_find_by_devname(bddev);
+ } else {
+ netdev_bd = netdev_find_by_index(bdindex);
+ }
if (netdev_bd && (netdev_bd->drv->transmit == netbd_transmit)) {
netbd = (netbd_t *)netdev_bd->priv;
if (netbd && netbd->magic_no == NETBONDING_MAGIC) {
@@ -1206,7 +1225,7 @@ void netbd_sub_delete_hook (netdev_t *netdev)
}
/* net bonding show all device in bonding virtual device */
-int netbd_show_dev (const char *bddev, int fd)
+int netbd_show_dev (const char *bddev, int bdindex, int fd)
{
#define NETBD_ARP_BUF_MAX 16
int found;
@@ -1222,14 +1241,18 @@ int netbd_show_dev (const char *bddev, int fd)
char ifname[NETIF_NAMESIZE];
LW_LIST_LINE *pline;
- if (!bddev || (fd < 0)) {
+ if (fd < 0) {
errno = EINVAL;
return (-1);
}
LWIP_IF_LIST_LOCK(FALSE);
found = 0;
- netdev_bd = netdev_find_by_devname(bddev);
+ if (bddev && bddev[0]) {
+ netdev_bd = netdev_find_by_devname(bddev);
+ } else {
+ netdev_bd = netdev_find_by_index(bdindex);
+ }
if (netdev_bd && (netdev_bd->drv->transmit == netbd_transmit)) {
netbd = (netbd_t *)netdev_bd->priv;
if (netbd && netbd->magic_no == NETBONDING_MAGIC) {
diff --git a/SylixOS/net/lwip/bonding/netbonding.h b/SylixOS/net/lwip/bonding/netbonding.h
index cbb67f8..53028c0 100644
--- a/SylixOS/net/lwip/bonding/netbonding.h
+++ b/SylixOS/net/lwip/bonding/netbonding.h
@@ -50,21 +50,21 @@ int netbd_add(const char *bddev, const char *ip,
const char *netmask, const char *gw,
int mode, int mon_mode, int interval,
int alive, int *index);
-int netbd_delete(const char *bddev);
+int netbd_delete(const char *bddev, int bdindex);
/* add or delete a net device to net bonding virtual device */
-int netbd_add_dev(const char *bddev, const char *sub, int sub_is_ifname);
-int netbd_delete_dev(const char *bddev, const char *sub, int sub_is_ifname);
+int netbd_add_dev(const char *bddev, int bdindex, const char *sub, int sub_is_ifname);
+int netbd_delete_dev(const char *bddev, int bdindex, const char *sub, int sub_is_ifname);
/* net bonding set master device */
-int netbd_master_dev(const char *bddev, const char *sub, int sub_is_ifname);
+int netbd_master_dev(const char *bddev, int bdindex, const char *sub, int sub_is_ifname);
/* add or delete a arp detect target to net bonding virtual device */
-int netbd_add_arp(const char *bddev, const char *ip);
-int netbd_delete_arp(const char *bddev, const char *ip);
+int netbd_add_arp(const char *bddev, int bdindex, const char *ip);
+int netbd_delete_arp(const char *bddev, int bdindex, const char *ip);
/* net bonding show all device in bonding virtual device */
-int netbd_show_dev(const char *bddev, int fd);
+int netbd_show_dev(const char *bddev, int bdindex, int fd);
#endif /* LW_CFG_NET_DEV_BONDING_EN */
#endif /* __NETBONDING_H */
diff --git a/SylixOS/net/lwip/bridge/netbridge.c b/SylixOS/net/lwip/bridge/netbridge.c
index 51388fb..5420675 100644
--- a/SylixOS/net/lwip/bridge/netbridge.c
+++ b/SylixOS/net/lwip/bridge/netbridge.c
@@ -342,7 +342,7 @@ static void netbr_wd (netdev_t *netdev_br)
'subdev' sub ethernet device name
sub_is_ifname == 0: dev name
sub_is_ifname == 1: if name */
-int netbr_add_dev (const char *brdev, const char *sub, int sub_is_ifname)
+int netbr_add_dev (const char *brdev, int brindex, const char *sub, int sub_is_ifname)
{
int found, flags, need_up = 0;
struct netif *netif;
@@ -353,14 +353,18 @@ int netbr_add_dev (const char *brdev, const char *sub, int sub_is_ifname)
netdev_t *netdev;
struct ifreq ifreq;
- if (!brdev || !sub) {
+ if (!sub) {
errno = EINVAL;
return (-1);
}
LWIP_IF_LIST_LOCK(FALSE);
found = 0;
- netdev_br = netdev_find_by_devname(brdev);
+ if (brdev && brdev[0]) {
+ netdev_br = netdev_find_by_devname(brdev);
+ } else {
+ netdev_br = netdev_find_by_index(brindex);
+ }
if (netdev_br && (netdev_br->drv->transmit == netbr_transmit)) {
netbr = (netbr_t *)netdev_br->priv;
if (netbr && netbr->magic_no == NETBRIDGE_MAGIC) {
@@ -468,7 +472,7 @@ int netbr_add_dev (const char *brdev, const char *sub, int sub_is_ifname)
'subdev' sub ethernet device name
sub_is_ifname == 0: dev name
sub_is_ifname == 1: if name */
-int netbr_delete_dev (const char *brdev, const char *sub, int sub_is_ifname)
+int netbr_delete_dev (const char *brdev, int brindex, const char *sub, int sub_is_ifname)
{
int found, flags;
char subif[IFNAMSIZ];
@@ -480,14 +484,18 @@ int netbr_delete_dev (const char *brdev, const char *sub, int sub_is_ifname)
LW_LIST_LINE *pline;
struct ifreq ifreq;
- if (!brdev || !sub) {
+ if (!sub) {
errno = EINVAL;
return (-1);
}
LWIP_IF_LIST_LOCK(FALSE);
found = 0;
- netdev_br = netdev_find_by_devname(brdev);
+ if (brdev && brdev[0]) {
+ netdev_br = netdev_find_by_devname(brdev);
+ } else {
+ netdev_br = netdev_find_by_index(brindex);
+ }
if (netdev_br && (netdev_br->drv->transmit == netbr_transmit)) {
netbr = (netbr_t *)netdev_br->priv;
if (netbr && netbr->magic_no == NETBRIDGE_MAGIC) {
@@ -649,7 +657,7 @@ int netbr_add (const char *brdev, const char *ip,
/* delete net bridge
'brdev' bridge device name (not ifname) */
-int netbr_delete (const char *brdev)
+int netbr_delete (const char *brdev, int brindex)
{
int found, flags;
struct netif *netif;
@@ -659,14 +667,13 @@ int netbr_delete (const char *brdev)
netdev_t *netdev;
struct ifreq ifreq;
- if (!brdev) {
- errno = EINVAL;
- return (-1);
- }
-
LWIP_IF_LIST_LOCK(FALSE);
found = 0;
- netdev_br = netdev_find_by_devname(brdev);
+ if (brdev && brdev[0]) {
+ netdev_br = netdev_find_by_devname(brdev);
+ } else {
+ netdev_br = netdev_find_by_index(brindex);
+ }
if (netdev_br && (netdev_br->drv->transmit == netbr_transmit)) {
netbr = (netbr_t *)netdev_br->priv;
if (netbr && netbr->magic_no == NETBRIDGE_MAGIC) {
@@ -746,7 +753,7 @@ int netbr_delete (const char *brdev)
/* net bridge mac cache flush
'brdev' bridge device name (not ifname) */
-int netbr_flush_cache (const char *brdev)
+int netbr_flush_cache (const char *brdev, int brindex)
{
int found;
netbr_t *netbr;
@@ -755,14 +762,13 @@ int netbr_flush_cache (const char *brdev)
LW_LIST_LINE *pline;
int i;
- if (!brdev) {
- errno = EINVAL;
- return (-1);
- }
-
LWIP_IF_LIST_LOCK(FALSE);
found = 0;
- netdev_br = netdev_find_by_devname(brdev);
+ if (brdev && brdev[0]) {
+ netdev_br = netdev_find_by_devname(brdev);
+ } else {
+ netdev_br = netdev_find_by_index(brindex);
+ }
if (netdev_br && (netdev_br->drv->transmit == netbr_transmit)) {
netbr = (netbr_t *)netdev_br->priv;
if (netbr && netbr->magic_no == NETBRIDGE_MAGIC) {
@@ -845,7 +851,7 @@ void netbr_sub_delete_hook (netdev_t *netdev)
}
/* net bridge show all device in bridge */
-int netbr_show_dev (const char *brdev, int fd)
+int netbr_show_dev (const char *brdev, int brindex, int fd)
{
int found;
int i = 0, j;
@@ -858,14 +864,18 @@ int netbr_show_dev (const char *brdev, int fd)
char ifname[NETIF_NAMESIZE];
LW_LIST_LINE *pline;
- if (!brdev || (fd < 0)) {
+ if (fd < 0) {
errno = EINVAL;
return (-1);
}
LWIP_IF_LIST_LOCK(FALSE);
found = 0;
- netdev_br = netdev_find_by_devname(brdev);
+ if (brdev && brdev[0]) {
+ netdev_br = netdev_find_by_devname(brdev);
+ } else {
+ netdev_br = netdev_find_by_index(brindex);
+ }
if (netdev_br && (netdev_br->drv->transmit == netbr_transmit)) {
netbr = (netbr_t *)netdev_br->priv;
if (netbr && netbr->magic_no == NETBRIDGE_MAGIC) {
diff --git a/SylixOS/net/lwip/bridge/netbridge.h b/SylixOS/net/lwip/bridge/netbridge.h
index 1aadbce..b9eff08 100644
--- a/SylixOS/net/lwip/bridge/netbridge.h
+++ b/SylixOS/net/lwip/bridge/netbridge.h
@@ -48,17 +48,17 @@
/* add and delete net bridge */
int netbr_add(const char *brdev, const char *ip,
const char *netmask, const char *gw, int *index);
-int netbr_delete(const char *brdev);
+int netbr_delete(const char *brdev, int brindex);
/* add or delete a net device to net bridge */
-int netbr_add_dev(const char *brdev, const char *sub, int sub_is_ifname);
-int netbr_delete_dev(const char *brdev, const char *sub, int sub_is_ifname);
+int netbr_add_dev(const char *brdev, int brindex, const char *sub, int sub_is_ifname);
+int netbr_delete_dev(const char *brdev, int brindex, const char *sub, int sub_is_ifname);
/* net bridge mac cache flush */
-int netbr_flush_cache(const char *brdev);
+int netbr_flush_cache(const char *brdev, int brindex);
/* net bridge show all device in bridge */
-int netbr_show_dev(const char *brdev, int fd);
+int netbr_show_dev(const char *brdev, int brindex, int fd);
#endif /* LW_CFG_NET_DEV_BRIDGE_EN */
#endif /* __NETBRIDGE_H */
diff --git a/SylixOS/net/lwip/lwip_bonding.c b/SylixOS/net/lwip/lwip_bonding.c
index 1b1f13b..1ef4842 100644
--- a/SylixOS/net/lwip/lwip_bonding.c
+++ b/SylixOS/net/lwip/lwip_bonding.c
@@ -110,63 +110,63 @@ static INT _netbdIoctl (PLW_DEV_HDR pdevhdr,
case NETBD_CTL_DELETE:
pnetbdcrl = (struct net_bonding_ctl *)lArg;
if (pnetbdcrl) {
- iRet = netbd_delete(pnetbdcrl->bd_dev);
+ iRet = netbd_delete(pnetbdcrl->bd_dev, pnetbdcrl->bd_index);
}
return (iRet);
case NETBD_CTL_ADD_DEV:
pnetbdcrl = (struct net_bonding_ctl *)lArg;
if (pnetbdcrl) {
- iRet = netbd_add_dev(pnetbdcrl->bd_dev, pnetbdcrl->eth_dev, 0);
+ iRet = netbd_add_dev(pnetbdcrl->bd_dev, pnetbdcrl->bd_index, pnetbdcrl->eth_dev, 0);
}
return (iRet);
case NETBD_CTL_DELETE_DEV:
pnetbdcrl = (struct net_bonding_ctl *)lArg;
if (pnetbdcrl) {
- iRet = netbd_delete_dev(pnetbdcrl->bd_dev, pnetbdcrl->eth_dev, 0);
+ iRet = netbd_delete_dev(pnetbdcrl->bd_dev, pnetbdcrl->bd_index, pnetbdcrl->eth_dev, 0);
}
return (iRet);
case NETBD_CTL_ADD_IF:
pnetbdcrl = (struct net_bonding_ctl *)lArg;
if (pnetbdcrl) {
- iRet = netbd_add_dev(pnetbdcrl->bd_dev, pnetbdcrl->eth_dev, 1);
+ iRet = netbd_add_dev(pnetbdcrl->bd_dev, pnetbdcrl->bd_index, pnetbdcrl->eth_dev, 1);
}
return (iRet);
case NETBD_CTL_DELETE_IF:
pnetbdcrl = (struct net_bonding_ctl *)lArg;
if (pnetbdcrl) {
- iRet = netbd_delete_dev(pnetbdcrl->bd_dev, pnetbdcrl->eth_dev, 1);
+ iRet = netbd_delete_dev(pnetbdcrl->bd_dev, pnetbdcrl->bd_index, pnetbdcrl->eth_dev, 1);
}
return (iRet);
case NETBD_CTL_MASTER_DEV:
pnetbddev = (struct net_bonding_device *)lArg;
if (pnetbddev) {
- iRet = netbd_master_dev(pnetbddev->bd_dev, pnetbddev->eth_dev, 0);
+ iRet = netbd_master_dev(pnetbddev->bd_dev, pnetbddev->bd_index, pnetbddev->eth_dev, 0);
}
return (iRet);
case NETBD_CTL_MASTER_IF:
pnetbddev = (struct net_bonding_device *)lArg;
if (pnetbddev) {
- iRet = netbd_master_dev(pnetbddev->bd_dev, pnetbddev->eth_dev, 1);
+ iRet = netbd_master_dev(pnetbddev->bd_dev, pnetbddev->bd_index, pnetbddev->eth_dev, 1);
}
return (iRet);
case NETBD_CTL_ARP_ADD:
pnetbdarp = (struct net_bonding_arp *)lArg;
if (pnetbdarp) {
- iRet = netbd_add_arp(pnetbdarp->bd_dev, pnetbdarp->arp_ip_target);
+ iRet = netbd_add_arp(pnetbdarp->bd_dev, pnetbdarp->bd_index, pnetbdarp->arp_ip_target);
}
return (iRet);
case NETBD_CTL_ARP_DELETE:
pnetbdarp = (struct net_bonding_arp *)lArg;
if (pnetbdarp) {
- iRet = netbd_delete_arp(pnetbdarp->bd_dev, pnetbdarp->arp_ip_target);
+ iRet = netbd_delete_arp(pnetbdarp->bd_dev, pnetbdarp->bd_index, pnetbdarp->arp_ip_target);
}
return (iRet);
@@ -306,7 +306,7 @@ static INT __tshellNetbd (INT iArgC, PCHAR *ppcArgV)
} else {
if (iArgC == 3) {
if (lib_strcmp(ppcArgV[1], "delbd") == 0) {
- iRet = netbd_delete(ppcArgV[2]);
+ iRet = netbd_delete(ppcArgV[2], 0);
if (iRet) {
fprintf(stderr, "can not delete net bonding device: %s!\n", lib_strerror(errno));
} else {
@@ -314,7 +314,7 @@ static INT __tshellNetbd (INT iArgC, PCHAR *ppcArgV)
}
} else if (lib_strcmp(ppcArgV[1], "show") == 0) {
- iRet = netbd_show_dev(ppcArgV[2], STD_OUT);
+ iRet = netbd_show_dev(ppcArgV[2], 0, STD_OUT);
if (iRet) {
fprintf(stderr, "can not show net bonding device: %s!\n", lib_strerror(errno));
}
@@ -325,49 +325,49 @@ static INT __tshellNetbd (INT iArgC, PCHAR *ppcArgV)
} else if (iArgC == 4) {
if (lib_strcmp(ppcArgV[1], "adddev") == 0) {
- iRet = netbd_add_dev(ppcArgV[2], ppcArgV[3], 0);
+ iRet = netbd_add_dev(ppcArgV[2], 0, ppcArgV[3], 0);
if (iRet) {
fprintf(stderr, "can not add device '%s' to bonding '%s'!\n", ppcArgV[3], ppcArgV[2]);
}
} else if (lib_strcmp(ppcArgV[1], "deldev") == 0) {
- iRet = netbd_delete_dev(ppcArgV[2], ppcArgV[3], 0);
+ iRet = netbd_delete_dev(ppcArgV[2], 0, ppcArgV[3], 0);
if (iRet) {
fprintf(stderr, "can not delete device '%s' from bonding '%s'!\n", ppcArgV[3], ppcArgV[2]);
}
} else if (lib_strcmp(ppcArgV[1], "addif") == 0) {
- iRet = netbd_add_dev(ppcArgV[2], ppcArgV[3], 1);
+ iRet = netbd_add_dev(ppcArgV[2], 0, ppcArgV[3], 1);
if (iRet) {
fprintf(stderr, "can not add if '%s' to bonding '%s'!\n", ppcArgV[3], ppcArgV[2]);
}
} else if (lib_strcmp(ppcArgV[1], "delif") == 0) {
- iRet = netbd_delete_dev(ppcArgV[2], ppcArgV[3], 1);
+ iRet = netbd_delete_dev(ppcArgV[2], 0, ppcArgV[3], 1);
if (iRet) {
fprintf(stderr, "can not delete if '%s' from bonding '%s'!\n", ppcArgV[3], ppcArgV[2]);
}
} else if (lib_strcmp(ppcArgV[1], "masterdev") == 0) {
- iRet = netbd_master_dev(ppcArgV[2], ppcArgV[3], 0);
+ iRet = netbd_master_dev(ppcArgV[2], 0, ppcArgV[3], 0);
if (iRet) {
fprintf(stderr, "can not set device '%s' to bonding '%s' MASTER device!\n", ppcArgV[3], ppcArgV[2]);
}
} else if (lib_strcmp(ppcArgV[1], "masterif") == 0) {
- iRet = netbd_master_dev(ppcArgV[2], ppcArgV[3], 1);
+ iRet = netbd_master_dev(ppcArgV[2], 0, ppcArgV[3], 1);
if (iRet) {
fprintf(stderr, "can not set if '%s' to bonding '%s' MASTER device!\n", ppcArgV[3], ppcArgV[2]);
}
} else if (lib_strcmp(ppcArgV[1], "addarp") == 0) {
- iRet = netbd_add_arp(ppcArgV[2], ppcArgV[3]);
+ iRet = netbd_add_arp(ppcArgV[2], 0, ppcArgV[3]);
if (iRet) {
fprintf(stderr, "can not add ip '%s' to bonding '%s' ARP detect target!\n", ppcArgV[3], ppcArgV[2]);
}
} else if (lib_strcmp(ppcArgV[1], "delarp") == 0) {
- iRet = netbd_delete_arp(ppcArgV[2], ppcArgV[3]);
+ iRet = netbd_delete_arp(ppcArgV[2], 0, ppcArgV[3]);
if (iRet) {
fprintf(stderr, "can not delete ip '%s' from bonding '%s' ARP detect target!\n", ppcArgV[3], ppcArgV[2]);
}
diff --git a/SylixOS/net/lwip/lwip_bridge.c b/SylixOS/net/lwip/lwip_bridge.c
index 62a0c4b..7c1a7b1 100644
--- a/SylixOS/net/lwip/lwip_bridge.c
+++ b/SylixOS/net/lwip/lwip_bridge.c
@@ -105,42 +105,42 @@ static INT _netbrIoctl (PLW_DEV_HDR pdevhdr,
case NETBR_CTL_DELETE:
pnetbrcrl = (struct net_bridge_ctl *)lArg;
if (pnetbrcrl) {
- iRet = netbr_delete(pnetbrcrl->br_dev);
+ iRet = netbr_delete(pnetbrcrl->br_dev, pnetbrcrl->br_index);
}
return (iRet);
case NETBR_CTL_ADD_DEV:
pnetbrcrl = (struct net_bridge_ctl *)lArg;
if (pnetbrcrl) {
- iRet = netbr_add_dev(pnetbrcrl->br_dev, pnetbrcrl->eth_dev, 0);
+ iRet = netbr_add_dev(pnetbrcrl->br_dev, pnetbrcrl->br_index, pnetbrcrl->eth_dev, 0);
}
return (iRet);
case NETBR_CTL_DELETE_DEV:
pnetbrcrl = (struct net_bridge_ctl *)lArg;
if (pnetbrcrl) {
- iRet = netbr_delete_dev(pnetbrcrl->br_dev, pnetbrcrl->eth_dev, 0);
+ iRet = netbr_delete_dev(pnetbrcrl->br_dev, pnetbrcrl->br_index, pnetbrcrl->eth_dev, 0);
}
return (iRet);
case NETBR_CTL_ADD_IF:
pnetbrcrl = (struct net_bridge_ctl *)lArg;
if (pnetbrcrl) {
- iRet = netbr_add_dev(pnetbrcrl->br_dev, pnetbrcrl->eth_dev, 1);
+ iRet = netbr_add_dev(pnetbrcrl->br_dev, pnetbrcrl->br_index, pnetbrcrl->eth_dev, 1);
}
return (iRet);
case NETBR_CTL_DELETE_IF:
pnetbrcrl = (struct net_bridge_ctl *)lArg;
if (pnetbrcrl) {
- iRet = netbr_delete_dev(pnetbrcrl->br_dev, pnetbrcrl->eth_dev, 1);
+ iRet = netbr_delete_dev(pnetbrcrl->br_dev, pnetbrcrl->br_index, pnetbrcrl->eth_dev, 1);
}
return (iRet);
case NETBR_CTL_CACHE_FLUSH:
pnetbrcrl = (struct net_bridge_ctl *)lArg;
if (pnetbrcrl) {
- iRet = netbr_flush_cache(pnetbrcrl->br_dev);
+ iRet = netbr_flush_cache(pnetbrcrl->br_dev, pnetbrcrl->br_index);
}
return (iRet);
@@ -244,7 +244,7 @@ static INT __tshellNetbr (INT iArgC, PCHAR *ppcArgV)
}
} else if (lib_strcmp(ppcArgV[1], "delbr") == 0) {
- iRet = netbr_delete(ppcArgV[2]);
+ iRet = netbr_delete(ppcArgV[2], 0);
if (iRet) {
fprintf(stderr, "can not delete net bridge device: %s!\n", lib_strerror(errno));
} else {
@@ -252,13 +252,13 @@ static INT __tshellNetbr (INT iArgC, PCHAR *ppcArgV)
}
} else if (lib_strcmp(ppcArgV[1], "flush") == 0) {
- iRet = netbr_flush_cache(ppcArgV[2]);
+ iRet = netbr_flush_cache(ppcArgV[2], 0);
if (iRet) {
fprintf(stderr, "can not flush net bridge device: %s!\n", lib_strerror(errno));
}
} else if (lib_strcmp(ppcArgV[1], "show") == 0) {
- iRet = netbr_show_dev(ppcArgV[2], STD_OUT);
+ iRet = netbr_show_dev(ppcArgV[2], 0, STD_OUT);
if (iRet) {
fprintf(stderr, "can not show net bridge device: %s!\n", lib_strerror(errno));
}
@@ -269,25 +269,25 @@ static INT __tshellNetbr (INT iArgC, PCHAR *ppcArgV)
} else if (iArgC == 4) {
if (lib_strcmp(ppcArgV[1], "adddev") == 0) {
- iRet = netbr_add_dev(ppcArgV[2], ppcArgV[3], 0);
+ iRet = netbr_add_dev(ppcArgV[2], 0, ppcArgV[3], 0);
if (iRet) {
fprintf(stderr, "can not add device '%s' to bridge '%s'!\n", ppcArgV[3], ppcArgV[2]);
}
} else if (lib_strcmp(ppcArgV[1], "deldev") == 0) {
- iRet = netbr_delete_dev(ppcArgV[2], ppcArgV[3], 0);
+ iRet = netbr_delete_dev(ppcArgV[2], 0, ppcArgV[3], 0);
if (iRet) {
fprintf(stderr, "can not delete device '%s' from bridge '%s'!\n", ppcArgV[3], ppcArgV[2]);
}
} else if (lib_strcmp(ppcArgV[1], "addif") == 0) {
- iRet = netbr_add_dev(ppcArgV[2], ppcArgV[3], 1);
+ iRet = netbr_add_dev(ppcArgV[2], 0, ppcArgV[3], 1);
if (iRet) {
fprintf(stderr, "can not add if '%s' to bridge '%s'!\n", ppcArgV[3], ppcArgV[2]);
}
} else if (lib_strcmp(ppcArgV[1], "delif") == 0) {
- iRet = netbr_delete_dev(ppcArgV[2], ppcArgV[3], 1);
+ iRet = netbr_delete_dev(ppcArgV[2], 0, ppcArgV[3], 1);
if (iRet) {
fprintf(stderr, "can not delete if '%s' from bridge '%s'!\n", ppcArgV[3], ppcArgV[2]);
}
diff --git a/SylixOS/net/lwip/lwip_route.c b/SylixOS/net/lwip/lwip_route.c
index 925730b..af849b9 100644
--- a/SylixOS/net/lwip/lwip_route.c
+++ b/SylixOS/net/lwip/lwip_route.c
@@ -106,6 +106,7 @@ static VOID __route_show_ipv4 (VOID)
iRet = ioctl(iSock, SIOCLSTRT, &rtentrylist);
if (iRet < 0) {
fprintf(stderr, "command 'SIOCLSTRT' error: %s!\n", lib_strerror(errno));
+ __SHEAP_FREE(rtentrylist.rtl_buf);
close(iSock);
return;
}
@@ -201,6 +202,7 @@ static VOID __route_show_ipv6 (VOID)
iRet = ioctl(iSock, SIOCLSTRT, &rtentrylist);
if (iRet < 0) {
fprintf(stderr, "command 'SIOCLSTRT' error: %s!\n", lib_strerror(errno));
+ __SHEAP_FREE(rtentrylist.rtl_buf);
close(iSock);
return;
}
diff --git a/SylixOS/posix/pthread/pthread_cond.c b/SylixOS/posix/pthread/pthread_cond.c
index e2673b0..3cc1092 100644
--- a/SylixOS/posix/pthread/pthread_cond.c
+++ b/SylixOS/posix/pthread/pthread_cond.c
@@ -54,6 +54,7 @@ VOID _posixPCondInit (VOID)
_G_ulPCondInitLock = API_SemaphoreMCreate("pcondinit", LW_PRIO_DEF_CEILING,
LW_OPTION_INHERIT_PRIORITY |
LW_OPTION_WAIT_PRIORITY |
+ LW_OPTION_OBJECT_GLOBAL |
LW_OPTION_DELETE_SAFE, LW_NULL);
}
/*********************************************************************************************************
diff --git a/SylixOS/posix/pthread/pthread_mutex.c b/SylixOS/posix/pthread/pthread_mutex.c
index 1b9cc12..d0e9e8f 100644
--- a/SylixOS/posix/pthread/pthread_mutex.c
+++ b/SylixOS/posix/pthread/pthread_mutex.c
@@ -62,6 +62,7 @@ VOID _posixPMutexInit (VOID)
_G_ulPMutexInitLock = API_SemaphoreMCreate("pmutexinit", LW_PRIO_DEF_CEILING,
LW_OPTION_INHERIT_PRIORITY |
LW_OPTION_WAIT_PRIORITY |
+ LW_OPTION_OBJECT_GLOBAL |
LW_OPTION_DELETE_SAFE, LW_NULL);
}
}
diff --git a/SylixOS/posix/pthread/pthread_rwlock.c b/SylixOS/posix/pthread/pthread_rwlock.c
index b340826..4af4fbe 100644
--- a/SylixOS/posix/pthread/pthread_rwlock.c
+++ b/SylixOS/posix/pthread/pthread_rwlock.c
@@ -56,6 +56,7 @@ VOID _posixPRWLockInit (VOID)
_G_ulPRWLockInitLock = API_SemaphoreMCreate("prwinit", LW_PRIO_DEF_CEILING,
LW_OPTION_INHERIT_PRIORITY |
LW_OPTION_WAIT_PRIORITY |
+ LW_OPTION_OBJECT_GLOBAL |
LW_OPTION_DELETE_SAFE, LW_NULL);
}
/*********************************************************************************************************
diff --git a/SylixOS/posix/semaphore/semaphore.c b/SylixOS/posix/semaphore/semaphore.c
index feeaa4f..39d6a2f 100644
--- a/SylixOS/posix/semaphore/semaphore.c
+++ b/SylixOS/posix/semaphore/semaphore.c
@@ -78,6 +78,7 @@ VOID _posixPSemInit (VOID)
_G_ulPSemInitLock = API_SemaphoreMCreate("pseminit", LW_PRIO_DEF_CEILING,
LW_OPTION_INHERIT_PRIORITY |
LW_OPTION_WAIT_PRIORITY |
+ LW_OPTION_OBJECT_GLOBAL |
LW_OPTION_DELETE_SAFE, LW_NULL);
}
/*********************************************************************************************************