Implement consistent IPx_ADDR_ANYx macro naming between IPv4 and IPv6

- rename IP4_ADDR_ANY to IP4_ADDR_ANY4
- IP4_ADDR_ANY (= IP_ADDR_ANY) is now IPv4 any address in ip_addr_t format
This commit is contained in:
Dirk Ziegelmeier 2016-09-28 12:56:39 +02:00
parent 0e2354e658
commit 633696c153
23 changed files with 68 additions and 62 deletions

View File

@ -241,8 +241,8 @@ netconn_getaddr(struct netconn *conn, ip_addr_t *addr, u16_t *port, u8_t local)
* Binding one netconn twice might not always be checked correctly! * Binding one netconn twice might not always be checked correctly!
* *
* @param conn the netconn to bind * @param conn the netconn to bind
* @param addr the local IP address to bind the netconn to (use IP_ADDR_ANY * @param addr the local IP address to bind the netconn to
* to bind to all addresses) * (use IP4_ADDR_ANY/IP6_ADDR_ANY to bind to all addresses)
* @param port the local port to bind the netconn to (not used for RAW) * @param port the local port to bind the netconn to (not used for RAW)
* @return ERR_OK if bound, any other err_t on failure * @return ERR_OK if bound, any other err_t on failure
*/ */
@ -256,7 +256,7 @@ netconn_bind(struct netconn *conn, const ip_addr_t *addr, u16_t port)
/* Don't propagate NULL pointer (IP_ADDR_ANY alias) to subsequent functions */ /* Don't propagate NULL pointer (IP_ADDR_ANY alias) to subsequent functions */
if (addr == NULL) { if (addr == NULL) {
addr = IP_ADDR_ANY; addr = IP4_ADDR_ANY;
} }
API_MSG_VAR_ALLOC(msg); API_MSG_VAR_ALLOC(msg);
@ -288,7 +288,7 @@ netconn_connect(struct netconn *conn, const ip_addr_t *addr, u16_t port)
/* Don't propagate NULL pointer (IP_ADDR_ANY alias) to subsequent functions */ /* Don't propagate NULL pointer (IP_ADDR_ANY alias) to subsequent functions */
if (addr == NULL) { if (addr == NULL) {
addr = IP_ADDR_ANY; addr = IP4_ADDR_ANY;
} }
API_MSG_VAR_ALLOC(msg); API_MSG_VAR_ALLOC(msg);
@ -867,10 +867,10 @@ netconn_join_leave_group(struct netconn *conn,
/* Don't propagate NULL pointer (IP_ADDR_ANY alias) to subsequent functions */ /* Don't propagate NULL pointer (IP_ADDR_ANY alias) to subsequent functions */
if (multiaddr == NULL) { if (multiaddr == NULL) {
multiaddr = IP_ADDR_ANY; multiaddr = IP4_ADDR_ANY;
} }
if (netif_addr == NULL) { if (netif_addr == NULL) {
netif_addr = IP_ADDR_ANY; netif_addr = IP4_ADDR_ANY;
} }
API_MSG_VAR_REF(msg).conn = conn; API_MSG_VAR_REF(msg).conn = conn;

View File

@ -134,13 +134,13 @@ netifapi_netif_add(struct netif *netif,
#if LWIP_IPV4 #if LWIP_IPV4
if (ipaddr == NULL) { if (ipaddr == NULL) {
ipaddr = IP4_ADDR_ANY; ipaddr = IP4_ADDR_ANY4;
} }
if (netmask == NULL) { if (netmask == NULL) {
netmask = IP4_ADDR_ANY; netmask = IP4_ADDR_ANY4;
} }
if (gw == NULL) { if (gw == NULL) {
gw = IP4_ADDR_ANY; gw = IP4_ADDR_ANY4;
} }
#endif /* LWIP_IPV4 */ #endif /* LWIP_IPV4 */
@ -177,13 +177,13 @@ netifapi_netif_set_addr(struct netif *netif,
NETIFAPI_VAR_ALLOC(msg); NETIFAPI_VAR_ALLOC(msg);
if (ipaddr == NULL) { if (ipaddr == NULL) {
ipaddr = IP4_ADDR_ANY; ipaddr = IP4_ADDR_ANY4;
} }
if (netmask == NULL) { if (netmask == NULL) {
netmask = IP4_ADDR_ANY; netmask = IP4_ADDR_ANY4;
} }
if (gw == NULL) { if (gw == NULL) {
gw = IP4_ADDR_ANY; gw = IP4_ADDR_ANY4;
} }
NETIFAPI_VAR_REF(msg).netif = netif; NETIFAPI_VAR_REF(msg).netif = netif;

View File

@ -579,7 +579,7 @@ lwiperf_tcp_accept(void *arg, struct tcp_pcb *newpcb, err_t err)
void* void*
lwiperf_start_tcp_server_default(lwiperf_report_fn report_fn, void* report_arg) lwiperf_start_tcp_server_default(lwiperf_report_fn report_fn, void* report_arg)
{ {
return lwiperf_start_tcp_server(IP_ADDR_ANY, LWIPERF_TCP_PORT_DEFAULT, return lwiperf_start_tcp_server(IP4_ADDR_ANY, LWIPERF_TCP_PORT_DEFAULT,
report_fn, report_arg); report_fn, report_arg);
} }

View File

@ -1892,7 +1892,7 @@ mdns_resp_netif_settings_changed(struct netif *netif)
mdns_announce(netif, IP6_ADDR_ANY); mdns_announce(netif, IP6_ADDR_ANY);
#endif #endif
#if LWIP_IPV4 #if LWIP_IPV4
mdns_announce(netif, IP_ADDR_ANY); mdns_announce(netif, IP4_ADDR_ANY);
#endif #endif
} }
@ -2044,7 +2044,7 @@ mdns_resp_add_service(struct netif *netif, const char *name, const char *service
mdns_announce(netif, IP6_ADDR_ANY); mdns_announce(netif, IP6_ADDR_ANY);
#endif #endif
#if LWIP_IPV4 #if LWIP_IPV4
mdns_announce(netif, IP_ADDR_ANY); mdns_announce(netif, IP4_ADDR_ANY);
#endif #endif
return ERR_OK; return ERR_OK;

View File

@ -270,7 +270,7 @@ snmp_oid_to_ip4(const u32_t *oid, ip4_addr_t *ip)
(oid[1] > 0xFF) || (oid[1] > 0xFF) ||
(oid[2] > 0xFF) || (oid[2] > 0xFF) ||
(oid[3] > 0xFF)) { (oid[3] > 0xFF)) {
ip4_addr_copy(*ip, *IP4_ADDR_ANY); ip4_addr_copy(*ip, *IP4_ADDR_ANY4);
return 0; return 0;
} }

