This source file includes following definitions.
- ipip_rcv
- init_module
- cleanup_module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include <linux/module.h>
23
24 #include <linux/config.h>
25 #include <linux/types.h>
26 #include <linux/sched.h>
27 #include <linux/kernel.h>
28 #include <linux/skbuff.h>
29 #include <linux/netdevice.h>
30 #include <linux/in.h>
31 #include <linux/tcp.h>
32 #include <linux/udp.h>
33 #include <linux/firewall.h>
34 #include <linux/config.h>
35
36 #include <net/datalink.h>
37 #include <net/sock.h>
38 #include <net/ip.h>
39 #include <net/icmp.h>
40 #include <net/protocol.h>
41 #include <net/ipip.h>
42
43
44
45
46
47
48
49
50
51
52 int ipip_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
53 __u32 daddr, unsigned short len, __u32 saddr,
54 int redo, struct inet_protocol *protocol)
55 {
56 #ifdef CONFIG_FIREWALL
57 int err;
58 #endif
59
60 MOD_INC_USE_COUNT;
61 #ifdef TUNNEL_DEBUG
62 printk("ipip_rcv: got a packet!\n");
63 #endif
64
65
66
67
68 skb_pull(skb, ((struct iphdr *)skb->data)->ihl<<2);
69
70
71
72
73
74 skb->h.iph=(struct iphdr *)skb->data;
75 skb->ip_hdr=(struct iphdr *)skb->data;
76 memset(skb->proto_priv, 0, sizeof(struct options));
77
78
79
80
81
82
83 skb->protocol = htons(ETH_P_IP);
84 skb->ip_summed = 0;
85 netif_rx(skb);
86 MOD_DEC_USE_COUNT;
87 return(0);
88 }
89
90 #ifdef MODULE
91
92 static struct inet_protocol ipip_protocol = {
93 ipip_rcv,
94 #if 0
95 NULL,
96 #endif
97 NULL,
98 0,
99 IPPROTO_IPIP,
100 0,
101 NULL,
102 "IPIP"
103 };
104
105
106
107
108
109
110 int init_module( void)
111 {
112 inet_add_protocol(&ipip_protocol);
113 return 0;
114 }
115
116 void cleanup_module( void)
117 {
118 if ( inet_del_protocol(&ipip_protocol) < 0 )
119 printk("ipip close: can't remove protocol\n");
120 }
121
122 #endif