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];
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);
}
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);
}
{
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;