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