1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 47 unchanged lines hidden (view full) --- 56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 * SUCH DAMAGE. 59 * 60 * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94 61 */ 62 63#include <sys/cdefs.h> |
64__FBSDID("$FreeBSD: head/sys/netinet6/in6_pcb.c 192895 2009-05-27 14:11:23Z jamie $"); |
65 66#include "opt_inet.h" 67#include "opt_inet6.h" 68#include "opt_ipsec.h" 69#include "opt_mac.h" 70 71#include <sys/param.h> 72#include <sys/systm.h> --- 588 unchanged lines hidden (view full) --- 661 /* XXX inp locking */ 662 if ((inp->inp_vflag & INP_IPV6) == 0) 663 continue; 664 if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) && 665 IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) && 666 inp->inp_lport == lport) { 667 /* Found. */ 668 if (cred == NULL || |
669 prison_equal_ip6(cred->cr_prison, 670 inp->inp_cred->cr_prison)) |
671 return (inp); 672 } 673 } 674 /* 675 * Not found. 676 */ 677 return (NULL); 678 } else { --- 15 unchanged lines hidden (view full) --- 694 if (phd != NULL) { 695 /* 696 * Port is in use by one or more PCBs. Look for best 697 * fit. 698 */ 699 LIST_FOREACH(inp, &phd->phd_pcblist, inp_portlist) { 700 wildcard = 0; 701 if (cred != NULL && |
702 !prison_equal_ip6(cred->cr_prison, 703 inp->inp_cred->cr_prison)) |
704 continue; 705 /* XXX inp locking */ 706 if ((inp->inp_vflag & INP_IPV6) == 0) 707 continue; 708 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) 709 wildcard++; 710 if (!IN6_IS_ADDR_UNSPECIFIED( 711 &inp->in6p_laddr)) { --- 123 unchanged lines hidden (view full) --- 835 IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) && 836 inp->inp_fport == fport && 837 inp->inp_lport == lport) { 838 /* 839 * XXX We should be able to directly return 840 * the inp here, without any checks. 841 * Well unless both bound with SO_REUSEPORT? 842 */ |
843 if (prison_flag(inp->inp_cred, PR_IP6)) |
844 return (inp); 845 if (tmpinp == NULL) 846 tmpinp = inp; 847 } 848 } 849 if (tmpinp != NULL) 850 return (tmpinp); 851 --- 23 unchanged lines hidden (view full) --- 875 inp->inp_lport != lport) { 876 continue; 877 } 878 879 /* XXX inp locking */ 880 if (faith && (inp->inp_flags & INP_FAITH) == 0) 881 continue; 882 |
883 injail = prison_flag(inp->inp_cred, PR_IP6); |
884 if (injail) { 885 if (prison_check_ip6(inp->inp_cred, 886 laddr) != 0) 887 continue; 888 } else { 889 if (local_exact != NULL) 890 continue; 891 } --- 43 unchanged lines hidden --- |