Blame view

net/netfilter/nf_conntrack_proto_udp.c 9.92 KB
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
1
2
3
4
5
6
  /* (C) 1999-2001 Paul `Rusty' Russell
   * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org>
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
7
8
9
   */
  
  #include <linux/types.h>
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
10
11
  #include <linux/timer.h>
  #include <linux/module.h>
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
12
13
14
15
16
17
  #include <linux/udp.h>
  #include <linux/seq_file.h>
  #include <linux/skbuff.h>
  #include <linux/ipv6.h>
  #include <net/ip6_checksum.h>
  #include <net/checksum.h>
f61801218   Martin Josefsson   [NETFILTER]: nf_c...
18

9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
19
20
21
  #include <linux/netfilter.h>
  #include <linux/netfilter_ipv4.h>
  #include <linux/netfilter_ipv6.h>
605dcad6c   Martin Josefsson   [NETFILTER]: nf_c...
22
  #include <net/netfilter/nf_conntrack_l4proto.h>
f61801218   Martin Josefsson   [NETFILTER]: nf_c...
23
  #include <net/netfilter/nf_conntrack_ecache.h>
f01ffbd6e   Patrick McHardy   [NETFILTER]: nf_l...
24
  #include <net/netfilter/nf_log.h>
9d2493f88   Christoph Paasch   netfilter: remove...
25
26
  #include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
  #include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
27

5a41db94c   Pablo Neira Ayuso   netfilter: nf_ct_...
28
29
30
31
  static unsigned int udp_timeouts[UDP_CT_MAX] = {
  	[UDP_CT_UNREPLIED]	= 30*HZ,
  	[UDP_CT_REPLIED]	= 180*HZ,
  };
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
32

0ce490ad4   Gao feng   netfilter: nf_ct_...
33
34
35
36
  static inline struct nf_udp_net *udp_pernet(struct net *net)
  {
  	return &net->ct.nf_ct_proto.udp;
  }
09f263cd3   Jan Engelhardt   [NETFILTER]: nf_c...
37
  static bool udp_pkt_to_tuple(const struct sk_buff *skb,
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
38
39
40
  			     unsigned int dataoff,
  			     struct nf_conntrack_tuple *tuple)
  {
da3f13c95   Jan Engelhardt   [NETFILTER]: nf_{...
41
42
  	const struct udphdr *hp;
  	struct udphdr _hdr;
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
43
44
45
46
  
  	/* Actually only need first 8 bytes. */
  	hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr);
  	if (hp == NULL)
09f263cd3   Jan Engelhardt   [NETFILTER]: nf_c...
47
  		return false;
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
48
49
50
  
  	tuple->src.u.udp.port = hp->source;
  	tuple->dst.u.udp.port = hp->dest;
09f263cd3   Jan Engelhardt   [NETFILTER]: nf_c...
51
  	return true;
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
52
  }
09f263cd3   Jan Engelhardt   [NETFILTER]: nf_c...
53
54
  static bool udp_invert_tuple(struct nf_conntrack_tuple *tuple,
  			     const struct nf_conntrack_tuple *orig)
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
55
56
57
  {
  	tuple->src.u.udp.port = orig->dst.u.udp.port;
  	tuple->dst.u.udp.port = orig->src.u.udp.port;
09f263cd3   Jan Engelhardt   [NETFILTER]: nf_c...
58
  	return true;
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
59
60
61
62
63
64
65
66
67
68
  }
  
  /* Print out the per-protocol part of the tuple. */
  static int udp_print_tuple(struct seq_file *s,
  			   const struct nf_conntrack_tuple *tuple)
  {
  	return seq_printf(s, "sport=%hu dport=%hu ",
  			  ntohs(tuple->src.u.udp.port),
  			  ntohs(tuple->dst.u.udp.port));
  }
2c8503f55   Pablo Neira Ayuso   netfilter: nf_con...
69
70
  static unsigned int *udp_get_timeouts(struct net *net)
  {
0ce490ad4   Gao feng   netfilter: nf_ct_...
71
  	return udp_pernet(net)->timeouts;
2c8503f55   Pablo Neira Ayuso   netfilter: nf_con...
72
  }
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
73
  /* Returns verdict for packet, and may modify conntracktype */
