From c25f7cbfc7c03453f650c020f9704136f5a615c1 Mon Sep 17 00:00:00 2001 From: nicedayzhu Date: Wed, 29 May 2019 11:12:05 +0800 Subject: [PATCH 1/6] bugfix [net][netdev] Update netdev->ip_addr&gw&netmask after registered. --- components/net/lwip-2.0.2/src/netif/ethernetif.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/net/lwip-2.0.2/src/netif/ethernetif.c b/components/net/lwip-2.0.2/src/netif/ethernetif.c index f19ec094fa..8263040484 100644 --- a/components/net/lwip-2.0.2/src/netif/ethernetif.c +++ b/components/net/lwip-2.0.2/src/netif/ethernetif.c @@ -317,7 +317,10 @@ static int netdev_add(struct netif *lwip_netif) rt_strncpy(name, lwip_netif->name, LWIP_NETIF_NAME_LEN); result = netdev_register(netdev, name, (void *)lwip_netif); - + netdev->ip_addr = lwip_netif->ip_addr; + netdev->gw = lwip_netif->gw; + netdev->netmask = lwip_netif->netmask; + #ifdef RT_LWIP_DHCP netdev_low_level_set_dhcp_status(netdev, RT_TRUE); #endif From f5cb3ac7600639b761cba3968bc6227c799e2f33 Mon Sep 17 00:00:00 2001 From: nicedayzhu Date: Wed, 29 May 2019 13:37:16 +0800 Subject: [PATCH 2/6] [Bugfix]Update netdev info after registered MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复ifconfig命令无法正确显示IP,网关,掩码的问题 --- components/net/lwip-2.0.2/src/netif/ethernetif.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/components/net/lwip-2.0.2/src/netif/ethernetif.c b/components/net/lwip-2.0.2/src/netif/ethernetif.c index 8263040484..a5a1f94c0b 100644 --- a/components/net/lwip-2.0.2/src/netif/ethernetif.c +++ b/components/net/lwip-2.0.2/src/netif/ethernetif.c @@ -303,12 +303,6 @@ static int netdev_add(struct netif *lwip_netif) return -ERR_IF; } - netdev->flags = lwip_netif->flags; - netdev->mtu = lwip_netif->mtu; - netdev->ops = &lwip_netdev_ops; - netdev->hwaddr_len = lwip_netif->hwaddr_len; - rt_memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len); - #ifdef SAL_USING_LWIP extern int sal_lwip_netdev_set_pf_info(struct netdev *netdev); /* set the lwIP network interface device protocol family information */ @@ -317,6 +311,13 @@ static int netdev_add(struct netif *lwip_netif) rt_strncpy(name, lwip_netif->name, LWIP_NETIF_NAME_LEN); result = netdev_register(netdev, name, (void *)lwip_netif); + + /* Update netdev info after registered */ + netdev->flags = lwip_netif->flags; + netdev->mtu = lwip_netif->mtu; + netdev->ops = &lwip_netdev_ops; + netdev->hwaddr_len = lwip_netif->hwaddr_len; + rt_memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len); netdev->ip_addr = lwip_netif->ip_addr; netdev->gw = lwip_netif->gw; netdev->netmask = lwip_netif->netmask; From 6454fa81d817e26d8c13698bb4e3ed597d95f296 Mon Sep 17 00:00:00 2001 From: nicedayzhu Date: Wed, 29 May 2019 13:42:06 +0800 Subject: [PATCH 3/6] [Bugfix]Update netdev info after registered MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复ifconfig命令无法正确显示IP,网关,掩码的问题 --- components/net/lwip-2.1.0/src/netif/ethernetif.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/components/net/lwip-2.1.0/src/netif/ethernetif.c b/components/net/lwip-2.1.0/src/netif/ethernetif.c index db28a4a55b..5ea03a9ae8 100755 --- a/components/net/lwip-2.1.0/src/netif/ethernetif.c +++ b/components/net/lwip-2.1.0/src/netif/ethernetif.c @@ -303,11 +303,6 @@ static int netdev_add(struct netif *lwip_netif) { return -ERR_IF; } - - netdev->flags = lwip_netif->flags; - netdev->ops = &lwip_netdev_ops; - netdev->hwaddr_len = lwip_netif->hwaddr_len; - rt_memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len); #ifdef SAL_USING_LWIP extern int sal_lwip_netdev_set_pf_info(struct netdev *netdev); @@ -317,6 +312,16 @@ static int netdev_add(struct netif *lwip_netif) rt_strncpy(name, lwip_netif->name, LWIP_NETIF_NAME_LEN); result = netdev_register(netdev, name, (void *)lwip_netif); + + /* Update netdev info after registered */ + netdev->flags = lwip_netif->flags; + netdev->mtu = lwip_netif->mtu; + netdev->ops = &lwip_netdev_ops; + netdev->hwaddr_len = lwip_netif->hwaddr_len; + rt_memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len); + netdev->ip_addr = lwip_netif->ip_addr; + netdev->gw = lwip_netif->gw; + netdev->netmask = lwip_netif->netmask; #ifdef RT_LWIP_DHCP netdev_low_level_set_dhcp_status(netdev, RT_TRUE); From c10f087d9e477b18025889b07a40199b9dee011c Mon Sep 17 00:00:00 2001 From: nicedayzhu Date: Wed, 29 May 2019 14:15:10 +0800 Subject: [PATCH 4/6] [Bugfix]Update netdev info after registered MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复ifconfig命令无法正确显示IP,网关,掩码的问题 --- .../net/lwip-1.4.1/src/netif/ethernetif.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/components/net/lwip-1.4.1/src/netif/ethernetif.c b/components/net/lwip-1.4.1/src/netif/ethernetif.c index 10bcaa0c95..df960fcde0 100644 --- a/components/net/lwip-1.4.1/src/netif/ethernetif.c +++ b/components/net/lwip-1.4.1/src/netif/ethernetif.c @@ -295,12 +295,6 @@ static int netdev_add(struct netif *lwip_netif) return -ERR_IF; } - netdev->flags = lwip_netif->flags; - netdev->mtu = lwip_netif->mtu; - netdev->ops = &lwip_netdev_ops; - netdev->hwaddr_len = lwip_netif->hwaddr_len; - rt_memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len); - #ifdef SAL_USING_LWIP extern int sal_lwip_netdev_set_pf_info(struct netdev *netdev); /* set the lwIP network interface device protocol family information */ @@ -309,7 +303,17 @@ static int netdev_add(struct netif *lwip_netif) rt_strncpy(name, lwip_netif->name, LWIP_NETIF_NAME_LEN); result = netdev_register(netdev, name, (void *)lwip_netif); - + + /* Update netdev info after registered */ + netdev->flags = lwip_netif->flags; + netdev->mtu = lwip_netif->mtu; + netdev->ops = &lwip_netdev_ops; + netdev->hwaddr_len = lwip_netif->hwaddr_len; + rt_memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len); + netdev->ip_addr = lwip_netif->ip_addr; + netdev->gw = lwip_netif->gw; + netdev->netmask = lwip_netif->netmask; + #ifdef RT_LWIP_DHCP netdev_low_level_set_dhcp_status(netdev, RT_TRUE); #endif From c8e1fbf673c9872645511d4bf4e738cadc7f0599 Mon Sep 17 00:00:00 2001 From: nicedayzhu Date: Wed, 29 May 2019 15:22:11 +0800 Subject: [PATCH 5/6] [Bugfix]Update netdev info after registered MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复ifconfig命令无法正确显示IP,网关,掩码的问题 --- components/net/lwip-2.1.0/src/netif/ethernetif.c | 1 - 1 file changed, 1 deletion(-) diff --git a/components/net/lwip-2.1.0/src/netif/ethernetif.c b/components/net/lwip-2.1.0/src/netif/ethernetif.c index 5ea03a9ae8..af9426ecdd 100755 --- a/components/net/lwip-2.1.0/src/netif/ethernetif.c +++ b/components/net/lwip-2.1.0/src/netif/ethernetif.c @@ -315,7 +315,6 @@ static int netdev_add(struct netif *lwip_netif) /* Update netdev info after registered */ netdev->flags = lwip_netif->flags; - netdev->mtu = lwip_netif->mtu; netdev->ops = &lwip_netdev_ops; netdev->hwaddr_len = lwip_netif->hwaddr_len; rt_memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len); From fe3ab4605dfdbc5b514b52397c7d7e3f9b89f6d9 Mon Sep 17 00:00:00 2001 From: nicedayzhu Date: Wed, 29 May 2019 15:34:02 +0800 Subject: [PATCH 6/6] [Bugfix]Update netdev info after registered MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.修复ifconfig命令无法正确显示IP,网关,掩码的问题 2.lwip_2.1.0,增加netdev->mtu = lwip_netif->mtu; --- components/net/lwip-2.1.0/src/netif/ethernetif.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/net/lwip-2.1.0/src/netif/ethernetif.c b/components/net/lwip-2.1.0/src/netif/ethernetif.c index af9426ecdd..5ea03a9ae8 100755 --- a/components/net/lwip-2.1.0/src/netif/ethernetif.c +++ b/components/net/lwip-2.1.0/src/netif/ethernetif.c @@ -315,6 +315,7 @@ static int netdev_add(struct netif *lwip_netif) /* Update netdev info after registered */ netdev->flags = lwip_netif->flags; + netdev->mtu = lwip_netif->mtu; netdev->ops = &lwip_netdev_ops; netdev->hwaddr_len = lwip_netif->hwaddr_len; rt_memcpy(netdev->hwaddr, lwip_netif->hwaddr, lwip_netif->hwaddr_len);