* [PFKEY] spirange should be in host byte order
@ 2004-07-31 10:04 Herbert Xu
2004-08-01 6:51 ` David S. Miller
0 siblings, 1 reply; 2+ messages in thread
From: Herbert Xu @ 2004-07-31 10:04 UTC (permalink / raw)
To: kuznet, davem, jmorris, netdev
[-- Attachment #1: Type: text/plain, Size: 1184 bytes --]
Hi:
I'm looking through the xfrm_alloc_spi stuff and noticed that the
netlink alloc_spi function takes the range in host order while the
PFKEY alloc_spi function takes them in network order.
First I thought that I stuffed up since I was the one who changed
the code in the netlink interface to take them in host order :)
But reading RFC 2367 seems to indicate otherwise. It says that all
fields are host order unless specified otherwise. And the spirange
fields are not specified to be network order at all.
Looking at the existing PFKEY users:
User Space
----------
Openswan - Doesn't use PFKEY for this.
Racoon - Puts zeros in there so it doesn't care. However its test-pfkey
program stores things in host order.
ISAKMPD - Stores things in host order.
So the conclusion is that we can and should change our PFKEY
implementation to use host order for these fields.
This patch does exactly that.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Cheers,
--
Visit Openswan at http://www.openswan.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
[-- Attachment #2: p --]
[-- Type: text/plain, Size: 543 bytes --]
===== net/key/af_key.c 1.64 vs edited =====
--- 1.64/net/key/af_key.c 2004-07-01 19:11:29 +10:00
+++ edited/net/key/af_key.c 2004-07-31 20:00:19 +10:00
@@ -1182,10 +1182,10 @@
min_spi = range->sadb_spirange_min;
max_spi = range->sadb_spirange_max;
} else {
- min_spi = htonl(0x100);
- max_spi = htonl(0x0fffffff);
+ min_spi = 0x100;
+ max_spi = 0x0fffffff;
}
- xfrm_alloc_spi(x, min_spi, max_spi);
+ xfrm_alloc_spi(x, htonl(min_spi), htonl(max_spi));
if (x->id.spi)
resp_skb = pfkey_xfrm_state2msg(x, 0, 3);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-08-01 6:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-31 10:04 [PFKEY] spirange should be in host byte order Herbert Xu
2004-08-01 6:51 ` David S. Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).