1 packaging/utils/nattpatch 2.6
2 --- /dev/null Tue Mar 11 13:02:56 2003
3 +++ nat-t/include/net/xfrmudp.h Mon Feb 9 13:51:03 2004
6 + * pointer to function for type that xfrm4_input wants, to permit
7 + * decoupling of XFRM from udp.c
9 +#define HAVE_XFRM4_UDP_REGISTER
11 +typedef int (*xfrm4_rcv_encap_t)(struct sk_buff *skb, __u16 encap_type);
12 +extern int udp4_register_esp_rcvencap(xfrm4_rcv_encap_t func
13 + , xfrm4_rcv_encap_t *oldfunc);
14 +extern int udp4_unregister_esp_rcvencap(xfrm4_rcv_encap_t func);
15 --- /distros/kernel/linux-2.6.11.2/net/ipv4/Kconfig 2005-03-09 03:12:33.000000000 -0500
16 +++ swan26/net/ipv4/Kconfig 2005-04-04 18:46:13.000000000 -0400
19 +config IPSEC_NAT_TRAVERSAL
20 + bool "IPSEC NAT-Traversal (KLIPS compatible)"
23 + Includes support for RFC3947/RFC3948 NAT-Traversal of ESP over UDP.
26 --- plain26/net/ipv4/udp.c.orig 2006-01-02 22:21:10.000000000 -0500
27 +++ plain26/net/ipv4/udp.c 2006-01-12 20:18:57.000000000 -0500
30 +#include <net/xfrmudp.h>
33 sk_common_release(sk);
36 +#if defined(CONFIG_XFRM) || defined(CONFIG_IPSEC_NAT_TRAVERSAL)
38 +/* if XFRM isn't a module, then register it directly. */
39 +#if !defined(CONFIG_XFRM_MODULE)
40 +static xfrm4_rcv_encap_t xfrm4_rcv_encap_func = xfrm4_rcv_encap;
42 +static xfrm4_rcv_encap_t xfrm4_rcv_encap_func = NULL;
45 +static xfrm4_rcv_encap_t xfrm4_rcv_encap_func;
47 +int udp4_register_esp_rcvencap(xfrm4_rcv_encap_t func
48 + , xfrm4_rcv_encap_t *oldfunc)
50 + if(oldfunc != NULL) {
51 + *oldfunc = xfrm4_rcv_encap_func;
55 + if(xfrm4_rcv_encap_func != NULL)
59 + xfrm4_rcv_encap_func = func;
63 +int udp4_unregister_esp_rcvencap(xfrm4_rcv_encap_t func)
65 + if(xfrm4_rcv_encap_func != func)
68 + xfrm4_rcv_encap_func = NULL;
71 +#endif /* CONFIG_XFRM || defined(CONFIG_IPSEC_NAT_TRAVERSAL)*/
75 * 1 if the the UDP system should process it
76 * 0 if we should drop this packet
79 static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb)
82 +#if !defined(CONFIG_XFRM) && !defined(CONFIG_IPSEC_NAT_TRAVERSAL)
85 +#else /* either CONFIG_XFRM or CONFIG_IPSEC_NAT_TRAVERSAL */
86 struct udp_sock *up = udp_sk(sk);
87 struct udphdr *uh = skb->h.uh;
89 @@ -1021,10 +1060,14 @@
93 - /* process the ESP packet */
94 - ret = xfrm4_rcv_encap(skb, up->encap_type);
95 - UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS);
97 + if(xfrm4_rcv_encap_func != NULL) {
98 + ret = (*xfrm4_rcv_encap_func)(skb, up->encap_type);
99 + UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS);
101 + UDP_INC_STATS_BH(UDP_MIB_INERRORS);
106 /* FALLTHROUGH -- it's a UDP Packet */
108 @@ -1114,7 +1157,6 @@
110 * All we need to do is get the socket, and then do a checksum.
113 int udp_rcv(struct sk_buff *skb)
116 @@ -1571,3 +1613,9 @@
117 EXPORT_SYMBOL(udp_proc_register);
118 EXPORT_SYMBOL(udp_proc_unregister);
121 +#if defined(CONFIG_IPSEC_NAT_TRAVERSAL)
122 +EXPORT_SYMBOL(udp4_register_esp_rcvencap);
123 +EXPORT_SYMBOL(udp4_unregister_esp_rcvencap);