From 53a63c517a735473bef64dae7b15993d4147749f Mon Sep 17 00:00:00 2001 From: chao an Date: Sun, 4 Dec 2022 23:50:35 +0800 Subject: [PATCH] sim/netdriver: fix build break if enable NET_IPv6 only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In file included from sim/sim_netdriver.c:73: sim/sim_netdriver.c: In function ‘netdriver_ifup’: sim/sim_netdriver.c:284:32: error: ‘struct net_driver_s’ has no member named ‘d_ipaddr’; did you mean ‘d_ipv6addr’? 284 | sim_netdev_ifup(devidx, dev->d_ipaddr); | ^~~~~~~~ sim/sim_internal.h:279:67: note: in definition of macro ‘sim_netdev_ifup’ 279 | # define sim_netdev_ifup(idx,ifaddr) sim_tapdev_ifup(idx,ifaddr) | Signed-off-by: chao an --- arch/sim/src/sim/sim_netdriver.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/sim/src/sim/sim_netdriver.c b/arch/sim/src/sim/sim_netdriver.c index a4aa586bd4..e7d414d858 100644 --- a/arch/sim/src/sim/sim_netdriver.c +++ b/arch/sim/src/sim/sim_netdriver.c @@ -281,7 +281,11 @@ static int netdriver_ifup(struct net_driver_s *dev) int devidx = (intptr_t)dev->d_private; UNUSED(devidx); +#ifdef CONFIG_NET_IPv4 sim_netdev_ifup(devidx, dev->d_ipaddr); +#else /* CONFIG_NET_IPv6 */ + sim_netdev_ifup(devidx, INADDR_ANY); +#endif /* CONFIG_NET_IPv4 */ netdev_carrier_on(dev); return OK; }