freebsd-nq/sys/netinet6
Andrey V. Elsukov 627c036f65 Remove IPsec related PCB code from SCTP.
The inpcb structure has inp_sp pointer that is initialized by
ipsec_init_pcbpolicy() function. This pointer keeps strorage for IPsec
security policies associated with a specific socket.
An application can use IP_IPSEC_POLICY and IPV6_IPSEC_POLICY socket
options to configure these security policies. Then ip[6]_output()
uses inpcb pointer to specify that an outgoing packet is associated
with some socket. And IPSEC_OUTPUT() method can use a security policy
stored in the inp_sp. For inbound packet the protocol-specific input
routine uses IPSEC_CHECK_POLICY() method to check that a packet conforms
to inbound security policy configured in the inpcb.

SCTP protocol doesn't specify inpcb for ip[6]_output() when it sends
packets. Thus IPSEC_OUTPUT() method does not consider such packets as
associated with some socket and can not apply security policies
from inpcb, even if they are configured. Since IPSEC_CHECK_POLICY()
method is called from protocol-specific input routine, it can specify
inpcb pointer and associated with socket inbound policy will be
checked. But there are two problems:
1. Such check is asymmetric, becasue we can not apply security policy
from inpcb for outgoing packet.
2. IPSEC_CHECK_POLICY() expects that caller holds INPCB lock and
access to inp_sp is protected. But for SCTP this is not correct,
becasue SCTP uses own locks to protect inpcb.

To fix these problems remove IPsec related PCB code from SCTP.
This imply that IP_IPSEC_POLICY and IPV6_IPSEC_POLICY socket options
will be not applicable to SCTP sockets. To be able correctly check
inbound security policies for SCTP, mark its protocol header with
the PR_LASTHDR flag.

Reported by:	tuexen
Reviewed by:	tuexen
Differential Revision:	https://reviews.freebsd.org/D9538
2017-02-13 11:37:52 +00:00
..
dest6.c
frag6.c
icmp6.c
icmp6.h
in6_cksum.c
in6_fib.c
in6_fib.h
in6_gif.c
in6_ifattach.c Garbage collect IFT_IEEE80211 (but leave the define for possible reuse) 2017-01-28 17:08:40 +00:00
in6_ifattach.h
in6_jail.c
in6_mcast.c
in6_pcb.c Committed without approval from mentor. 2017-02-12 06:56:33 +00:00
in6_pcb.h Committed without approval from mentor. 2017-02-12 06:56:33 +00:00
in6_pcbgroup.c
in6_proto.c Remove IPsec related PCB code from SCTP. 2017-02-13 11:37:52 +00:00
in6_rmx.c
in6_rss.c
in6_rss.h
in6_src.c Revert r313527 2017-02-10 05:58:16 +00:00
in6_var.h
in6.c Garbage collect IFT_IEEE80211 (but leave the define for possible reuse) 2017-01-28 17:08:40 +00:00
in6.h Committed without approval from mentor. 2017-02-12 06:56:33 +00:00
ip6_ecn.h
ip6_fastfwd.c
ip6_forward.c Merge projects/ipsec into head/. 2017-02-06 08:49:57 +00:00
ip6_gre.c
ip6_id.c
ip6_input.c Merge projects/ipsec into head/. 2017-02-06 08:49:57 +00:00
ip6_mroute.c
ip6_mroute.h
ip6_output.c Committed without approval from mentor. 2017-02-12 06:56:33 +00:00
ip6_var.h
ip6.h
ip6protosw.h
ip_fw_nat64.h
ip_fw_nptv6.h
mld6_var.h
mld6.c
mld6.h
nd6_nbr.c Garbage collect IFT_IEEE80211 (but leave the define for possible reuse) 2017-01-28 17:08:40 +00:00
nd6_rtr.c Remove a bogus KASSERT from nd6_prefix_unlink(). 2016-12-19 19:21:28 +00:00
nd6.c Garbage collect IFT_IEEE80211 (but leave the define for possible reuse) 2017-01-28 17:08:40 +00:00
nd6.h
pim6_var.h
pim6.h
raw_ip6.c Committed without approval from mentor. 2017-02-12 06:56:33 +00:00
raw_ip6.h
route6.c
scope6_var.h
scope6.c
sctp6_usrreq.c Remove IPsec related PCB code from SCTP. 2017-02-13 11:37:52 +00:00
sctp6_var.h
send.c
send.h
tcp6_var.h
udp6_usrreq.c Committed without approval from mentor. 2017-02-12 06:56:33 +00:00
udp6_var.h