summaryrefslogtreecommitdiffstats
path: root/sys/netipsec
Commit message (Collapse)AuthorAgeFilesLines
* s,#if INET6,#ifdef INET6,bz2006-12-142-2/+2
| | | | | | This unbreaks the build for FAST_IPSEC && !INET6 and was wrong anyway. Reported by: Dmitry Pryanishnikov <dmitry atlantis.dp.ua>
* MFp4: 92972, 98913 + one more changebz2006-12-122-3/+15
| | | | | | | In ip6_sprintf no longer use and return one of eight static buffers for printing/logging ipv6 addresses. The caller now has to hand in a sufficiently large buffer as first argument.
* Add priv.h include required to build FAST_IPSEC, which is not present inrwatson2006-11-071-0/+1
| | | | | | LINT due to a conflict with KAME IPSEC. Submitted by: Pawel Worach <pawel dot worach at gmail dot com>
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-061-1/+3
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* Fix build breakage from previous commit which confused key_abort and key_close.gnn2006-07-221-1/+1
|
* Change semantics of socket close and detach. Add a new protocol switchrwatson2006-07-211-0/+12
| | | | | | | | | | | | | | | | | | | function, pru_close, to notify protocols that the file descriptor or other consumer of a socket is closing the socket. pru_abort is now a notification of close also, and no longer detaches. pru_detach is no longer used to notify of close, and will be called during socket tear-down by sofree() when all references to a socket evaporate after an earlier call to abort or close the socket. This means detach is now an unconditional teardown of a socket, whereas previously sockets could persist after detach of the protocol retained a reference. This faciliates sharing mutexes between layers of the network stack as the mutex is required during the checking and removal of references at the head of sofree(). With this change, pru_detach can now assume that the mutex will no longer be required by the socket layer after completion, whereas before this was not necessarily true. Reviewed by: gnn
* - Use suser_cred(9) instead of directly comparing cr_uid.pjd2006-06-271-2/+3
| | | | | | - Compare pointer with NULL. Reviewed by: rwatson
* Add a pseudo interface for packet filtering IPSec connections before or afterthompsa2006-06-264-0/+35
| | | | | | | | | | | encryption. There are two functions, a bpf tap which has a basic header with the SPI number which our current tcpdump knows how to display, and handoff to pfil(9) for packet filtering. Obtained from: OpenBSD Based on: kern/94829 No objections: arch, net MFC after: 1 month
* Change '#if INET' and '#if INET6' to '#ifdef INET' and '#ifdef INET6'.pjd2006-06-042-3/+3
| | | | This unbreaks compiling a kernel with FAST_IPSEC and no INET6.
* Extend the notdef #ifdef to cover the packet copy as there is no point in ↵gnn2006-06-041-8/+4
| | | | | | | doing that if we're not doing the rest of the work. Submitted by: thompsa MFC after: 1 week
* Prevent disappearing SAD entries by implementing MPsafe refcounting.pjd2006-05-201-20/+33
| | | | | | | | | | | | | "Why didn't he use SECASVAR_LOCK()/SECASVAR_UNLOCK() macros to synchronize access to the secasvar structure's fields?" one may ask. There were two reasons: 1. refcount(9) is faster then mutex(9) synchronization (one atomic operation instead of two). 2. Those macros are not used now at all, so at some point we may decide to remove them entirely. OK'ed by: gnn MFC after: 2 weeks
* - The authsize field from auth_hash structure was removed.pjd2006-05-172-10/+11
| | | | | | | - Define that we want to receive only 96 bits of HMAC. - Names of the structues have no longer _96 suffix. Reviewed by: sam
* Hide net.inet.ipsec.test_{replay,integrity} sysctls under #ifdef REGRESSION.pjd2006-04-104-0/+12
| | | | Requested by: sam, rwatson
* Introduce two new sysctls:pjd2006-04-094-2/+54
| | | | | | | | | | | | | net.inet.ipsec.test_replay - When set to 1, IPsec will send packets with the same sequence number. This allows to verify if the other side has proper replay attacks detection. net.inet.ipsec.test_integrity - When set 1, IPsec will send packets with corrupted HMAC. This allows to verify if the other side properly detects modified packets. I used the first one to discover that we don't have proper replay attacks detection in ESP (in fast_ipsec(4)).
* Be consistent with the rest of the code.pjd2006-04-091-1/+1
|
* Remove unused variables s and error in key_detach. The previousdd2006-04-041-1/+0
| | | | | revision removed their usage but did not remove the declaration. This caused a warning in my build, which was fatal with -Werror.
* Remove unintended DEBUG flag setting.gnn2006-04-041-1/+0
|
* Chance protocol switch method pru_detach() so that it returns voidrwatson2006-04-011-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | rather than an error. Detaches do not "fail", they other occur or the protocol flags SS_PROTOREF to take ownership of the socket. soclose() no longer looks at so_pcb to see if it's NULL, relying entirely on the protocol to decide whether it's time to free the socket or not using SS_PROTOREF. so_pcb is now entirely owned and managed by the protocol code. Likewise, no longer test so_pcb in other socket functions, such as soreceive(), which have no business digging into protocol internals. Protocol detach routines no longer try to free the socket on detach, this is performed in the socket code if the protocol permits it. In rts_detach(), no longer test for rp != NULL in detach, and likewise in other protocols that don't permit a NULL so_pcb, reduce the incidence of testing for it during detach. netinet and netinet6 are not fully updated to this change, which will be in an upcoming commit. In their current state they may leak memory or panic. MFC after: 3 months
* Change protocol switch pru_abort() API so that it returns void ratherrwatson2006-04-011-6/+3
| | | | | | | | | | | | | | than an int, as an error here is not meaningful. Modify soabort() to unconditionally free the socket on the return of pru_abort(), and modify most protocols to no longer conditionally free the socket, since the caller will do this. This commit likely leaves parts of netinet and netinet6 in a situation where they may panic or leak memory, as they have not are not fully updated by this commit. This will be corrected shortly in followup commits to these components. MFC after: 3 months
* Fix more stack corruptions on amd64.bz2006-03-302-19/+11
| | | | | | | | | | | | | | | | | | | Vararg functions have a different calling convention than regular functions on amd64. Casting a varag function to a regular one to match the function pointer declaration will hide the varargs from the caller and we will end up with an incorrectly setup stack. Entirely remove the varargs from these functions and change the functions to match the declaration of the function pointers. Remove the now unnecessary casts. Also change static struct ipprotosw[] to two independent protosw/ip6protosw definitions to remove an unnecessary cast. PR: amd64/95008 Submitted and tested by: Mats Palmgren Reviewed by: rwatson MFC after: 3 days
* First steps towards IPSec cleanup.gnn2006-03-257-105/+257
| | | | | | | | | Make the kernel side of FAST_IPSEC not depend on the shared structures defined in /usr/include/net/pfkeyv2.h The kernel now defines all the necessary in kernel structures in sys/netipsec/keydb.h and does the proper massaging when moving messages around. Sponsored By: Secure Computing
* Allow to use fast_ipsec(4) on debug.mpsafenet=0 and INVARIANTS-enabledpjd2006-03-233-11/+44
| | | | | | systems. Without the change it will panic on assertions. MFC after: 2 weeks
* Add missing code needed for the detection of IPSec packet replays. [1]cperciva2006-03-221-0/+17
| | | | | | | | Correctly identify the user running opiepasswd(1) when the login name differs from the account name. [2] Security: FreeBSD-SA-06:11.ipsec [1] Security: FreeBSD-SA-06:12.opie [2]
* promote fast ipsec's m_clone routine for public use; it is renamedsam2006-03-155-153/+3
| | | | | | | m_unshare and the caller can now control how mbufs are allocated Reviewed by: andre, luigi, mlaier MFC after: 1 week
* Fix stack corruptions on amd64.bz2006-01-212-15/+3
| | | | | | | | | | | | | | | | Vararg functions have a different calling convention than regular functions on amd64. Casting a varag function to a regular one to match the function pointer declaration will hide the varargs from the caller and we will end up with an incorrectly setup stack. Entirely remove the varargs from these functions and change the functions to match the declaration of the function pointers. Remove the now unnecessary casts. Lots of explanations and help from: peter Reviewed by: peter PR: amd64/89261 MFC after: 6 days
* Fix -Wundef warnings found when compiling i386 LINT, GENERIC andru2005-12-051-1/+1
| | | | custom kernels.
* Use sparse initializers for "struct domain" and "struct protosw",ru2005-11-091-8/+16
| | | | so they are easier to follow for the human being.
* Retire MT_HEADER mbuf type and change its users to use MT_DATA.andre2005-11-021-1/+1
| | | | | | | | | | | | Having an additional MT_HEADER mbuf type is superfluous and redundant as nothing depends on it. It only adds a layer of confusion. The distinction between header mbuf's and data mbuf's is solely done through the m->m_flags M_PKTHDR flag. Non-native code is not changed in this commit. For compatibility MT_HEADER is mapped to MT_DATA. Sponsored by: TCP/IP Optimization Fundraise 2005
* Replace custom mbuf writeability test with generic M_WRITABLE() testandre2005-09-261-1/+1
| | | | | | covering all edge cases too. Sponsored by: TCP/IP Optimization Fundraise 2005
* Correct typo in a comment describing vshiftl().hmp2005-06-021-1/+1
|
* correct space checksam2005-03-091-1/+1
| | | | Submitted by: ume
* /* -> /*- for license, minor formatting changesimp2005-01-0726-26/+26
|
* Initialize struct pr_userreqs in new/sparse style and fill in commonphk2004-11-081-8/+10
| | | | | | default elements in net_init_domain(). This makes it possible to grep these structures and see any bogosities.
* Remove extraneous SECPOLICY_LOCK_DESTROY calls that cause the mutex to besam2004-10-021-2/+0
| | | | | | destroyed twice. Submitted by: Roselyn Lee
* Add missing locking for secpolicy refcnt manipulations.sam2004-09-303-3/+16
| | | | Submitted by: Roselyn Lee
* Correct handling of SADB_UPDATE and SADB_ADD requests. key_align may splitsam2004-09-261-5/+0
| | | | | | | | | the mbuf due to use of m_pulldown. Discarding the result because of this does not make sense as no subsequent code depends on the entire msg being linearized (only the individual pieces). It's likely something else is wrong here but for now this appears to get things back to a working state. Submitted by: Roselyn Lee
* Protect sockaddr_union definitions with a protecting define. This allows tomlaier2004-09-231-0/+3
| | | | | | | | build kernels with FAST_IPSEC and PF. This is the least disruptive fix. PR: kern/71836 Reviewed by: bms, various mailing lists MFC after: 3 days
* Apply error and success logic consistently to the function netisr_queue() andandre2004-08-272-3/+3
| | | | | | | | | | | | | | | | | | its users. netisr_queue() now returns (0) on success and ERRNO on failure. At the moment ENXIO (netisr queue not functional) and ENOBUFS (netisr queue full) are supported. Previously it would return (1) on success but the return value of IF_HANDOFF() was interpreted wrongly and (0) was actually returned on success. Due to this schednetisr() was never called to kick the scheduling of the isr. However this was masked by other normal packets coming through netisr_dispatch() causing the dequeueing of waiting packets. PR: kern/70988 Found by: MOROHOSHI Akihiko <moro@remus.dti.ne.jp> MFC after: 3 days
* Get rid of the RANDOM_IP_ID option and make it a sysctl. NetBSDdwmalone2004-08-141-6/+1
| | | | | | | | | | | | | | | | | | | | | have already done this, so I have styled the patch on their work: 1) introduce a ip_newid() static inline function that checks the sysctl and then decides if it should return a sequential or random IP ID. 2) named the sysctl net.inet.ip.random_id 3) IPv6 flow IDs and fragment IDs are now always random. Flow IDs and frag IDs are significantly less common in the IPv6 world (ie. rarely generated per-packet), so there should be smaller performance concerns. The sysctl defaults to 0 (sequential IP IDs). Reviewed by: andre, silby, mlaier, ume Based on: NetBSD MFC after: 2 months
* Add required includes for post-sorwakeup() change to fix FAST_IPSECbms2004-06-231-0/+2
| | | | compilation.
* Fix a paste-o in key_cmpspidx_withmask().bms2004-06-221-2/+2
| | | | | PR: misc/67013 Submitted by: Zhenmin <zli4@cs.uiuc.edu>
* use correct address for SADB_EXT_ADDRESS_DST in key_do_allocsa_policysam2004-05-031-2/+2
| | | | | | | | (was using src instead of dst) Submitted by: Bjoern A. Zeeb Obtained from: KAME MFC after: 1 day
* correct behaviour of key_getsavbyspi broken in rev 1.7; corrects problems withsam2004-05-031-2/+2
| | | | | | removing specific SPIs Submitted by: Bjoern A. Zeeb
* add support to prefer old SA to new SA during allocationsam2004-05-031-18/+27
| | | | | | | | (makes net.key.preferred_oldsa work as for KAME) Submitted by: gabor@sentex.net Reviewed by: Bjoern A. Zeeb MFC after: 1 day
* Fix a debugging printf snafu.bms2004-04-201-1/+1
|
* use native names for if_link, ifa_link, if_addrhead.luigi2004-04-171-4/+2
| | | | | | Change for (...) to TAILQ_FOREACH(...) Ok'ed by: sam
* Unbreak FAST_IPSEC build on 64 bit archs with INVARIANTS.pjd2004-04-071-1/+1
| | | | Approved by: sam
* This file was erroneously removed from HEAD when TCP-MD5 support was MFC'd;bms2004-04-031-0/+169
| | | | correct this lameness.
* Fix type in a sysctl. It used to be: net.key.prefered_oldsaguido2004-02-161-5/+5
| | | | | | | and is corrected to net.key.preferred_oldsa This makes it consistent with the KAME IPsec implementation. Approved by: sam
* Initial import of RFC 2385 (TCP-MD5) digest support.bms2004-02-112-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first of two commits; bringing in the kernel support first. This can be enabled by compiling a kernel with options TCP_SIGNATURE and FAST_IPSEC. For the uninitiated, this is a TCP option which provides for a means of authenticating TCP sessions which came into being before IPSEC. It is still relevant today, however, as it is used by many commercial router vendors, particularly with BGP, and as such has become a requirement for interconnect at many major Internet points of presence. Several parts of the TCP and IP headers, including the segment payload, are digested with MD5, including a shared secret. The PF_KEY interface is used to manage the secrets using security associations in the SADB. There is a limitation here in that as there is no way to map a TCP flow per-port back to an SPI without polluting tcpcb or using the SPD; the code to do the latter is unstable at this time. Therefore this code only supports per-host keying granularity. Whilst FAST_IPSEC is mutually exclusive with KAME IPSEC (and thus IPv6), TCP_SIGNATURE applies only to IPv4. For the vast majority of prospective users of this feature, this will not pose any problem. This implementation is output-only; that is, the option is honoured when responding to a host initiating a TCP session, but no effort is made [yet] to authenticate inbound traffic. This is, however, sufficient to interwork with Cisco equipment. Tested with a Cisco 2501 running IOS 12.0(27), and Quagga 0.96.4 with local patches. Patches for tcpdump to validate TCP-MD5 sessions are also available from me upon request. Sponsored by: sentex.net
OpenPOWER on IntegriCloud