c88130bcd   Patrick McHardy   [NETFILTER]: nf_c...
74
  static int udp_packet(struct nf_conn *ct,
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
75
76
77
  		      const struct sk_buff *skb,
  		      unsigned int dataoff,
  		      enum ip_conntrack_info ctinfo,
76108cea0   Jan Engelhardt   netfilter: Use un...
78
  		      u_int8_t pf,
2c8503f55   Pablo Neira Ayuso   netfilter: nf_con...
79
80
  		      unsigned int hooknum,
  		      unsigned int *timeouts)
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
81
82
83
  {
  	/* If we've seen traffic both ways, this is some kind of UDP
  	   stream.  Extend timeout. */
c88130bcd   Patrick McHardy   [NETFILTER]: nf_c...
84
  	if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) {
5a41db94c   Pablo Neira Ayuso   netfilter: nf_ct_...
85
  		nf_ct_refresh_acct(ct, ctinfo, skb,
2c8503f55   Pablo Neira Ayuso   netfilter: nf_con...
86
  				   timeouts[UDP_CT_REPLIED]);
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
87
  		/* Also, more likely to be important, and not a probe */
c88130bcd   Patrick McHardy   [NETFILTER]: nf_c...
88
  		if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
858b31330   Patrick McHardy   netfilter: nf_con...
89
  			nf_conntrack_event_cache(IPCT_ASSURED, ct);
5a41db94c   Pablo Neira Ayuso   netfilter: nf_ct_...
90
91
  	} else {
  		nf_ct_refresh_acct(ct, ctinfo, skb,
2c8503f55   Pablo Neira Ayuso   netfilter: nf_con...
92
  				   timeouts[UDP_CT_UNREPLIED]);
5a41db94c   Pablo Neira Ayuso   netfilter: nf_ct_...
93
  	}
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
94
95
96
97
  	return NF_ACCEPT;
  }
  
  /* Called when a new connection for this protocol found. */
09f263cd3   Jan Engelhardt   [NETFILTER]: nf_c...
98
  static bool udp_new(struct nf_conn *ct, const struct sk_buff *skb,
2c8503f55   Pablo Neira Ayuso   netfilter: nf_con...
99
  		    unsigned int dataoff, unsigned int *timeouts)
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
100
  {
09f263cd3   Jan Engelhardt   [NETFILTER]: nf_c...
101
  	return true;
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
102
  }
8fea97ec1   Patrick McHardy   netfilter: nf_con...
103
104
  static int udp_error(struct net *net, struct nf_conn *tmpl, struct sk_buff *skb,
  		     unsigned int dataoff, enum ip_conntrack_info *ctinfo,
76108cea0   Jan Engelhardt   netfilter: Use un...
105
  		     u_int8_t pf,
96f6bf82e   Patrick McHardy   [NETFILTER]: Conv...
106
  		     unsigned int hooknum)
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
107
108
  {
  	unsigned int udplen = skb->len - dataoff;
da3f13c95   Jan Engelhardt   [NETFILTER]: nf_{...
109
110
  	const struct udphdr *hdr;
  	struct udphdr _hdr;
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
111
112
113
114
  
  	/* Header is too small? */
  	hdr = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr);
  	if (hdr == NULL) {
c2a2c7e0c   Alexey Dobriyan   netfilter: netns ...
115
  		if (LOG_INVALID(net, IPPROTO_UDP))
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
116
117
118
119
120
121
122
  			nf_log_packet(pf, 0, skb, NULL, NULL, NULL,
  				      "nf_ct_udp: short packet ");
  		return -NF_ACCEPT;
  	}
  
  	/* Truncated/malformed packets */
  	if (ntohs(hdr->len) > udplen || ntohs(hdr->len) < sizeof(*hdr)) {
c2a2c7e0c   Alexey Dobriyan   netfilter: netns ...
123
  		if (LOG_INVALID(net, IPPROTO_UDP))
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
124
125
126
127
128
129
130
131
132
133
134
  			nf_log_packet(pf, 0, skb, NULL, NULL, NULL,
  				"nf_ct_udp: truncated/malformed packet ");
  		return -NF_ACCEPT;
  	}
  
  	/* Packet with no checksum */
  	if (!hdr->check)
  		return NF_ACCEPT;
  
  	/* Checksum invalid? Ignore.
  	 * We skip checking packets on the outgoing path
84fa7933a   Patrick McHardy   [NET]: Replace CH...
135
  	 * because the checksum is assumed to be correct.
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
136
  	 * FIXME: Source route IP option packets --RR */
c04d05529   Alexey Dobriyan   netfilter: netns ...
137
  	if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING &&
96f6bf82e   Patrick McHardy   [NETFILTER]: Conv...
138
  	    nf_checksum(skb, hooknum, dataoff, IPPROTO_UDP, pf)) {
c2a2c7e0c   Alexey Dobriyan   netfilter: netns ...
139
  		if (LOG_INVALID(net, IPPROTO_UDP))
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
140
141
142
143
144
145
146
  			nf_log_packet(pf, 0, skb, NULL, NULL, NULL,
  				"nf_ct_udp: bad UDP checksum ");
  		return -NF_ACCEPT;
  	}
  
  	return NF_ACCEPT;
  }
