Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/udp_usrreq.c
Context not available. | |||||
return (0); | return (0); | ||||
} | } | ||||
static bool | |||||
udp_inpcb_eq_ip_uh(struct inpcb *inp, struct ip *ip, struct udphdr *uh) | |||||
{ | |||||
if (inp->inp_lport != uh->uh_dport) | |||||
return false; | |||||
#ifdef INET6 | |||||
if ((inp->inp_vflag & INP_IPV4) == 0) | |||||
return false; | |||||
#endif | |||||
if (inp->inp_laddr.s_addr != INADDR_ANY && | |||||
inp->inp_laddr.s_addr != ip->ip_dst.s_addr) | |||||
return false; | |||||
if (inp->inp_faddr.s_addr != INADDR_ANY && | |||||
inp->inp_faddr.s_addr != ip->ip_src.s_addr) | |||||
return false; | |||||
if (inp->inp_fport != 0 && | |||||
inp->inp_fport != uh->uh_sport) | |||||
return false; | |||||
return true; | |||||
} | |||||
int | int | ||||
udp_input(struct mbuf **mp, int *offp, int proto) | udp_input(struct mbuf **mp, int *offp, int proto) | ||||
{ | { | ||||
Context not available. | |||||
pcblist = udp_get_pcblist(proto); | pcblist = udp_get_pcblist(proto); | ||||
last = NULL; | last = NULL; | ||||
CK_LIST_FOREACH(inp, pcblist, inp_list) { | CK_LIST_FOREACH(inp, pcblist, inp_list) { | ||||
if (inp->inp_lport != uh->uh_dport) | if (!udp_inpcb_eq_ip_uh(inp, ip, uh)) | ||||
continue; | continue; | ||||
#ifdef INET6 | |||||
if ((inp->inp_vflag & INP_IPV4) == 0) | |||||
continue; | |||||
#endif | |||||
if (inp->inp_laddr.s_addr != INADDR_ANY && | |||||
inp->inp_laddr.s_addr != ip->ip_dst.s_addr) | |||||
continue; | |||||
if (inp->inp_faddr.s_addr != INADDR_ANY && | |||||
inp->inp_faddr.s_addr != ip->ip_src.s_addr) | |||||
continue; | |||||
if (inp->inp_fport != 0 && | |||||
inp->inp_fport != uh->uh_sport) | |||||
continue; | |||||
INP_RLOCK(inp); | INP_RLOCK(inp); | ||||
donner: I do not get the second condition.
This was already evaluated in line 558 above and caused a… | |||||
Done Inline ActionsThe second condition checks for a match, related to the comment I removed below. nc: The second condition checks for a match, related to the comment I removed below. | |||||
Context not available. | |||||
continue; | continue; | ||||
} | } | ||||
/* | if (!udp_inpcb_eq_ip_uh(inp, ip, uh)) { | ||||
* XXXRW: Because we weren't holding either the inpcb | INP_RUNLOCK(inp); | ||||
* or the hash lock when we checked for a match | continue; | ||||
* before, we should probably recheck now that the | } | ||||
* inpcb lock is held. | |||||
*/ | |||||
/* | /* | ||||
Not Done Inline ActionsWhy is this remark solved? donner: Why is this remark solved?
I do see no code for handling the concern nor any documentation why… | |||||
Done Inline ActionsThe code is handled by the condition: !udp_inpcb_eq_ip_uh(inp, ip, uh) So if we don't get a match, we unlock and continue. This is based on r222488 around the "In the UDPv4 and UDPv6 multicast cases" lins: https://freshbsd.org/commit/freebsd/src/222488 nc: The code is handled by the condition:
```
!udp_inpcb_eq_ip_uh(inp, ip, uh)
```
So if we don't… | |||||
* Handle socket delivery policy for any-source | * Handle socket delivery policy for any-source | ||||
Context not available. |
I do not get the second condition.
This was already evaluated in line 558 above and caused a "continue".
So in which case will this condition ever be effective?