aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-09-27 21:47:05 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-28 21:02:36 -0400
commit26977b4ed728ae911a162b16dbfe1a165b7cf9a1 (patch)
treee70980811cbd0c6a271e3e92cd3c2c48bdea5701
parent737b5761dfc609b5be4163deb2cf09226f56bcbc (diff)
[XFRM]: xfrm_alloc_spi() annotated
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/xfrm.h2
-rw-r--r--net/xfrm/xfrm_state.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index b096e9058f3f..80a19748e96a 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -989,7 +989,7 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
989struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete); 989struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete);
990void xfrm_policy_flush(u8 type); 990void xfrm_policy_flush(u8 type);
991u32 xfrm_get_acqseq(void); 991u32 xfrm_get_acqseq(void);
992void xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 992void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi);
993struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, 993struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto,
994 xfrm_address_t *daddr, xfrm_address_t *saddr, 994 xfrm_address_t *daddr, xfrm_address_t *saddr,
995 int create, unsigned short family); 995 int create, unsigned short family);
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 9f63edd39346..e40a8862db5d 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1040,7 +1040,7 @@ u32 xfrm_get_acqseq(void)
1040EXPORT_SYMBOL(xfrm_get_acqseq); 1040EXPORT_SYMBOL(xfrm_get_acqseq);
1041 1041
1042void 1042void
1043xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi) 1043xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi)
1044{ 1044{
1045 unsigned int h; 1045 unsigned int h;
1046 struct xfrm_state *x0; 1046 struct xfrm_state *x0;
@@ -1057,10 +1057,10 @@ xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi)
1057 x->id.spi = minspi; 1057 x->id.spi = minspi;
1058 } else { 1058 } else {
1059 u32 spi = 0; 1059 u32 spi = 0;
1060 minspi = ntohl(minspi); 1060 u32 low = ntohl(minspi);
1061 maxspi = ntohl(maxspi); 1061 u32 high = ntohl(maxspi);
1062 for (h=0; h<maxspi-minspi+1; h++) { 1062 for (h=0; h<high-low+1; h++) {
1063 spi = minspi + net_random()%(maxspi-minspi+1); 1063 spi = low + net_random()%(high-low+1);
1064 x0 = xfrm_state_lookup(&x->id.daddr, htonl(spi), x->id.proto, x->props.family); 1064 x0 = xfrm_state_lookup(&x->id.daddr, htonl(spi), x->id.proto, x->props.family);
1065 if (x0 == NULL) { 1065 if (x0 == NULL) {
1066 x->id.spi = htonl(spi); 1066 x->id.spi = htonl(spi);