509784623   Pablo Neira Ayuso   netfilter: add ct...
147
148
149
150
  #if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT)
  
  #include <linux/netfilter/nfnetlink.h>
  #include <linux/netfilter/nfnetlink_cttimeout.h>
8264deb81   Gao feng   netfilter: nf_con...
151
152
  static int udp_timeout_nlattr_to_obj(struct nlattr *tb[],
  				     struct net *net, void *data)
509784623   Pablo Neira Ayuso   netfilter: add ct...
153
154
  {
  	unsigned int *timeouts = data;
8264deb81   Gao feng   netfilter: nf_con...
155
  	struct nf_udp_net *un = udp_pernet(net);
509784623   Pablo Neira Ayuso   netfilter: add ct...
156
157
  
  	/* set default timeouts for UDP. */
8264deb81   Gao feng   netfilter: nf_con...
158
159
  	timeouts[UDP_CT_UNREPLIED] = un->timeouts[UDP_CT_UNREPLIED];
  	timeouts[UDP_CT_REPLIED] = un->timeouts[UDP_CT_REPLIED];
509784623   Pablo Neira Ayuso   netfilter: add ct...
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
  
  	if (tb[CTA_TIMEOUT_UDP_UNREPLIED]) {
  		timeouts[UDP_CT_UNREPLIED] =
  			ntohl(nla_get_be32(tb[CTA_TIMEOUT_UDP_UNREPLIED])) * HZ;
  	}
  	if (tb[CTA_TIMEOUT_UDP_REPLIED]) {
  		timeouts[UDP_CT_REPLIED] =
  			ntohl(nla_get_be32(tb[CTA_TIMEOUT_UDP_REPLIED])) * HZ;
  	}
  	return 0;
  }
  
  static int
  udp_timeout_obj_to_nlattr(struct sk_buff *skb, const void *data)
  {
  	const unsigned int *timeouts = data;
3c60a17b1   David S. Miller   nf_conntrack_prot...
176
177
178
179
180
  	if (nla_put_be32(skb, CTA_TIMEOUT_UDP_UNREPLIED,
  			 htonl(timeouts[UDP_CT_UNREPLIED] / HZ)) ||
  	    nla_put_be32(skb, CTA_TIMEOUT_UDP_REPLIED,
  			 htonl(timeouts[UDP_CT_REPLIED] / HZ)))
  		goto nla_put_failure;
509784623   Pablo Neira Ayuso   netfilter: add ct...
181
182
183
184
185
186
187
188
189
190
191
192
  	return 0;
  
  nla_put_failure:
  	return -ENOSPC;
  }
  
  static const struct nla_policy
  udp_timeout_nla_policy[CTA_TIMEOUT_UDP_MAX+1] = {
         [CTA_TIMEOUT_UDP_UNREPLIED]	= { .type = NLA_U32 },
         [CTA_TIMEOUT_UDP_REPLIED]	= { .type = NLA_U32 },
  };
  #endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */
