[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>
This commit is contained in:
Masahide NAKAMURA 2006-09-27 22:21:52 -07:00 committed by David S. Miller
parent 7fa6b06689
commit 7b4dc3600e
1 changed files with 7 additions and 4 deletions

View File

@ -96,10 +96,13 @@ static void xfrm_hash_transfer(struct hlist_head *list,
nhashmask); nhashmask);
hlist_add_head(&x->bysrc, nsrctable+h); hlist_add_head(&x->bysrc, nsrctable+h);
h = __xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto, if (x->id.spi) {
x->props.family, nhashmask); h = __xfrm_spi_hash(&x->id.daddr, x->id.spi,
x->id.proto, x->props.family,
nhashmask);
hlist_add_head(&x->byspi, nspitable+h); hlist_add_head(&x->byspi, nspitable+h);
} }
}
} }
static unsigned long xfrm_hash_new_size(void) static unsigned long xfrm_hash_new_size(void)
@ -622,7 +625,7 @@ static void __xfrm_state_insert(struct xfrm_state *x)
h = xfrm_src_hash(&x->props.saddr, x->props.family); h = xfrm_src_hash(&x->props.saddr, x->props.family);
hlist_add_head(&x->bysrc, xfrm_state_bysrc+h); 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, h = xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto,
x->props.family); x->props.family);