1 /* The "unknown" protocol. This is what is used for protocols we
2 * don't understand. It's returned by ip_ct_find_proto().
3 */
4
5 #include <linux/types.h>
6 #include <linux/init.h>
7 #include <linux/netfilter.h>
8 #include <linux/if.h>
9
10 #include <linux/netfilter_ipv4/ip_nat.h>
11 #include <linux/netfilter_ipv4/ip_nat_rule.h>
12 #include <linux/netfilter_ipv4/ip_nat_protocol.h>
13
unknown_in_range(const struct ip_conntrack_tuple * tuple,enum ip_nat_manip_type manip_type,const union ip_conntrack_manip_proto * min,const union ip_conntrack_manip_proto * max)14 static int unknown_in_range(const struct ip_conntrack_tuple *tuple,
15 enum ip_nat_manip_type manip_type,
16 const union ip_conntrack_manip_proto *min,
17 const union ip_conntrack_manip_proto *max)
18 {
19 return 1;
20 }
21
unknown_unique_tuple(struct ip_conntrack_tuple * tuple,const struct ip_nat_range * range,enum ip_nat_manip_type maniptype,const struct ip_conntrack * conntrack)22 static int unknown_unique_tuple(struct ip_conntrack_tuple *tuple,
23 const struct ip_nat_range *range,
24 enum ip_nat_manip_type maniptype,
25 const struct ip_conntrack *conntrack)
26 {
27 /* Sorry: we can't help you; if it's not unique, we can't frob
28 anything. */
29 return 0;
30 }
31
32 static void
unknown_manip_pkt(struct iphdr * iph,size_t len,const struct ip_conntrack_manip * manip,enum ip_nat_manip_type maniptype)33 unknown_manip_pkt(struct iphdr *iph, size_t len,
34 const struct ip_conntrack_manip *manip,
35 enum ip_nat_manip_type maniptype)
36 {
37 return;
38 }
39
40 static unsigned int
unknown_print(char * buffer,const struct ip_conntrack_tuple * match,const struct ip_conntrack_tuple * mask)41 unknown_print(char *buffer,
42 const struct ip_conntrack_tuple *match,
43 const struct ip_conntrack_tuple *mask)
44 {
45 return 0;
46 }
47
48 static unsigned int
unknown_print_range(char * buffer,const struct ip_nat_range * range)49 unknown_print_range(char *buffer, const struct ip_nat_range *range)
50 {
51 return 0;
52 }
53
54 struct ip_nat_protocol unknown_nat_protocol = {
55 { NULL, NULL }, "unknown", 0,
56 unknown_manip_pkt,
57 unknown_in_range,
58 unknown_unique_tuple,
59 unknown_print,
60 unknown_print_range
61 };
62