933a41e7e   Patrick McHardy   [NETFILTER]: nf_c...
193
  #ifdef CONFIG_SYSCTL
933a41e7e   Patrick McHardy   [NETFILTER]: nf_c...
194
195
  static struct ctl_table udp_sysctl_table[] = {
  	{
933a41e7e   Patrick McHardy   [NETFILTER]: nf_c...
196
  		.procname	= "nf_conntrack_udp_timeout",
933a41e7e   Patrick McHardy   [NETFILTER]: nf_c...
197
198
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
6d9f239a1   Alexey Dobriyan   net: '&' redux
199
  		.proc_handler	= proc_dointvec_jiffies,
933a41e7e   Patrick McHardy   [NETFILTER]: nf_c...
200
201
  	},
  	{
933a41e7e   Patrick McHardy   [NETFILTER]: nf_c...
202
  		.procname	= "nf_conntrack_udp_timeout_stream",
933a41e7e   Patrick McHardy   [NETFILTER]: nf_c...
203
204
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
6d9f239a1   Alexey Dobriyan   net: '&' redux
205
  		.proc_handler	= proc_dointvec_jiffies,
933a41e7e   Patrick McHardy   [NETFILTER]: nf_c...
206
  	},
f8572d8f2   Eric W. Biederman   sysctl net: Remov...
207
  	{ }
933a41e7e   Patrick McHardy   [NETFILTER]: nf_c...
208
  };
a999e6837   Patrick McHardy   [NETFILTER]: nf_c...
209
210
211
  #ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
  static struct ctl_table udp_compat_sysctl_table[] = {
  	{
a999e6837   Patrick McHardy   [NETFILTER]: nf_c...
212
  		.procname	= "ip_conntrack_udp_timeout",
a999e6837   Patrick McHardy   [NETFILTER]: nf_c...
213
214
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
6d9f239a1   Alexey Dobriyan   net: '&' redux
215
  		.proc_handler	= proc_dointvec_jiffies,
a999e6837   Patrick McHardy   [NETFILTER]: nf_c...
216
217
  	},
  	{
a999e6837   Patrick McHardy   [NETFILTER]: nf_c...
218
  		.procname	= "ip_conntrack_udp_timeout_stream",
a999e6837   Patrick McHardy   [NETFILTER]: nf_c...
219
220
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
6d9f239a1   Alexey Dobriyan   net: '&' redux
221
  		.proc_handler	= proc_dointvec_jiffies,
a999e6837   Patrick McHardy   [NETFILTER]: nf_c...
222
  	},
f8572d8f2   Eric W. Biederman   sysctl net: Remov...
223
  	{ }
a999e6837   Patrick McHardy   [NETFILTER]: nf_c...
224
225
  };
  #endif /* CONFIG_NF_CONNTRACK_PROC_COMPAT */
933a41e7e   Patrick McHardy   [NETFILTER]: nf_c...
226
  #endif /* CONFIG_SYSCTL */
dee7364e0   Gao feng   netfilter: nf_ct_...
227
228
  static int udp_kmemdup_sysctl_table(struct nf_proto_net *pn,
  				    struct nf_udp_net *un)
0ce490ad4   Gao feng   netfilter: nf_ct_...
229
230
  {
  #ifdef CONFIG_SYSCTL
0ce490ad4   Gao feng   netfilter: nf_ct_...
231
232
233
234
235
236
237
238
239
240
241
242
  	if (pn->ctl_table)
  		return 0;
  	pn->ctl_table = kmemdup(udp_sysctl_table,
  				sizeof(udp_sysctl_table),
  				GFP_KERNEL);
  	if (!pn->ctl_table)
  		return -ENOMEM;
  	pn->ctl_table[0].data = &un->timeouts[UDP_CT_UNREPLIED];
  	pn->ctl_table[1].data = &un->timeouts[UDP_CT_REPLIED];
  #endif
  	return 0;
  }
dee7364e0   Gao feng   netfilter: nf_ct_...
243
244
  static int udp_kmemdup_compat_sysctl_table(struct nf_proto_net *pn,
  					   struct nf_udp_net *un)
