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)
Feb 18 2024, 3:46 AM
Unknown Object (File)
Jan 18 2024, 10:29 AM
Unknown Object (File)
Dec 22 2023, 9:19 PM
Unknown Object (File)
Dec 21 2023, 9:21 AM
Unknown Object (File)
Dec 9 2023, 1:20 AM
Unknown Object (File)
Dec 2 2023, 8:25 PM
Unknown Object (File)
Oct 27 2023, 7:49 PM
Unknown Object (File)
Sep 9 2023, 1:26 AM
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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.