1 --- /dev/null Tue Mar 11 13:02:56 2003
2 +++ nat-t/include/net/xfrmudp.h Mon Feb 9 13:51:03 2004
5 + * pointer to function for type that xfrm4_input wants, to permit
6 + * decoupling of XFRM from udp.c
8 +#define HAVE_XFRM4_UDP_REGISTER
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 --- /distros/kernel/linux-2.6.11.2/net/ipv4/Kconfig 2005-03-09 03:12:33.000000000 -0500
15 +++ swan26/net/ipv4/Kconfig 2005-04-04 18:46:13.000000000 -0400
18 +config IPSEC_NAT_TRAVERSAL
19 + bool "IPSEC NAT-Traversal (KLIPS compatible)"
22 + Includes support for RFC3947/RFC3948 NAT-Traversal of ESP over UDP.
25 --- plain26/net/ipv4/udp.c.orig 2006-12-28 20:53:17.000000000 -0500
26 +++ plain26/net/ipv4/udp.c 2007-05-11 10:22:50.000000000 -0400
28 #include <net/inet_common.h>
29 #include <net/checksum.h>
31 +#include <net/xfrmudp.h>
34 * Snmp MIB for the UDP layer
36 sk_common_release(sk);
39 +#if defined(CONFIG_XFRM) || defined(CONFIG_IPSEC_NAT_TRAVERSAL)
41 +static xfrm4_rcv_encap_t xfrm4_rcv_encap_func = NULL;
42 +int udp4_register_esp_rcvencap(xfrm4_rcv_encap_t func
43 + , xfrm4_rcv_encap_t *oldfunc)
45 + if(oldfunc != NULL) {
46 + *oldfunc = xfrm4_rcv_encap_func;
49 + xfrm4_rcv_encap_func = func;
53 +int udp4_unregister_esp_rcvencap(xfrm4_rcv_encap_t func)
55 + if(xfrm4_rcv_encap_func != func)
58 + xfrm4_rcv_encap_func = NULL;
61 +#endif /* CONFIG_XFRM_MODULE || CONFIG_IPSEC_NAT_TRAVERSAL */
65 * 1 if the the UDP system should process it
66 * 0 if we should drop this packet
69 static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb)
72 +#if !defined(CONFIG_XFRM) && !defined(CONFIG_IPSEC_NAT_TRAVERSAL)
75 +#else /* either CONFIG_XFRM or CONFIG_IPSEC_NAT_TRAVERSAL */
76 struct udp_sock *up = udp_sk(sk);
79 @@ -1018,10 +1044,27 @@
83 - /* process the ESP packet */
84 - ret = xfrm4_rcv_encap(skb, up->encap_type);
85 - UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS);
87 + if(xfrm4_rcv_encap_func != NULL)
88 + ret = (*xfrm4_rcv_encap_func)(skb, up->encap_type);
92 + /* FALLTHROUGH to send-up */;
96 + /* PROCESSED, free it */
97 + UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS);
101 + /* PACKET wasn't for _func, or no func, pass it
102 + * to stock function
104 + ret = xfrm4_rcv_encap(skb, up->encap_type);
105 + UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS);
109 /* FALLTHROUGH -- it's a UDP Packet */
111 @@ -1110,7 +1153,6 @@
113 * All we need to do is get the socket, and then do a checksum.
116 int udp_rcv(struct sk_buff *skb)
119 @@ -1599,3 +1641,9 @@
120 EXPORT_SYMBOL(udp_proc_register);
121 EXPORT_SYMBOL(udp_proc_unregister);
124 +#if defined(CONFIG_IPSEC_NAT_TRAVERSAL)
125 +EXPORT_SYMBOL(udp4_register_esp_rcvencap);
126 +EXPORT_SYMBOL(udp4_unregister_esp_rcvencap);
129 make[1]: Leaving directory `/usr/src/openswan-2.6.14'