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 #include <linux/types.h>
21 #include <linux/kernel.h>
22 #include <linux/skbuff.h>
23 #include <linux/netdevice.h>
24 #include <linux/in.h>
25 #include <net/datalink.h>
26 #include <net/sock.h>
27 #include <net/ip.h>
28 #include <net/protocol.h>
29 #include <net/ipip.h>
30
31
32
33
34
35 #if ( defined(CONFIG_NET_IPIP) && defined(CONFIG_IP_FORWARD)) || defined(MODULE)
36 #ifdef MODULE
37 #include <linux/module.h>
38 #include <linux/version.h>
39
40 static char kernel_version[] = UTS_RELEASE;
41
42 #else
43 #define MOD_INC_USE_COUNT
44 #define MOD_DEC_USE_COUNT
45 #endif
46
47
48
49
50
51
52 int ipip_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
53 unsigned long daddr, unsigned short len, unsigned long saddr,
54 int redo, struct inet_protocol *protocol)
55 {
56
57 MOD_INC_USE_COUNT;
58 #ifdef TUNNEL_DEBUG
59 printk("ipip_rcv: got a packet!\n");
60 #endif
61 skb->h.iph=skb->data;
62 if(ip_forward(skb, dev, 0, daddr, 0))
63 kfree_skb(skb, FREE_READ);
64 MOD_DEC_USE_COUNT;
65 return(0);
66 }
67
68 #ifdef MODULE
69 static struct inet_protocol ipip_protocol = {
70 ipip_rcv,
71 NULL,
72 NULL,
73 0,
74 IPPROTO_IPIP,
75 0,
76 NULL,
77 "IPIP"
78 };
79
80
81
82
83
84
85 int init_module( void)
86 {
87 inet_add_protocol(&ipip_protocol);
88 return 0;
89 }
90
91 void cleanup_module( void)
92 {
93 if ( inet_del_protocol(&ipip_protocol) < 0 )
94 printk("ipip close: can't remove protocol\n");
95 }
96
97 #endif
98 #endif