View File

@ -326,7 +326,7 @@ ip_RouteTable_get_cell_value_core(struct netif *netif, u8_t default_route, const
case 1: /* ipRouteDest */ case 1: /* ipRouteDest */
if (default_route) { if (default_route) {
/* default rte has 0.0.0.0 dest */ /* default rte has 0.0.0.0 dest */
value->u32 = IP4_ADDR_ANY->addr; value->u32 = IP4_ADDR_ANY4->addr;
} else { } else {
/* netifs have netaddress dest */ /* netifs have netaddress dest */
ip4_addr_t tmp; ip4_addr_t tmp;
@ -378,7 +378,7 @@ ip_RouteTable_get_cell_value_core(struct netif *netif, u8_t default_route, const
case 11: /* ipRouteMask */ case 11: /* ipRouteMask */
if (default_route) { if (default_route) {
/* default rte use 0.0.0.0 mask */ /* default rte use 0.0.0.0 mask */
value->u32 = IP4_ADDR_ANY->addr; value->u32 = IP4_ADDR_ANY4->addr;
} else { } else {
/* other rtes use netmask */ /* other rtes use netmask */
value->u32 = netif_ip4_netmask(netif)->addr; value->u32 = netif_ip4_netmask(netif)->addr;
@ -449,7 +449,7 @@ ip_RouteTable_get_next_cell_instance_and_value(const u32_t* column, struct snmp_
/* check default route */ /* check default route */
if (netif_default != NULL) { if (netif_default != NULL) {
snmp_ip4_to_oid(IP4_ADDR_ANY, &test_oid[0]); snmp_ip4_to_oid(IP4_ADDR_ANY4, &test_oid[0]);
snmp_next_oid_check(&state, test_oid, LWIP_ARRAYSIZE(ip_RouteTable_oid_ranges), netif_default); snmp_next_oid_check(&state, test_oid, LWIP_ARRAYSIZE(ip_RouteTable_oid_ranges), netif_default);
} }

View File

@ -172,7 +172,7 @@ tcp_ConnTable_get_cell_value_core(struct tcp_pcb *pcb, const u32_t* column, unio
break; break;
case 4: /* tcpConnRemAddress */ case 4: /* tcpConnRemAddress */
if (pcb->state == LISTEN) { if (pcb->state == LISTEN) {
value->u32 = IP4_ADDR_ANY->addr; value->u32 = IP4_ADDR_ANY4->addr;
} else { } else {
value->u32 = ip_2_ip4(&pcb->remote_ip)->addr; value->u32 = ip_2_ip4(&pcb->remote_ip)->addr;
} }
@ -224,7 +224,7 @@ tcp_ConnTable_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_t row
/* PCBs in state LISTEN are not connected and have no remote_ip or remote_port */ /* PCBs in state LISTEN are not connected and have no remote_ip or remote_port */
if (pcb->state == LISTEN) { if (pcb->state == LISTEN) {
if (ip4_addr_cmp(&remote_ip, IP4_ADDR_ANY) && (remote_port == 0)) { if (ip4_addr_cmp(&remote_ip, IP4_ADDR_ANY4) && (remote_port == 0)) {
/* fill in object properties */ /* fill in object properties */
return tcp_ConnTable_get_cell_value_core(pcb, column, value, value_len); return tcp_ConnTable_get_cell_value_core(pcb, column, value, value_len);
} }
@ -268,7 +268,7 @@ tcp_ConnTable_get_next_cell_instance_and_value(const u32_t* column, struct snmp_
/* PCBs in state LISTEN are not connected and have no remote_ip or remote_port */ /* PCBs in state LISTEN are not connected and have no remote_ip or remote_port */
if (pcb->state == LISTEN) { if (pcb->state == LISTEN) {
snmp_ip4_to_oid(IP4_ADDR_ANY, &test_oid[5]); snmp_ip4_to_oid(IP4_ADDR_ANY4, &test_oid[5]);
test_oid[9] = 0; test_oid[9] = 0;
} else { } else {
if (IP_IS_V6_VAL(pcb->remote_ip)) { /* should never happen */ if (IP_IS_V6_VAL(pcb->remote_ip)) { /* should never happen */

View File

@ -57,7 +57,7 @@ snmp_netconn_thread(void *arg)
netconn_bind(conn, IP6_ADDR_ANY, SNMP_IN_PORT); netconn_bind(conn, IP6_ADDR_ANY, SNMP_IN_PORT);
#else /* LWIP_IPV6 */ #else /* LWIP_IPV6 */
conn = netconn_new(NETCONN_UDP); conn = netconn_new(NETCONN_UDP);
netconn_bind(conn, IP_ADDR_ANY, SNMP_IN_PORT); netconn_bind(conn, IP4_ADDR_ANY, SNMP_IN_PORT);
#endif /* LWIP_IPV6 */ #endif /* LWIP_IPV6 */
LWIP_ERROR("snmp_netconn: invalid conn", (conn != NULL), return;); LWIP_ERROR("snmp_netconn: invalid conn", (conn != NULL), return;);

View File

@ -80,7 +80,7 @@ snmp_get_local_ip_for_dst(void* handle, const ip_addr_t *dst, ip_addr_t *result)
/** /**
* @ingroup snmp_core * @ingroup snmp_core
* Starts SNMP Agent. * Starts SNMP Agent.
* Allocates UDP pcb and binds it to IP_ADDR_ANY port 161. * Allocates UDP pcb and binds it to IP_ANY_TYPE port 161.
*/ */
void void
snmp_init(void) snmp_init(void)

View File

@ -688,7 +688,7 @@ sntp_getserver(u8_t idx)
if (idx < SNTP_MAX_SERVERS) { if (idx < SNTP_MAX_SERVERS) {
return &sntp_servers[idx].addr; return &sntp_servers[idx].addr;
} }
return IP_ADDR_ANY; return IP4_ADDR_ANY;
} }
#if SNTP_SERVER_DNS #if SNTP_SERVER_DNS

View File

@ -362,7 +362,7 @@ dns_setserver(u8_t numdns, const ip_addr_t *dnsserver)
if (dnsserver != NULL) { if (dnsserver != NULL) {
dns_servers[numdns] = (*dnsserver); dns_servers[numdns] = (*dnsserver);
} else { } else {
dns_servers[numdns] = *IP_ADDR_ANY; dns_servers[numdns] = *IP4_ADDR_ANY;
} }
} }
} }
@ -381,7 +381,7 @@ dns_getserver(u8_t numdns)
if (numdns < DNS_MAX_SERVERS) { if (numdns < DNS_MAX_SERVERS) {
return &dns_servers[numdns]; return &dns_servers[numdns];
} else { } else {
return IP_ADDR_ANY; return IP4_ADDR_ANY;
} }
} }

View File

@ -264,7 +264,7 @@ autoip_start(struct netif *netif)
/* Set IP-Address, Netmask and Gateway to 0 to make sure that /* Set IP-Address, Netmask and Gateway to 0 to make sure that
* ARP Packets are formed correctly * ARP Packets are formed correctly
*/ */
netif_set_addr(netif, IP4_ADDR_ANY, IP4_ADDR_ANY, IP4_ADDR_ANY); netif_set_addr(netif, IP4_ADDR_ANY4, IP4_ADDR_ANY4, IP4_ADDR_ANY4);
LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
("autoip_start(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0], ("autoip_start(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0],
@ -355,7 +355,7 @@ autoip_stop(struct netif *netif)
if (autoip != NULL) { if (autoip != NULL) {
autoip->state = AUTOIP_STATE_OFF; autoip->state = AUTOIP_STATE_OFF;
if (ip4_addr_islinklocal(netif_ip4_addr(netif))) { if (ip4_addr_islinklocal(netif_ip4_addr(netif))) {
netif_set_addr(netif, IP4_ADDR_ANY, IP4_ADDR_ANY, IP4_ADDR_ANY); netif_set_addr(netif, IP4_ADDR_ANY4, IP4_ADDR_ANY4, IP4_ADDR_ANY4);
} }
} }
return ERR_OK; return ERR_OK;

View File

@ -212,8 +212,8 @@ dhcp_inc_pcb_refcount(void)
ip_set_option(dhcp_pcb, SOF_BROADCAST); ip_set_option(dhcp_pcb, SOF_BROADCAST);
/* set up local and remote port for the pcb -> listen on all interfaces on all src/dest IPs */ /* set up local and remote port for the pcb -> listen on all interfaces on all src/dest IPs */
udp_bind(dhcp_pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT); udp_bind(dhcp_pcb, IP4_ADDR_ANY, DHCP_CLIENT_PORT);
udp_connect(dhcp_pcb, IP_ADDR_ANY, DHCP_SERVER_PORT); udp_connect(dhcp_pcb, IP4_ADDR_ANY, DHCP_SERVER_PORT);
udp_recv(dhcp_pcb, dhcp_recv, NULL); udp_recv(dhcp_pcb, dhcp_recv, NULL);
} }
@ -258,7 +258,7 @@ dhcp_handle_nak(struct netif *netif)
to ensure the callback can use dhcp_supplied_address() */ to ensure the callback can use dhcp_supplied_address() */
dhcp_set_state(dhcp, DHCP_STATE_BACKING_OFF); dhcp_set_state(dhcp, DHCP_STATE_BACKING_OFF);
/* remove IP address from interface (must no longer be used, as per RFC2131) */ /* remove IP address from interface (must no longer be used, as per RFC2131) */
netif_set_addr(netif, IP4_ADDR_ANY, IP4_ADDR_ANY, IP4_ADDR_ANY); netif_set_addr(netif, IP4_ADDR_ANY4, IP4_ADDR_ANY4, IP4_ADDR_ANY4);
/* We can immediately restart discovery */ /* We can immediately restart discovery */
dhcp_discover(netif); dhcp_discover(netif);
} }
@ -372,7 +372,7 @@ dhcp_select(struct netif *netif)
pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len); pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len);
/* send broadcast to any DHCP server */ /* send broadcast to any DHCP server */
udp_sendto_if_src(dhcp_pcb, dhcp->p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT, netif, IP_ADDR_ANY); udp_sendto_if_src(dhcp_pcb, dhcp->p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT, netif, IP4_ADDR_ANY);
dhcp_delete_msg(dhcp); dhcp_delete_msg(dhcp);
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_select: REQUESTING\n")); LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_select: REQUESTING\n"));
} else { } else {
@ -920,7 +920,7 @@ dhcp_decline(struct netif *netif)
pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len); pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len);
/* per section 4.4.4, broadcast DECLINE messages */ /* per section 4.4.4, broadcast DECLINE messages */
udp_sendto_if_src(dhcp_pcb, dhcp->p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT, netif, IP_ADDR_ANY); udp_sendto_if_src(dhcp_pcb, dhcp->p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT, netif, IP4_ADDR_ANY);
dhcp_delete_msg(dhcp); dhcp_delete_msg(dhcp);
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_decline: BACKING OFF\n")); LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_decline: BACKING OFF\n"));
} else { } else {
@ -971,7 +971,7 @@ dhcp_discover(struct netif *netif)
pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len); pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len);
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, DHCP_SERVER_PORT)\n")); LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, DHCP_SERVER_PORT)\n"));
udp_sendto_if_src(dhcp_pcb, dhcp->p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT, netif, IP_ADDR_ANY); udp_sendto_if_src(dhcp_pcb, dhcp->p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT, netif, IP4_ADDR_ANY);
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_discover: deleting()ing\n")); LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_discover: deleting()ing\n"));
dhcp_delete_msg(dhcp); dhcp_delete_msg(dhcp);
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_discover: SELECTING\n")); LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_discover: SELECTING\n"));
@ -1314,7 +1314,7 @@ dhcp_release(struct netif *netif)
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("dhcp_release: could not allocate DHCP request\n")); LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("dhcp_release: could not allocate DHCP request\n"));
} }
/* remove IP address from interface (prevents routing from selecting this interface) */ /* remove IP address from interface (prevents routing from selecting this interface) */
netif_set_addr(netif, IP4_ADDR_ANY, IP4_ADDR_ANY, IP4_ADDR_ANY); netif_set_addr(netif, IP4_ADDR_ANY4, IP4_ADDR_ANY4, IP4_ADDR_ANY4);
return result; return result;
} }

