#
70703aa9 |
| 03-Mar-2025 |
acazuc <acazuc@acazuc.fr> |
netinet: allow per protocol random IP id control, single out IPSEC
A globally enabled random IP id generation maybe useful in most IP contexts, but it may be unnecessary in the case of IPsec encapsu
netinet: allow per protocol random IP id control, single out IPSEC
A globally enabled random IP id generation maybe useful in most IP contexts, but it may be unnecessary in the case of IPsec encapsulated packets because IPsec can be configured to use anti-replay windows.
This commit adds a new net.inet.ipsec.random_id sysctl to control whether or not IPsec packets should use random IP id generation.
Rest of the protocols/modules are still controlled by the global net.inet.ip.random_id, but can be easily augmented with a knob.
Reviewed by: glebius Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D49164
show more ...
|
Revision tags: release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3 |
|
#
0ff2d00d |
| 29-Dec-2024 |
Konstantin Belousov <kib@FreeBSD.org> |
ipsec: allow it to work with unmapped mbufs
Only map mbuf when a policy is looked up and indicates that IPSEC needs to transform the packet. If IPSEC is inline offloaded, it is up to the interface
ipsec: allow it to work with unmapped mbufs
Only map mbuf when a policy is looked up and indicates that IPSEC needs to transform the packet. If IPSEC is inline offloaded, it is up to the interface driver to request remap if needed.
Fetch the IP header using m_copydata() instead of using mtod() to select policy/SA.
Reviewed by: markj Sponsored by: NVidia networking Differential revision: https://reviews.freebsd.org/D48265
show more ...
|
Revision tags: release/14.2.0, release/13.4.0 |
|
#
b1c3a4d7 |
| 22-Aug-2024 |
Kristof Provost <kp@FreeBSD.org> |
netipsec: add probe points for the ipsec/esp/ah/ipcomp counters
Extend what we did for netinet counters in 60d8dbbef075 (netinet: add a probe point for IP, IP6, ICMP, ICMP6, UDP and TCP stats counte
netipsec: add probe points for the ipsec/esp/ah/ipcomp counters
Extend what we did for netinet counters in 60d8dbbef075 (netinet: add a probe point for IP, IP6, ICMP, ICMP6, UDP and TCP stats counters, 2024-01-18) to the IPsec code.
Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46416
show more ...
|
#
6023bd1d |
| 19-Jul-2024 |
Konstantin Belousov <kib@FreeBSD.org> |
netipsec: move declaration of the sysctl net.inet{,6}.ipsec nodes to header
Reviewed by: kp Sponsored by: NVIDIA networking Differential revision: https://reviews.freebsd.org/D46045
|
#
eb0fdc77 |
| 19-Jul-2024 |
Konstantin Belousov <kib@FreeBSD.org> |
netinet/ipsec.h: remove unneeded "extern"s
Reviewed by: kp Sponsored by: NVIDIA networking Differential revision: https://reviews.freebsd.org/D46045
|
Revision tags: release/14.1.0, release/13.3.0, release/14.0.0, release/13.2.0, release/12.4.0, release/13.1.0, release/12.3.0 |
|
#
ef2a572b |
| 22-Aug-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
ipsec_offload: kernel infrastructure
Inline IPSEC offload moves almost whole IPSEC processing from the CPU/MCU and possibly crypto accelerator, to the network card.
The transmitted packet content i
ipsec_offload: kernel infrastructure
Inline IPSEC offload moves almost whole IPSEC processing from the CPU/MCU and possibly crypto accelerator, to the network card.
The transmitted packet content is not touched by CPU during TX operations, kernel only does the required policy and security association lookups to find out that given flow is offloaded, and then packet is transmitted as plain text to the card. For driver convenience, a metadata is attached to the packet identifying SA which must process the packet. Card does encryption of the payload, padding, calculates authentication, and does the reformat according to the policy.
Similarly, on receive, card does the decapsulation, decryption, and authentification. Kernel receives the identifier of SA that was used to process the packet, together with the plain-text packet.
Overall, payload octets are only read or written by card DMA engine, removing a lot of memory subsystem overhead, and saving CPU time because IPSEC algos calculations are avoided.
If driver declares support for inline IPSEC offload (with the IFCAP2_IPSEC_OFFLOAD capability set and registering method table struct if_ipsec_accel_methods), kernel offers the SPD and SAD to driver. Driver decides which policies and SAs can be offloaded based on hardware capacity, and acks/nacks each SA for given interface to kernel. Kernel needs to keep this information to make a decision to skip software processing on TX, and to assume processing already done on RX. This shadow SPD/SAD database of offloads is rooted from policies (struct secpolicy accel_ifps, struct ifp_handle_sp) and SAs (struct secasvar accel_ipfs, struct ifp_handle_sav).
Some extensions to the PF_KEY socket allow to limit interfaces for which given SP/SA could be offloaded (proposed for offload). Also, additional statistics extensions allow to observe allocation/octet/use counters for specific SA.
Since SPs and SAs are typically instantiated in non-sleepable context, while offloading them into card is expected to require costly async manipulations of the card state, calls to the driver for offload and termination are executed in the threaded taskqueue. It also solves the issue of allocating resources needed for the offload database. Neither ipf_handle_sp nor ipf_handle_sav do not add reference to the owning SP/SA, the offload must be terminated before last reference is dropped. ipsec_accel only adds transient references to ensure safe pointer ownership by taskqueue.
Maintaining the SA counters for hardware-accelerated packets is the duty of the driver. The helper ipsec_accel_drv_sa_lifetime_update() is provided to hide accel infrastructure from drivers which would use expected callout to query hardware periodically for updates.
Reviewed by: rscheff (transport, stack integration), np Sponsored by: NVIDIA networking Differential revision: https://reviews.freebsd.org/D44219
show more ...
|
#
00524fd4 |
| 30-Jan-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
ipsec_output(): add mtu argument
Similarly, mtu is needed to decide inline IPSEC offloiad for the driver.
Sponsored by: NVIDIA networking Differential revision: https://reviews.freebsd.org/D44224
|
#
de1da299 |
| 25-Jan-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
ipsec_output(): add outcoming ifp argument
The information about the interface is needed to coordinate inline offloading of IPSEC processing with corresponding driver.
Sponsored by: NVIDIA networki
ipsec_output(): add outcoming ifp argument
The information about the interface is needed to coordinate inline offloading of IPSEC processing with corresponding driver.
Sponsored by: NVIDIA networking Differential revision: https://reviews.freebsd.org/D44223
show more ...
|
#
50ecbc51 |
| 22-Apr-2024 |
Lexi Winter <lexi@le-Fay.ORG> |
libipsec: make const-correct
- add const to the appropriate places in the libipsec public API and the relevant internal functions needed to support that.
- replace caddr_t with c_caddr_t in ipsec
libipsec: make const-correct
- add const to the appropriate places in the libipsec public API and the relevant internal functions needed to support that.
- replace caddr_t with c_caddr_t in ipsec_dump_policy()
- update the ipsec_dump_policy manpage to use c_caddr_t (this manpage was already wrong as it had "char *" instead of caddr_t previously).
While here, update pfkeyv2.h to not cast away const in the PFKEY_*() macros.
This should not cause any ABI changes as the actual types have not changed.
Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1099
show more ...
|
#
71625ec9 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
|
#
809fef29 |
| 04-Oct-2022 |
Gleb Smirnoff <glebius@FreeBSD.org> |
netipsec: move specific ipsecmethods declarations to ipsec_support.h
where struct ipsec_methods is defined. Not a functional change. Allows further modification of method prototypes without breakin
netipsec: move specific ipsecmethods declarations to ipsec_support.h
where struct ipsec_methods is defined. Not a functional change. Allows further modification of method prototypes without breaking compilation of other ipsec compilation units.
Differential revision: https://reviews.freebsd.org/D36730
show more ...
|
#
6b66194b |
| 13-Aug-2021 |
Kornel Duleba <mindal@semihalf.com> |
ipsec: Check PMTU before sending a frame.
If an encapsulated frame is going to have DF bit set check its desitnitions' PMTU and if it won't fit drop it and:
Generate ICMP 3/4 message if the packet
ipsec: Check PMTU before sending a frame.
If an encapsulated frame is going to have DF bit set check its desitnitions' PMTU and if it won't fit drop it and:
Generate ICMP 3/4 message if the packet was to be forwarded. Return EMSGSIZE error otherwise.
Obtained from: Semihalf Sponsored by: Stormshield Differential revision: https://reviews.freebsd.org/D30993
show more ...
|
#
d9d59bb1 |
| 09-Aug-2021 |
Wojciech Macek <wma@FreeBSD.org> |
ipsec: Handle ICMP NEEDFRAG message.
It will be needed for upcoming PMTU implementation in ipsec. For now simply create/update an entry in tcp hostcache when needed. The code is based on
ipsec: Handle ICMP NEEDFRAG message.
It will be needed for upcoming PMTU implementation in ipsec. For now simply create/update an entry in tcp hostcache when needed. The code is based on https://people.freebsd.org/~ae/ipsec_transport_mode_ctlinput.diff
Authored by: Kornel Duleba <mindal@semihalf.com> Differential revision: https://reviews.freebsd.org/D30992 Reviewed by: tuxen Sponsored by: Stormshield Obtained from: Semihalf
show more ...
|
Revision tags: release/13.0.0, release/12.2.0 |
|
#
8b7f3994 |
| 16-Oct-2020 |
Marcin Wojtas <mw@FreeBSD.org> |
Implement anti-replay algorithm with ESN support
As RFC 4304 describes there is anti-replay algorithm responsibility to provide appropriate value of Extended Sequence Number.
This patch introduces
Implement anti-replay algorithm with ESN support
As RFC 4304 describes there is anti-replay algorithm responsibility to provide appropriate value of Extended Sequence Number.
This patch introduces anti-replay algorithm with ESN support based on RFC 4304, however to avoid performance regressions window implementation was based on RFC 6479, which was already implemented in FreeBSD.
To keep things clean and improve code readability, implementation of window is kept in seperate functions.
Submitted by: Grzegorz Jaszczyk <jaz@semihalf.com> Patryk Duda <pdk@semihalf.com> Reviewed by: jhb Differential revision: https://reviews.freebsd.org/D22367 Obtained from: Semihalf Sponsored by: Stormshield
show more ...
|
Revision tags: release/11.4.0 |
|
#
28d2a72b |
| 29-May-2020 |
John Baldwin <jhb@FreeBSD.org> |
Consistently include opt_ipsec.h for consumers of <netipsec/ipsec.h>.
This fixes ipsec.ko to include all of IPSEC_DEBUG.
Reviewed by: imp MFC after: 2 weeks Sponsored by: Netflix Differential Revis
Consistently include opt_ipsec.h for consumers of <netipsec/ipsec.h>.
This fixes ipsec.ko to include all of IPSEC_DEBUG.
Reviewed by: imp MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D25046
show more ...
|
#
16aabb76 |
| 02-May-2020 |
John Baldwin <jhb@FreeBSD.org> |
Remove support for IPsec algorithms deprecated in r348205 and r360202.
Examples of depecrated algorithms in manual pages and sample configs are updated where relevant. I removed the one example of
Remove support for IPsec algorithms deprecated in r348205 and r360202.
Examples of depecrated algorithms in manual pages and sample configs are updated where relevant. I removed the one example of combining ESP and AH (vs using a cipher and auth in ESP) as RFC 8221 says this combination is NOT RECOMMENDED.
Specifically, this removes support for the following ciphers: - des-cbc - 3des-cbc - blowfish-cbc - cast128-cbc - des-deriv - des-32iv - camellia-cbc
This also removes support for the following authentication algorithms: - hmac-md5 - keyed-md5 - keyed-sha1 - hmac-ripemd160
Reviewed by: cem, gnn (older verisons) Relnotes: yes Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D24342
show more ...
|
Revision tags: release/12.1.0, release/11.3.0 |
|
#
e532a999 |
| 20-Jun-2019 |
Alan Somers <asomers@FreeBSD.org> |
MFHead @349234
Sponsored by: The FreeBSD Foundation
|
#
0f702183 |
| 12-Jun-2019 |
John Baldwin <jhb@FreeBSD.org> |
Make the warning intervals for deprecated crypto algorithms tunable.
New sysctl/tunables can now set the interval (in seconds) between rate-limited crypto warnings. The new sysctls are: - kern.cryp
Make the warning intervals for deprecated crypto algorithms tunable.
New sysctl/tunables can now set the interval (in seconds) between rate-limited crypto warnings. The new sysctls are: - kern.cryptodev_warn_interval for /dev/crypto - net.inet.ipsec.crypto_warn_interval for IPsec - kern.kgssapi_warn_interval for KGSSAPI
Reviewed by: cem MFC after: 1 month Relnotes: yes Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D20555
show more ...
|
Revision tags: release/12.0.0 |
|
#
2e08e39f |
| 14-Jul-2018 |
Conrad Meyer <cem@FreeBSD.org> |
OCF: Add a typedef for session identifiers
No functional change.
This should ease the transition from an integer session identifier model to an opaque pointer model.
|
Revision tags: release/11.2.0 |
|
#
f8e73c47 |
| 22-May-2018 |
Fabien Thomas <fabient@FreeBSD.org> |
Add a SPD cache to speed up lookups.
When large SPDs are used, we face two problems:
- too many CPU cycles are spent during the linear searches in the SPD for each packet - too much contention on
Add a SPD cache to speed up lookups.
When large SPDs are used, we face two problems:
- too many CPU cycles are spent during the linear searches in the SPD for each packet - too much contention on multi socket systems, since we use a single shared lock.
Main changes:
- added the sysctl tree 'net.key.spdcache' to control the SPD cache (disabled by default). - cache the sp indexes that are used to perform SP lookups. - use a range of dedicated mutexes to protect the cache lines.
Submitted by: Emeric Poupon <emeric.poupon@stormshield.eu> Reviewed by: ae Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D15050
show more ...
|
#
15bf717a |
| 19-Feb-2018 |
Andrey V. Elsukov <ae@FreeBSD.org> |
Remove unused variables and sysctl declaration.
MFC after: 1 week
|
#
82725ba9 |
| 23-Nov-2017 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Merge ^/head r325999 through r326131.
|
#
51369649 |
| 20-Nov-2017 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
sys: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.
The Software Package Data Exchange (SPDX) group provides a specification to make it easier for
sys: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.
The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts.
Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point.
show more ...
|
#
c2c014f2 |
| 07-Nov-2017 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Merge ^/head r323559 through r325504.
|
#
f6e116ee |
| 04-Nov-2017 |
Enji Cooper <ngie@FreeBSD.org> |
MFhead@r325383
|