Silly advise in bridge Configure help
Subsystems (10)
Bert Hubert said a few days back:
| In the Configure HELP of Ethernet bridging: | | "Note that if your box acts as a bridge, it probably contains | several Ethernet devices, but the kernel is not able to recognize | more than one at | boot time without help; for details read the Ethernet-HOWTO, | available from in <http://www.linuxdoc.org/docs.html#howto>." | | This is extremely bogus these days and prone to confuse people. | I suggest this warning is removed.
Sounds good, so here's the patch to 2.5.46 Kconfig to do that if you want it.
~Randy
net/Kconfig renamed from net/Kconfig%fixhelp +0 -5
@@ -382,11 +382,6 @@ for location. Please read the Bridge mini-HOWTO for more information. - Note that if your box acts as a bridge, it probably contains several - Ethernet devices, but the kernel is not able to recognize more than - one at boot time without help; for details read the Ethernet-HOWTO, - available from in <http://www.linuxdoc.org/docs.html#howto>. - If you want to compile this code as a module ( = code which can be inserted in and removed from the running kernel whenever you want), say M here and read <file:Documentation/modules.txt>. The module
From: "Randy.Dunlap" <[email protected]>
Date: Wed, 06 Nov 2002 20:20:58 -0800
Sounds good, so here's the patch to 2.5.46 Kconfig to do that if you want it.
I had a similar patch in my queue from Lennert Buytenhek (written by Bart De Schuyer) which I'm about to send to Linus.
[BRIDGE] update help docs
net/Kconfig +4 -4
@@ -382,10 +382,10 @@ for location. Please read the Bridge mini-HOWTO for more information. - Note that if your box acts as a bridge, it probably contains several - Ethernet devices, but the kernel is not able to recognize more than - one at boot time without help; for details read the Ethernet-HOWTO, - available from in <http://www.linuxdoc.org/docs.html#howto>. + If you enable iptables support along with the bridge support then you + turn your bridge into a bridging firewall. + iptables will then see the IP packets being bridged, so you need to + take this into account when setting up your firewall rules. If you want to compile this code as a module ( = code which can be inserted in and removed from the running kernel whenever you want),
Quoted 8 lines · David S. Miller
From: "Randy.Dunlap" <[email protected]>
Date: Wed, 06 Nov 2002 20:20:58 -0800Sounds good, so here's the patch to 2.5.46
Kconfigto do that if you want it.I had a similar patch in my queue from Lennert Buytenhek (written by Bart De Schuyer) which I'm about to send to Linus.
The one by Lennert is lots better. Dave, I'm about to explode with IPSEC anxiety, any hints on where we stand? Should I start looking at Racoon yet :-)
Regards,
bert
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
From: bert hubert <[email protected]>
Date: Thu, 7 Nov 2002 10:18:22 +0100
The one by Lennert is lots better. Dave, I'm about to explode with IPSEC anxiety, any hints on where we stand? Should I start looking at Racoon yet :-)
If you take Linus's current BK tree, and apply the patch below, you can begin trying to use the racoon and other KAME tools that we 'ported' at:
ftp://ftp.inr.ac.ru/ip-routing/ipsec/
I'll be sending this set of changes to him tonight.
Have fun :-)
[email protected], 2002-11-06 17:20:44-08:00, [email protected]
[IPSEC]: Semantic fixes with help from Maxim Giryaev.
- BSD apps want sin_zero cleared in sys_getname.
- Fix protocol setting in flow descriptor of RAW sockets
- Wildcard protocol is represented differently in policy than for association.
- Missing update of key manager sequence in xfrm_state entries.
net/ipv4/af_inet.c +1 -0
@@ -722,6 +722,7 @@ sin->sin_port = inet->sport; sin->sin_addr.s_addr = addr; } +memset (sin->sin_zero,0 ,sizeof (sin->sin_zero)); *uaddr_len =sizeof (*sin);return 0 ; }
net/ipv4/raw.c +1 -1
@@ -430,7 +430,7 @@ { .daddr = daddr, .saddr = saddr, .tos = tos } }, - .proto = IPPROTO_RAW }; + .proto = inet->hdrincl ? IPPROTO_RAW : sk->protocol }; err =ip_route_output_flow (&rt, &fl, sk, msg->msg_flags&MSG_DONTWAIT ); }if (err)
net/ipv4/xfrm_state.c +4 -3
@@ -1,5 +1,6 @@#include <net/xfrm.h> #include <linux/pfkeyv2.h> +#include <linux/ipsec.h> /* Each xfrm_state is linked to three tables:
@@ -91,7 +92,7 @@for (i =0 ; i <XFRM_DST_HSIZE ; i++) { restart:list_for_each_entry (x, xfrm_state_bydst+i, bydst) { -if (!proto || x->id.proto == proto) { +if (proto ==IPSEC_PROTO_ANY || x->id.proto == proto) {atomic_inc (&x->refcnt);spin_unlock_bh (&xfrm_state_lock);
@@ -389,7 +390,7 @@spin_lock_bh (&xfrm_state_lock);for (i =0 ; i <XFRM_DST_HSIZE ; i++) {list_for_each_entry (x, xfrm_state_bydst+i, bydst) { -if (proto ==255 || x->id.proto == proto) +if (proto ==IPSEC_PROTO_ANY || x->id.proto == proto) count++; } }
@@ -400,7 +401,7 @@for (i =0 ; i <XFRM_DST_HSIZE ; i++) {list_for_each_entry (x, xfrm_state_bydst+i, bydst) { -if (proto !=255 && x->id.proto != proto) +if (proto !=IPSEC_PROTO_ANY && x->id.proto != proto)continue ; err =func (x, --count, data);if (err)
net/key/af_key.c +67 -42
218 lines not on this page · raw message
[email protected], 2002-11-06 17:28:07-08:00, [email protected]
[NET]: Timer init fixes.
net/ax25/ax25_dev.c +4 -0
@@ -98,6 +98,10 @@ ax25_dev->values[AX25_VALUES_PROTOCOL ] =AX25_DEF_PROTOCOL ; ax25_dev->values[AX25_VALUES_DS_TIMEOUT ]=AX25_DEF_DS_TIMEOUT ; +#if defined(CONFIG_AX25_DAMA_SLAVE ) || defined(CONFIG_AX25_DAMA_MASTER ) +init_timer (&ax25_dev->dama.slave_timer); +#endif +spin_lock_bh (&ax25_dev_lock); ax25_dev->next = ax25_dev_list; ax25_dev_list = ax25_dev;
net/bridge/br_if.c +2 -0
@@ -106,6 +106,8 @@memset (br,0 ,sizeof (*br)); dev = &br->dev; +init_timer (&br->tick); +strncpy (dev->name, name,IFNAMSIZ ); dev->priv = br;ether_setup (dev);
net/core/dev.c +1 -1
@@ -172,7 +172,7 @@#ifdef OFFLINE_SAMPLE static void sample_queue (unsigned long dummy); -static struct timer_list samp_timer = { function: sample_queue }; +static struct timer_list samp_timer =TIMER_INITIALIZER (sample_queue,0 ,0 );#endif #ifdef CONFIG_HOTPLUG
net/core/dst.c +1 -1
@@ -39,7 +39,7 @@static void ___dst_free (struct dst_entry * dst);static struct timer_list dst_gc_timer = - { data:DST_GC_MIN , function: dst_run_gc }; +TIMER_INITIALIZER (dst_run_gc,0 ,DST_GC_MIN );static void dst_run_gc (unsigned long dummy) {
net/core/profile.c +2 -3
@@ -34,8 +34,7 @@static void alpha_tick (unsigned long ); -static struct timer_list alpha_timer = - { .function = alpha_tick }; +static struct timer_list alpha_timer =TIMER_INITIALIZER (alpha_tick,0 ,0 );void alpha_tick (unsigned long dummy) {
@@ -158,7 +157,7 @@int whitehole_init (struct net_device *dev);static struct timer_list whitehole_timer = - { .function = whitehole_inject }; +TIMER_INITIALIZER (whitehole_inject,0 ,0 );static struct net_device whitehole_dev = {"whitehole" ,0x0 ,0x0 ,0x0 ,0x0 ,0 ,0 ,0 ,0 ,0 ,NULL , whitehole_init, };
net/decnet/dn_route.c +3 -1
@@ -109,7 +109,8 @@static unsigned dn_rt_hash_mask;static struct timer_list dn_route_timer; -static struct timer_list dn_rt_flush_timer = { .function = dn_run_flush }; +static struct timer_list dn_rt_flush_timer = +TIMER_INITIALIZER (dn_run_flush,0 ,0 );int decnet_dst_gc_interval =2 ;static struct dst_ops dn_dst_ops = {
@@ -1260,6 +1261,7 @@if (!dn_dst_ops.kmem_cachep)panic ("DECnet: Failed to allocate dn_dst_cache\n" ); +init_timer (&dn_route_timer); dn_route_timer.function = dn_dst_check_expire; dn_route_timer.expires = jiffies + decnet_dst_gc_interval *HZ ;add_timer (&dn_route_timer);
net/ipv6/addrconf.c +2 -1
@@ -94,7 +94,8 @@static void addrconf_verify (unsigned long ); -static struct timer_list addr_chk_timer = { .function = addrconf_verify }; +static struct timer_list addr_chk_timer = +TIMER_INITIALIZER (addrconf_verify,0 ,0 );static spinlock_t addrconf_verify_lock =SPIN_LOCK_UNLOCKED ;static int addrconf_ifdown (struct net_device *dev,int how);
net/ipv6/ip6_fib.c +1 -1
@@ -93,7 +93,7 @@static __u32 rt_sernum =0 ; -static struct timer_list ip6_fib_timer = { .function = fib6_run_gc }; +static struct timer_list ip6_fib_timer =TIMER_INITIALIZER (fib6_run_gc,0 ,0 );static struct fib6_walker_t fib6_walker_list = { &fib6_walker_list, &fib6_walker_list,
net/ipv6/reassembly.c +1 -1
@@ -314,7 +314,7 @@ipv6_addr_copy (&fq->saddr, src);ipv6_addr_copy (&fq->daddr, dst); -/* init_timer has been done by the memset */ +init_timer (&fq->timer); fq->timer.function = ip6_frag_expire; fq->timer.data = (long ) fq; fq->lock =SPIN_LOCK_UNLOCKED ;
net/sched/sch_api.c +1 -2
@@ -1105,8 +1105,7 @@static void psched_tick (unsigned long ); -static struct timer_list psched_timer = - { function: psched_tick }; +static struct timer_list psched_timer =TIMER_INITIALIZER (psched_tick,0 ,0 );static void psched_tick (unsigned long dummy) {
net/wanrouter/af_wanpipe.c +1 -0
@@ -512,6 +512,7 @@/* Use timer to send data to the driver. This will act * as a BH handler for sendmsg functions */ +init_timer (&wan_opt->tx_timer); wan_opt->tx_timer.data = (unsigned long )sk; wan_opt->tx_timer.function = wanpipe_delayed_transmit;
[email protected], 2002-11-06 17:46:12-08:00, [email protected]
[CRYPTO]: Add SHA256 plus bug fixes.
- Bugfix in sha1 copyright
- Add support for SHA256, test vectors and HMAC test vectors
- Remove obsolete atomic messages.
crypto/Kconfig +12 -1
@@ -29,10 +29,21 @@ MD5 message digest algorithm (RFC1321). config CRYPTO_SHA1 - tristate "SHA-1 digest algorithm" + tristate "SHA1 digest algorithm" depends on CRYPTO help SHA-1 secure hash standard (FIPS 180-1). + +config CRYPTO_SHA256 + tristate "SHA256 digest algorithm" + depends on CRYPTO + help + SHA256 secure hash standard. + + This version of SHA implements a 256 bit hash with 128 bits of + security against collision attacks. It is described in: + http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf + config CRYPTO_DES tristate "DES and Triple DES EDE cipher algorithms"
crypto/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_CRYPTO_MD4) += md4.o obj-$(CONFIG_CRYPTO_MD5) += md5.o obj-$(CONFIG_CRYPTO_SHA1) += sha1.o +obj-$(CONFIG_CRYPTO_SHA256) += sha256.o obj-$(CONFIG_CRYPTO_DES) += des.o obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o
crypto/sha1.c +1 -1
@@ -8,7 +8,7 @@* implementation written by Steve Raid. * * Copyright (c) Alan Smithee. -* Copyright (c) McDonald <[email protected]> +* Copyright (c) Andrew McDonald <[email protected]> * Copyright (c) Jean-Francois Dive <[email protected]> * * This program is free software; you can redistribute it and/or modify it
crypto/tcrypt.c +152 -4
207 lines not on this page · raw message
crypto/tcrypt.h +205 -0
223 lines not on this page · raw message
[email protected], 2002-11-06 17:49:19-08:00, [email protected]
[CRYPTO]: Add in crypto/sha256.c
crypto/sha256.c new file +354 -0
354 lines not on this page · raw message
[email protected], 2002-11-06 17:54:08-08:00, [email protected]
[CRYPTO]: Add blowfish algorithm.
Documentation/crypto/api-intro.txt +10 -0
@@ -101,6 +101,10 @@ on a recognized standard and/or have been subjected to appropriate peer review. +Also check for any RFCs which may relate to the use of specific algorithms, +as well as general application notes such as RFC2451 ("The ESP CBC-Mode +Cipher Algorithms"). + BUGS
@@ -164,6 +168,7 @@ Andrew Tridgell and Steve French (MD4) Colin Plumb (MD5) Steve Raid (SHA1) + Jean-Luc Cooke (SHA256) Kazunori Miyazawa / USAGI (HMAC) The DES code was subsequently redeveloped by:
@@ -171,6 +176,11 @@ Raimar Falke Gisle Sælensminde Niels Möller + +The Blowfish code was subsequently redeveloped by: + Herbert Valerio Riedel + Kyle McMartin + Please send any credits updates or corrections to: James Morris <[email protected]>
crypto/Kconfig +16 -5
@@ -32,24 +32,35 @@ tristate "SHA1 digest algorithm" depends on CRYPTO help - SHA-1 secure hash standard (FIPS 180-1). + SHA-1 secure hash standard (FIPS 180-1/DFIPS 180-2). config CRYPTO_SHA256 tristate "SHA256 digest algorithm" depends on CRYPTO help - SHA256 secure hash standard. + SHA256 secure hash standard (DFIPS 180-2). This version of SHA implements a 256 bit hash with 128 bits of - security against collision attacks. It is described in: - http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf - + security against collision attacks. config CRYPTO_DES tristate "DES and Triple DES EDE cipher algorithms" depends on CRYPTO help DES cipher algorithm (FIPS 46-2), and Triple DES EDE (FIPS 46-3). + +config CRYPTO_BLOWFISH + tristate "Blowfish cipher algorithm" + depends on CRYPTO + help + Blowfish cipher algorithm, by Bruce Schneier. + + This is a fast cipher which can use variable length key from 32 + bits to 448 bits. It's fast, simple and specifically designed for + use on "large microprocessors". + + See also: + http://www.counterpane.com/blowfish.html config CRYPTO_TEST tristate "Testing module"
crypto/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_CRYPTO_SHA1) += sha1.o obj-$(CONFIG_CRYPTO_SHA256) += sha256.o obj-$(CONFIG_CRYPTO_DES) += des.o +obj-$(CONFIG_CRYPTO_BLOWFISH) += blowfish.o obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o
crypto/api.c +10 -6
@@ -262,19 +262,23 @@ {struct crypto_alg *alg = (struct crypto_alg *)p; -seq_printf (m,"name : %s\n" , alg->cra_name); -seq_printf (m,"module : %s\n" , alg->cra_module ? +seq_printf (m,"name : %s\n" , alg->cra_name); +seq_printf (m,"module : %s\n" , alg->cra_module ? alg->cra_module->name :"[static]" ); -seq_printf (m,"blocksize : %u\n" , alg->cra_blocksize); +seq_printf (m,"blocksize : %u\n" , alg->cra_blocksize);switch (alg->cra_flags &CRYPTO_ALG_TYPE_MASK ) {case CRYPTO_ALG_TYPE_CIPHER : -seq_printf (m,"keysize : %u\n" , alg->cra_cipher.cia_keysize); -seq_printf (m,"ivsize : %u\n" , alg->cra_cipher.cia_ivsize); +seq_printf (m,"min keysize : %u\n" , + alg->cra_cipher.cia_min_keysize); +seq_printf (m,"max keysize : %u\n" , + alg->cra_cipher.cia_max_keysize); +seq_printf (m,"ivsize : %u\n" , + alg->cra_cipher.cia_ivsize);break ;case CRYPTO_ALG_TYPE_DIGEST : -seq_printf (m,"digestsize : %u\n" , +seq_printf (m,"digestsize : %u\n" , alg->cra_digest.dia_digestsize);break ; }
crypto/blowfish.c new file +479 -0
479 lines not on this page · raw message
crypto/cipher.c +8 -2
@@ -188,8 +188,14 @@static int setkey (struct crypto_tfm *tfm,const u8 *key,unsigned int keylen) { -return tfm->__crt_alg->cra_cipher.cia_setkey (tfm->crt_ctx, key, - keylen, &tfm->crt_flags); +struct cipher_alg *cia = &tfm->__crt_alg->cra_cipher; + +if (keylen < cia->cia_min_keysize || keylen > cia->cia_max_keysize) { + tfm->crt_flags |=CRYPTO_TFM_RES_BAD_KEY_LEN ; +return -EINVAL ; + }else +return cia->cia_setkey (tfm->crt_ctx, key, keylen, + &tfm->crt_flags); } static int ecb_encrypt(struct crypto_tfm *tfm,
crypto/des.c +26 -34
81 lines not on this page · raw message
crypto/tcrypt.c +211 -1
236 lines not on this page · raw message
crypto/tcrypt.h +195 -2
208 lines not on this page · raw message
include/linux/crypto.h +9 -3
@@ -67,7 +67,8 @@* via crypto_register_alg() and crypto_unregister_alg(). */ struct cipher_alg { -unsigned int cia_keysize; +unsigned int cia_min_keysize; +unsigned int cia_max_keysize;unsigned int cia_ivsize;int (*cia_setkey)(void *ctx,const u8 *key,unsigned int keylen,u32 *flags);
@@ -208,9 +209,14 @@return tfm->__crt_alg->cra_flags &CRYPTO_ALG_TYPE_MASK ; } -static inline unsigned int crypto_tfm_alg_keysize (struct crypto_tfm *tfm) +static inline unsigned int crypto_tfm_alg_min_keysize (struct crypto_tfm *tfm) { -return tfm->__crt_alg->cra_cipher.cia_keysize; +return tfm->__crt_alg->cra_cipher.cia_min_keysize; +} + +static inline unsigned int crypto_tfm_alg_max_keysize (struct crypto_tfm *tfm) +{ +return tfm->__crt_alg->cra_cipher.cia_max_keysize; }static inline unsigned int crypto_tfm_alg_ivsize (struct crypto_tfm *tfm)
[email protected], 2002-11-06 18:34:01-08:00, [email protected]
[IPSEC]: Few changes to keep racoon ISAKMP daemon happy.
net/ipv4/xfrm_policy.c +20 -0
@@ -272,6 +272,25 @@write_unlock_bh (&policy->lock); } +/* Generate new index... KAME seems to generate them ordered by cost +* of an absolute inpredictability of ordering of rules. This will not pass. */ +static u32 xfrm_gen_index (int dir) +{ +u32 idx; +struct xfrm_policy *p; +static u32 pol_id; + +for (;;) { + idx = (++pol_id ? : ++pol_id); +for (p = xfrm_policy_list[dir]; p; p = p->next) { +if (p->index == idx) +break ; + } +if (!p) +return idx; + } +} +int xfrm_policy_insert (int dir,struct xfrm_policy *policy,int excl) {struct xfrm_policy *pol, **p;
@@ -290,6 +309,7 @@ policy->next = pol ? pol->next :NULL ; *p = policy; xfrm_policy_genid++; + policy->index = pol ? pol->index :xfrm_gen_index (dir);write_unlock_bh (&xfrm_policy_lock);if (pol) {
net/key/af_key.c +10 -11
@@ -274,13 +274,13 @@ *new = *orig; } -static void pfkey_error (struct sadb_msg *orig,int err) +static int pfkey_error (struct sadb_msg *orig,int err,struct sock *sk) {struct sk_buff *skb =alloc_skb (sizeof (struct sadb_msg ) +16 ,GFP_KERNEL );struct sadb_msg *hdr;if (!skb) -return ; +return -ENOBUFS ;/* Woe be to the platform trying to support PFKEY yet * having normal errnos outside the 1-255 range, inclusive.
@@ -301,7 +301,9 @@ hdr->sadb_msg_len = (sizeof (struct sadb_msg ) /sizeof (uint64_t )); -pfkey_broadcast (skb,GFP_KERNEL ,BROADCAST_ALL ,NULL ); +pfkey_broadcast (skb,GFP_KERNEL ,BROADCAST_ONE , sk); + +return 0 ; }static u8 sadb_ext_min_len[] = {
@@ -716,7 +718,7 @@struct algo_desc *a =ealg_get_byname (x->ealg->alg_name); sa->sadb_sa_encrypt = a ? a->desc.sadb_alg_id :0 ; } - sa->sadb_sa_flags =SADB_SAFLAGS_PFS ; + sa->sadb_sa_flags =0 ;/* hard time */ if (hsc &2 ) {
@@ -1538,6 +1540,7 @@ } } hdr->sadb_msg_len = size /sizeof (uint64_t ); + hdr->sadb_msg_reserved =atomic_read (&xp->refcnt);return skb; }
@@ -1638,7 +1641,6 @@ out_hdr->sadb_msg_type = hdr->sadb_msg_type; out_hdr->sadb_msg_satype =0 ; out_hdr->sadb_msg_errno =0 ; - out_hdr->sadb_msg_reserved =0 ; out_hdr->sadb_msg_seq = hdr->sadb_msg_seq; out_hdr->sadb_msg_pid = hdr->sadb_msg_pid;pfkey_broadcast (out_skb,GFP_ATOMIC ,BROADCAST_ALL , sk);
@@ -1703,7 +1705,6 @@ out_hdr->sadb_msg_type =SADB_X_SPDDELETE ; out_hdr->sadb_msg_satype =0 ; out_hdr->sadb_msg_errno =0 ; - out_hdr->sadb_msg_reserved =0 ; out_hdr->sadb_msg_seq = hdr->sadb_msg_seq; out_hdr->sadb_msg_pid = hdr->sadb_msg_pid;pfkey_broadcast (out_skb,GFP_ATOMIC ,BROADCAST_ALL , sk);
@@ -1750,7 +1751,6 @@ out_hdr->sadb_msg_type = hdr->sadb_msg_type; out_hdr->sadb_msg_satype =0 ; out_hdr->sadb_msg_errno =0 ; - out_hdr->sadb_msg_reserved =0 ; out_hdr->sadb_msg_seq = hdr->sadb_msg_seq; out_hdr->sadb_msg_pid = hdr->sadb_msg_pid;pfkey_broadcast (out_skb,GFP_ATOMIC ,BROADCAST_ALL , sk);
@@ -1780,7 +1780,6 @@ out_hdr->sadb_msg_type =SADB_X_SPDDUMP ; out_hdr->sadb_msg_satype =SADB_SATYPE_UNSPEC ; out_hdr->sadb_msg_errno =0 ; - out_hdr->sadb_msg_reserved =0 ; out_hdr->sadb_msg_seq = count; out_hdr->sadb_msg_pid = data->hdr->sadb_msg_pid;pfkey_broadcast (out_skb,GFP_ATOMIC ,BROADCAST_ONE , data->sk);
@@ -1995,7 +1994,7 @@ out_hdr->sadb_msg_seq =0 ; out_hdr->sadb_msg_pid =0 ; -pfkey_broadcast (out_skb,GFP_KERNEL ,BROADCAST_REGISTERED ,NULL ); +pfkey_broadcast (out_skb,GFP_ATOMIC ,BROADCAST_REGISTERED ,NULL );return 0 ; }
@@ -2166,8 +2165,8 @@ err =pfkey_process (sk, skb, hdr); out: -if (err && hdr) -pfkey_error (hdr, err); +if (err && hdr &&pfkey_error (hdr, err, sk) ==0 ) + err =0 ;if (skb)kfree_skb (skb);
[email protected], 2002-11-06 21:57:07-08:00, [email protected]
[CRYPTO]: Make sha256.c more palatable to GCCs optimizers.
crypto/sha256.c +36 -28
86 lines not on this page · raw message
[email protected], 2002-11-07 00:38:49-08:00, [email protected]
[CRYPTO]: minor updates
- Fixed min keysize bug for Blowfish (it is 32, not 64).
- Documentation updates.
Documentation/crypto/api-intro.txt +5 -1
@@ -105,6 +105,10 @@ as well as general application notes such as RFC2451 ("The ESP CBC-Mode Cipher Algorithms"). +It's a good idea to avoid using lots of macros and use inlined functions +instead, as gcc does a good job with inlining, while excessive use of +macros can cause compilation problems on some platforms. + BUGS
@@ -167,7 +171,7 @@ Dana L. How (DES) Andrew Tridgell and Steve French (MD4) Colin Plumb (MD5) - Steve Raid (SHA1) + Steve Reid (SHA1) Jean-Luc Cooke (SHA256) Kazunori Miyazawa / USAGI (HMAC)
crypto/Kconfig +3 -3
@@ -55,9 +55,9 @@ help Blowfish cipher algorithm, by Bruce Schneier. - This is a fast cipher which can use variable length key from 32 - bits to 448 bits. It's fast, simple and specifically designed for - use on "large microprocessors". + This is a variable key length cipher which can use keys from 32 + bits to 448 bits in length. It's fast, simple and specifically + designed for use on "large microprocessors". See also: http://www.counterpane.com/blowfish.html
crypto/blowfish.c +1 -1
@@ -23,7 +23,7 @@#include <linux/crypto.h> #define BF_BLOCK_SIZE 8 -#define BF_MIN_KEY_SIZE 8 +#define BF_MIN_KEY_SIZE 4#define BF_MAX_KEY_SIZE 56struct bf_ctx {
crypto/sha1.c +1 -1
@@ -5,7 +5,7 @@* * Derived from cryptoapi implementation, adapted for in-place * scatterlist interface. Originally based on the public domain -* implementation written by Steve Raid. +* implementation written by Steve Reid. * * Copyright (c) Alan Smithee. * Copyright (c) Andrew McDonald <[email protected]>
[email protected], 2002-11-07 01:16:09-08:00, [email protected]
[BRIDGE]: Fix help docs.
net/Kconfig +4 -4
@@ -391,10 +391,10 @@ for location. Please read the Bridge mini-HOWTO for more information. - Note that if your box acts as a bridge, it probably contains several - Ethernet devices, but the kernel is not able to recognize more than - one at boot time without help; for details read the Ethernet-HOWTO, - available from in <http://www.linuxdoc.org/docs.html#howto>. + If you enable iptables support along with the bridge support then you + turn your bridge into a bridging firewall. + iptables will then see the IP packets being bridged, so you need to + take this into account when setting up your firewall rules. If you want to compile this code as a module ( = code which can be inserted in and removed from the running kernel whenever you want),
Quoted 3 lines
If you take Linus's current BK tree, and apply the patch below, you can begin trying to use the racoon and other KAME tools that we 'ported' at:
This also appears to need some changes in the crypto api:
1 out of 1 hunk FAILED -- saving rejects to file crypto/Kconfig.rej 2 out of 4 hunks FAILED -- saving rejects to file crypto/tcrypt.c.rej 1 out of 10 hunks FAILED -- saving rejects to file net/key/af_key.c.rej
missing |diff -Nru a/crypto/sha256.c b/crypto/sha256.c missing |diff -Nru a/crypto/blowfish.c b/crypto/blowfish.c
Quoted 5 lines
ftp://ftp.inr.ac.ru/ip-routing/ipsec/I'll be sending this set of changes to him tonight.
Have fun :-)
Oh I will :-)
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
Quoted 5 lines · bert hubert
Quoted 3 lines
If you take Linus's current BK tree, and apply the patch below, you can begin trying to use the racoon and other KAME tools that we 'ported' at:
This also appears to need some changes in the crypto api:
Apologies, the patch does apply without --dry-run
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
From: bert hubert <[email protected]>
Date: Thu, 7 Nov 2002 11:39:05 +0100
Quoted 3 lines
If you take Linus's current BK tree, and apply the patch below, you can begin trying to use the racoon and other KAME tools that we 'ported' at:
This also appears to need some changes in the crypto api:
1 out of 1 hunk FAILED -- saving rejects to file crypto/Kconfig.rej 2 out of 4 hunks FAILED -- saving rejects to file crypto/tcrypt.c.rej 1 out of 10 hunks FAILED -- saving rejects to file net/key/af_key.c.rej
missing |diff -Nru a/crypto/sha256.c b/crypto/sha256.c missing |diff -Nru a/crypto/blowfish.c b/crypto/blowfish.c
Let me try this again, here is a new patch :-)
Really, if this one doesn't apply, your 2.5 bitkeeper tree is not totally uptodate.
Documentation/crypto/api-intro.txt renamed from linus-2.5/Documentation/crypto/api-intro.txt +15 -1
@@ -101,6 +101,14 @@ on a recognized standard and/or have been subjected to appropriate peer review. +Also check for any RFCs which may relate to the use of specific algorithms, +as well as general application notes such as RFC2451 ("The ESP CBC-Mode +Cipher Algorithms"). + +It's a good idea to avoid using lots of macros and use inlined functions +instead, as gcc does a good job with inlining, while excessive use of +macros can cause compilation problems on some platforms. + BUGS
@@ -163,7 +171,8 @@ Dana L. How (DES) Andrew Tridgell and Steve French (MD4) Colin Plumb (MD5) - Steve Raid (SHA1) + Steve Reid (SHA1) + Jean-Luc Cooke (SHA256) Kazunori Miyazawa / USAGI (HMAC) The DES code was subsequently redeveloped by:
@@ -171,6 +180,11 @@ Raimar Falke Gisle Sælensminde Niels Möller + +The Blowfish code was subsequently redeveloped by: + Herbert Valerio Riedel + Kyle McMartin + Please send any credits updates or corrections to: James Morris <[email protected]>
crypto/Kconfig renamed from linus-2.5/crypto/Kconfig +24 -2
@@ -29,16 +29,38 @@ MD5 message digest algorithm (RFC1321). config CRYPTO_SHA1 - tristate "SHA-1 digest algorithm" + tristate "SHA1 digest algorithm" depends on CRYPTO help - SHA-1 secure hash standard (FIPS 180-1). + SHA-1 secure hash standard (FIPS 180-1/DFIPS 180-2). + +config CRYPTO_SHA256 + tristate "SHA256 digest algorithm" + depends on CRYPTO + help + SHA256 secure hash standard (DFIPS 180-2). + + This version of SHA implements a 256 bit hash with 128 bits of + security against collision attacks. config CRYPTO_DES tristate "DES and Triple DES EDE cipher algorithms" depends on CRYPTO help DES cipher algorithm (FIPS 46-2), and Triple DES EDE (FIPS 46-3). + +config CRYPTO_BLOWFISH + tristate "Blowfish cipher algorithm" + depends on CRYPTO + help + Blowfish cipher algorithm, by Bruce Schneier. + + This is a variable key length cipher which can use keys from 32 + bits to 448 bits in length. It's fast, simple and specifically + designed for use on "large microprocessors". + + See also: + http://www.counterpane.com/blowfish.html config CRYPTO_TEST tristate "Testing module"
crypto/Makefile renamed from linus-2.5/crypto/Makefile +2 -0
@@ -12,7 +12,9 @@ obj-$(CONFIG_CRYPTO_MD4) += md4.o obj-$(CONFIG_CRYPTO_MD5) += md5.o obj-$(CONFIG_CRYPTO_SHA1) += sha1.o +obj-$(CONFIG_CRYPTO_SHA256) += sha256.o obj-$(CONFIG_CRYPTO_DES) += des.o +obj-$(CONFIG_CRYPTO_BLOWFISH) += blowfish.o obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o
crypto/api.c renamed from linus-2.5/crypto/api.c +10 -6
@@ -262,19 +262,23 @@ {struct crypto_alg *alg = (struct crypto_alg *)p; -seq_printf (m,"name : %s\n" , alg->cra_name); -seq_printf (m,"module : %s\n" , alg->cra_module ? +seq_printf (m,"name : %s\n" , alg->cra_name); +seq_printf (m,"module : %s\n" , alg->cra_module ? alg->cra_module->name :"[static]" ); -seq_printf (m,"blocksize : %u\n" , alg->cra_blocksize); +seq_printf (m,"blocksize : %u\n" , alg->cra_blocksize);switch (alg->cra_flags &CRYPTO_ALG_TYPE_MASK ) {case CRYPTO_ALG_TYPE_CIPHER : -seq_printf (m,"keysize : %u\n" , alg->cra_cipher.cia_keysize); -seq_printf (m,"ivsize : %u\n" , alg->cra_cipher.cia_ivsize); +seq_printf (m,"min keysize : %u\n" , + alg->cra_cipher.cia_min_keysize); +seq_printf (m,"max keysize : %u\n" , + alg->cra_cipher.cia_max_keysize); +seq_printf (m,"ivsize : %u\n" , + alg->cra_cipher.cia_ivsize);break ;case CRYPTO_ALG_TYPE_DIGEST : -seq_printf (m,"digestsize : %u\n" , +seq_printf (m,"digestsize : %u\n" , alg->cra_digest.dia_digestsize);break ; }
crypto/blowfish.c renamed from linus-2.5/crypto/blowfish.c +479 -0
479 lines not on this page · raw message
crypto/cipher.c renamed from linus-2.5/crypto/cipher.c +8 -2
@@ -188,8 +188,14 @@static int setkey (struct crypto_tfm *tfm,const u8 *key,unsigned int keylen) { -return tfm->__crt_alg->cra_cipher.cia_setkey (tfm->crt_ctx, key, - keylen, &tfm->crt_flags); +struct cipher_alg *cia = &tfm->__crt_alg->cra_cipher; + +if (keylen < cia->cia_min_keysize || keylen > cia->cia_max_keysize) { + tfm->crt_flags |=CRYPTO_TFM_RES_BAD_KEY_LEN ; +return -EINVAL ; + }else +return cia->cia_setkey (tfm->crt_ctx, key, keylen, + &tfm->crt_flags); } static int ecb_encrypt(struct crypto_tfm *tfm,
crypto/des.c renamed from linus-2.5/crypto/des.c +26 -34
81 lines not on this page · raw message
crypto/sha1.c renamed from linus-2.5/crypto/sha1.c +2 -2
@@ -5,10 +5,10 @@* * Derived from cryptoapi implementation, adapted for in-place * scatterlist interface. Originally based on the public domain -* implementation written by Steve Raid. +* implementation written by Steve Reid. * * Copyright (c) Alan Smithee. -* Copyright (c) McDonald <[email protected]> +* Copyright (c) Andrew McDonald <[email protected]> * Copyright (c) Jean-Francois Dive <[email protected]> * * This program is free software; you can redistribute it and/or modify it
crypto/sha256.c renamed from linus-2.5/crypto/sha256.c +362 -0
362 lines not on this page · raw message
crypto/tcrypt.c renamed from linus-2.5/crypto/tcrypt.c +362 -4
426 lines not on this page · raw message
crypto/tcrypt.h renamed from linus-2.5/crypto/tcrypt.h +400 -2
425 lines not on this page · raw message
include/linux/crypto.h renamed from linus-2.5/include/linux/crypto.h +9 -3
@@ -67,7 +67,8 @@* via crypto_register_alg() and crypto_unregister_alg(). */ struct cipher_alg { -unsigned int cia_keysize; +unsigned int cia_min_keysize; +unsigned int cia_max_keysize;unsigned int cia_ivsize;int (*cia_setkey)(void *ctx,const u8 *key,unsigned int keylen,u32 *flags);
@@ -208,9 +209,14 @@return tfm->__crt_alg->cra_flags &CRYPTO_ALG_TYPE_MASK ; } -static inline unsigned int crypto_tfm_alg_keysize (struct crypto_tfm *tfm) +static inline unsigned int crypto_tfm_alg_min_keysize (struct crypto_tfm *tfm) { -return tfm->__crt_alg->cra_cipher.cia_keysize; +return tfm->__crt_alg->cra_cipher.cia_min_keysize; +} + +static inline unsigned int crypto_tfm_alg_max_keysize (struct crypto_tfm *tfm) +{ +return tfm->__crt_alg->cra_cipher.cia_max_keysize; }static inline unsigned int crypto_tfm_alg_ivsize (struct crypto_tfm *tfm)
net/Kconfig renamed from linus-2.5/net/Kconfig +4 -4
@@ -391,10 +391,10 @@ for location. Please read the Bridge mini-HOWTO for more information. - Note that if your box acts as a bridge, it probably contains several - Ethernet devices, but the kernel is not able to recognize more than - one at boot time without help; for details read the Ethernet-HOWTO, - available from in <http://www.linuxdoc.org/docs.html#howto>. + If you enable iptables support along with the bridge support then you + turn your bridge into a bridging firewall. + iptables will then see the IP packets being bridged, so you need to + take this into account when setting up your firewall rules. If you want to compile this code as a module ( = code which can be inserted in and removed from the running kernel whenever you want),
net/ax25/ax25_dev.c renamed from linus-2.5/net/ax25/ax25_dev.c +4 -0
@@ -98,6 +98,10 @@ ax25_dev->values[AX25_VALUES_PROTOCOL ] =AX25_DEF_PROTOCOL ; ax25_dev->values[AX25_VALUES_DS_TIMEOUT ]=AX25_DEF_DS_TIMEOUT ; +#if defined(CONFIG_AX25_DAMA_SLAVE ) || defined(CONFIG_AX25_DAMA_MASTER ) +init_timer (&ax25_dev->dama.slave_timer); +#endif +spin_lock_bh (&ax25_dev_lock); ax25_dev->next = ax25_dev_list; ax25_dev_list = ax25_dev;
net/bridge/br_if.c renamed from linus-2.5/net/bridge/br_if.c +2 -0
@@ -106,6 +106,8 @@memset (br,0 ,sizeof (*br)); dev = &br->dev; +init_timer (&br->tick); +strncpy (dev->name, name,IFNAMSIZ ); dev->priv = br;ether_setup (dev);
net/core/dev.c renamed from linus-2.5/net/core/dev.c +1 -1
@@ -172,7 +172,7 @@#ifdef OFFLINE_SAMPLE static void sample_queue (unsigned long dummy); -static struct timer_list samp_timer = { function: sample_queue }; +static struct timer_list samp_timer =TIMER_INITIALIZER (sample_queue,0 ,0 );#endif #ifdef CONFIG_HOTPLUG
net/core/dst.c renamed from linus-2.5/net/core/dst.c +1 -1
@@ -39,7 +39,7 @@static void ___dst_free (struct dst_entry * dst);static struct timer_list dst_gc_timer = - { data:DST_GC_MIN , function: dst_run_gc }; +TIMER_INITIALIZER (dst_run_gc,0 ,DST_GC_MIN );static void dst_run_gc (unsigned long dummy) {
net/core/profile.c renamed from linus-2.5/net/core/profile.c +2 -3
@@ -34,8 +34,7 @@static void alpha_tick (unsigned long ); -static struct timer_list alpha_timer = - { .function = alpha_tick }; +static struct timer_list alpha_timer =TIMER_INITIALIZER (alpha_tick,0 ,0 );void alpha_tick (unsigned long dummy) {
@@ -158,7 +157,7 @@int whitehole_init (struct net_device *dev);static struct timer_list whitehole_timer = - { .function = whitehole_inject }; +TIMER_INITIALIZER (whitehole_inject,0 ,0 );static struct net_device whitehole_dev = {"whitehole" ,0x0 ,0x0 ,0x0 ,0x0 ,0 ,0 ,0 ,0 ,0 ,NULL , whitehole_init, };
net/decnet/dn_route.c renamed from linus-2.5/net/decnet/dn_route.c +3 -1
@@ -109,7 +109,8 @@static unsigned dn_rt_hash_mask;static struct timer_list dn_route_timer; -static struct timer_list dn_rt_flush_timer = { .function = dn_run_flush }; +static struct timer_list dn_rt_flush_timer = +TIMER_INITIALIZER (dn_run_flush,0 ,0 );int decnet_dst_gc_interval =2 ;static struct dst_ops dn_dst_ops = {
@@ -1260,6 +1261,7 @@if (!dn_dst_ops.kmem_cachep)panic ("DECnet: Failed to allocate dn_dst_cache\n" ); +init_timer (&dn_route_timer); dn_route_timer.function = dn_dst_check_expire; dn_route_timer.expires = jiffies + decnet_dst_gc_interval *HZ ;add_timer (&dn_route_timer);
net/ipv4/af_inet.c renamed from linus-2.5/net/ipv4/af_inet.c +1 -0
@@ -722,6 +722,7 @@ sin->sin_port = inet->sport; sin->sin_addr.s_addr = addr; } +memset (sin->sin_zero,0 ,sizeof (sin->sin_zero)); *uaddr_len =sizeof (*sin);return 0 ; }
net/ipv4/raw.c renamed from linus-2.5/net/ipv4/raw.c +1 -1
@@ -430,7 +430,7 @@ { .daddr = daddr, .saddr = saddr, .tos = tos } }, - .proto = IPPROTO_RAW }; + .proto = inet->hdrincl ? IPPROTO_RAW : sk->protocol }; err =ip_route_output_flow (&rt, &fl, sk, msg->msg_flags&MSG_DONTWAIT ); }if (err)
net/ipv4/xfrm_policy.c renamed from linus-2.5/net/ipv4/xfrm_policy.c +20 -0
@@ -272,6 +272,25 @@write_unlock_bh (&policy->lock); } +/* Generate new index... KAME seems to generate them ordered by cost +* of an absolute inpredictability of ordering of rules. This will not pass. */ +static u32 xfrm_gen_index (int dir) +{ +u32 idx; +struct xfrm_policy *p; +static u32 pol_id; + +for (;;) { + idx = (++pol_id ? : ++pol_id); +for (p = xfrm_policy_list[dir]; p; p = p->next) { +if (p->index == idx) +break ; + } +if (!p) +return idx; + } +} +int xfrm_policy_insert (int dir,struct xfrm_policy *policy,int excl) {struct xfrm_policy *pol, **p;
@@ -290,6 +309,7 @@ policy->next = pol ? pol->next :NULL ; *p = policy; xfrm_policy_genid++; + policy->index = pol ? pol->index :xfrm_gen_index (dir);write_unlock_bh (&xfrm_policy_lock);if (pol) {
net/ipv4/xfrm_state.c renamed from linus-2.5/net/ipv4/xfrm_state.c +4 -3
@@ -1,5 +1,6 @@#include <net/xfrm.h> #include <linux/pfkeyv2.h> +#include <linux/ipsec.h> /* Each xfrm_state is linked to three tables:
@@ -91,7 +92,7 @@for (i =0 ; i <XFRM_DST_HSIZE ; i++) { restart:list_for_each_entry (x, xfrm_state_bydst+i, bydst) { -if (!proto || x->id.proto == proto) { +if (proto ==IPSEC_PROTO_ANY || x->id.proto == proto) {atomic_inc (&x->refcnt);spin_unlock_bh (&xfrm_state_lock);
@@ -389,7 +390,7 @@spin_lock_bh (&xfrm_state_lock);for (i =0 ; i <XFRM_DST_HSIZE ; i++) {list_for_each_entry (x, xfrm_state_bydst+i, bydst) { -if (proto ==255 || x->id.proto == proto) +if (proto ==IPSEC_PROTO_ANY || x->id.proto == proto) count++; } }
@@ -400,7 +401,7 @@for (i =0 ; i <XFRM_DST_HSIZE ; i++) {list_for_each_entry (x, xfrm_state_bydst+i, bydst) { -if (proto !=255 && x->id.proto != proto) +if (proto !=IPSEC_PROTO_ANY && x->id.proto != proto)continue ; err =func (x, --count, data);if (err)
net/ipv6/addrconf.c renamed from linus-2.5/net/ipv6/addrconf.c +2 -1
@@ -94,7 +94,8 @@static void addrconf_verify (unsigned long ); -static struct timer_list addr_chk_timer = { .function = addrconf_verify }; +static struct timer_list addr_chk_timer = +TIMER_INITIALIZER (addrconf_verify,0 ,0 );static spinlock_t addrconf_verify_lock =SPIN_LOCK_UNLOCKED ;static int addrconf_ifdown (struct net_device *dev,int how);
net/ipv6/ip6_fib.c renamed from linus-2.5/net/ipv6/ip6_fib.c +1 -1
@@ -93,7 +93,7 @@static __u32 rt_sernum =0 ; -static struct timer_list ip6_fib_timer = { .function = fib6_run_gc }; +static struct timer_list ip6_fib_timer =TIMER_INITIALIZER (fib6_run_gc,0 ,0 );static struct fib6_walker_t fib6_walker_list = { &fib6_walker_list, &fib6_walker_list,
net/ipv6/reassembly.c renamed from linus-2.5/net/ipv6/reassembly.c +1 -1
@@ -314,7 +314,7 @@ipv6_addr_copy (&fq->saddr, src);ipv6_addr_copy (&fq->daddr, dst); -/* init_timer has been done by the memset */ +init_timer (&fq->timer); fq->timer.function = ip6_frag_expire; fq->timer.data = (long ) fq; fq->lock =SPIN_LOCK_UNLOCKED ;
net/key/af_key.c renamed from linus-2.5/net/key/af_key.c +77 -53
298 lines not on this page · raw message
net/sched/sch_api.c renamed from linus-2.5/net/sched/sch_api.c +1 -2
@@ -1105,8 +1105,7 @@static void psched_tick (unsigned long ); -static struct timer_list psched_timer = - { function: psched_tick }; +static struct timer_list psched_timer =TIMER_INITIALIZER (psched_tick,0 ,0 );static void psched_tick (unsigned long dummy) {
net/wanrouter/af_wanpipe.c renamed from linus-2.5/net/wanrouter/af_wanpipe.c +1 -0
@@ -512,6 +512,7 @@/* Use timer to send data to the driver. This will act * as a BH handler for sendmsg functions */ +init_timer (&wan_opt->tx_timer); wan_opt->tx_timer.data = (unsigned long )sk; wan_opt->tx_timer.function = wanpipe_delayed_transmit;
Quoted 1 line · David S. Miller
Let me try this again, here is a new patch :-)
I'm now trying this one. The previous patch applied fine when I left off the --dry-run. However, it oopses badly on starting named it appears. The backtrace is way longer than my screen but it mentions 'udp'.
If this one oopses, I'll try to capture it.
Regards,
bert
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
IPSEC FIRST LIGHT! (by non-kernel developer :-))
In reply to David S. MillerQuoted 2 lines · David S. Miller
Really, if this one doesn't apply, your 2.5 bitkeeper tree is not totally uptodate.
It works in transport mode! Both EH/ASP.
Hints:
Use the latest bitkeeper sources as of Thurday morning MET
Apply the last patch Alexey sent in the 'silly advise' thread
on linux kernel mailinglist
Do not compile anything AH/ESP/CRYPTO as modules
failed for me with bad oops
Make very very sure that you are not filtering ipsec packets
iptables needs to allow protocols 50 and 51
Use the KAME tools port on ftp://ftp.inr.ac.ru/ip-routing/ipsec/
racoon won't compile, you don't need it yet point it at your 2.5.46+bk+davem tree (edit GNUMakefiles)
Use 3des-cbc
examples online use blowfish-cbc but that gives an error in setkey
Configuration (needs the setkey tool) on 10.0.0.11:
#!./setkey -f
flush;
spdflush;
# AH
add 10.0.0.11 10.0.0.216 ah 15700 -A hmac-md5 "1234567890123456"; add 10.0.0.216 10.0.0.11 ah 24500 -A hmac-md5 "1234567890123456";
# ESP
add 10.0.0.11 10.0.0.216 esp 15701 -E 3des-cbc "123456789012123456789012"; add 10.0.0.216 10.0.0.11 esp 24501 -E 3des-cbc "123456789012123456789012";
spdadd 10.0.0.216 10.0.0.11 icmp -P out ipsec
esp/transport//use
ah/transport//use;Configuration on 10.0.0.216:
#!./setkey -f
flush;
spdflush;
# AH
add 10.0.0.11 10.0.0.216 ah 15700 -A hmac-md5 "1234567890123456"; add 10.0.0.216 10.0.0.11 ah 24500 -A hmac-md5 "1234567890123456";
# ESP
add 10.0.0.11 10.0.0.216 esp 15701 -E 3des-cbc "123456789012123456789012"; add 10.0.0.216 10.0.0.11 esp 24501 -E 3des-cbc "123456789012123456789012";
# this is reversed
spdadd 10.0.0.11 10.0.0.216 icmp -P out ipsec
esp/transport//use
ah/transport//use;# ping 10.0.0.11 PING 10.0.0.11 (10.0.0.11) from 10.0.0.216 : 56(84) bytes of data. 64 bytes from 10.0.0.11: icmp_seq=1 ttl=64 time=1.11 ms
$ sudo tcpdump -n -i eth0 -p tcpdump: listening on eth0 13:55:42.381669 10.0.0.216 > 10.0.0.11: AH(spi=0x00005fb4,seq=0x39): ESP(spi=0x00005fb5,seq=0x39) (DF) 13:55:42.382518 10.0.0.11 > 10.0.0.216: AH(spi=0x00003d54,seq=0x39): ESP(spi=0x00003d55,seq=0x39)
Great work everybody! I'm very impressed.
Regards,
bert
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
Re: IPSEC FIRST LIGHT! (by non-kernel developer :-))
Quoted 3 lines · bert hubert
Use 3des-cbc
examples online use blowfish-cbc but that gives an error in setkey
The kernel keying code doesn't know about blowfish yet, but it soon will.
- James
Signature · 2 lines
James Morris <[email protected]>
Re: IPSEC FIRST LIGHT! (by non-kernel developer :-))
In reply to bert hubert From: bert hubert <[email protected]>
Date: Thu, 7 Nov 2002 14:02:44 +0100
Great work everybody! I'm very impressed.
Thanks for testing :-)
As James said, pfkeyv2 just needs to be taught how to use the more recently added crypto algorithms.
Re: IPSEC FIRST LIGHT! (by non-kernel developer :-))
Quoted 6 lines · David S. Miller
From: bert hubert <[email protected]>
Date: Thu, 7 Nov 2002 14:02:44 +0100Great work everybody! I'm very impressed.
Thanks for testing :-)
No problem! By the way, is tunnel mode there yet?
Does it require more than setkey? Or does it need pseudo devices, GRE or anything? Just setting up tunnel mode doesn't appear to work - nothing gets crypted or signed.
Regards,
bert
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
Re: IPSEC FIRST LIGHT! (by non-kernel developer :-))
From: bert hubert <[email protected]>
Date: Thu, 7 Nov 2002 15:12:19 +0100
By the way, is tunnel mode there yet?
Does it require more than setkey? Or does it need pseudo devices, GRE or anything? Just setting up tunnel mode doesn't appear to work - nothing gets crypted or signed.
Alexey, any ideas?
Re: IPSEC FIRST LIGHT! (by non-kernel developer :-))
Quoted 5 lines · David S. Miller
Does it require more than setkey? Or does it need pseudo devices, GRE or anything? Just setting up tunnel mode doesn't appear to work - nothing gets crypted or signed.
Alexey, any ideas?
This is the setup I am using ON host 10.0.0.216 itself:
# AH
add 1.2.3.4 10.0.0.216 ah 25700 -A hmac-md5 "1234567890123456"; add 10.0.0.216 1.2.3.4 ah 34500 -A hmac-md5 "1234567890123456";
# ESP
add 1.2.3.4 10.0.0.216 esp 25701 -E 3des-cbc "123456789012123456789012"; add 10.0.0.216 1.2.3.4 esp 34501 -E 3des-cbc "123456789012123456789012";
spdadd 10.0.0.0/24 1.2.3.0/24 any -P out ipsec
esp/tunnel/1.2.3.4-10.0.0.216/require;
If I now ping 1.2.3.4, I see the packet go out on the wire unencrypted.
If I ping from 10.0.0.11 with a route to 1.2.3.0/24 to the ipsec host 10.0.0.216, I get an ICMP redirect.
Oh, by the way, my lowly pentiumpro200 manages to crypt *6 megabits/second* with 3des-cbc! The box does get a bit slowish over the network then though.
Regards,
bert
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
Re: IPSEC FIRST LIGHT! (by non-kernel developer :-))
In reply to David S. MillerHello!
Quoted 1 line
Alexey, any ideas?
Yes, rules with prefixlen!=32 do not work, gem forgot htonl() on netmask.
Also, forwarding is still sick, as I told you before going to sleep, so expect a patch soon. Unfortunately, despite of all the precautions I sleeped all the day, so I am again at the point when cannot test anything but loopback. :-)
Alexey
===== net/key/af_key.c 1.6 vs edited =====
net/key/af_key.c +2 -1
@@ -488,7 +491,8 @@case AF_INET : xaddr->xfrm4_addr = ((struct sockaddr_in *)(addr +1 ))->sin_addr.s_addr; - xaddr->xfrm4_mask = ~0 << (32 - addr->sadb_address_prefixlen); +if (addr->sadb_address_prefixlen) + xaddr->xfrm4_mask =htonl (~0 << (32 - addr->sadb_address_prefixlen));break ;case AF_INET6 : memcpy(xaddr->a6,
Re: IPSEC FIRST LIGHT! (by non-kernel developer :-))
Quoted 4 lines · On Thu, Nov 07, 2002 at 08:49:37PM +0300, [email protected] wrote:
Also, forwarding is still sick, as I told you before going to sleep, so expect a patch soon. Unfortunately, despite of all the precautions I sleeped all the day, so I am again at the point when cannot test anything but loopback. :-)
Well, you are probably a lot smarter now that you slept all day :-)
Any way, this patch helps somethat but it is indeed sick:
first time:connect(3, {sin_family=AF_INET, sin_port=htons(23), sin_addr=inet_addr("1.2.3.5")}}, 16) = -1 EAGAIN (Resource temporarily unavailable)
subsequent times:connect(3, {sin_family=AF_INET, sin_port=htons(23), sin_addr=inet_addr("1.2.3.5")}}, 16) = -1 ENOMEM (Cannot allocate memory)
With this configuration:
add 1.2.3.4 10.0.0.216 esp 25701 -E 3des-cbc "123456789012123456789012"; add 10.0.0.216 1.2.3.4 esp 34501 -E 3des-cbc "123456789012123456789012";
spdadd 10.0.0.0/24 1.2.3.0/24 any -P out ipsec
esp/tunnel/10.0.0.216-1.2.3.4/require;
Anything I can do to help, let me know.
Regards,
bert
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
Re: IPSEC FIRST LIGHT! (by non-kernel developer :-))
Hello!
Quoted 1 line
add 10.0.0.216 1.2.3.4 esp 34501 -E 3des-cbc "123456789012123456789012";
should read:
add 10.0.0.216 1.2.3.4 esp 34501
-m tunnel
-E 3des-cbc "123456789012123456789012";KAME allows to use single SA both for transport and for tunnel, we do not.
Actually, if you used setkey -D and setkey -DP to look at SAD/SPD, you would notice this.
Alexey
Re: [LARTC] IPSEC FIRST LIGHT! (by non-kernel developer :-))
In reply to bert hubertSo the IPSec in the 2.5 kernel actually works!!! I had heard it was mostly nonfunctional.
This is good news. FreeSwan has some quirky political policys.
On Thursday 07 November 2002 08:02 am, bert hubert wrote:
> On Thu, Nov 07, 2002 at 02:52:50AM -0800, David S. Miller wrote:
> > Really, if this one doesn't apply, your 2.5 bitkeeper tree is not
> > totally uptodate.
>
> It works in transport mode! Both EH/ASP.
>
> Hints:
> Use the latest bitkeeper sources as of Thurday morning MET
>
> Apply the last patch Alexey sent in the 'silly advise' thread
> on linux kernel mailinglist
>
> Do not compile anything AH/ESP/CRYPTO as modules
> failed for me with bad oops
>
> Make very very sure that you are not filtering ipsec packets
> iptables needs to allow protocols 50 and 51
>
> Use the KAME tools port on ftp://ftp.inr.ac.ru/ip-routing/ipsec/
> racoon won't compile, you don't need it yet
> point it at your 2.5.46+bk+davem tree (edit GNUMakefiles)
>
> Use 3des-cbc
> examples online use blowfish-cbc but that gives an error
> in setkey
>
> Configuration (needs the setkey tool) on 10.0.0.11:
>
> #!./setkey -f
> flush;
> spdflush;
>
> # AH
> add 10.0.0.11 10.0.0.216 ah 15700 -A hmac-md5 "1234567890123456";
> add 10.0.0.216 10.0.0.11 ah 24500 -A hmac-md5 "1234567890123456";
>
> # ESP
> add 10.0.0.11 10.0.0.216 esp 15701 -E 3des-cbc
> "123456789012123456789012"; add 10.0.0.216 10.0.0.11 esp 24501 -E
> 3des-cbc "123456789012123456789012";
>
> spdadd 10.0.0.216 10.0.0.11 icmp -P out ipsec
> esp/transport//use
> ah/transport//use;
>
> Configuration on 10.0.0.216:
>
> #!./setkey -f
> flush;
> spdflush;
>
> # AH
> add 10.0.0.11 10.0.0.216 ah 15700 -A hmac-md5 "1234567890123456";
> add 10.0.0.216 10.0.0.11 ah 24500 -A hmac-md5 "1234567890123456";
>
> # ESP
> add 10.0.0.11 10.0.0.216 esp 15701 -E 3des-cbc
> "123456789012123456789012"; add 10.0.0.216 10.0.0.11 esp 24501 -E
> 3des-cbc "123456789012123456789012";
>
> # this is reversed
> spdadd 10.0.0.11 10.0.0.216 icmp -P out ipsec
> esp/transport//use
> ah/transport//use;
>
> # ping 10.0.0.11
> PING 10.0.0.11 (10.0.0.11) from 10.0.0.216 : 56(84) bytes of data.
> 64 bytes from 10.0.0.11: icmp_seq=1 ttl=64 time=1.11 ms
>
> $ sudo tcpdump -n -i eth0 -p
> tcpdump: listening on eth0
> 13:55:42.381669 10.0.0.216 > 10.0.0.11: AH(spi=0x00005fb4,seq=0x39):
> ESP(spi=0x00005fb5,seq=0x39) (DF)
> 13:55:42.382518 10.0.0.11 > 10.0.0.216: AH(spi=0x00003d54,seq=0x39):
> ESP(spi=0x00003d55,seq=0x39)
>
> Great work everybody! I'm very impressed.
>
> Regards,
>
> bertSignature · 3 lines
Mike Diehl PGP Encrypted E-mail preferred. Public Key via: http://dominion.dyndns.org/~mdiehl/mdiehl.asc
[documentation] Re: [LARTC] IPSEC FIRST LIGHT! (by non-kernel developer :-))
Quoted 2 lines · Mike Diehl
So the IPSec in the 2.5 kernel actually works!!! I had heard it was mostly nonfunctional.
Well, it requires patches still. I hope 2.5.47 will contain everything you need. As of this moment, there is no set of patches that will apply cleanly to bitkeeper HEAD to give you working IPSEC, unless you manage to check out a tree from Thursday morning CET.
Perhaps dave can re-diff?
I'm writing documentation on http://lartc.org/howto/lartc.ipsec.html which explains how to set everything up.
Regards,
bert
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
Re: [documentation] Re: [LARTC] IPSEC FIRST LIGHT! (by non-kernel developer :-))
From: bert hubert <[email protected]>
Date: Fri, 8 Nov 2002 10:41:22 +0100
Perhaps dave can re-diff?
This is against current BK-2.5
--------------------
1. Expiration of SA's. Some missing updates of counters.
Question: very strange, rfc defines use_time as time of the first use of SA. But kame setkey refers to this as "lastuse".
2. Bug fixes for tunnel mode and forwarding.
3. Fix bugs in per-socket policy: policy entries do not leak but are destroyed, when socket is closed, and are cloned on children of listening sockets.
4. Implemented "use" policy: i.e. use ipsec if a SA is available, ignore if it is not.
5. Added sysctl to disable in/out policy on some devices.
It is set on loopback by default.
6. Remove "resolved" reference from template. It is not used,
but pollutes code.
7. Added all the SASTATE's, now they make sense.
===== include/linux/inetdevice.h 1.4 vs edited =====
include/linux/inetdevice.h +2 -0
@@ -19,6 +19,8 @@int tag;int arp_filter;int medium_id; +int no_xfrm; +int no_policy;void *sysctl; };
===== include/linux/sysctl.h 1.35 vs edited =====
include/linux/sysctl.h +2 -0
@@ -351,6 +351,8 @@NET_IPV4_CONF_TAG =12 ,NET_IPV4_CONF_ARPFILTER =13 ,NET_IPV4_CONF_MEDIUM_ID =14 , +NET_IPV4_CONF_NOXFRM =15 , + NET_IPV4_CONF_NOPOLICY=16, };/* /proc/sys/net/ipv6 */
===== include/net/xfrm.h 1.3 vs edited =====
include/net/xfrm.h +35 -9
101 lines not on this page · raw message
===== net/ipv4/af_inet.c 1.32 vs edited =====
net/ipv4/af_inet.c +3 -0
@@ -110,6 +110,7 @@#include <net/icmp.h> #include <net/ipip.h> #include <net/inet_common.h> +#include <net/xfrm.h> #ifdef CONFIG_IP_MROUTE #include <linux/mroute.h> #endif
@@ -195,6 +196,8 @@*/ sock_orphan (sk); + +xfrm_sk_free_policy (sk);#ifdef INET_REFCNT_DEBUG if (atomic_read (&sk->refcnt) !=1 )
===== net/ipv4/ah.c 1.5 vs edited =====
net/ipv4/ah.c +1 -0
@@ -231,6 +231,7 @@ skb->nh.raw = skb->data; x->curlft.bytes += skb->len; + x->curlft.packets++;spin_unlock_bh (&x->lock);if ((skb->dst =dst_pop (dst)) ==NULL ) goto error;
===== net/ipv4/devinet.c 1.10 vs edited =====
net/ipv4/devinet.c +19 -1
@@ -857,6 +857,8 @@memcpy (ifa->ifa_label, dev->name,IFNAMSIZ );inet_insert_ifa (ifa); } + in_dev->cnf.no_xfrm =1 ; + in_dev->cnf.no_policy =1 ; }ip_mc_up (in_dev);break ;
@@ -1041,7 +1043,7 @@ static struct devinet_sysctl_table { struct ctl_table_header *sysctl_header; - ctl_table devinet_vars[15]; + ctl_table devinet_vars[17]; ctl_table devinet_dev[2]; ctl_table devinet_conf_dir[2]; ctl_table devinet_proto_dir[2];
@@ -1156,6 +1158,22 @@ .ctl_name = NET_IPV4_CONF_ARPFILTER, .procname = "arp_filter", .data = &ipv4_devconf.arp_filter, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler =&proc_dointvec, + }, + { + .ctl_name = NET_IPV4_CONF_NOXFRM, + .procname = "disable_xfrm", + .data = &ipv4_devconf.no_xfrm, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler =&proc_dointvec, + }, + { + .ctl_name = NET_IPV4_CONF_NOPOLICY, + .procname = "disable_policy", + .data = &ipv4_devconf.no_policy, .maxlen = sizeof(int), .mode = 0644, .proc_handler =&proc_dointvec,
===== net/ipv4/esp.c 1.3 vs edited =====
net/ipv4/esp.c +2 -1
@@ -199,7 +199,7 @@/* Check that skb data bits are writable. If they are not, copy data * to newly created private area. If "tailbits" is given, make sure that -* tailbits bytes beoynd current end of skb are writable. +* tailbits bytes beyond current end of skb are writable. * * Returns amount of elements of scatterlist to load for subsequent * transformations and pointer to writable trailer skb.
@@ -433,6 +433,7 @@ skb->nh.raw = skb->data; x->curlft.bytes += skb->len; + x->curlft.packets++;spin_unlock_bh (&x->lock);if ((skb->dst =dst_pop (dst)) ==NULL ) goto error;
===== net/ipv4/route.c 1.29 vs edited =====
net/ipv4/route.c +25 -12
@@ -1265,6 +1265,8 @@atomic_set (&rth->u.dst.__refcnt,1 ); rth->u.dst.flags=DST_HOST ; +if (in_dev->cnf.no_policy) + rth->u.dst.flags |=DST_NOPOLICY ; rth->fl.fl4_dst = daddr; rth->rt_dst = daddr; rth->fl.fl4_tos = tos;
@@ -1470,6 +1472,10 @@atomic_set (&rth->u.dst.__refcnt,1 ); rth->u.dst.flags=DST_HOST ; +if (in_dev->cnf.no_policy) + rth->u.dst.flags |=DST_NOPOLICY ; +if (in_dev->cnf.no_xfrm) + rth->u.dst.flags |=DST_NOXFRM ; rth->fl.fl4_dst = daddr; rth->rt_dst = daddr; rth->fl.fl4_tos = tos;
@@ -1547,6 +1553,8 @@atomic_set (&rth->u.dst.__refcnt,1 ); rth->u.dst.flags=DST_HOST ; +if (in_dev->cnf.no_policy) + rth->u.dst.flags |=DST_NOPOLICY ; rth->fl.fl4_dst = daddr; rth->rt_dst = daddr; rth->fl.fl4_tos = tos;
@@ -1719,6 +1727,7 @@unsigned flags =0 ;struct rtable *rth;struct net_device *dev_out =NULL ; +struct in_device *in_dev =NULL ;unsigned hash;int free_res =0 ;int err;
@@ -1895,6 +1904,10 @@if (dev_out->flags &IFF_LOOPBACK ) flags |=RTCF_LOCAL ; + in_dev =in_dev_get (dev_out); +if (!in_dev) + goto e_inval; +if (res.type ==RTN_BROADCAST ) { flags |=RTCF_BROADCAST |RTCF_LOCAL ;if (res.fi) {
@@ -1903,11 +1916,8 @@ } }else if (res.type ==RTN_MULTICAST ) { flags |=RTCF_MULTICAST |RTCF_LOCAL ; -read_lock (&inetdev_lock); -if (!__in_dev_get (dev_out) || - !ip_check_mc (__in_dev_get (dev_out), oldflp->fl4_dst)) +if (!ip_check_mc (in_dev, oldflp->fl4_dst)) flags &= ~RTCF_LOCAL ; -read_unlock (&inetdev_lock);/* If multicast route do not exist use default one, but do not gateway in this case. Yes, it is hack.
@@ -1924,6 +1934,10 @@atomic_set (&rth->u.dst.__refcnt,1 ); rth->u.dst.flags=DST_HOST ; +if (in_dev->cnf.no_xfrm) + rth->u.dst.flags |=DST_NOXFRM ; +if (in_dev->cnf.no_policy) + rth->u.dst.flags |=DST_NOPOLICY ; rth->fl.fl4_dst = oldflp->fl4_dst; rth->fl.fl4_tos = tos; rth->fl.fl4_src = oldflp->fl4_src;
@@ -1959,20 +1973,17 @@ }#ifdef CONFIG_IP_MROUTE if (res.type ==RTN_MULTICAST ) { -struct in_device *in_dev =in_dev_get (dev_out); -if (in_dev) { -if (IN_DEV_MFORWARD (in_dev) && - !LOCAL_MCAST (oldflp->fl4_dst)) { - rth->u.dst.input = ip_mr_input; - rth->u.dst.output = ip_mc_output; - } -in_dev_put (in_dev); +if (IN_DEV_MFORWARD (in_dev) && + !LOCAL_MCAST (oldflp->fl4_dst)) { + rth->u.dst.input = ip_mr_input; + rth->u.dst.output = ip_mc_output; } }#endif }rt_set_nexthop (rth, &res,0 ); + rth->rt_flags = flags;
@@ -1983,6 +1994,8 @@fib_res_put (&res);if (dev_out)dev_put (dev_out); +if (in_dev) +in_dev_put (in_dev); out:return err; e_inval:
===== net/ipv4/tcp.c 1.31 vs edited =====
net/ipv4/tcp.c +3 -0
@@ -257,6 +257,7 @@#include <net/icmp.h> #include <net/tcp.h> +#include <net/xfrm.h> #include <asm/uaccess.h> #include <asm/ioctls.h>
@@ -1919,6 +1920,8 @@ sk->prot->destroy (sk);tcp_kill_sk_queues (sk); + +xfrm_sk_free_policy (sk);#ifdef INET_REFCNT_DEBUG if (atomic_read (&sk->refcnt) !=1 ) {
===== net/ipv4/tcp_minisocks.c 1.19 vs edited =====
net/ipv4/tcp_minisocks.c +8 -0
@@ -25,6 +25,7 @@#include <linux/sysctl.h> #include <net/tcp.h> #include <net/inet_common.h> +#include <net/xfrm.h> #ifdef CONFIG_SYSCTL #define SYNC_INIT 0/* let the user enable it */
@@ -685,6 +686,13 @@if ((filter = newsk->filter) !=NULL )sk_filter_charge (newsk, filter);#endif +if (unlikely (xfrm_sk_clone_policy (newsk))) { +/* It is still raw copy of parent, so invalidate +* destructor and make plain sk_free() */ + newsk->destruct =NULL ; +sk_free (newsk); +return NULL ; + }/* Now setup tcp_opt */ newtp =tcp_sk (newsk);
===== net/ipv4/xfrm_input.c 1.2 vs edited =====
net/ipv4/xfrm_input.c +3 -0
@@ -81,6 +81,9 @@if (x->props.replay_window)xfrm_replay_advance (x, seq); + x->curlft.bytes += skb->len; + x->curlft.packets++; +spin_unlock (&x->lock); xfrm_vec[xfrm_nr++] = x;
===== net/ipv4/xfrm_policy.c 1.7 vs edited =====
net/ipv4/xfrm_policy.c +150 -59
366 lines not on this page · raw message
===== net/ipv4/xfrm_state.c 1.4 vs edited =====
net/ipv4/xfrm_state.c +138 -21
290 lines not on this page · raw message
===== net/key/af_key.c 1.6 vs edited =====
net/key/af_key.c +71 -62
277 lines not on this page · raw message
Re: [documentation] Re: [LARTC] IPSEC FIRST LIGHT! (by non-kernel developer :-))
Quoted 6 lines · David S. Miller
From: bert hubert <[email protected]>
Date: Fri, 8 Nov 2002 10:41:22 +0100Perhaps dave can re-diff?
This is against current BK-2.5
Dave,
This code locks up solid on any ipsec TCP traffic outgoing with this configuration:
add 10.0.0.11 10.0.0.216 ah 15700 -A hmac-md5 "1234567890123456"; add 10.0.0.216 10.0.0.11 ah 24500 -A hmac-md5 "1234567890123456";
# ESP
add 10.0.0.11 10.0.0.216 esp 15701 -E 3des-cbc "123456789012123456789012"; add 10.0.0.216 10.0.0.11 esp 24501 -E 3des-cbc "123456789012123456789012";
spdadd 10.0.0.216 10.0.0.11 any -P out ipsec
esp/transport//require
ah/transport//require;spdadd 10.0.0.11 10.0.0.216 any -P in ipsec
esp/transport//require
ah/transport//require;ICMP traffic is fine however. I'm now investigating how far it gets before locking up.
Regards,
bert
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
Re: [documentation] Re: [LARTC] IPSEC FIRST LIGHT! (by non-kernel developer :-))
Quoted 2 lines · bert hubert
This code locks up solid on any ipsec TCP traffic outgoing with this configuration:
Also with the following configuration:
add 10.0.0.216 10.0.0.12 ah 24500 -A hmac-md5 "1234567890123456"; spdadd 10.0.0.216 10.0.0.11 any -P out ipsec
ah/transport//require;
-or-
add 10.0.0.216 10.0.0.12 esp 24501 -E 3des-cbc "123456789012123456789012"; spdadd 10.0.0.216 10.0.0.11 any -P out ipsec
esp/transport//require;
10.0.0.12 is a host which does not exist. 'telnet 10.0.0.12' locks up instantly. I'm unsure how to extract more data from my kernel.
Regards,
bert
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
Re: [documentation] Re: [LARTC] IPSEC FIRST LIGHT! (by non-kernel developer :-))
Quoted 4 lines · bert hubert
Quoted 2 lines · bert hubert
This code locks up solid on any ipsec TCP traffic outgoing with this configuration:
Bug is here:
+/* Optimize later using cookies and generation ids. */
+
static struct dst_entry *xfrm4_dst_check(struct dst_entry *dst, u32 cookie) {
- dst_release(dst); - return NULL; + struct dst_entry *child = dst;
+
+ while (child) {
+ if (child->obsolete > 0 ||
+ (child->xfrm && child->xfrm->km.state != XFRM_STATE_VALID)) {
+ dst_release(dst);
+ return NULL;
+ }
+ }
+
+ return dst;
}
Kernel enters a very tight loop here, I'm amazed that magic sysrq still works, how is that?
Anyhow, this function smells but I'm not sure how it should be fixed, perhaps child=child->next?
Regards,
bert
Quoted 23 lines
Also with the following configuration:
add 10.0.0.216 10.0.0.12 ah 24500 -A hmac-md5 "1234567890123456"; spdadd 10.0.0.216 10.0.0.11 any -P out ipsec
ah/transport//require;-or-
add 10.0.0.216 10.0.0.12 esp 24501 -E 3des-cbc "123456789012123456789012"; spdadd 10.0.0.216 10.0.0.11 any -P out ipsec
esp/transport//require;10.0.0.12 is a host which does not exist. 'telnet 10.0.0.12' locks up instantly. I'm unsure how to extract more data from my kernel.
Regards,
bert
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
Re: [documentation] Re: [LARTC] IPSEC FIRST LIGHT! (by non-kernel developer :-))
Hello!
Quoted 2 lines
Kernel enters a very tight loop here, I'm amazed that magic sysrq still works, how is that?
Yes, this is sort of inefficient loop. :-)
===== net/ipv4/xfrm_policy.c 1.8 vs edited =====
net/ipv4/xfrm_policy.c +1 -0
@@ -948,6 +948,7 @@dst_release (dst);return NULL ; } + child = child->child; }return dst;
Alexey
Re: [documentation] Re: [LARTC] IPSEC FIRST LIGHT! (by non-kernel developer :-))
net/ipv4/xfrm_policy.c line 951
Quoted 6 lines · On Fri, Nov 08, 2002 at 04:31:29PM +0300, [email protected] wrote:
Quoted 2 lines
Kernel enters a very tight loop here, I'm amazed that magic sysrq still works, how is that?
Yes, this is sort of inefficient loop. :-)
net/ipv4/xfrm_policy.c +1
-0+ child = child->child;
I had 'child=child->next;' here, which worked, but may be wrong.
By the way, have your thoughts included 'UDP Encapsulation of IPsec Packets'
http://www.ietf.org/internet-drafts/draft-ietf-ipsec-udp-encaps-04.txt so far?
Not sure if this would break your pretty design :-) It would just *rock* for traversing NAT.
Regards,
bert
Signature · 2 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://lartc.org Linux Advanced Routing & Traffic Control HOWTO