mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-10 17:43:39 +08:00
Create new IP_IS_V4 macros and use them at instead of !IP_IS_V6 - since we now have an IPADDR_ANY_TYPE, just checking for !V6 does not mean it is V4
This commit is contained in:
@@ -1438,7 +1438,7 @@ dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr, dns_found_call
|
||||
if (ipaddr_aton(hostname, addr)) {
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
if ((IP_IS_V6(addr) && (dns_addrtype != LWIP_DNS_ADDRTYPE_IPV4)) ||
|
||||
(!IP_IS_V6(addr) && (dns_addrtype != LWIP_DNS_ADDRTYPE_IPV6)))
|
||||
(IP_IS_V4(addr) && (dns_addrtype != LWIP_DNS_ADDRTYPE_IPV6)))
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
{
|
||||
return ERR_OK;
|
||||
|
||||
@@ -1649,7 +1649,7 @@ dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr,
|
||||
goto free_pbuf_and_return;
|
||||
}
|
||||
|
||||
LWIP_ASSERT("invalid server address type", !IP_IS_V6(addr));
|
||||
LWIP_ASSERT("invalid server address type", IP_IS_V4(addr));
|
||||
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_recv(pbuf = %p) from DHCP server %"U16_F".%"U16_F".%"U16_F".%"U16_F" port %"U16_F"\n", (void*)p,
|
||||
ip4_addr1_16(ip_2_ip4(addr)), ip4_addr2_16(ip_2_ip4(addr)), ip4_addr3_16(ip_2_ip4(addr)), ip4_addr4_16(ip_2_ip4(addr)), port));
|
||||
|
||||
@@ -323,7 +323,7 @@ raw_sendto(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr)
|
||||
}
|
||||
|
||||
#if IP_SOF_BROADCAST
|
||||
if (!IP_IS_V6(ipaddr))
|
||||
if (IP_IS_V4(ipaddr))
|
||||
{
|
||||
/* broadcast filter? */
|
||||
if (!ip_get_option(pcb, SOF_BROADCAST) && ip_addr_isbroadcast(ipaddr, netif)) {
|
||||
|
||||
@@ -1872,7 +1872,7 @@ tcp_netif_ipv4_addr_changed_pcblist(const ip4_addr_t* old_addr, struct tcp_pcb*
|
||||
pcb = pcb_list;
|
||||
while (pcb != NULL) {
|
||||
/* PCB bound to current local interface address? */
|
||||
if (!IP_IS_V6_VAL(pcb->local_ip) && ip4_addr_cmp(ip_2_ip4(&pcb->local_ip), old_addr)
|
||||
if (IP_IS_V4_VAL(pcb->local_ip) && ip4_addr_cmp(ip_2_ip4(&pcb->local_ip), old_addr)
|
||||
#if LWIP_AUTOIP
|
||||
/* connections to link-local addresses must persist (RFC3927 ch. 1.9) */
|
||||
&& !ip4_addr_islinklocal(ip_2_ip4(&pcb->local_ip))
|
||||
@@ -1906,7 +1906,7 @@ void tcp_netif_ipv4_addr_changed(const ip4_addr_t* old_addr, const ip4_addr_t* n
|
||||
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = next) {
|
||||
next = lpcb->next;
|
||||
/* Is this an IPv4 pcb? */
|
||||
if (!IP_IS_V6_VAL(lpcb->local_ip)) {
|
||||
if (IP_IS_V4_VAL(lpcb->local_ip)) {
|
||||
/* PCB bound to current local interface address? */
|
||||
if ((!(ip4_addr_isany(ip_2_ip4(&lpcb->local_ip)))) &&
|
||||
(ip4_addr_cmp(ip_2_ip4(&lpcb->local_ip), old_addr))) {
|
||||
|
||||
@@ -701,7 +701,7 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d
|
||||
/* broadcast filter? */
|
||||
if (!ip_get_option(pcb, SOF_BROADCAST) &&
|
||||
#if LWIP_IPV6
|
||||
!IP_IS_V6(dst_ip) &&
|
||||
IP_IS_V4(dst_ip) &&
|
||||
#endif /* LWIP_IPV6 */
|
||||
ip_addr_isbroadcast(dst_ip, netif)) {
|
||||
LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_LEVEL_SERIOUS,
|
||||
@@ -943,9 +943,9 @@ udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
|
||||
#endif /* SO_REUSE */
|
||||
{
|
||||
/* port matches that of PCB in list and REUSEADDR not set -> reject */
|
||||
if ((ipcb->local_port == port) && (IP_IS_V6(ipaddr) == IP_IS_V6_VAL(ipcb->local_ip)) &&
|
||||
if ((ipcb->local_port == port) &&
|
||||
/* IP address matches? */
|
||||
ip_addr_cmp(&ipcb->local_ip, ipaddr)) {
|
||||
ip_addr_cmp(&ipcb->local_ip, ipaddr)) {
|
||||
/* other PCB already binds to this local IP and port */
|
||||
LWIP_DEBUGF(UDP_DEBUG,
|
||||
("udp_bind: local port %"U16_F" already bound by another pcb\n", port));
|
||||
@@ -1165,7 +1165,7 @@ void udp_netif_ipv4_addr_changed(const ip4_addr_t* old_addr, const ip4_addr_t* n
|
||||
if (!ip4_addr_isany(new_addr)) {
|
||||
for (upcb = udp_pcbs; upcb != NULL; upcb = upcb->next) {
|
||||
/* Is this an IPv4 pcb? */
|
||||
if (!IP_IS_V6_VAL(upcb->local_ip)) {
|
||||
if (IP_IS_V4_VAL(upcb->local_ip)) {
|
||||
/* PCB bound to current local interface address? */
|
||||
if (!ip4_addr_isany(ip_2_ip4(&upcb->local_ip)) &&
|
||||
ip4_addr_cmp(ip_2_ip4(&upcb->local_ip), old_addr)) {
|
||||
|
||||
Reference in New Issue
Block a user