Skip to content

Commit 1cf5243

Browse files
committed
Don't call ip_addr_isany() on objects which can't be NULL.
GCC will issue a warning when the ip_addr_isany() macro is used on a pointer which can never be NULL since the macros NULL check will always be false: #define ip_addr_isany(addr1) ((addr1) == NULL || \ (addr1)->addr == IPADDR_ANY) In these cases, it is probably clearer to just perform the x.addr == IPADDR_ANY check inline.
1 parent 6e95a5e commit 1cf5243

File tree

1 file changed

+1
-1
lines changed
  • libraries/net/lwip/lwip/core/ipv4

1 file changed

+1
-1
lines changed

libraries/net/lwip/lwip/core/ipv4/ip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ ip_input(struct pbuf *p, struct netif *inp)
400400
/* broadcast or multicast packet source address? Compliant with RFC 1122: 3.2.1.3 */
401401
#if IP_ACCEPT_LINK_LAYER_ADDRESSING
402402
/* DHCP servers need 0.0.0.0 to be allowed as source address (RFC 1.1.2.2: 3.2.1.3/a) */
403-
if (check_ip_src && !ip_addr_isany(&current_iphdr_src))
403+
if (check_ip_src && current_iphdr_src.addr != IPADDR_ANY)
404404
#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */
405405
{ if ((ip_addr_isbroadcast(&current_iphdr_src, inp)) ||
406406
(ip_addr_ismulticast(&current_iphdr_src))) {

0 commit comments

Comments
 (0)