View File

@ -711,7 +711,7 @@ igmp_delaying_member(struct igmp_group *group, u8_t maxresp)
* @param p the packet to send (p->payload points to the data, e.g. next * @param p the packet to send (p->payload points to the data, e.g. next
protocol header; if dest == LWIP_IP_HDRINCL, p already includes an protocol header; if dest == LWIP_IP_HDRINCL, p already includes an
IP header and p->payload points to that IP header) IP header and p->payload points to that IP header)
* @param src the source IP address to send from (if src == IP_ADDR_ANY, the * @param src the source IP address to send from (if src == IP4_ADDR_ANY, the
* IP address of the netif used to send is used as source address) * IP address of the netif used to send is used as source address)
* @param dest the destination IP address to send the packet to * @param dest the destination IP address to send the packet to
* @param ttl the TTL value to be set in the IP header * @param ttl the TTL value to be set in the IP header
@ -743,7 +743,7 @@ igmp_send(struct netif *netif, struct igmp_group *group, u8_t type)
{ {
struct pbuf* p = NULL; struct pbuf* p = NULL;
struct igmp_msg* igmp = NULL; struct igmp_msg* igmp = NULL;
ip4_addr_t src = *IP4_ADDR_ANY; ip4_addr_t src = *IP4_ADDR_ANY4;
ip4_addr_t* dest = NULL; ip4_addr_t* dest = NULL;
/* IP header + "router alert" option + IGMP header */ /* IP header + "router alert" option + IGMP header */

View File

@ -724,7 +724,7 @@ ip4_input(struct pbuf *p, struct netif *inp)
* @param p the packet to send (p->payload points to the data, e.g. next * @param p the packet to send (p->payload points to the data, e.g. next
protocol header; if dest == LWIP_IP_HDRINCL, p already includes an protocol header; if dest == LWIP_IP_HDRINCL, p already includes an
IP header and p->payload points to that IP header) IP header and p->payload points to that IP header)
* @param src the source IP address to send from (if src == IP_ADDR_ANY, the * @param src the source IP address to send from (if src == IP4_ADDR_ANY, the
* IP address of the netif used to send is used as source address) * IP address of the netif used to send is used as source address)
* @param dest the destination IP address to send the packet to * @param dest the destination IP address to send the packet to
* @param ttl the TTL value to be set in the IP header * @param ttl the TTL value to be set in the IP header
@ -881,7 +881,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
++ip_id; ++ip_id;
if (src == NULL) { if (src == NULL) {
ip4_addr_copy(iphdr->src, *IP4_ADDR_ANY); ip4_addr_copy(iphdr->src, *IP4_ADDR_ANY4);
} else { } else {
/* src cannot be NULL here */ /* src cannot be NULL here */
ip4_addr_copy(iphdr->src, *src); ip4_addr_copy(iphdr->src, *src);
@ -955,7 +955,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
* @param p the packet to send (p->payload points to the data, e.g. next * @param p the packet to send (p->payload points to the data, e.g. next
protocol header; if dest == LWIP_IP_HDRINCL, p already includes an protocol header; if dest == LWIP_IP_HDRINCL, p already includes an
IP header and p->payload points to that IP header) IP header and p->payload points to that IP header)
* @param src the source IP address to send from (if src == IP_ADDR_ANY, the * @param src the source IP address to send from (if src == IP4_ADDR_ANY, the
* IP address of the netif used to send is used as source address) * IP address of the netif used to send is used as source address)
* @param dest the destination IP address to send the packet to * @param dest the destination IP address to send the packet to
* @param ttl the TTL value to be set in the IP header * @param ttl the TTL value to be set in the IP header
@ -990,7 +990,7 @@ ip4_output(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
* @param p the packet to send (p->payload points to the data, e.g. next * @param p the packet to send (p->payload points to the data, e.g. next
protocol header; if dest == LWIP_IP_HDRINCL, p already includes an protocol header; if dest == LWIP_IP_HDRINCL, p already includes an
IP header and p->payload points to that IP header) IP header and p->payload points to that IP header)
* @param src the source IP address to send from (if src == IP_ADDR_ANY, the * @param src the source IP address to send from (if src == IP4_ADDR_ANY, the
* IP address of the netif used to send is used as source address) * IP address of the netif used to send is used as source address)
* @param dest the destination IP address to send the packet to * @param dest the destination IP address to send the packet to
* @param ttl the TTL value to be set in the IP header * @param ttl the TTL value to be set in the IP header

View File

@ -43,7 +43,7 @@
#include "lwip/ip_addr.h" #include "lwip/ip_addr.h"
#include "lwip/netif.h" #include "lwip/netif.h"
/* used by IP_ADDR_ANY and IP_ADDR_BROADCAST in ip_addr.h */ /* used by IP4_ADDR_ANY and IP_ADDR_BROADCAST in ip_addr.h */
const ip_addr_t ip_addr_any = IPADDR4_INIT(IPADDR_ANY); const ip_addr_t ip_addr_any = IPADDR4_INIT(IPADDR_ANY);
const ip_addr_t ip_addr_broadcast = IPADDR4_INIT(IPADDR_BROADCAST); const ip_addr_t ip_addr_broadcast = IPADDR4_INIT(IPADDR_BROADCAST);

View File

@ -497,7 +497,7 @@ void
netif_set_ipaddr(struct netif *netif, const ip4_addr_t *ipaddr) netif_set_ipaddr(struct netif *netif, const ip4_addr_t *ipaddr)
{ {
ip_addr_t new_addr; ip_addr_t new_addr;
*ip_2_ip4(&new_addr) = (ipaddr ? *ipaddr : *IP4_ADDR_ANY); *ip_2_ip4(&new_addr) = (ipaddr ? *ipaddr : *IP4_ADDR_ANY4);
IP_SET_TYPE_VAL(new_addr, IPADDR_TYPE_V4); IP_SET_TYPE_VAL(new_addr, IPADDR_TYPE_V4);
/* address is actually being changed? */ /* address is actually being changed? */

View File

@ -196,7 +196,7 @@ raw_input(struct pbuf *p, struct netif *inp)
* Bind a RAW PCB. * Bind a RAW PCB.
* *
* @param pcb RAW PCB to be bound with a local address ipaddr. * @param pcb RAW PCB to be bound with a local address ipaddr.
* @param ipaddr local IP address to bind with. Use IP_ADDR_ANY to * @param ipaddr local IP address to bind with. Use IP4_ADDR_ANY to
* bind to all local interfaces. * bind to all local interfaces.
* *
* @return lwIP error code. * @return lwIP error code.

View File

@ -529,7 +529,7 @@ tcp_abort(struct tcp_pcb *pcb)
* *
* @param pcb the tcp_pcb to bind (no check is done whether this pcb is * @param pcb the tcp_pcb to bind (no check is done whether this pcb is
* already bound!) * already bound!)
* @param ipaddr the local ip address to bind to (use IP_ADDR_ANY to bind * @param ipaddr the local ip address to bind to (use IP4_ADDR_ANY to bind
* to any local address * to any local address
* @param port the local port to bind to * @param port the local port to bind to
* @return ERR_USE if the port is already in use * @return ERR_USE if the port is already in use
@ -546,7 +546,7 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
#if LWIP_IPV4 #if LWIP_IPV4
/* Don't propagate NULL pointer (IPv4 ANY) to subsequent functions */ /* Don't propagate NULL pointer (IPv4 ANY) to subsequent functions */
if (ipaddr == NULL) { if (ipaddr == NULL) {
ipaddr = IP_ADDR_ANY; ipaddr = IP4_ADDR_ANY;
} }
#endif /* LWIP_IPV4 */ #endif /* LWIP_IPV4 */

View File

@ -883,7 +883,7 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d
* Bind an UDP PCB. * Bind an UDP PCB.
* *
* @param pcb UDP PCB to be bound with a local address ipaddr and port. * @param pcb UDP PCB to be bound with a local address ipaddr and port.
* @param ipaddr local IP address to bind with. Use IP_ADDR_ANY to * @param ipaddr local IP address to bind with. Use IP4_ADDR_ANY to
* bind to all local interfaces. * bind to all local interfaces.
* @param port local UDP port to bind with. Use 0 to automatically bind * @param port local UDP port to bind with. Use 0 to automatically bind
* to a random port between UDP_LOCAL_PORT_RANGE_START and * to a random port between UDP_LOCAL_PORT_RANGE_START and
@ -907,7 +907,7 @@ udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
#if LWIP_IPV4 #if LWIP_IPV4
/* Don't propagate NULL pointer (IPv4 ANY) to subsequent functions */ /* Don't propagate NULL pointer (IPv4 ANY) to subsequent functions */
if (ipaddr == NULL) { if (ipaddr == NULL) {
ipaddr = IP_ADDR_ANY; ipaddr = IP4_ADDR_ANY;
} }
#endif /* LWIP_IPV4 */ #endif /* LWIP_IPV4 */

View File

@ -313,19 +313,25 @@ extern const ip_addr_t ip_addr_any;
extern const ip_addr_t ip_addr_broadcast; extern const ip_addr_t ip_addr_broadcast;
/** /**
* @ingroup ipaddr * @ingroup ip4addr
* IP_ADDR_ can be used as a fixed/const ip_addr_t * Provided for compatibility. Use IP4_ADDR_ANY for better readability.
* for the IPv4 wildcard and the broadcast address
*/ */
#define IP_ADDR_ANY (&ip_addr_any) #define IP_ADDR_ANY IP4_ADDR_ANY
/** @ingroup ipaddr */
#define IP_ADDR_BROADCAST (&ip_addr_broadcast)
/** /**
* @ingroup ip4addr * @ingroup ip4addr
* IP4_ADDR_ can be used as a fixed/const ip4_addr_t * Can be used as a fixed/const ip_addr_t
* for the IPv4 wildcard and the broadcast address
*/
#define IP4_ADDR_ANY (&ip_addr_any)
/**
* @ingroup ip4addr
* Can be used as a fixed/const ip4_addr_t
* for the wildcard and the broadcast address * for the wildcard and the broadcast address
*/ */
#define IP4_ADDR_ANY (ip_2_ip4(&ip_addr_any)) #define IP4_ADDR_ANY4 (ip_2_ip4(&ip_addr_any))
/** @ingroup ip4addr */
#define IP_ADDR_BROADCAST (&ip_addr_broadcast)
/** @ingroup ip4addr */ /** @ingroup ip4addr */
#define IP4_ADDR_BROADCAST (ip_2_ip4(&ip_addr_broadcast)) #define IP4_ADDR_BROADCAST (ip_2_ip4(&ip_addr_broadcast))

View File

@ -695,7 +695,7 @@ ppp_pcb *ppp_new(struct netif *pppif, const struct link_callbacks *callbacks, vo
MIB2_INIT_NETIF(pppif, snmp_ifType_ppp, 0); MIB2_INIT_NETIF(pppif, snmp_ifType_ppp, 0);
if (!netif_add(pcb->netif, if (!netif_add(pcb->netif,
#if LWIP_IPV4 #if LWIP_IPV4
IP4_ADDR_ANY, IP4_ADDR_BROADCAST, IP4_ADDR_ANY, IP4_ADDR_ANY4, IP4_ADDR_BROADCAST, IP4_ADDR_ANY4,
#endif /* LWIP_IPV4 */ #endif /* LWIP_IPV4 */
(void *)pcb, ppp_netif_init_cb, NULL)) { (void *)pcb, ppp_netif_init_cb, NULL)) {
LWIP_MEMPOOL_FREE(PPP_PCB, pcb); LWIP_MEMPOOL_FREE(PPP_PCB, pcb);
@ -1090,7 +1090,7 @@ int cifaddr(ppp_pcb *pcb, u32_t our_adr, u32_t his_adr) {
LWIP_UNUSED_ARG(our_adr); LWIP_UNUSED_ARG(our_adr);
LWIP_UNUSED_ARG(his_adr); LWIP_UNUSED_ARG(his_adr);
netif_set_addr(pcb->netif, IP4_ADDR_ANY, IP4_ADDR_BROADCAST, IP4_ADDR_ANY); netif_set_addr(pcb->netif, IP4_ADDR_ANY4, IP4_ADDR_BROADCAST, IP4_ADDR_ANY4);
return 1; return 1;
} }
@ -1145,12 +1145,12 @@ int cdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2) {
nsa = dns_getserver(0); nsa = dns_getserver(0);
ip_addr_set_ip4_u32(&nsb, ns1); ip_addr_set_ip4_u32(&nsb, ns1);
if (ip_addr_cmp(nsa, &nsb)) { if (ip_addr_cmp(nsa, &nsb)) {
dns_setserver(0, IP_ADDR_ANY); dns_setserver(0, IP4_ADDR_ANY);
} }
nsa = dns_getserver(1); nsa = dns_getserver(1);
ip_addr_set_ip4_u32(&nsb, ns2); ip_addr_set_ip4_u32(&nsb, ns2);
if (ip_addr_cmp(nsa, &nsb)) { if (ip_addr_cmp(nsa, &nsb)) {
dns_setserver(1, IP_ADDR_ANY); dns_setserver(1, IP4_ADDR_ANY);
} }
return 1; return 1;
} }

View File

@ -303,7 +303,7 @@ static err_t pppol2tp_connect(ppp_pcb *ppp, void *ctx) {
udp_bind(l2tp->udp, IP6_ADDR_ANY, 0); udp_bind(l2tp->udp, IP6_ADDR_ANY, 0);
} else } else
#endif /* LWIP_IPV6 */ #endif /* LWIP_IPV6 */
udp_bind(l2tp->udp, IP_ADDR_ANY, 0); udp_bind(l2tp->udp, IP4_ADDR_ANY, 0);
#if PPPOL2TP_AUTH_SUPPORT #if PPPOL2TP_AUTH_SUPPORT
/* Generate random vector */ /* Generate random vector */