X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fkey%2Faf_key.c;h=fdf75a1ba801019a4a7b46cd1629e63ff64c259d;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=645b42564bd2d8da55bbe9568b97107621636c51;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/net/key/af_key.c b/net/key/af_key.c index 645b42564..fdf75a1ba 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -1075,6 +1075,15 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr, n_type = ext_hdrs[SADB_X_EXT_NAT_T_TYPE-1]; natt->encap_type = n_type->sadb_x_nat_t_type_type; + switch (natt->encap_type) { + case UDP_ENCAP_ESPINUDP: + case UDP_ENCAP_ESPINUDP_NON_IKE: + break; + default: + err = -ENOPROTOOPT; + goto out; + } + if (ext_hdrs[SADB_X_EXT_NAT_T_SPORT-1]) { struct sadb_x_nat_t_port* n_port = ext_hdrs[SADB_X_EXT_NAT_T_SPORT-1]; @@ -1173,10 +1182,10 @@ static int pfkey_getspi(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h 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); } @@ -2848,7 +2857,7 @@ static struct xfrm_mgr pfkeyv2_mgr = static void __exit ipsec_pfkey_exit(void) { xfrm_unregister_km(&pfkeyv2_mgr); - remove_proc_entry("net/pfkey", 0); + remove_proc_entry("net/pfkey", NULL); sock_unregister(PF_KEY); } @@ -2856,7 +2865,7 @@ static int __init ipsec_pfkey_init(void) { sock_register(&pfkey_family_ops); #ifdef CONFIG_PROC_FS - create_proc_read_entry("net/pfkey", 0, 0, pfkey_read_proc, NULL); + create_proc_read_entry("net/pfkey", 0, NULL, pfkey_read_proc, NULL); #endif xfrm_register_km(&pfkeyv2_mgr); return 0;