diff --git a/src/core/dhcp.c b/src/core/dhcp.c index dfe7fac8..be1ba5c4 100644 --- a/src/core/dhcp.c +++ b/src/core/dhcp.c @@ -836,7 +836,7 @@ dhcp_discover(struct netif *netif) err_t result = ERR_OK; u16_t msecs; LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_discover()\n")); - ip_addr_set(&dhcp->offered_ip_addr, IP_ADDR_ANY); + ip_addr_set_any(&dhcp->offered_ip_addr); dhcp_set_state(dhcp, DHCP_SELECTING); /* create and initialize the DHCP message header */ result = dhcp_create_request(netif, dhcp); diff --git a/src/core/snmp/mib2.c b/src/core/snmp/mib2.c index 3f8d3d7e..0bf8ec13 100644 --- a/src/core/snmp/mib2.c +++ b/src/core/snmp/mib2.c @@ -1442,7 +1442,7 @@ void snmp_insert_iprteidx_tree(u8_t dflt, struct netif *ni) if (dflt != 0) { /* the default route 0.0.0.0 */ - ip_addr_set(&dst, &ip_addr_any); + ip_addr_set_any(&dst); insert = 1; } else @@ -1519,7 +1519,7 @@ void snmp_delete_iprteidx_tree(u8_t dflt, struct netif *ni) if (dflt != 0) { /* the default route 0.0.0.0 */ - ip_addr_set(&dst, &ip_addr_any); + ip_addr_set_any(&dst); del = 1; } else diff --git a/src/core/udp.c b/src/core/udp.c index 68b79b4c..80e52a56 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -739,7 +739,7 @@ void udp_disconnect(struct udp_pcb *pcb) { /* reset remote address association */ - ip_addr_set(&pcb->remote_ip, IP_ADDR_ANY); + ip_addr_set_any(&pcb->remote_ip); pcb->remote_port = 0; /* mark PCB as unconnected */ pcb->flags &= ~UDP_FLAGS_CONNECTED; diff --git a/src/include/ipv4/lwip/ip_addr.h b/src/include/ipv4/lwip/ip_addr.h index f48fa9e5..afe2a8ac 100644 --- a/src/include/ipv4/lwip/ip_addr.h +++ b/src/include/ipv4/lwip/ip_addr.h @@ -134,9 +134,11 @@ extern const ip_addr_t ip_addr_broadcast; ((src) == NULL ? 0:\ (src)->addr)) /** Set complete address to zero */ -#define ip_addr_set_zero(ipaddr) (ipaddr)->addr = IPADDR_ANY +#define ip_addr_set_zero(ipaddr) ((ipaddr)->addr = 0) +/** Set address to IPADDR_ANY (no need for htonl()) */ +#define ip_addr_set_any(ipaddr) ((ipaddr)->addr = IPADDR_ANY) /** Set address to loopback address */ -#define ip_addr_set_loopback(ipaddr) ((ipaddr)->addr = htonl(IPADDR_LOOPBACK)) +#define ip_addr_set_loopback(ipaddr) ((ipaddr)->addr = htonl(IPADDR_LOOPBACK)) /** Safely copy one IP address to another and change byte order * from host- to network-order. */ #define ip_addr_set_hton(dest, src) ((dest)->addr = \