Page MenuHomeFreeBSD

IPSec: make SPDUPDATE atomic
Needs ReviewPublic

Authored by emeric.poupon_stormshield.eu on May 24 2018, 3:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 27 2024, 12:13 AM
Unknown Object (File)
Nov 9 2023, 6:41 AM
Unknown Object (File)
Sep 25 2023, 2:20 AM
Unknown Object (File)
Aug 21 2023, 10:06 PM
Unknown Object (File)
Jul 2 2023, 8:28 AM
Unknown Object (File)
May 23 2023, 6:02 PM
Unknown Object (File)
Mar 10 2023, 11:31 AM
Unknown Object (File)
Dec 31 2022, 12:31 AM
Subscribers

Details

Reviewers
ae
Group Reviewers
secteam
Summary

SPDUPDATE is implemented using a del/add mechanism.
Unfortunately it is not atomic: the SP tree lock is released after the SP is removed and taken again before the SP is inserted.
Depending on the configuration, some packets may leak (e.g. using the default route)

Test Plan

In a network-to-network IPSec configuration, I set up an aggressive ping between two hosts.
tcpdump on the public interface shows ping packets from time to time (during the SPDUPDATE events triggered by the IKE daemon).

After the patch, there is no more packet leak.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

I have two questions:

  • is it OK to leave the old SP in case of error? I guess it is but in the previous implementation the SP is removed if it cannot be updated, and I think it is really questionable.
  • is it OK to hold a mutex during a printf? I guess not but there are already some examples doing that in this file