Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 1 | /* |
| 2 | * (C) 2003,2004 USAGI/WIDE Project <http://www.linux-ipv6.org> |
| 3 | * |
| 4 | * Based largely upon the original ip_conntrack code which |
| 5 | * had the following copyright information: |
| 6 | * |
| 7 | * (C) 1999-2001 Paul `Rusty' Russell |
| 8 | * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org> |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | * |
| 14 | * Author: |
| 15 | * Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> |
| 16 | */ |
| 17 | |
| 18 | #include <linux/config.h> |
| 19 | #include <linux/types.h> |
| 20 | #include <linux/ip.h> |
| 21 | #include <linux/netfilter.h> |
| 22 | #include <linux/module.h> |
| 23 | #include <linux/skbuff.h> |
| 24 | #include <linux/icmp.h> |
| 25 | #include <linux/sysctl.h> |
| 26 | #include <net/ip.h> |
| 27 | |
| 28 | #include <linux/netfilter_ipv4.h> |
| 29 | #include <net/netfilter/nf_conntrack.h> |
| 30 | #include <net/netfilter/nf_conntrack_protocol.h> |
| 31 | #include <net/netfilter/nf_conntrack_l3proto.h> |
| 32 | #include <net/netfilter/nf_conntrack_core.h> |
| 33 | #include <net/netfilter/ipv4/nf_conntrack_ipv4.h> |
| 34 | |
| 35 | #if 0 |
| 36 | #define DEBUGP printk |
| 37 | #else |
| 38 | #define DEBUGP(format, args...) |
| 39 | #endif |
| 40 | |
| 41 | DECLARE_PER_CPU(struct nf_conntrack_stat, nf_conntrack_stat); |
| 42 | |
| 43 | static int generic_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, |
| 44 | struct nf_conntrack_tuple *tuple) |
| 45 | { |
| 46 | memset(&tuple->src.u3, 0, sizeof(tuple->src.u3)); |
| 47 | memset(&tuple->dst.u3, 0, sizeof(tuple->dst.u3)); |
| 48 | |
| 49 | return 1; |
| 50 | } |
| 51 | |
| 52 | static int generic_invert_tuple(struct nf_conntrack_tuple *tuple, |
| 53 | const struct nf_conntrack_tuple *orig) |
| 54 | { |
| 55 | memset(&tuple->src.u3, 0, sizeof(tuple->src.u3)); |
| 56 | memset(&tuple->dst.u3, 0, sizeof(tuple->dst.u3)); |
| 57 | |
| 58 | return 1; |
| 59 | } |
| 60 | |
| 61 | static int generic_print_tuple(struct seq_file *s, |
| 62 | const struct nf_conntrack_tuple *tuple) |
| 63 | { |
| 64 | return 0; |
| 65 | } |
| 66 | |
| 67 | static int generic_print_conntrack(struct seq_file *s, |
| 68 | const struct nf_conn *conntrack) |
| 69 | { |
| 70 | return 0; |
| 71 | } |
| 72 | |
| 73 | static int |
| 74 | generic_prepare(struct sk_buff **pskb, unsigned int hooknum, |
| 75 | unsigned int *dataoff, u_int8_t *protonum) |
| 76 | { |
| 77 | /* Never track !!! */ |
| 78 | return -NF_ACCEPT; |
| 79 | } |
| 80 | |
| 81 | |
| 82 | static u_int32_t generic_get_features(const struct nf_conntrack_tuple *tuple) |
| 83 | |
| 84 | { |
| 85 | return NF_CT_F_BASIC; |
| 86 | } |
| 87 | |
| 88 | struct nf_conntrack_l3proto nf_conntrack_generic_l3proto = { |
| 89 | .l3proto = PF_UNSPEC, |
| 90 | .name = "unknown", |
| 91 | .pkt_to_tuple = generic_pkt_to_tuple, |
| 92 | .invert_tuple = generic_invert_tuple, |
| 93 | .print_tuple = generic_print_tuple, |
| 94 | .print_conntrack = generic_print_conntrack, |
| 95 | .prepare = generic_prepare, |
| 96 | .get_features = generic_get_features, |
| 97 | .me = THIS_MODULE, |
| 98 | }; |