1 --- ./net/ipv4/udp.c Sun Mar 25 18:37:41 2001
2 +++ ./net/ipv4/udp.c Mon Jun 10 19:53:18 2002
5 static int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
7 +#ifdef CONFIG_IPSEC_NAT_TRAVERSAL
8 + struct udp_opt *tp = &(sk->tp_pinfo.af_udp);
11 * Charge it to the socket, dropping if the queue is full.
17 +#ifdef CONFIG_IPSEC_NAT_TRAVERSAL
18 + if (tp->esp_in_udp) {
20 + * Set skb->sk and xmit packet to ipsec_rcv.
22 + * If ret != 0, ipsec_rcv refused the packet (not ESPinUDP),
23 + * restore skb->sk and fall back to sock_queue_rcv_skb
25 + struct inet_protocol *esp = NULL;
27 +#ifdef CONFIG_IPSEC_MODULE
28 + for (esp = (struct inet_protocol *)inet_protos[IPPROTO_ESP & (MAX_INET_PROTOS - 1)];
29 + (esp) && (esp->protocol != IPPROTO_ESP);
32 + extern struct inet_protocol esp_protocol;
33 + esp = &esp_protocol;
36 + if (esp && esp->handler) {
37 + struct sock *sav_sk = skb->sk;
39 + if (esp->handler(skb, 0) == 0) {
41 + /* not sure we might count ESPinUDP as UDP... */
42 + udp_statistics.UdpInDatagrams++;
49 if (sock_queue_rcv_skb(sk,skb)<0) {
50 udp_statistics.UdpInErrors++;
51 ip_statistics.IpInDiscards++;
52 @@ -1165,6 +1200,44 @@
57 +static int udp_setsockopt(struct sock *sk, int level, int optname,
58 + char *optval, int optlen)
60 + struct udp_opt *tp = &(sk->tp_pinfo.af_udp);
64 + if (level != SOL_UDP)
65 + return ip_setsockopt(sk, level, optname, optval, optlen);
67 + if(optlen<sizeof(int))
70 + if (get_user(val, (int *)optval))
76 +#ifdef CONFIG_IPSEC_NAT_TRAVERSAL
78 +#define UDP_ESPINUDP 100
81 + tp->esp_in_udp = val;
94 struct proto udp_prot = {
95 (struct sock *)&udp_prot, /* sklist_next */
96 (struct sock *)&udp_prot, /* sklist_prev */
97 @@ -1179,7 +1252,11 @@
102 + udp_setsockopt, /* setsockopt */
104 ip_setsockopt, /* setsockopt */
106 ip_getsockopt, /* getsockopt */
107 udp_sendmsg, /* sendmsg */
108 udp_recvmsg, /* recvmsg */