Lines 386-391
Link Here
|
386 |
return (0); |
386 |
return (0); |
387 |
} |
387 |
} |
388 |
|
388 |
|
|
|
389 |
static bool |
390 |
udp_inpcb_eq_ip_uh(struct inpcb *inp, struct ip *ip, struct udphdr *uh) |
391 |
{ |
392 |
if (inp->inp_lport != uh->uh_dport) |
393 |
return false; |
394 |
#ifdef INET6 |
395 |
if ((inp->inp_vflag & INP_IPV4) == 0) |
396 |
return false; |
397 |
#endif |
398 |
if (inp->inp_laddr.s_addr != INADDR_ANY && |
399 |
inp->inp_laddr.s_addr != ip->ip_dst.s_addr) |
400 |
return false; |
401 |
if (inp->inp_faddr.s_addr != INADDR_ANY && |
402 |
inp->inp_faddr.s_addr != ip->ip_src.s_addr) |
403 |
return false; |
404 |
if (inp->inp_fport != 0 && |
405 |
inp->inp_fport != uh->uh_sport) |
406 |
return false; |
407 |
|
408 |
return true; |
409 |
} |
410 |
|
389 |
int |
411 |
int |
390 |
udp_input(struct mbuf **mp, int *offp, int proto) |
412 |
udp_input(struct mbuf **mp, int *offp, int proto) |
391 |
{ |
413 |
{ |
Lines 533-553
Link Here
|
533 |
pcblist = udp_get_pcblist(proto); |
555 |
pcblist = udp_get_pcblist(proto); |
534 |
last = NULL; |
556 |
last = NULL; |
535 |
CK_LIST_FOREACH(inp, pcblist, inp_list) { |
557 |
CK_LIST_FOREACH(inp, pcblist, inp_list) { |
536 |
if (inp->inp_lport != uh->uh_dport) |
558 |
if (!udp_inpcb_eq_ip_uh(inp, ip, uh)) |
537 |
continue; |
559 |
continue; |
538 |
#ifdef INET6 |
|
|
539 |
if ((inp->inp_vflag & INP_IPV4) == 0) |
540 |
continue; |
541 |
#endif |
542 |
if (inp->inp_laddr.s_addr != INADDR_ANY && |
543 |
inp->inp_laddr.s_addr != ip->ip_dst.s_addr) |
544 |
continue; |
545 |
if (inp->inp_faddr.s_addr != INADDR_ANY && |
546 |
inp->inp_faddr.s_addr != ip->ip_src.s_addr) |
547 |
continue; |
548 |
if (inp->inp_fport != 0 && |
549 |
inp->inp_fport != uh->uh_sport) |
550 |
continue; |
551 |
|
560 |
|
552 |
INP_RLOCK(inp); |
561 |
INP_RLOCK(inp); |
553 |
|
562 |
|
Lines 556-567
Link Here
|
556 |
continue; |
565 |
continue; |
557 |
} |
566 |
} |
558 |
|
567 |
|
559 |
/* |
568 |
if (!udp_inpcb_eq_ip_uh(inp, ip, uh)) { |
560 |
* XXXRW: Because we weren't holding either the inpcb |
569 |
INP_RUNLOCK(inp); |
561 |
* or the hash lock when we checked for a match |
570 |
continue; |
562 |
* before, we should probably recheck now that the |
571 |
} |
563 |
* inpcb lock is held. |
|
|
564 |
*/ |
565 |
|
572 |
|
566 |
/* |
573 |
/* |
567 |
* Handle socket delivery policy for any-source |
574 |
* Handle socket delivery policy for any-source |