mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-07 15:04:39 +08:00
Eliminate IP_PCB_IPVER_INPUT_MATCH macro
This commit is contained in:
parent
8f675c37fc
commit
5a25652c21
@ -106,7 +106,7 @@ raw_input(struct pbuf *p, struct netif *inp)
|
|||||||
/* loop through all raw pcbs until the packet is eaten by one */
|
/* loop through all raw pcbs until the packet is eaten by one */
|
||||||
/* this allows multiple pcbs to match against the packet by design */
|
/* this allows multiple pcbs to match against the packet by design */
|
||||||
while ((eaten == 0) && (pcb != NULL)) {
|
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_isany(&pcb->local_ip) ||
|
||||||
ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr()))) {
|
ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr()))) {
|
||||||
#if IP_SOF_BROADCAST_RECV
|
#if IP_SOF_BROADCAST_RECV
|
||||||
|
@ -269,7 +269,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
|||||||
#endif /* SO_REUSE */
|
#endif /* SO_REUSE */
|
||||||
} else
|
} else
|
||||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
#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())) {
|
if (ip_addr_cmp(&lpcb->local_ip, ip_current_dest_addr())) {
|
||||||
/* found an exact match */
|
/* found an exact match */
|
||||||
break;
|
break;
|
||||||
|
@ -285,7 +285,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
}
|
}
|
||||||
/* compare PCB remote addr+port to UDP source addr+port */
|
/* compare PCB remote addr+port to UDP source addr+port */
|
||||||
if ((local_match != 0) &&
|
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_isany_val(pcb->remote_ip) ||
|
||||||
ip_addr_cmp(&pcb->remote_ip, ip_current_src_addr()))) {
|
ip_addr_cmp(&pcb->remote_ip, ip_current_src_addr()))) {
|
||||||
/* the first fully matching PCB */
|
/* the first fully matching PCB */
|
||||||
|
@ -78,14 +78,10 @@ extern "C" {
|
|||||||
#if LWIP_IPV6 && LWIP_IPV4
|
#if LWIP_IPV6 && LWIP_IPV4
|
||||||
#define IP_PCB_ISIPV6_MEMBER u8_t isipv6;
|
#define IP_PCB_ISIPV6_MEMBER u8_t isipv6;
|
||||||
#define IP_PCB_IPVER_EQ(pcb1, pcb2) ((pcb1)->isipv6 == (pcb2)->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)
|
#define PCB_ISIPV6(pcb) ((pcb)->isipv6)
|
||||||
#else
|
#else
|
||||||
#define IP_PCB_ISIPV6_MEMBER
|
#define IP_PCB_ISIPV6_MEMBER
|
||||||
#define IP_PCB_IPVER_EQ(pcb1, pcb2) 1
|
#define IP_PCB_IPVER_EQ(pcb1, pcb2) 1
|
||||||
#define IP_PCB_IPVER_INPUT_MATCH(pcb) 1
|
|
||||||
#define PCB_ISIPV6(pcb) LWIP_IPV6
|
#define PCB_ISIPV6(pcb) LWIP_IPV6
|
||||||
#endif /* LWIP_IPV6 */
|
#endif /* LWIP_IPV6 */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user