Hi Dave: This patch sets the port numbers and proto field in acquire messages. In doing so it adds a selector field to xfrm_user_acquire. This means that saddr is now duplicated. Can we get rid of it? Cheers, -- Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ ) Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Index: kernel-source-2.5/include/linux/xfrm.h =================================================================== RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/include/linux/xfrm.h,v retrieving revision 1.1.1.6 diff -u -r1.1.1.6 xfrm.h --- kernel-source-2.5/include/linux/xfrm.h 17 Jun 2003 04:19:42 -0000 1.1.1.6 +++ kernel-source-2.5/include/linux/xfrm.h 21 Jun 2003 11:28:56 -0000 @@ -201,6 +201,7 @@ struct xfrm_user_acquire { struct xfrm_id id; xfrm_address_t saddr; + struct xfrm_selector sel; struct xfrm_userpolicy_info policy; __u32 aalgos; __u32 ealgos; Index: kernel-source-2.5/net/key/af_key.c =================================================================== RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/net/key/af_key.c,v retrieving revision 1.6 diff -u -r1.6 af_key.c --- kernel-source-2.5/net/key/af_key.c 20 Jun 2003 11:49:08 -0000 1.6 +++ kernel-source-2.5/net/key/af_key.c 21 Jun 2003 11:35:46 -0000 @@ -2386,7 +2386,7 @@ (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); addr->sadb_address_exttype = SADB_EXT_ADDRESS_SRC; - addr->sadb_address_proto = 0; + addr->sadb_address_proto = pfkey_proto_from_xfrm(x->sel.proto); addr->sadb_address_reserved = 0; if (x->props.family == AF_INET) { addr->sadb_address_prefixlen = 32; @@ -2394,7 +2394,7 @@ sin = (struct sockaddr_in *) (addr + 1); sin->sin_family = AF_INET; sin->sin_addr.s_addr = x->props.saddr.a4; - sin->sin_port = 0; + sin->sin_port = x->sel.sport; memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); } #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) @@ -2403,7 +2403,7 @@ sin6 = (struct sockaddr_in6 *) (addr + 1); sin6->sin6_family = AF_INET6; - sin6->sin6_port = 0; + sin6->sin6_port = x->sel.sport; sin6->sin6_flowinfo = 0; memcpy(&sin6->sin6_addr, x->props.saddr.a6, sizeof(struct in6_addr)); @@ -2420,7 +2420,7 @@ (sizeof(struct sadb_address)+sockaddr_size)/ sizeof(uint64_t); addr->sadb_address_exttype = SADB_EXT_ADDRESS_DST; - addr->sadb_address_proto = 0; + addr->sadb_address_proto = pfkey_proto_from_xfrm(x->sel.proto); addr->sadb_address_reserved = 0; if (x->props.family == AF_INET) { addr->sadb_address_prefixlen = 32; @@ -2428,7 +2428,7 @@ sin = (struct sockaddr_in *) (addr + 1); sin->sin_family = AF_INET; sin->sin_addr.s_addr = x->id.daddr.a4; - sin->sin_port = 0; + sin->sin_port = x->sel.dport; memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); } #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) @@ -2437,7 +2437,7 @@ sin6 = (struct sockaddr_in6 *) (addr + 1); sin6->sin6_family = AF_INET6; - sin6->sin6_port = 0; + sin6->sin6_port = x->sel.dport; sin6->sin6_flowinfo = 0; memcpy(&sin6->sin6_addr, x->id.daddr.a6, sizeof(struct in6_addr)); Index: kernel-source-2.5/net/xfrm/xfrm_user.c =================================================================== RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/net/xfrm/xfrm_user.c,v retrieving revision 1.5 diff -u -r1.5 xfrm_user.c --- kernel-source-2.5/net/xfrm/xfrm_user.c 20 Jun 2003 11:49:08 -0000 1.5 +++ kernel-source-2.5/net/xfrm/xfrm_user.c 21 Jun 2003 11:26:59 -0000 @@ -1012,6 +1012,7 @@ memcpy(&ua->id, &x->id, sizeof(ua->id)); memcpy(&ua->saddr, &x->props.saddr, sizeof(ua->saddr)); + memcpy(&ua->sel, &x->sel, sizeof(ua->sel)); copy_to_user_policy(xp, &ua->policy, dir); ua->aalgos = xt->aalgos; ua->ealgos = xt->ealgos;