mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-27 12:35:26 +00:00
netif: Fix IPv6-only build
Fix below build error if LWIP_IPV4 == 0. cc -g -Wall -DLWIP_DEBUG -pedantic -Werror -Wparentheses -Wsequence-point -Wswitch-default -Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Wno-address -Wunreachable-code -Wuninitialized -Wlogical-op -I. -I../../.. -I../../../../lwip/src/include -I../../../ports/unix/port/include -I../../../../mbedtls/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -c ../../../../lwip/src/core/netif.c ../../../../lwip/src/core/netif.c: In function ‘netif_add’: ../../../../lwip/src/core/netif.c:284:7: error: ‘ipaddr’ undeclared (first use in this function) if (ipaddr == NULL) { ^~~~~~ ../../../../lwip/src/core/netif.c:284:7: note: each undeclared identifier is reported only once for each function it appears in ../../../../lwip/src/core/netif.c:285:14: error: implicit declaration of function ‘ip_2_ip4’ [-Werror=implicit-function-declaration] ipaddr = ip_2_ip4(IP4_ADDR_ANY); ^~~~~~~~ ../../../../lwip/src/core/netif.c:285:5: error: nested extern declaration of ‘ip_2_ip4’ [-Werror=nested-externs] ipaddr = ip_2_ip4(IP4_ADDR_ANY); ^~~~~~ ../../../../lwip/src/core/netif.c:285:23: error: ‘IP4_ADDR_ANY’ undeclared (first use in this function) ipaddr = ip_2_ip4(IP4_ADDR_ANY); ^~~~~~~~~~~~ ../../../../lwip/src/core/netif.c:287:7: error: ‘netmask’ undeclared (first use in this function) if (netmask == NULL) { ^~~~~~~ ../../../../lwip/src/core/netif.c:290:7: error: ‘gw’ undeclared (first use in this function) if (gw == NULL) { ^~ cc1: all warnings being treated as errors ../../Common.allports.mk:94: recipe for target 'netif.o' failed make: *** [netif.o] Error 1 Fixes: 5967380c2034 ("netif_add: avoid passing NULL pointers to subsequent functions") Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
This commit is contained in:
parent
749e078d36
commit
89d825f603
@ -281,6 +281,7 @@ netif_add(struct netif *netif,
|
||||
|
||||
LWIP_ASSERT("No init function given", init != NULL);
|
||||
|
||||
#if LWIP_IPV4
|
||||
if (ipaddr == NULL) {
|
||||
ipaddr = ip_2_ip4(IP4_ADDR_ANY);
|
||||
}
|
||||
@ -290,6 +291,7 @@ netif_add(struct netif *netif,
|
||||
if (gw == NULL) {
|
||||
gw = ip_2_ip4(IP4_ADDR_ANY);
|
||||
}
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
/* reset new interface configuration state */
|
||||
#if LWIP_IPV4
|
||||
|
Loading…
x
Reference in New Issue
Block a user