summaryrefslogtreecommitdiff
path: root/components/net
diff options
context:
space:
mode:
authornicedayzhu <[email protected]>2019-05-29 13:37:16 +0800
committerGitHub <[email protected]>2019-05-29 13:37:16 +0800
commitf5cb3ac7600639b761cba3968bc6227c799e2f33 (patch)
tree9823796dc4bfc563a15fd5feb92b3f345a490540 /components/net
parentc25f7cbfc7c03453f650c020f9704136f5a615c1 (diff)
[Bugfix]Update netdev info after registered
修复ifconfig命令无法正确显示IP,网关,掩码的问题
Diffstat (limited to 'components/net')
-rw-r--r--components/net/lwip-2.0.2/src/netif/ethernetif.c13
1 files 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;