Flatten brcm63xx patches, should make our life easier to patch files now ;)
[openwrt.git] / target / linux / generic-2.6 / patches-2.6.23 / 120-openswan-2.4.0.kernel-2.6-natt.patch
1 --- /dev/null
2 +++ b/include/net/xfrmudp.h
3 @@ -0,0 +1,10 @@
4 +/*
5 + * pointer to function for type that xfrm4_input wants, to permit
6 + * decoupling of XFRM from udp.c
7 + */
8 +#define HAVE_XFRM4_UDP_REGISTER
9 +
10 +typedef int (*xfrm4_rcv_encap_t)(struct sk_buff *skb, __u16 encap_type);
11 +extern int udp4_register_esp_rcvencap(xfrm4_rcv_encap_t func
12 + , xfrm4_rcv_encap_t *oldfunc);
13 +extern int udp4_unregister_esp_rcvencap(xfrm4_rcv_encap_t func);
14 --- a/net/ipv4/Kconfig
15 +++ b/net/ipv4/Kconfig
16 @@ -224,6 +224,12 @@
17 Network), but can be distributed all over the Internet. If you want
18 to do that, say Y here and to "IP multicast routing" below.
19
20 +config IPSEC_NAT_TRAVERSAL
21 + bool "IPSEC NAT-Traversal (KLIPS compatible)"
22 + depends on INET
23 + ---help---
24 + Includes support for RFC3947/RFC3948 NAT-Traversal of ESP over UDP.
25 +
26 config IP_MROUTE
27 bool "IP: multicast routing"
28 depends on IP_MULTICAST
29 --- a/net/ipv4/xfrm4_input.c
30 +++ b/net/ipv4/xfrm4_input.c
31 @@ -15,6 +15,7 @@
32 #include <linux/netfilter_ipv4.h>
33 #include <net/ip.h>
34 #include <net/xfrm.h>
35 +#include <net/xfrmudp.h>
36
37 static int xfrm4_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq)
38 {
39 @@ -161,6 +162,29 @@
40 return 0;
41 }
42
43 +#ifdef CONFIG_IPSEC_NAT_TRAVERSAL
44 +static xfrm4_rcv_encap_t xfrm4_rcv_encap_func = NULL;
45 +
46 +int udp4_register_esp_rcvencap(xfrm4_rcv_encap_t func,
47 + xfrm4_rcv_encap_t *oldfunc)
48 +{
49 + if(oldfunc != NULL)
50 + *oldfunc = xfrm4_rcv_encap_func;
51 +
52 + xfrm4_rcv_encap_func = func;
53 + return 0;
54 +}
55 +
56 +int udp4_unregister_esp_rcvencap(xfrm4_rcv_encap_t func)
57 +{
58 + if(xfrm4_rcv_encap_func != func)
59 + return -1;
60 +
61 + xfrm4_rcv_encap_func = NULL;
62 + return 0;
63 +}
64 +#endif /* CONFIG_IPSEC_NAT_TRAVERSAL */
65 +
66 /* If it's a keepalive packet, then just eat it.
67 * If it's an encapsulated packet, then pass it to the
68 * IPsec xfrm input.
69 @@ -251,7 +275,13 @@
70 iph->protocol = IPPROTO_ESP;
71
72 /* process ESP */
73 +#ifdef CONFIG_IPSEC_NAT_TRAVERSAL
74 + if(xfrm4_rcv_encap_func == NULL)
75 + goto drop;
76 + ret = (*xfrm4_rcv_encap_func)(skb, up->encap_type);
77 +#else
78 ret = xfrm4_rcv_encap(skb, encap_type);
79 +#endif
80 return ret;
81
82 drop:
83 @@ -265,3 +295,8 @@
84 }
85
86 EXPORT_SYMBOL(xfrm4_rcv);
87 +
88 +#ifdef CONFIG_IPSEC_NAT_TRAVERSAL
89 +EXPORT_SYMBOL(udp4_register_esp_rcvencap);
90 +EXPORT_SYMBOL(udp4_unregister_esp_rcvencap);
91 +#endif
This page took 0.041503 seconds and 5 git commands to generate.