0ce490ad4   Gao feng   netfilter: nf_ct_...
245
246
247
  {
  #ifdef CONFIG_SYSCTL
  #ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
0ce490ad4   Gao feng   netfilter: nf_ct_...
248
249
250
251
252
253
254
255
256
257
258
259
  	pn->ctl_compat_table = kmemdup(udp_compat_sysctl_table,
  				       sizeof(udp_compat_sysctl_table),
  				       GFP_KERNEL);
  	if (!pn->ctl_compat_table)
  		return -ENOMEM;
  
  	pn->ctl_compat_table[0].data = &un->timeouts[UDP_CT_UNREPLIED];
  	pn->ctl_compat_table[1].data = &un->timeouts[UDP_CT_REPLIED];
  #endif
  #endif
  	return 0;
  }
dee7364e0   Gao feng   netfilter: nf_ct_...
260
  static int udp_init_net(struct net *net, u_int16_t proto)
0ce490ad4   Gao feng   netfilter: nf_ct_...
261
262
263
  {
  	int ret;
  	struct nf_udp_net *un = udp_pernet(net);
dee7364e0   Gao feng   netfilter: nf_ct_...
264
  	struct nf_proto_net *pn = &un->pn;
0ce490ad4   Gao feng   netfilter: nf_ct_...
265

dee7364e0   Gao feng   netfilter: nf_ct_...
266
267
  	if (!pn->users) {
  		int i;
0ce490ad4   Gao feng   netfilter: nf_ct_...
268

dee7364e0   Gao feng   netfilter: nf_ct_...
269
270
  		for (i = 0; i < UDP_CT_MAX; i++)
  			un->timeouts[i] = udp_timeouts[i];
0ce490ad4   Gao feng   netfilter: nf_ct_...
271
  	}
0ce490ad4   Gao feng   netfilter: nf_ct_...
272

dee7364e0   Gao feng   netfilter: nf_ct_...
273
274
275
276
  	if (proto == AF_INET) {
  		ret = udp_kmemdup_compat_sysctl_table(pn, un);
  		if (ret < 0)
  			return ret;
0ce490ad4   Gao feng   netfilter: nf_ct_...
277

dee7364e0   Gao feng   netfilter: nf_ct_...
278
279
280
281
282
283
284
  		ret = udp_kmemdup_sysctl_table(pn, un);
  		if (ret < 0)
  			nf_ct_kfree_compat_sysctl_table(pn);
  	} else
  		ret = udp_kmemdup_sysctl_table(pn, un);
  
  	return ret;
0ce490ad4   Gao feng   netfilter: nf_ct_...
285
  }
08911475d   Pablo Neira Ayuso   netfilter: nf_con...
286
287
288
289
  static struct nf_proto_net *udp_get_net_proto(struct net *net)
  {
  	return &net->ct.nf_ct_proto.udp.pn;
  }
61075af51   Patrick McHardy   [NETFILTER]: nf_c...
290
  struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4 __read_mostly =
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
291
292
  {
  	.l3proto		= PF_INET,
605dcad6c   Martin Josefsson   [NETFILTER]: nf_c...
293
  	.l4proto		= IPPROTO_UDP,
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
294
295
296
297
  	.name			= "udp",
  	.pkt_to_tuple		= udp_pkt_to_tuple,
  	.invert_tuple		= udp_invert_tuple,
  	.print_tuple		= udp_print_tuple,
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
298
  	.packet			= udp_packet,
2c8503f55   Pablo Neira Ayuso   netfilter: nf_con...
299
  	.get_timeouts		= udp_get_timeouts,
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
300
  	.new			= udp_new,
96f6bf82e   Patrick McHardy   [NETFILTER]: Conv...
301
  	.error			= udp_error,
c0cd11566   Igor Maravić   net:netfilter: us...
302
  #if IS_ENABLED(CONFIG_NF_CT_NETLINK)
fdf708322   Patrick McHardy   [NETFILTER]: nfne...
303
304
  	.tuple_to_nlattr	= nf_ct_port_tuple_to_nlattr,
  	.nlattr_to_tuple	= nf_ct_port_nlattr_to_tuple,
a400c30ed   Holger Eitzenberger   netfilter: nf_con...
305
  	.nlattr_tuple_size	= nf_ct_port_nlattr_tuple_size,
f73e924cd   Patrick McHardy   [NETFILTER]: ctne...
306
  	.nla_policy		= nf_ct_port_nla_policy,
c1d10adb4   Pablo Neira Ayuso   [NETFILTER]: Add ...
307
  #endif
509784623   Pablo Neira Ayuso   netfilter: add ct...
308
309
310
311
312
313
314
315
316
  #if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT)
  	.ctnl_timeout		= {
  		.nlattr_to_obj	= udp_timeout_nlattr_to_obj,
  		.obj_to_nlattr	= udp_timeout_obj_to_nlattr,
  		.nlattr_max	= CTA_TIMEOUT_UDP_MAX,
  		.obj_size	= sizeof(unsigned int) * CTA_TIMEOUT_UDP_MAX,
  		.nla_policy	= udp_timeout_nla_policy,
  	},
  #endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */
dee7364e0   Gao feng   netfilter: nf_ct_...
317
  	.init_net		= udp_init_net,
08911475d   Pablo Neira Ayuso   netfilter: nf_con...
318
  	.get_net_proto		= udp_get_net_proto,
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
319
  };
