mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
Eliminate IP_PCB_IPVER_EQ macro
This commit is contained in:
parent
5a25652c21
commit
339e82d7aa
@ -478,7 +478,7 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
|
||||
#endif /* SO_REUSE */
|
||||
{
|
||||
/* @todo: check accept_any_ip_version */
|
||||
if (IP_PCB_IPVER_EQ(pcb, cpcb) &&
|
||||
if ((IP_IS_V6(ipaddr) == IP_IS_V6_VAL(cpcb->local_ip)) &&
|
||||
(ip_addr_isany(&cpcb->local_ip) ||
|
||||
ip_addr_isany(ipaddr) ||
|
||||
ip_addr_cmp(&cpcb->local_ip, ipaddr))) {
|
||||
@ -547,11 +547,9 @@ tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog)
|
||||
this port is only used once for every local IP. */
|
||||
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
|
||||
if ((lpcb->local_port == pcb->local_port) &&
|
||||
IP_PCB_IPVER_EQ(pcb, lpcb)) {
|
||||
if (ip_addr_cmp(&lpcb->local_ip, &pcb->local_ip)) {
|
||||
/* this address/port is already used */
|
||||
return NULL;
|
||||
}
|
||||
ip_addr_cmp(&lpcb->local_ip, &pcb->local_ip)) {
|
||||
/* this address/port is already used */
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -797,7 +795,6 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port,
|
||||
for (cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) {
|
||||
if ((cpcb->local_port == pcb->local_port) &&
|
||||
(cpcb->remote_port == port) &&
|
||||
IP_PCB_IPVER_EQ(cpcb, pcb) &&
|
||||
ip_addr_cmp(&cpcb->local_ip, &pcb->local_ip) &&
|
||||
ip_addr_cmp(&cpcb->remote_ip, ipaddr)) {
|
||||
/* linux returns EISCONN here, but ERR_USE should be OK for us */
|
||||
@ -1672,7 +1669,7 @@ tcp_pcb_purge(struct tcp_pcb *pcb)
|
||||
tcp_listen_pcbs.listen_pcbs != NULL);
|
||||
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
|
||||
if ((lpcb->local_port == pcb->local_port) &&
|
||||
IP_PCB_IPVER_EQ(pcb, lpcb) &&
|
||||
(IP_IS_V6_VAL(pcb->local_ip) == IP_IS_V6_VAL(lpcb->local_ip)) &&
|
||||
(ip_addr_isany(&lpcb->local_ip) ||
|
||||
ip_addr_cmp(&pcb->local_ip, &lpcb->local_ip))) {
|
||||
/* port and address of the listen pcb match the timed-out pcb */
|
||||
|
@ -967,7 +967,7 @@ 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_PCB_IPVER_EQ(pcb, ipcb) &&
|
||||
if ((ipcb->local_port == port) && (IP_IS_V6(ipaddr) == IP_IS_V6_VAL(ipcb->local_ip)) &&
|
||||
/* IP address matches, or one is IP_ADDR_ANY? */
|
||||
(ip_addr_isany(&ipcb->local_ip) ||
|
||||
ip_addr_isany(ipaddr) ||
|
||||
|
@ -77,11 +77,9 @@ 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 PCB_ISIPV6(pcb) ((pcb)->isipv6)
|
||||
#else
|
||||
#define IP_PCB_ISIPV6_MEMBER
|
||||
#define IP_PCB_IPVER_EQ(pcb1, pcb2) 1
|
||||
#define PCB_ISIPV6(pcb) LWIP_IPV6
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user