From 5a25652c21525f4c11288f3d44d429c70221076c Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Sun, 21 Feb 2016 19:21:36 +0100 Subject: [PATCH] Eliminate IP_PCB_IPVER_INPUT_MATCH macro --- src/core/raw.c | 2 +- src/core/tcp_in.c | 2 +- src/core/udp.c | 2 +- src/include/lwip/ip.h | 4 ---- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/core/raw.c b/src/core/raw.c index d034517f..69c3da0a 100644 --- a/src/core/raw.c +++ b/src/core/raw.c @@ -106,7 +106,7 @@ raw_input(struct pbuf *p, struct netif *inp) /* loop through all raw pcbs until the packet is eaten by one */ /* this allows multiple pcbs to match against the packet by design */ while ((eaten == 0) && (pcb != NULL)) { - if ((pcb->protocol == proto) && IP_PCB_IPVER_INPUT_MATCH(pcb) && + if ((pcb->protocol == proto) && (ip_current_is_v6() == IP_IS_V6_VAL(pcb->local_ip)) && (ip_addr_isany(&pcb->local_ip) || ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr()))) { #if IP_SOF_BROADCAST_RECV diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index b33c0867..d7dbad85 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -269,7 +269,7 @@ tcp_input(struct pbuf *p, struct netif *inp) #endif /* SO_REUSE */ } else #endif /* LWIP_IPV4 && LWIP_IPV6 */ - if (IP_PCB_IPVER_INPUT_MATCH(lpcb)) { + if (ip_current_is_v6() == IP_IS_V6_VAL(lpcb->local_ip)) { if (ip_addr_cmp(&lpcb->local_ip, ip_current_dest_addr())) { /* found an exact match */ break; diff --git a/src/core/udp.c b/src/core/udp.c index d34bfdb0..f593838f 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -285,7 +285,7 @@ udp_input(struct pbuf *p, struct netif *inp) } /* compare PCB remote addr+port to UDP source addr+port */ if ((local_match != 0) && - (pcb->remote_port == src) && IP_PCB_IPVER_INPUT_MATCH(pcb) && + (pcb->remote_port == src) && (ip_current_is_v6() == IP_IS_V6_VAL(pcb->remote_ip)) && (ip_addr_isany_val(pcb->remote_ip) || ip_addr_cmp(&pcb->remote_ip, ip_current_src_addr()))) { /* the first fully matching PCB */ diff --git a/src/include/lwip/ip.h b/src/include/lwip/ip.h index 4c7a168f..30fd55cd 100644 --- a/src/include/lwip/ip.h +++ b/src/include/lwip/ip.h @@ -78,14 +78,10 @@ extern "C" { #if LWIP_IPV6 && LWIP_IPV4 #define IP_PCB_ISIPV6_MEMBER u8_t isipv6; #define IP_PCB_IPVER_EQ(pcb1, pcb2) ((pcb1)->isipv6 == (pcb2)->isipv6) -#define IP_PCB_IPVER_INPUT_MATCH(pcb) (ip_current_is_v6() ? \ - ((pcb)->isipv6 != 0) : \ - ((pcb)->isipv6 == 0)) #define PCB_ISIPV6(pcb) ((pcb)->isipv6) #else #define IP_PCB_ISIPV6_MEMBER #define IP_PCB_IPVER_EQ(pcb1, pcb2) 1 -#define IP_PCB_IPVER_INPUT_MATCH(pcb) 1 #define PCB_ISIPV6(pcb) LWIP_IPV6 #endif /* LWIP_IPV6 */