Deleted Added
full compact
in6_pcb.c (191672) in6_pcb.c (192895)
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>
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 191672 2009-04-29 19:19:13Z bms $");
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 ||
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 inp->inp_cred->cr_prison == cred->cr_prison)
669 prison_equal_ip6(cred->cr_prison,
670 inp->inp_cred->cr_prison))
670 return (inp);
671 }
672 }
673 /*
674 * Not found.
675 */
676 return (NULL);
677 } else {

--- 15 unchanged lines hidden (view full) ---

693 if (phd != NULL) {
694 /*
695 * Port is in use by one or more PCBs. Look for best
696 * fit.
697 */
698 LIST_FOREACH(inp, &phd->phd_pcblist, inp_portlist) {
699 wildcard = 0;
700 if (cred != NULL &&
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 &&
701 inp->inp_cred->cr_prison != cred->cr_prison)
702 !prison_equal_ip6(cred->cr_prison,
703 inp->inp_cred->cr_prison))
702 continue;
703 /* XXX inp locking */
704 if ((inp->inp_vflag & INP_IPV6) == 0)
705 continue;
706 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr))
707 wildcard++;
708 if (!IN6_IS_ADDR_UNSPECIFIED(
709 &inp->in6p_laddr)) {

--- 123 unchanged lines hidden (view full) ---

833 IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) &&
834 inp->inp_fport == fport &&
835 inp->inp_lport == lport) {
836 /*
837 * XXX We should be able to directly return
838 * the inp here, without any checks.
839 * Well unless both bound with SO_REUSEPORT?
840 */
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 */
841 if (jailed(inp->inp_cred))
843 if (prison_flag(inp->inp_cred, PR_IP6))
842 return (inp);
843 if (tmpinp == NULL)
844 tmpinp = inp;
845 }
846 }
847 if (tmpinp != NULL)
848 return (tmpinp);
849

--- 23 unchanged lines hidden (view full) ---

873 inp->inp_lport != lport) {
874 continue;
875 }
876
877 /* XXX inp locking */
878 if (faith && (inp->inp_flags & INP_FAITH) == 0)
879 continue;
880
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
881 injail = jailed(inp->inp_cred);
883 injail = prison_flag(inp->inp_cred, PR_IP6);
882 if (injail) {
883 if (prison_check_ip6(inp->inp_cred,
884 laddr) != 0)
885 continue;
886 } else {
887 if (local_exact != NULL)
888 continue;
889 }

--- 43 unchanged lines hidden ---
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 ---