Skip to content

Commit

Permalink
[XFRM]: Do not add a state whose SPI is zero to the SPI hash.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Masahide NAKAMURA authored and David S. Miller committed Sep 29, 2006
1 parent 7fa6b06 commit 7b4dc36
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions net/xfrm/xfrm_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 7b4dc36

Please sign in to comment.