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/ip.h>
20#include <linux/netfilter.h>
21#include <linux/module.h>
22#include <linux/skbuff.h>
23#include <linux/icmp.h>
24#include <linux/sysctl.h>
25#include <net/ip.h>
26
27#include <linux/netfilter_ipv4.h>
28#include <net/netfilter/nf_conntrack.h>
29#include <net/netfilter/nf_conntrack_l4proto.h>
30#include <net/netfilter/nf_conntrack_l3proto.h>
31#include <net/netfilter/nf_conntrack_core.h>
32#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
33
34static bool generic_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff,
35 struct nf_conntrack_tuple *tuple)
36{
37 memset(&tuple->src.u3, 0, sizeof(tuple->src.u3));
38 memset(&tuple->dst.u3, 0, sizeof(tuple->dst.u3));
39
40 return true;
41}
42
43static bool generic_invert_tuple(struct nf_conntrack_tuple *tuple,
44 const struct nf_conntrack_tuple *orig)
45{
46 memset(&tuple->src.u3, 0, sizeof(tuple->src.u3));
47 memset(&tuple->dst.u3, 0, sizeof(tuple->dst.u3));
48
49 return true;
50}
51
52static void generic_print_tuple(struct seq_file *s,
53 const struct nf_conntrack_tuple *tuple)
54{
55}
56
57static int generic_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
58 unsigned int *dataoff, u_int8_t *protonum)
59{
60
61 return -NF_ACCEPT;
62}
63
64
65struct nf_conntrack_l3proto nf_conntrack_l3proto_generic __read_mostly = {
66 .l3proto = PF_UNSPEC,
67 .name = "unknown",
68 .pkt_to_tuple = generic_pkt_to_tuple,
69 .invert_tuple = generic_invert_tuple,
70 .print_tuple = generic_print_tuple,
71 .get_l4proto = generic_get_l4proto,
72};
73EXPORT_SYMBOL_GPL(nf_conntrack_l3proto_generic);
74