aboutsummaryrefslogtreecommitdiff
path: root/lib/libipsec
Commit message (Collapse)AuthorAgeFilesLines
* Add large replay widow support to setkey(8) and libipsec.Andrey V. Elsukov2017-04-131-1/+42
| | | | | | | | | | | | | | | | | | | | When the replay window size is large than UINT8_MAX, add to the request the SADB_X_EXT_SA_REPLAY extension header that was added in r309144. Also add support of SADB_X_EXT_NAT_T_TYPE, SADB_X_EXT_NAT_T_SPORT, SADB_X_EXT_NAT_T_DPORT, SADB_X_EXT_NAT_T_OAI, SADB_X_EXT_NAT_T_OAR, SADB_X_EXT_SA_REPLAY, SADB_X_EXT_NEW_ADDRESS_SRC, SADB_X_EXT_NEW_ADDRESS_DST extension headers to the key_debug that is used by `setkey -x`. Modify kdebug_sockaddr() to use inet_ntop() for IP addresses formatting. And modify kdebug_sadb_x_policy() to show policy scope and priority. Reviewed by: gnn, Emeric Poupon MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10375 Notes: svn path=/head/; revision=316759
* Fix two CURDIR references in comments that should be SRCTOPWarner Losh2017-03-121-1/+1
| | | | | | | | | | | references. Differential Revision: https://reviews.freebsd.org/D9932 Sponsored by: Netflix Silence On: arch@ (twice) Notes: svn path=/head/; revision=315173
* Introduce the concept of IPsec security policies scope.Andrey V. Elsukov2017-03-071-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently are defined three scopes: global, ifnet, and pcb. Generic security policies that IKE daemon can add via PF_KEY interface or an administrator creates with setkey(8) utility have GLOBAL scope. Such policies can be applied by the kernel to outgoing packets and checked agains inbound packets after IPsec processing. Security policies created by if_ipsec(4) interfaces have IFNET scope. Such policies are applied to packets that are passed through if_ipsec(4) interface. And security policies created by application using setsockopt() IP_IPSEC_POLICY option have PCB scope. Such policies are applied to packets related to specific socket. Currently there is no way to list PCB policies via setkey(8) utility. Modify setkey(8) and libipsec(3) to be able distinguish the scope of security policies in the `setkey -DP` listing. Add two optional flags: '-t' to list only policies related to virtual *tunneling* interfaces, i.e. policies with IFNET scope, and '-g' to list only policies with GLOBAL scope. By default policies from all scopes are listed. To implement this PF_KEY's sadb_x_policy structure was modified. sadb_x_policy_reserved field is used to pass the policy scope from the kernel to userland. SADB_SPDDUMP message extended to support filtering by scope: sadb_msg_satype field is used to specify bit mask of requested scopes. For IFNET policies the sadb_x_policy_priority field of struct sadb_x_policy is used to pass if_ipsec's interface if_index to the userland. For GLOBAL policies sadb_x_policy_priority is used only to manage order of security policies in the SPDB. For IFNET policies it is not used, so it can be used to keep if_index. After this change the output of `setkey -DP` now looks like: # setkey -DPt 0.0.0.0/0[any] 0.0.0.0/0[any] any in ipsec esp/tunnel/87.250.242.144-87.250.242.145/unique:145 spid=7 seq=3 pid=58025 scope=ifnet ifname=ipsec0 refcnt=1 # setkey -DPg ::/0 ::/0 icmp6 135,0 out none spid=5 seq=1 pid=872 scope=global refcnt=1 No objection from: #network Obtained from: Yandex LLC MFC after: 2 weeks Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D9805 Notes: svn path=/head/; revision=314812
* Merge projects/ipsec into head/.Andrey V. Elsukov2017-02-062-15/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Small summary ------------- o Almost all IPsec releated code was moved into sys/netipsec. o New kernel modules added: ipsec.ko and tcpmd5.ko. New kernel option IPSEC_SUPPORT added. It enables support for loading and unloading of ipsec.ko and tcpmd5.ko kernel modules. o IPSEC_NAT_T option was removed. Now NAT-T support is enabled by default. The UDP_ENCAP_ESPINUDP_NON_IKE encapsulation type support was removed. Added TCP/UDP checksum handling for inbound packets that were decapsulated by transport mode SAs. setkey(8) modified to show run-time NAT-T configuration of SA. o New network pseudo interface if_ipsec(4) added. For now it is build as part of ipsec.ko module (or with IPSEC kernel). It implements IPsec virtual tunnels to create route-based VPNs. o The network stack now invokes IPsec functions using special methods. The only one header file <netipsec/ipsec_support.h> should be included to declare all the needed things to work with IPsec. o All IPsec protocols handlers (ESP/AH/IPCOMP protosw) were removed. Now these protocols are handled directly via IPsec methods. o TCP_SIGNATURE support was reworked to be more close to RFC. o PF_KEY SADB was reworked: - now all security associations stored in the single SPI namespace, and all SAs MUST have unique SPI. - several hash tables added to speed up lookups in SADB. - SADB now uses rmlock to protect access, and concurrent threads can do SA lookups in the same time. - many PF_KEY message handlers were reworked to reflect changes in SADB. - SADB_UPDATE message was extended to support new PF_KEY headers: SADB_X_EXT_NEW_ADDRESS_SRC and SADB_X_EXT_NEW_ADDRESS_DST. They can be used by IKE daemon to change SA addresses. o ipsecrequest and secpolicy structures were cardinally changed to avoid locking protection for ipsecrequest. Now we support only limited number (4) of bundled SAs, but they are supported for both INET and INET6. o INPCB security policy cache was introduced. Each PCB now caches used security policies to avoid SP lookup for each packet. o For inbound security policies added the mode, when the kernel does check for full history of applied IPsec transforms. o References counting rules for security policies and security associations were changed. The proper SA locking added into xform code. o xform code was also changed. Now it is possible to unregister xforms. tdb_xxx structures were changed and renamed to reflect changes in SADB/SPDB, and changed rules for locking and refcounting. Reviewed by: gnn, wblock Obtained from: Yandex LLC Relnotes: yes Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D9352 Notes: svn path=/head/; revision=313330
* IPsec RFC6479 support for replay window sizes up to 2^32 - 32 packets.Fabien Thomas2016-11-252-1/+5
| | | | | | | | | | | | | | | | | | | Since the previous algorithm, based on bit shifting, does not scale with large replay windows, the algorithm used here is based on RFC 6479: IPsec Anti-Replay Algorithm without Bit Shifting. The replay window will be fast to be updated, but will cost as many bits in RAM as its size. The previous implementation did not provide a lock on the replay window, which may lead to replay issues. Reviewed by: ae Obtained from: emeric.poupon@stormshield.eu Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D8468 Notes: svn path=/head/; revision=309144
* libipsec: use NULL instead of zero for pointers.Pedro F. Giffuni2016-04-181-1/+1
| | | | Notes: svn path=/head/; revision=298214
* MFHGlen Barber2016-03-021-9/+0
|\ | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296318
| * DIRDEPS_BUILD: Regenerate without local dependencies.Bryan Drewery2016-02-241-9/+0
| | | | | | | | | | | | | | | | | | | | | | These are no longer needed after the recent 'beforebuild: depend' changes and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports skipping 'make depend'. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=295989
* | First pass through library packaging.Glen Barber2016-02-041-0/+1
|/ | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295278
* META MODE: Prefer INSTALL=tools/install.sh to lessen the need for xinstall.host.Bryan Drewery2015-11-251-1/+0
| | | | | | | | | | | This both avoids some dependencies on xinstall.host and allows bootstrapping on older releases to work due to lack of at least 'install -l' support. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291307
* New AES modes for IPSec, user space components.George V. Neville-Neil2015-07-031-0/+3
| | | | | | | | | | | | | | | Update setkey and libipsec to understand aes-gcm-16 as an encryption method. A partial commit of the work in review D2936. Submitted by: eri Reviewed by: jmg MFC after: 2 weeks Sponsored by: Rubicon Communications (Netgate) Notes: svn path=/head/; revision=285108
* new dependsSimon J. Gerraty2015-06-161-0/+1
| | | | Notes: svn path=/head/; revision=284481
* Revert r284417 it is not necessary anymoreBaptiste Daroussin2015-06-151-1/+1
| | | | Notes: svn path=/head/; revision=284421
* Enforce overwritting SHLIBDIRBaptiste Daroussin2015-06-151-1/+1
| | | | | | | | | | | | Since METAMODE has been added, sys.mk loads bsd.mkopt.mk which ends load loading bsd.own.mk which then defines SHLIBDIR before all the Makefile.inc everywhere. This makes /lib being populated again. Reported by: many Notes: svn path=/head/; revision=284417
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+29
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Updated dependenciesSimon J. Gerraty2014-05-161-1/+1
| | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * Merge from headSimon J. Gerraty2014-05-081-1/+1
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=265720
| * Merge headSimon J. Gerraty2014-04-271-0/+1
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265006
| * \ Merge from headSimon J. Gerraty2013-09-051-2/+2
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=255263
| * \ \ sync from headSimon J. Gerraty2013-04-121-8/+7
| |\ \ \ | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=249429
| * | | | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | | | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | | | Sync with HEAD.David E. O'Brien2013-02-081-1/+0
| |\ \ \ \ | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246555
| * | | | | Updated/new Makefile.dependSimon J. Gerraty2012-11-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=242788
| * | | | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | | | | | Use src.opts.mk in preference to bsd.own.mk except where we need stuffWarner Losh2014-05-061-1/+1
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | from the latter. Notes: svn path=/head/; revision=265420
* | | | | Add a missing break in the TCP case.Christian Brueffer2014-04-171-0/+1
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | Reviewed by: bms MFC after: 1 week Notes: svn path=/head/; revision=264585
* | | | Improve compatibility with recent flex from flex.sourceforge.net.Jung-uk Kim2013-05-031-2/+2
| |_|/ |/| | | | | | | | Notes: svn path=/head/; revision=250227
* | | Make this more compilable.Gleb Smirnoff2013-03-151-8/+7
| |/ |/| | | | | Notes: svn path=/head/; revision=248314
* | remove redundant yyparse declarationsBaptiste Daroussin2012-12-051-1/+0
|/ | | | | | | | PR: conf/174079 Submitted by: Garrett Cooper <yanegomi@gmail.com> Notes: svn path=/head/; revision=243906
* MFp4 204292:Bjoern A. Zeeb2012-02-111-0/+12
| | | | | | | | | | | | | Ignore the NAT_T extension types so we can at least dump the SADB from the in-base libipsec/setkey without error when NAT_T support is present in the kernel, though not printing the additional information yet. However in case there is no NAT_T support in kernel still consider them to be an error. MFC after: 8 weeks Notes: svn path=/head/; revision=231532
* Use the correct constant (with same value) for comparying the SA type.Bjoern A. Zeeb2012-02-111-1/+1
| | | | | | | | | PR: kern/142741 Submitted by: Matthijs Kooiman (matthijs stdin.nl) MFC after: 3 days Notes: svn path=/head/; revision=231515
* In lib/libipsec/policy_token.l, use lex's standard "%option noinput"Dimitry Andric2011-12-161-1/+1
| | | | | | | | | instead of hand-defining the YY_NO_INPUT macro. MFC after: 1 week Notes: svn path=/head/; revision=228555
* Define YY_NO_INPUT in lib/libipsec/policy_token.l, so lex's input()Dimitry Andric2011-12-151-0/+1
| | | | | | | | | function does not get defined needlessly. MFC after: 1 week Notes: svn path=/head/; revision=228552
* - change "is is" to "is" or "it is"Eitan Adler2011-10-161-1/+1
| | | | | | | | | | | - change "the the" to "the" Approved by: lstewart Approved by: sahil (mentor) MFC after: 3 days Notes: svn path=/head/; revision=226436
* The use of snprintf() to append to a buffer is not valid according to C99Kevin Lo2010-12-111-1/+2
| | | | Notes: svn path=/head/; revision=216369
* Build lib/ with WARNS=6 by default.Ed Schouten2010-01-021-0/+2
| | | | | | | | | | | | Similar to libexec/, do the same with lib/. Make WARNS=6 the norm and lower it when needed. I'm setting WARNS?=0 for secure/. It seems secure/ includes the Makefile.inc provided by lib/. I'm not going to touch that directory. Most of the code there is contributed anyway. Notes: svn path=/head/; revision=201381
* Bump the version of all non-symbol-versioned shared libraries inKen Smith2009-07-191-1/+1
| | | | | | | | | | | preparation for 8.0-RELEASE. Add the previous version of those libraries to ObsoleteFiles.inc and bump __FreeBSD_Version. Reviewed by: kib Approved by: re (rwatson) Notes: svn path=/head/; revision=195767
* Commit IPv6 support for FAST_IPSEC to the tree.George V. Neville-Neil2007-07-0111-19/+18
| | | | | | | | | | | This commit includes all remaining changes for the time being including user space updates. Submitted by: bz Approved by: re Notes: svn path=/head/; revision=171135
* Bump library versions in preparation for 7.0.Daniel Eischen2007-05-211-1/+1
| | | | | | | Ok'd by: kan Notes: svn path=/head/; revision=169807
* Integrate the Camellia Block Cipher. For more information see RFC 4132George V. Neville-Neil2007-05-091-0/+3
| | | | | | | | | | and its bibliography. Submitted by: Tomoyuki Okazaki <okazaki at kick dot gr dot jp> MFC after: 1 month Notes: svn path=/head/; revision=169425
* Markup fixes.Ruslan Ermilov2006-09-171-50/+47
| | | | Notes: svn path=/head/; revision=162385
* Provide alternate default for SHLIBDIR before bsd.own.mk does this.Ruslan Ermilov2006-03-181-1/+2
| | | | | | | Reported by: phk Notes: svn path=/head/; revision=156837
* Reimplementation of world/kernel build options. For details, see:Ruslan Ermilov2006-03-171-1/+3
| | | | | | | | | | | http://lists.freebsd.org/pipermail/freebsd-current/2006-March/061725.html The src.conf(5) manpage is to follow in a few days. Brought to you by: imp, jhb, kris, phk, ru (all bugs are mine) Notes: svn path=/head/; revision=156813
* Clean up some descriptions and remove ambiguities in the language.George V. Neville-Neil2006-02-142-97/+146
| | | | | | | | | Add explanations to the examples. MFC after: 1 week Notes: svn path=/head/; revision=155673
* Bump the shared library version number of all libraries that have notKen Smith2005-07-221-1/+1
| | | | | | | | | | been bumped since RELENG_5. Reviewed by: ru Approved by: re (not needed for commit check but in principle...) Notes: svn path=/head/; revision=148297
* Fixed the misplaced $FreeBSD$.Ruslan Ermilov2005-02-092-2/+4
| | | | Notes: svn path=/head/; revision=141580
* NOINET6 -> NO_INET6Ruslan Ermilov2004-12-211-1/+1
| | | | Notes: svn path=/head/; revision=139115