13b183391   Patrick McHardy   [NETFILTER]: nf_c...
320
  EXPORT_SYMBOL_GPL(nf_conntrack_l4proto_udp4);
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
321

61075af51   Patrick McHardy   [NETFILTER]: nf_c...
322
  struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6 __read_mostly =
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
323
324
  {
  	.l3proto		= PF_INET6,
605dcad6c   Martin Josefsson   [NETFILTER]: nf_c...
325
  	.l4proto		= IPPROTO_UDP,
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
326
327
328
329
  	.name			= "udp",
  	.pkt_to_tuple		= udp_pkt_to_tuple,
  	.invert_tuple		= udp_invert_tuple,
  	.print_tuple		= udp_print_tuple,
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
330
  	.packet			= udp_packet,
2c8503f55   Pablo Neira Ayuso   netfilter: nf_con...
331
  	.get_timeouts		= udp_get_timeouts,
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
332
  	.new			= udp_new,
96f6bf82e   Patrick McHardy   [NETFILTER]: Conv...
333
  	.error			= udp_error,
c0cd11566   Igor Maravić   net:netfilter: us...
334
  #if IS_ENABLED(CONFIG_NF_CT_NETLINK)
fdf708322   Patrick McHardy   [NETFILTER]: nfne...
335
336
  	.tuple_to_nlattr	= nf_ct_port_tuple_to_nlattr,
  	.nlattr_to_tuple	= nf_ct_port_nlattr_to_tuple,
a400c30ed   Holger Eitzenberger   netfilter: nf_con...
337
  	.nlattr_tuple_size	= nf_ct_port_nlattr_tuple_size,
f73e924cd   Patrick McHardy   [NETFILTER]: ctne...
338
  	.nla_policy		= nf_ct_port_nla_policy,
c1d10adb4   Pablo Neira Ayuso   [NETFILTER]: Add ...
339
  #endif
509784623   Pablo Neira Ayuso   netfilter: add ct...
340
341
342
343
344
345
346
347
348
  #if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT)
  	.ctnl_timeout		= {
  		.nlattr_to_obj	= udp_timeout_nlattr_to_obj,
  		.obj_to_nlattr	= udp_timeout_obj_to_nlattr,
  		.nlattr_max	= CTA_TIMEOUT_UDP_MAX,
  		.obj_size	= sizeof(unsigned int) * CTA_TIMEOUT_UDP_MAX,
  		.nla_policy	= udp_timeout_nla_policy,
  	},
  #endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */
dee7364e0   Gao feng   netfilter: nf_ct_...
349
  	.init_net		= udp_init_net,
08911475d   Pablo Neira Ayuso   netfilter: nf_con...
350
  	.get_net_proto		= udp_get_net_proto,
9fb9cbb10   Yasuyuki Kozakai   [NETFILTER]: Add ...
351
  };
13b183391   Patrick McHardy   [NETFILTER]: nf_c...
352
  EXPORT_SYMBOL_GPL(nf_conntrack_l4proto_udp6);