Page MenuHomeFreeBSD

Remove IPsec related PCB code from SCTP.
ClosedPublic

Authored by ae on Feb 11 2017, 8:36 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 25, 2:26 AM
Unknown Object (File)
Sun, Nov 24, 6:20 AM
Unknown Object (File)
Sun, Nov 24, 6:20 AM
Unknown Object (File)
Fri, Nov 22, 11:02 PM
Unknown Object (File)
Fri, Nov 22, 4:05 PM
Unknown Object (File)
Wed, Nov 20, 10:26 PM
Unknown Object (File)
Wed, Nov 6, 11:56 AM
Unknown Object (File)
Sun, Oct 27, 6:31 PM
Subscribers

Details

Summary
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 cant do similar check for
outgoing packet.
2. IPSEC_CHECK_POLICY() assumes 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 PR_LASTHDR flag.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 7351
Build 7517: arc lint + arc unit

Event Timeline

ae retitled this revision from to Remove IPsec related PCB code from SCTP..
ae updated this object.
ae edited the test plan for this revision. (Show Details)
ae set the repository for this revision to rS FreeBSD src repository - subversion.
tuexen edited edge metadata.

Thanks for cleaning this up!

This revision is now accepted and ready to land.Feb 11 2017, 2:40 PM
This revision was automatically updated to reflect the committed changes.