Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 1 | /* (C) 1999-2001 Paul `Rusty' Russell |
| 2 | * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include <linux/types.h> |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 10 | #include <linux/timer.h> |
| 11 | #include <linux/netfilter.h> |
| 12 | #include <linux/in.h> |
| 13 | #include <linux/icmp.h> |
| 14 | #include <linux/seq_file.h> |
| 15 | #include <net/ip.h> |
| 16 | #include <net/checksum.h> |
| 17 | #include <linux/netfilter_ipv4.h> |
| 18 | #include <net/netfilter/nf_conntrack_tuple.h> |
Martin Josefsson | 605dcad | 2006-11-29 02:35:06 +0100 | [diff] [blame] | 19 | #include <net/netfilter/nf_conntrack_l4proto.h> |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 20 | #include <net/netfilter/nf_conntrack_core.h> |
Patrick McHardy | f01ffbd | 2007-12-17 22:38:49 -0800 | [diff] [blame^] | 21 | #include <net/netfilter/nf_log.h> |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 22 | |
Patrick McHardy | 933a41e | 2006-11-29 02:35:18 +0100 | [diff] [blame] | 23 | static unsigned long nf_ct_icmp_timeout __read_mostly = 30*HZ; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 24 | |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 25 | static int icmp_pkt_to_tuple(const struct sk_buff *skb, |
| 26 | unsigned int dataoff, |
| 27 | struct nf_conntrack_tuple *tuple) |
| 28 | { |
| 29 | struct icmphdr _hdr, *hp; |
| 30 | |
| 31 | hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); |
| 32 | if (hp == NULL) |
| 33 | return 0; |
| 34 | |
| 35 | tuple->dst.u.icmp.type = hp->type; |
| 36 | tuple->src.u.icmp.id = hp->un.echo.id; |
| 37 | tuple->dst.u.icmp.code = hp->code; |
| 38 | |
| 39 | return 1; |
| 40 | } |
| 41 | |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 42 | /* Add 1; spaces filled with 0. */ |
| 43 | static const u_int8_t invmap[] = { |
| 44 | [ICMP_ECHO] = ICMP_ECHOREPLY + 1, |
| 45 | [ICMP_ECHOREPLY] = ICMP_ECHO + 1, |
| 46 | [ICMP_TIMESTAMP] = ICMP_TIMESTAMPREPLY + 1, |
| 47 | [ICMP_TIMESTAMPREPLY] = ICMP_TIMESTAMP + 1, |
| 48 | [ICMP_INFO_REQUEST] = ICMP_INFO_REPLY + 1, |
| 49 | [ICMP_INFO_REPLY] = ICMP_INFO_REQUEST + 1, |
| 50 | [ICMP_ADDRESS] = ICMP_ADDRESSREPLY + 1, |
| 51 | [ICMP_ADDRESSREPLY] = ICMP_ADDRESS + 1 |
| 52 | }; |
| 53 | |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 54 | static int icmp_invert_tuple(struct nf_conntrack_tuple *tuple, |
| 55 | const struct nf_conntrack_tuple *orig) |
| 56 | { |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 57 | if (orig->dst.u.icmp.type >= sizeof(invmap) |
| 58 | || !invmap[orig->dst.u.icmp.type]) |
| 59 | return 0; |
| 60 | |
| 61 | tuple->src.u.icmp.id = orig->src.u.icmp.id; |
| 62 | tuple->dst.u.icmp.type = invmap[orig->dst.u.icmp.type] - 1; |
| 63 | tuple->dst.u.icmp.code = orig->dst.u.icmp.code; |
| 64 | return 1; |
| 65 | } |
| 66 | |
| 67 | /* Print out the per-protocol part of the tuple. */ |
| 68 | static int icmp_print_tuple(struct seq_file *s, |
| 69 | const struct nf_conntrack_tuple *tuple) |
| 70 | { |
| 71 | return seq_printf(s, "type=%u code=%u id=%u ", |
| 72 | tuple->dst.u.icmp.type, |
| 73 | tuple->dst.u.icmp.code, |
| 74 | ntohs(tuple->src.u.icmp.id)); |
| 75 | } |
| 76 | |
| 77 | /* Print out the private part of the conntrack. */ |
| 78 | static int icmp_print_conntrack(struct seq_file *s, |
| 79 | const struct nf_conn *conntrack) |
| 80 | { |
| 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | /* Returns verdict for packet, or -1 for invalid. */ |
| 85 | static int icmp_packet(struct nf_conn *ct, |
| 86 | const struct sk_buff *skb, |
| 87 | unsigned int dataoff, |
| 88 | enum ip_conntrack_info ctinfo, |
| 89 | int pf, |
| 90 | unsigned int hooknum) |
| 91 | { |
| 92 | /* Try to delete connection immediately after all replies: |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 93 | won't actually vanish as we still have skb, and del_timer |
| 94 | means this will only run once even if count hits zero twice |
| 95 | (theoretically possible with SMP) */ |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 96 | if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) { |
| 97 | if (atomic_dec_and_test(&ct->proto.icmp.count) |
| 98 | && del_timer(&ct->timeout)) |
| 99 | ct->timeout.function((unsigned long)ct); |
| 100 | } else { |
| 101 | atomic_inc(&ct->proto.icmp.count); |
| 102 | nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, skb); |
| 103 | nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_icmp_timeout); |
| 104 | } |
| 105 | |
| 106 | return NF_ACCEPT; |
| 107 | } |
| 108 | |
| 109 | /* Called when a new connection for this protocol found. */ |
| 110 | static int icmp_new(struct nf_conn *conntrack, |
| 111 | const struct sk_buff *skb, unsigned int dataoff) |
| 112 | { |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 113 | static const u_int8_t valid_new[] = { |
| 114 | [ICMP_ECHO] = 1, |
| 115 | [ICMP_TIMESTAMP] = 1, |
| 116 | [ICMP_INFO_REQUEST] = 1, |
| 117 | [ICMP_ADDRESS] = 1 |
| 118 | }; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 119 | |
| 120 | if (conntrack->tuplehash[0].tuple.dst.u.icmp.type >= sizeof(valid_new) |
| 121 | || !valid_new[conntrack->tuplehash[0].tuple.dst.u.icmp.type]) { |
| 122 | /* Can't create a new ICMP `conn' with this. */ |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 123 | pr_debug("icmp: can't create new conn with type %u\n", |
| 124 | conntrack->tuplehash[0].tuple.dst.u.icmp.type); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 125 | NF_CT_DUMP_TUPLE(&conntrack->tuplehash[0].tuple); |
| 126 | return 0; |
| 127 | } |
| 128 | atomic_set(&conntrack->proto.icmp.count, 0); |
| 129 | return 1; |
| 130 | } |
| 131 | |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 132 | /* Returns conntrack if it dealt with ICMP, and filled in skb fields */ |
| 133 | static int |
| 134 | icmp_error_message(struct sk_buff *skb, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 135 | enum ip_conntrack_info *ctinfo, |
| 136 | unsigned int hooknum) |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 137 | { |
| 138 | struct nf_conntrack_tuple innertuple, origtuple; |
Martin Josefsson | 605dcad | 2006-11-29 02:35:06 +0100 | [diff] [blame] | 139 | struct nf_conntrack_l4proto *innerproto; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 140 | struct nf_conntrack_tuple_hash *h; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 141 | |
| 142 | NF_CT_ASSERT(skb->nfct == NULL); |
| 143 | |
Yasuyuki Kozakai | e2a3123 | 2007-07-14 20:45:14 -0700 | [diff] [blame] | 144 | /* Are they talking about one of our connections? */ |
| 145 | if (!nf_ct_get_tuplepr(skb, |
| 146 | skb_network_offset(skb) + ip_hdrlen(skb) |
| 147 | + sizeof(struct icmphdr), |
| 148 | PF_INET, &origtuple)) { |
| 149 | pr_debug("icmp_error_message: failed to get tuple\n"); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 150 | return -NF_ACCEPT; |
| 151 | } |
| 152 | |
Patrick McHardy | 923f490 | 2007-02-12 11:12:57 -0800 | [diff] [blame] | 153 | /* rcu_read_lock()ed by nf_hook_slow */ |
Yasuyuki Kozakai | e2a3123 | 2007-07-14 20:45:14 -0700 | [diff] [blame] | 154 | innerproto = __nf_ct_l4proto_find(PF_INET, origtuple.dst.protonum); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 155 | |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 156 | /* Ordinarily, we'd expect the inverted tupleproto, but it's |
| 157 | been preserved inside the ICMP. */ |
| 158 | if (!nf_ct_invert_tuple(&innertuple, &origtuple, |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 159 | &nf_conntrack_l3proto_ipv4, innerproto)) { |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 160 | pr_debug("icmp_error_message: no match\n"); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 161 | return -NF_ACCEPT; |
| 162 | } |
| 163 | |
| 164 | *ctinfo = IP_CT_RELATED; |
| 165 | |
Patrick McHardy | 330f7db | 2007-07-07 22:28:42 -0700 | [diff] [blame] | 166 | h = nf_conntrack_find_get(&innertuple); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 167 | if (!h) { |
Yasuyuki Kozakai | 130e7a8 | 2007-07-14 20:45:41 -0700 | [diff] [blame] | 168 | pr_debug("icmp_error_message: no match\n"); |
| 169 | return -NF_ACCEPT; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 170 | } |
| 171 | |
Yasuyuki Kozakai | 130e7a8 | 2007-07-14 20:45:41 -0700 | [diff] [blame] | 172 | if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY) |
| 173 | *ctinfo += IP_CT_IS_REPLY; |
| 174 | |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 175 | /* Update skb to refer to this connection */ |
| 176 | skb->nfct = &nf_ct_tuplehash_to_ctrack(h)->ct_general; |
| 177 | skb->nfctinfo = *ctinfo; |
| 178 | return -NF_ACCEPT; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 179 | } |
| 180 | |
| 181 | /* Small and modified version of icmp_rcv */ |
| 182 | static int |
| 183 | icmp_error(struct sk_buff *skb, unsigned int dataoff, |
| 184 | enum ip_conntrack_info *ctinfo, int pf, unsigned int hooknum) |
| 185 | { |
| 186 | struct icmphdr _ih, *icmph; |
| 187 | |
| 188 | /* Not enough header? */ |
Arnaldo Carvalho de Melo | c9bdd4b | 2007-03-12 20:09:15 -0300 | [diff] [blame] | 189 | icmph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_ih), &_ih); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 190 | if (icmph == NULL) { |
| 191 | if (LOG_INVALID(IPPROTO_ICMP)) |
| 192 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, |
| 193 | "nf_ct_icmp: short packet "); |
| 194 | return -NF_ACCEPT; |
| 195 | } |
| 196 | |
| 197 | /* See ip_conntrack_proto_tcp.c */ |
Patrick McHardy | 6e23ae2 | 2007-11-19 18:53:30 -0800 | [diff] [blame] | 198 | if (nf_conntrack_checksum && hooknum == NF_INET_PRE_ROUTING && |
Patrick McHardy | 96f6bf8 | 2006-04-06 14:19:24 -0700 | [diff] [blame] | 199 | nf_ip_checksum(skb, hooknum, dataoff, 0)) { |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 200 | if (LOG_INVALID(IPPROTO_ICMP)) |
| 201 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, |
| 202 | "nf_ct_icmp: bad HW ICMP checksum "); |
| 203 | return -NF_ACCEPT; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 204 | } |
| 205 | |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 206 | /* |
| 207 | * 18 is the highest 'known' ICMP type. Anything else is a mystery |
| 208 | * |
| 209 | * RFC 1122: 3.2.2 Unknown ICMP messages types MUST be silently |
| 210 | * discarded. |
| 211 | */ |
| 212 | if (icmph->type > NR_ICMP_TYPES) { |
| 213 | if (LOG_INVALID(IPPROTO_ICMP)) |
| 214 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, |
| 215 | "nf_ct_icmp: invalid ICMP type "); |
| 216 | return -NF_ACCEPT; |
| 217 | } |
| 218 | |
| 219 | /* Need to track icmp error message? */ |
| 220 | if (icmph->type != ICMP_DEST_UNREACH |
| 221 | && icmph->type != ICMP_SOURCE_QUENCH |
| 222 | && icmph->type != ICMP_TIME_EXCEEDED |
| 223 | && icmph->type != ICMP_PARAMETERPROB |
| 224 | && icmph->type != ICMP_REDIRECT) |
| 225 | return NF_ACCEPT; |
| 226 | |
| 227 | return icmp_error_message(skb, ctinfo, hooknum); |
| 228 | } |
| 229 | |
Patrick McHardy | e281db5c | 2007-03-04 15:57:25 -0800 | [diff] [blame] | 230 | #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 231 | |
| 232 | #include <linux/netfilter/nfnetlink.h> |
| 233 | #include <linux/netfilter/nfnetlink_conntrack.h> |
| 234 | |
Patrick McHardy | fdf7083 | 2007-09-28 14:37:41 -0700 | [diff] [blame] | 235 | static int icmp_tuple_to_nlattr(struct sk_buff *skb, |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 236 | const struct nf_conntrack_tuple *t) |
| 237 | { |
Patrick McHardy | 77236b6 | 2007-12-17 22:29:45 -0800 | [diff] [blame] | 238 | NLA_PUT_BE16(skb, CTA_PROTO_ICMP_ID, t->src.u.icmp.id); |
| 239 | NLA_PUT_U8(skb, CTA_PROTO_ICMP_TYPE, t->dst.u.icmp.type); |
| 240 | NLA_PUT_U8(skb, CTA_PROTO_ICMP_CODE, t->dst.u.icmp.code); |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 241 | |
| 242 | return 0; |
| 243 | |
Patrick McHardy | df6fb86 | 2007-09-28 14:37:03 -0700 | [diff] [blame] | 244 | nla_put_failure: |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 245 | return -1; |
| 246 | } |
| 247 | |
Patrick McHardy | f73e924 | 2007-09-28 14:39:55 -0700 | [diff] [blame] | 248 | static const struct nla_policy icmp_nla_policy[CTA_PROTO_MAX+1] = { |
| 249 | [CTA_PROTO_ICMP_TYPE] = { .type = NLA_U8 }, |
| 250 | [CTA_PROTO_ICMP_CODE] = { .type = NLA_U8 }, |
| 251 | [CTA_PROTO_ICMP_ID] = { .type = NLA_U16 }, |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 252 | }; |
| 253 | |
Patrick McHardy | fdf7083 | 2007-09-28 14:37:41 -0700 | [diff] [blame] | 254 | static int icmp_nlattr_to_tuple(struct nlattr *tb[], |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 255 | struct nf_conntrack_tuple *tuple) |
| 256 | { |
Patrick McHardy | df6fb86 | 2007-09-28 14:37:03 -0700 | [diff] [blame] | 257 | if (!tb[CTA_PROTO_ICMP_TYPE] |
| 258 | || !tb[CTA_PROTO_ICMP_CODE] |
| 259 | || !tb[CTA_PROTO_ICMP_ID]) |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 260 | return -EINVAL; |
| 261 | |
Patrick McHardy | 77236b6 | 2007-12-17 22:29:45 -0800 | [diff] [blame] | 262 | tuple->dst.u.icmp.type = nla_get_u8(tb[CTA_PROTO_ICMP_TYPE]); |
| 263 | tuple->dst.u.icmp.code = nla_get_u8(tb[CTA_PROTO_ICMP_CODE]); |
| 264 | tuple->src.u.icmp.id = nla_get_be16(tb[CTA_PROTO_ICMP_ID]); |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 265 | |
| 266 | if (tuple->dst.u.icmp.type >= sizeof(invmap) |
| 267 | || !invmap[tuple->dst.u.icmp.type]) |
| 268 | return -EINVAL; |
| 269 | |
| 270 | return 0; |
| 271 | } |
| 272 | #endif |
| 273 | |
Patrick McHardy | 933a41e | 2006-11-29 02:35:18 +0100 | [diff] [blame] | 274 | #ifdef CONFIG_SYSCTL |
| 275 | static struct ctl_table_header *icmp_sysctl_header; |
| 276 | static struct ctl_table icmp_sysctl_table[] = { |
| 277 | { |
Patrick McHardy | 933a41e | 2006-11-29 02:35:18 +0100 | [diff] [blame] | 278 | .procname = "nf_conntrack_icmp_timeout", |
| 279 | .data = &nf_ct_icmp_timeout, |
| 280 | .maxlen = sizeof(unsigned int), |
| 281 | .mode = 0644, |
| 282 | .proc_handler = &proc_dointvec_jiffies, |
| 283 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 284 | { |
Patrick McHardy | 933a41e | 2006-11-29 02:35:18 +0100 | [diff] [blame] | 285 | .ctl_name = 0 |
| 286 | } |
| 287 | }; |
Patrick McHardy | a999e68 | 2006-11-29 02:35:20 +0100 | [diff] [blame] | 288 | #ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT |
| 289 | static struct ctl_table icmp_compat_sysctl_table[] = { |
| 290 | { |
Patrick McHardy | a999e68 | 2006-11-29 02:35:20 +0100 | [diff] [blame] | 291 | .procname = "ip_conntrack_icmp_timeout", |
| 292 | .data = &nf_ct_icmp_timeout, |
| 293 | .maxlen = sizeof(unsigned int), |
| 294 | .mode = 0644, |
| 295 | .proc_handler = &proc_dointvec_jiffies, |
| 296 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 297 | { |
Patrick McHardy | a999e68 | 2006-11-29 02:35:20 +0100 | [diff] [blame] | 298 | .ctl_name = 0 |
| 299 | } |
| 300 | }; |
| 301 | #endif /* CONFIG_NF_CONNTRACK_PROC_COMPAT */ |
Patrick McHardy | 933a41e | 2006-11-29 02:35:18 +0100 | [diff] [blame] | 302 | #endif /* CONFIG_SYSCTL */ |
| 303 | |
Patrick McHardy | 61075af | 2007-07-14 20:48:19 -0700 | [diff] [blame] | 304 | struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp __read_mostly = |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 305 | { |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 306 | .l3proto = PF_INET, |
Martin Josefsson | 605dcad | 2006-11-29 02:35:06 +0100 | [diff] [blame] | 307 | .l4proto = IPPROTO_ICMP, |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 308 | .name = "icmp", |
| 309 | .pkt_to_tuple = icmp_pkt_to_tuple, |
| 310 | .invert_tuple = icmp_invert_tuple, |
| 311 | .print_tuple = icmp_print_tuple, |
| 312 | .print_conntrack = icmp_print_conntrack, |
| 313 | .packet = icmp_packet, |
| 314 | .new = icmp_new, |
| 315 | .error = icmp_error, |
| 316 | .destroy = NULL, |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 317 | .me = NULL, |
Patrick McHardy | e281db5c | 2007-03-04 15:57:25 -0800 | [diff] [blame] | 318 | #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) |
Patrick McHardy | fdf7083 | 2007-09-28 14:37:41 -0700 | [diff] [blame] | 319 | .tuple_to_nlattr = icmp_tuple_to_nlattr, |
| 320 | .nlattr_to_tuple = icmp_nlattr_to_tuple, |
Patrick McHardy | f73e924 | 2007-09-28 14:39:55 -0700 | [diff] [blame] | 321 | .nla_policy = icmp_nla_policy, |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 322 | #endif |
Patrick McHardy | 933a41e | 2006-11-29 02:35:18 +0100 | [diff] [blame] | 323 | #ifdef CONFIG_SYSCTL |
| 324 | .ctl_table_header = &icmp_sysctl_header, |
| 325 | .ctl_table = icmp_sysctl_table, |
Patrick McHardy | a999e68 | 2006-11-29 02:35:20 +0100 | [diff] [blame] | 326 | #ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT |
| 327 | .ctl_compat_table = icmp_compat_sysctl_table, |
| 328 | #endif |
Patrick McHardy | 933a41e | 2006-11-29 02:35:18 +0100 | [diff] [blame] | 329 | #endif |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 330 | }; |