mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-11 10:03:47 +08:00
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:
@@ -362,7 +362,7 @@ dns_setserver(u8_t numdns, const ip_addr_t *dnsserver)
|
||||
if (dnsserver != NULL) {
|
||||
dns_servers[numdns] = (*dnsserver);
|
||||
} 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) {
|
||||
return &dns_servers[numdns];
|
||||
} else {
|
||||
return IP_ADDR_ANY;
|
||||
return IP4_ADDR_ANY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ autoip_start(struct netif *netif)
|
||||
/* Set IP-Address, Netmask and Gateway to 0 to make sure that
|
||||
* 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,
|
||||
("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) {
|
||||
autoip->state = AUTOIP_STATE_OFF;
|
||||
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;
|
||||
|
||||
@@ -212,8 +212,8 @@ dhcp_inc_pcb_refcount(void)
|
||||
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 */
|
||||
udp_bind(dhcp_pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
|
||||
udp_connect(dhcp_pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
|
||||
udp_bind(dhcp_pcb, IP4_ADDR_ANY, DHCP_CLIENT_PORT);
|
||||
udp_connect(dhcp_pcb, IP4_ADDR_ANY, DHCP_SERVER_PORT);
|
||||
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() */
|
||||
dhcp_set_state(dhcp, DHCP_STATE_BACKING_OFF);
|
||||
/* 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 */
|
||||
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);
|
||||
|
||||
/* 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);
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_select: REQUESTING\n"));
|
||||
} 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);
|
||||
|
||||
/* 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);
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_decline: BACKING OFF\n"));
|
||||
} 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);
|
||||
|
||||
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"));
|
||||
dhcp_delete_msg(dhcp);
|
||||
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"));
|
||||
}
|
||||
/* 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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
protocol header; if dest == LWIP_IP_HDRINCL, p already includes an
|
||||
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)
|
||||
* @param dest the destination IP address to send the packet to
|
||||
* @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 igmp_msg* igmp = NULL;
|
||||
ip4_addr_t src = *IP4_ADDR_ANY;
|
||||
ip4_addr_t src = *IP4_ADDR_ANY4;
|
||||
ip4_addr_t* dest = NULL;
|
||||
|
||||
/* IP header + "router alert" option + IGMP header */
|
||||
|
||||
@@ -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
|
||||
protocol header; if dest == LWIP_IP_HDRINCL, p already includes an
|
||||
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)
|
||||
* @param dest the destination IP address to send the packet to
|
||||
* @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;
|
||||
|
||||
if (src == NULL) {
|
||||
ip4_addr_copy(iphdr->src, *IP4_ADDR_ANY);
|
||||
ip4_addr_copy(iphdr->src, *IP4_ADDR_ANY4);
|
||||
} else {
|
||||
/* src cannot be NULL here */
|
||||
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
|
||||
protocol header; if dest == LWIP_IP_HDRINCL, p already includes an
|
||||
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)
|
||||
* @param dest the destination IP address to send the packet to
|
||||
* @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
|
||||
protocol header; if dest == LWIP_IP_HDRINCL, p already includes an
|
||||
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)
|
||||
* @param dest the destination IP address to send the packet to
|
||||
* @param ttl the TTL value to be set in the IP header
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "lwip/ip_addr.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_broadcast = IPADDR4_INIT(IPADDR_BROADCAST);
|
||||
|
||||
|
||||
@@ -497,7 +497,7 @@ void
|
||||
netif_set_ipaddr(struct netif *netif, const ip4_addr_t *ipaddr)
|
||||
{
|
||||
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);
|
||||
|
||||
/* address is actually being changed? */
|
||||
|
||||
@@ -196,7 +196,7 @@ raw_input(struct pbuf *p, struct netif *inp)
|
||||
* Bind a RAW PCB.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @return lwIP error code.
|
||||
|
||||
@@ -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
|
||||
* 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
|
||||
* @param port the local port to bind to
|
||||
* @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
|
||||
/* Don't propagate NULL pointer (IPv4 ANY) to subsequent functions */
|
||||
if (ipaddr == NULL) {
|
||||
ipaddr = IP_ADDR_ANY;
|
||||
ipaddr = IP4_ADDR_ANY;
|
||||
}
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
* @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.
|
||||
* @param port local UDP port to bind with. Use 0 to automatically bind
|
||||
* 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
|
||||
/* Don't propagate NULL pointer (IPv4 ANY) to subsequent functions */
|
||||
if (ipaddr == NULL) {
|
||||
ipaddr = IP_ADDR_ANY;
|
||||
ipaddr = IP4_ADDR_ANY;
|
||||
}
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user