mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-09-17 20:24:24 +00:00
udp_bind: Fix the logic to check both pcbs have REUSEADDR set
The code for #if SO_REUSE case does not match the comment.
By default, we don't allow to bind to a port that any other udp
PCB is already bound to, unless *all* PCBs with that port have tha
REUSEADDR flag set.
Which means we want to omit checking for the same port if both pcbs
have REUSEADDR set. Fix the logic accordingly.
Fixes: d0348e0c60
("task #6995: Implement SO_REUSEADDR (correctly)")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
parent
5056d375f2
commit
156ad0dbf5
@ -962,7 +962,7 @@ udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
|
||||
PCB is already bound to, unless *all* PCBs with that port have tha
|
||||
REUSEADDR flag set. */
|
||||
#if SO_REUSE
|
||||
else if (!ip_get_option(pcb, SOF_REUSEADDR) &&
|
||||
else if (!ip_get_option(pcb, SOF_REUSEADDR) ||
|
||||
!ip_get_option(ipcb, SOF_REUSEADDR)) {
|
||||
#else /* SO_REUSE */
|
||||
/* port matches that of PCB in list and REUSEADDR not set -> reject */
|
||||
|
Loading…
Reference in New Issue
Block a user