summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMasahide NAKAMURA <nakam@linux-ipv6.org>2006-09-28 09:21:52 +0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-29 05:02:49 +0400
commit7b4dc3600e4877178ba94c7fbf7e520421378aa6 (patch)
treece3d6601b8fd7748d3026a1aed042bba002ecac0 /net
parent7fa6b06689085a3e2237cf810f5e0c114e00a2da (diff)
downloadlinux-7b4dc3600e4877178ba94c7fbf7e520421378aa6.tar.xz
[XFRM]: Do not add a state whose SPI is zero to the SPI hash.
SPI=0 is used for acquired IPsec SA and MIPv6 RO state. Such state should not be added to the SPI hash because we do not care about it on deleting path. Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net')
-rw-r--r--net/xfrm/xfrm_state.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index fafe1ed5f56b..f927b7330f02 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -96,9 +96,12 @@ static void xfrm_hash_transfer(struct hlist_head *list,
nhashmask);
hlist_add_head(&x->bysrc, nsrctable+h);
- h = __xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto,
- x->props.family, nhashmask);
- hlist_add_head(&x->byspi, nspitable+h);
+ if (x->id.spi) {
+ h = __xfrm_spi_hash(&x->id.daddr, x->id.spi,
+ x->id.proto, x->props.family,
+ nhashmask);
+ hlist_add_head(&x->byspi, nspitable+h);
+ }
}
}
@@ -622,7 +625,7 @@ static void __xfrm_state_insert(struct xfrm_state *x)
h = xfrm_src_hash(&x->props.saddr, x->props.family);
hlist_add_head(&x->bysrc, xfrm_state_bysrc+h);
- if (xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY)) {
+ if (x->id.spi) {
h = xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto,
x->props.family);