Eliminate IP_PCB_IPVER_INPUT_MATCH macro

This commit is contained in:
Dirk Ziegelmeier 2016-02-21 19:21:36 +01:00
parent 8f675c37fc
commit 5a25652c21
4 changed files with 3 additions and 7 deletions

View File

@ -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

View File

@ -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;

View File

@ -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 */

View File

@ -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 */