Revert "brcmfmac: move configuration of probe request IEs"
[platform/kernel/linux-rpi.git] / net / netfilter / nf_synproxy_core.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (c) 2013 Patrick McHardy <kaber@trash.net>
4  */
5
6 #include <linux/module.h>
7 #include <linux/skbuff.h>
8 #include <asm/unaligned.h>
9 #include <net/tcp.h>
10 #include <net/netns/generic.h>
11 #include <linux/proc_fs.h>
12
13 #include <linux/netfilter_ipv6.h>
14 #include <linux/netfilter/nf_synproxy.h>
15
16 #include <net/netfilter/nf_conntrack.h>
17 #include <net/netfilter/nf_conntrack_ecache.h>
18 #include <net/netfilter/nf_conntrack_extend.h>
19 #include <net/netfilter/nf_conntrack_seqadj.h>
20 #include <net/netfilter/nf_conntrack_synproxy.h>
21 #include <net/netfilter/nf_conntrack_zones.h>
22 #include <net/netfilter/nf_synproxy.h>
23
24 unsigned int synproxy_net_id;
25 EXPORT_SYMBOL_GPL(synproxy_net_id);
26
27 bool
28 synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,
29                        const struct tcphdr *th, struct synproxy_options *opts)
30 {
31         int length = (th->doff * 4) - sizeof(*th);
32         u8 buf[40], *ptr;
33
34         if (unlikely(length < 0))
35                 return false;
36
37         ptr = skb_header_pointer(skb, doff + sizeof(*th), length, buf);
38         if (ptr == NULL)
39                 return false;
40
41         opts->options = 0;
42         while (length > 0) {
43                 int opcode = *ptr++;
44                 int opsize;
45
46                 switch (opcode) {
47                 case TCPOPT_EOL:
48                         return true;
49                 case TCPOPT_NOP:
50                         length--;
51                         continue;
52                 default:
53                         if (length < 2)
54                                 return true;
55                         opsize = *ptr++;
56                         if (opsize < 2)
57                                 return true;
58                         if (opsize > length)
59                                 return true;
60
61                         switch (opcode) {
62                         case TCPOPT_MSS:
63                                 if (opsize == TCPOLEN_MSS) {
64                                         opts->mss_option = get_unaligned_be16(ptr);
65                                         opts->options |= NF_SYNPROXY_OPT_MSS;
66                                 }
67                                 break;
68                         case TCPOPT_WINDOW:
69                                 if (opsize == TCPOLEN_WINDOW) {
70                                         opts->wscale = *ptr;
71                                         if (opts->wscale > TCP_MAX_WSCALE)
72                                                 opts->wscale = TCP_MAX_WSCALE;
73                                         opts->options |= NF_SYNPROXY_OPT_WSCALE;
74                                 }
75                                 break;
76                         case TCPOPT_TIMESTAMP:
77                                 if (opsize == TCPOLEN_TIMESTAMP) {
78                                         opts->tsval = get_unaligned_be32(ptr);
79                                         opts->tsecr = get_unaligned_be32(ptr + 4);
80                                         opts->options |= NF_SYNPROXY_OPT_TIMESTAMP;
81                                 }
82                                 break;
83                         case TCPOPT_SACK_PERM:
84                                 if (opsize == TCPOLEN_SACK_PERM)
85                                         opts->options |= NF_SYNPROXY_OPT_SACK_PERM;
86                                 break;
87                         }
88
89                         ptr += opsize - 2;
90                         length -= opsize;
91                 }
92         }
93         return true;
94 }
95 EXPORT_SYMBOL_GPL(synproxy_parse_options);
96
97 static unsigned int
98 synproxy_options_size(const struct synproxy_options *opts)
99 {
100         unsigned int size = 0;
101
102         if (opts->options & NF_SYNPROXY_OPT_MSS)
103                 size += TCPOLEN_MSS_ALIGNED;
104         if (opts->options & NF_SYNPROXY_OPT_TIMESTAMP)
105                 size += TCPOLEN_TSTAMP_ALIGNED;
106         else if (opts->options & NF_SYNPROXY_OPT_SACK_PERM)
107                 size += TCPOLEN_SACKPERM_ALIGNED;
108         if (opts->options & NF_SYNPROXY_OPT_WSCALE)
109                 size += TCPOLEN_WSCALE_ALIGNED;
110
111         return size;
112 }
113
114 static void
115 synproxy_build_options(struct tcphdr *th, const struct synproxy_options *opts)
116 {
117         __be32 *ptr = (__be32 *)(th + 1);
118         u8 options = opts->options;
119
120         if (options & NF_SYNPROXY_OPT_MSS)
121                 *ptr++ = htonl((TCPOPT_MSS << 24) |
122                                (TCPOLEN_MSS << 16) |
123                                opts->mss_option);
124
125         if (options & NF_SYNPROXY_OPT_TIMESTAMP) {
126                 if (options & NF_SYNPROXY_OPT_SACK_PERM)
127                         *ptr++ = htonl((TCPOPT_SACK_PERM << 24) |
128                                        (TCPOLEN_SACK_PERM << 16) |
129                                        (TCPOPT_TIMESTAMP << 8) |
130                                        TCPOLEN_TIMESTAMP);
131                 else
132                         *ptr++ = htonl((TCPOPT_NOP << 24) |
133                                        (TCPOPT_NOP << 16) |
134                                        (TCPOPT_TIMESTAMP << 8) |
135                                        TCPOLEN_TIMESTAMP);
136
137                 *ptr++ = htonl(opts->tsval);
138                 *ptr++ = htonl(opts->tsecr);
139         } else if (options & NF_SYNPROXY_OPT_SACK_PERM)
140                 *ptr++ = htonl((TCPOPT_NOP << 24) |
141                                (TCPOPT_NOP << 16) |
142                                (TCPOPT_SACK_PERM << 8) |
143                                TCPOLEN_SACK_PERM);
144
145         if (options & NF_SYNPROXY_OPT_WSCALE)
146                 *ptr++ = htonl((TCPOPT_NOP << 24) |
147                                (TCPOPT_WINDOW << 16) |
148                                (TCPOLEN_WINDOW << 8) |
149                                opts->wscale);
150 }
151
152 void synproxy_init_timestamp_cookie(const struct nf_synproxy_info *info,
153                                     struct synproxy_options *opts)
154 {
155         opts->tsecr = opts->tsval;
156         opts->tsval = tcp_time_stamp_raw() & ~0x3f;
157
158         if (opts->options & NF_SYNPROXY_OPT_WSCALE) {
159                 opts->tsval |= opts->wscale;
160                 opts->wscale = info->wscale;
161         } else
162                 opts->tsval |= 0xf;
163
164         if (opts->options & NF_SYNPROXY_OPT_SACK_PERM)
165                 opts->tsval |= 1 << 4;
166
167         if (opts->options & NF_SYNPROXY_OPT_ECN)
168                 opts->tsval |= 1 << 5;
169 }
170 EXPORT_SYMBOL_GPL(synproxy_init_timestamp_cookie);
171
172 static void
173 synproxy_check_timestamp_cookie(struct synproxy_options *opts)
174 {
175         opts->wscale = opts->tsecr & 0xf;
176         if (opts->wscale != 0xf)
177                 opts->options |= NF_SYNPROXY_OPT_WSCALE;
178
179         opts->options |= opts->tsecr & (1 << 4) ? NF_SYNPROXY_OPT_SACK_PERM : 0;
180
181         opts->options |= opts->tsecr & (1 << 5) ? NF_SYNPROXY_OPT_ECN : 0;
182 }
183
184 static unsigned int
185 synproxy_tstamp_adjust(struct sk_buff *skb, unsigned int protoff,
186                        struct tcphdr *th, struct nf_conn *ct,
187                        enum ip_conntrack_info ctinfo,
188                        const struct nf_conn_synproxy *synproxy)
189 {
190         unsigned int optoff, optend;
191         __be32 *ptr, old;
192
193         if (synproxy->tsoff == 0)
194                 return 1;
195
196         optoff = protoff + sizeof(struct tcphdr);
197         optend = protoff + th->doff * 4;
198
199         if (skb_ensure_writable(skb, optend))
200                 return 0;
201
202         while (optoff < optend) {
203                 unsigned char *op = skb->data + optoff;
204
205                 switch (op[0]) {
206                 case TCPOPT_EOL:
207                         return 1;
208                 case TCPOPT_NOP:
209                         optoff++;
210                         continue;
211                 default:
212                         if (optoff + 1 == optend ||
213                             optoff + op[1] > optend ||
214                             op[1] < 2)
215                                 return 0;
216                         if (op[0] == TCPOPT_TIMESTAMP &&
217                             op[1] == TCPOLEN_TIMESTAMP) {
218                                 if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) {
219                                         ptr = (__be32 *)&op[2];
220                                         old = *ptr;
221                                         *ptr = htonl(ntohl(*ptr) -
222                                                      synproxy->tsoff);
223                                 } else {
224                                         ptr = (__be32 *)&op[6];
225                                         old = *ptr;
226                                         *ptr = htonl(ntohl(*ptr) +
227                                                      synproxy->tsoff);
228                                 }
229                                 inet_proto_csum_replace4(&th->check, skb,
230                                                          old, *ptr, false);
231                                 return 1;
232                         }
233                         optoff += op[1];
234                 }
235         }
236         return 1;
237 }
238
239 static struct nf_ct_ext_type nf_ct_synproxy_extend __read_mostly = {
240         .len            = sizeof(struct nf_conn_synproxy),
241         .align          = __alignof__(struct nf_conn_synproxy),
242         .id             = NF_CT_EXT_SYNPROXY,
243 };
244
245 #ifdef CONFIG_PROC_FS
246 static void *synproxy_cpu_seq_start(struct seq_file *seq, loff_t *pos)
247 {
248         struct synproxy_net *snet = synproxy_pernet(seq_file_net(seq));
249         int cpu;
250
251         if (*pos == 0)
252                 return SEQ_START_TOKEN;
253
254         for (cpu = *pos - 1; cpu < nr_cpu_ids; cpu++) {
255                 if (!cpu_possible(cpu))
256                         continue;
257                 *pos = cpu + 1;
258                 return per_cpu_ptr(snet->stats, cpu);
259         }
260
261         return NULL;
262 }
263
264 static void *synproxy_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos)
265 {
266         struct synproxy_net *snet = synproxy_pernet(seq_file_net(seq));
267         int cpu;
268
269         for (cpu = *pos; cpu < nr_cpu_ids; cpu++) {
270                 if (!cpu_possible(cpu))
271                         continue;
272                 *pos = cpu + 1;
273                 return per_cpu_ptr(snet->stats, cpu);
274         }
275         (*pos)++;
276         return NULL;
277 }
278
279 static void synproxy_cpu_seq_stop(struct seq_file *seq, void *v)
280 {
281         return;
282 }
283
284 static int synproxy_cpu_seq_show(struct seq_file *seq, void *v)
285 {
286         struct synproxy_stats *stats = v;
287
288         if (v == SEQ_START_TOKEN) {
289                 seq_puts(seq, "entries\t\tsyn_received\t"
290                               "cookie_invalid\tcookie_valid\t"
291                               "cookie_retrans\tconn_reopened\n");
292                 return 0;
293         }
294
295         seq_printf(seq, "%08x\t%08x\t%08x\t%08x\t%08x\t%08x\n", 0,
296                    stats->syn_received,
297                    stats->cookie_invalid,
298                    stats->cookie_valid,
299                    stats->cookie_retrans,
300                    stats->conn_reopened);
301
302         return 0;
303 }
304
305 static const struct seq_operations synproxy_cpu_seq_ops = {
306         .start          = synproxy_cpu_seq_start,
307         .next           = synproxy_cpu_seq_next,
308         .stop           = synproxy_cpu_seq_stop,
309         .show           = synproxy_cpu_seq_show,
310 };
311
312 static int __net_init synproxy_proc_init(struct net *net)
313 {
314         if (!proc_create_net("synproxy", 0444, net->proc_net_stat,
315                         &synproxy_cpu_seq_ops, sizeof(struct seq_net_private)))
316                 return -ENOMEM;
317         return 0;
318 }
319
320 static void __net_exit synproxy_proc_exit(struct net *net)
321 {
322         remove_proc_entry("synproxy", net->proc_net_stat);
323 }
324 #else
325 static int __net_init synproxy_proc_init(struct net *net)
326 {
327         return 0;
328 }
329
330 static void __net_exit synproxy_proc_exit(struct net *net)
331 {
332         return;
333 }
334 #endif /* CONFIG_PROC_FS */
335
336 static int __net_init synproxy_net_init(struct net *net)
337 {
338         struct synproxy_net *snet = synproxy_pernet(net);
339         struct nf_conn *ct;
340         int err = -ENOMEM;
341
342         ct = nf_ct_tmpl_alloc(net, &nf_ct_zone_dflt, GFP_KERNEL);
343         if (!ct)
344                 goto err1;
345
346         if (!nfct_seqadj_ext_add(ct))
347                 goto err2;
348         if (!nfct_synproxy_ext_add(ct))
349                 goto err2;
350
351         __set_bit(IPS_CONFIRMED_BIT, &ct->status);
352         snet->tmpl = ct;
353
354         snet->stats = alloc_percpu(struct synproxy_stats);
355         if (snet->stats == NULL)
356                 goto err2;
357
358         err = synproxy_proc_init(net);
359         if (err < 0)
360                 goto err3;
361
362         return 0;
363
364 err3:
365         free_percpu(snet->stats);
366 err2:
367         nf_ct_tmpl_free(ct);
368 err1:
369         return err;
370 }
371
372 static void __net_exit synproxy_net_exit(struct net *net)
373 {
374         struct synproxy_net *snet = synproxy_pernet(net);
375
376         nf_ct_put(snet->tmpl);
377         synproxy_proc_exit(net);
378         free_percpu(snet->stats);
379 }
380
381 static struct pernet_operations synproxy_net_ops = {
382         .init           = synproxy_net_init,
383         .exit           = synproxy_net_exit,
384         .id             = &synproxy_net_id,
385         .size           = sizeof(struct synproxy_net),
386 };
387
388 static int __init synproxy_core_init(void)
389 {
390         int err;
391
392         err = nf_ct_extend_register(&nf_ct_synproxy_extend);
393         if (err < 0)
394                 goto err1;
395
396         err = register_pernet_subsys(&synproxy_net_ops);
397         if (err < 0)
398                 goto err2;
399
400         return 0;
401
402 err2:
403         nf_ct_extend_unregister(&nf_ct_synproxy_extend);
404 err1:
405         return err;
406 }
407
408 static void __exit synproxy_core_exit(void)
409 {
410         unregister_pernet_subsys(&synproxy_net_ops);
411         nf_ct_extend_unregister(&nf_ct_synproxy_extend);
412 }
413
414 module_init(synproxy_core_init);
415 module_exit(synproxy_core_exit);
416
417 static struct iphdr *
418 synproxy_build_ip(struct net *net, struct sk_buff *skb, __be32 saddr,
419                   __be32 daddr)
420 {
421         struct iphdr *iph;
422
423         skb_reset_network_header(skb);
424         iph = skb_put(skb, sizeof(*iph));
425         iph->version    = 4;
426         iph->ihl        = sizeof(*iph) / 4;
427         iph->tos        = 0;
428         iph->id         = 0;
429         iph->frag_off   = htons(IP_DF);
430         iph->ttl        = READ_ONCE(net->ipv4.sysctl_ip_default_ttl);
431         iph->protocol   = IPPROTO_TCP;
432         iph->check      = 0;
433         iph->saddr      = saddr;
434         iph->daddr      = daddr;
435
436         return iph;
437 }
438
439 static void
440 synproxy_send_tcp(struct net *net,
441                   const struct sk_buff *skb, struct sk_buff *nskb,
442                   struct nf_conntrack *nfct, enum ip_conntrack_info ctinfo,
443                   struct iphdr *niph, struct tcphdr *nth,
444                   unsigned int tcp_hdr_size)
445 {
446         nth->check = ~tcp_v4_check(tcp_hdr_size, niph->saddr, niph->daddr, 0);
447         nskb->ip_summed   = CHECKSUM_PARTIAL;
448         nskb->csum_start  = (unsigned char *)nth - nskb->head;
449         nskb->csum_offset = offsetof(struct tcphdr, check);
450
451         skb_dst_set_noref(nskb, skb_dst(skb));
452         nskb->protocol = htons(ETH_P_IP);
453         if (ip_route_me_harder(net, nskb->sk, nskb, RTN_UNSPEC))
454                 goto free_nskb;
455
456         if (nfct) {
457                 nf_ct_set(nskb, (struct nf_conn *)nfct, ctinfo);
458                 nf_conntrack_get(nfct);
459         }
460
461         ip_local_out(net, nskb->sk, nskb);
462         return;
463
464 free_nskb:
465         kfree_skb(nskb);
466 }
467
468 void
469 synproxy_send_client_synack(struct net *net,
470                             const struct sk_buff *skb, const struct tcphdr *th,
471                             const struct synproxy_options *opts)
472 {
473         struct sk_buff *nskb;
474         struct iphdr *iph, *niph;
475         struct tcphdr *nth;
476         unsigned int tcp_hdr_size;
477         u16 mss = opts->mss_encode;
478
479         iph = ip_hdr(skb);
480
481         tcp_hdr_size = sizeof(*nth) + synproxy_options_size(opts);
482         nskb = alloc_skb(sizeof(*niph) + tcp_hdr_size + MAX_TCP_HEADER,
483                          GFP_ATOMIC);
484         if (!nskb)
485                 return;
486         skb_reserve(nskb, MAX_TCP_HEADER);
487
488         niph = synproxy_build_ip(net, nskb, iph->daddr, iph->saddr);
489
490         skb_reset_transport_header(nskb);
491         nth = skb_put(nskb, tcp_hdr_size);
492         nth->source     = th->dest;
493         nth->dest       = th->source;
494         nth->seq        = htonl(__cookie_v4_init_sequence(iph, th, &mss));
495         nth->ack_seq    = htonl(ntohl(th->seq) + 1);
496         tcp_flag_word(nth) = TCP_FLAG_SYN | TCP_FLAG_ACK;
497         if (opts->options & NF_SYNPROXY_OPT_ECN)
498                 tcp_flag_word(nth) |= TCP_FLAG_ECE;
499         nth->doff       = tcp_hdr_size / 4;
500         nth->window     = 0;
501         nth->check      = 0;
502         nth->urg_ptr    = 0;
503
504         synproxy_build_options(nth, opts);
505
506         synproxy_send_tcp(net, skb, nskb, skb_nfct(skb),
507                           IP_CT_ESTABLISHED_REPLY, niph, nth, tcp_hdr_size);
508 }
509 EXPORT_SYMBOL_GPL(synproxy_send_client_synack);
510
511 static void
512 synproxy_send_server_syn(struct net *net,
513                          const struct sk_buff *skb, const struct tcphdr *th,
514                          const struct synproxy_options *opts, u32 recv_seq)
515 {
516         struct synproxy_net *snet = synproxy_pernet(net);
517         struct sk_buff *nskb;
518         struct iphdr *iph, *niph;
519         struct tcphdr *nth;
520         unsigned int tcp_hdr_size;
521
522         iph = ip_hdr(skb);
523
524         tcp_hdr_size = sizeof(*nth) + synproxy_options_size(opts);
525         nskb = alloc_skb(sizeof(*niph) + tcp_hdr_size + MAX_TCP_HEADER,
526                          GFP_ATOMIC);
527         if (!nskb)
528                 return;
529         skb_reserve(nskb, MAX_TCP_HEADER);
530
531         niph = synproxy_build_ip(net, nskb, iph->saddr, iph->daddr);
532
533         skb_reset_transport_header(nskb);
534         nth = skb_put(nskb, tcp_hdr_size);
535         nth->source     = th->source;
536         nth->dest       = th->dest;
537         nth->seq        = htonl(recv_seq - 1);
538         /* ack_seq is used to relay our ISN to the synproxy hook to initialize
539          * sequence number translation once a connection tracking entry exists.
540          */
541         nth->ack_seq    = htonl(ntohl(th->ack_seq) - 1);
542         tcp_flag_word(nth) = TCP_FLAG_SYN;
543         if (opts->options & NF_SYNPROXY_OPT_ECN)
544                 tcp_flag_word(nth) |= TCP_FLAG_ECE | TCP_FLAG_CWR;
545         nth->doff       = tcp_hdr_size / 4;
546         nth->window     = th->window;
547         nth->check      = 0;
548         nth->urg_ptr    = 0;
549
550         synproxy_build_options(nth, opts);
551
552         synproxy_send_tcp(net, skb, nskb, &snet->tmpl->ct_general, IP_CT_NEW,
553                           niph, nth, tcp_hdr_size);
554 }
555
556 static void
557 synproxy_send_server_ack(struct net *net,
558                          const struct ip_ct_tcp *state,
559                          const struct sk_buff *skb, const struct tcphdr *th,
560                          const struct synproxy_options *opts)
561 {
562         struct sk_buff *nskb;
563         struct iphdr *iph, *niph;
564         struct tcphdr *nth;
565         unsigned int tcp_hdr_size;
566
567         iph = ip_hdr(skb);
568
569         tcp_hdr_size = sizeof(*nth) + synproxy_options_size(opts);
570         nskb = alloc_skb(sizeof(*niph) + tcp_hdr_size + MAX_TCP_HEADER,
571                          GFP_ATOMIC);
572         if (!nskb)
573                 return;
574         skb_reserve(nskb, MAX_TCP_HEADER);
575
576         niph = synproxy_build_ip(net, nskb, iph->daddr, iph->saddr);
577
578         skb_reset_transport_header(nskb);
579         nth = skb_put(nskb, tcp_hdr_size);
580         nth->source     = th->dest;
581         nth->dest       = th->source;
582         nth->seq        = htonl(ntohl(th->ack_seq));
583         nth->ack_seq    = htonl(ntohl(th->seq) + 1);
584         tcp_flag_word(nth) = TCP_FLAG_ACK;
585         nth->doff       = tcp_hdr_size / 4;
586         nth->window     = htons(state->seen[IP_CT_DIR_ORIGINAL].td_maxwin);
587         nth->check      = 0;
588         nth->urg_ptr    = 0;
589
590         synproxy_build_options(nth, opts);
591
592         synproxy_send_tcp(net, skb, nskb, NULL, 0, niph, nth, tcp_hdr_size);
593 }
594
595 static void
596 synproxy_send_client_ack(struct net *net,
597                          const struct sk_buff *skb, const struct tcphdr *th,
598                          const struct synproxy_options *opts)
599 {
600         struct sk_buff *nskb;
601         struct iphdr *iph, *niph;
602         struct tcphdr *nth;
603         unsigned int tcp_hdr_size;
604
605         iph = ip_hdr(skb);
606
607         tcp_hdr_size = sizeof(*nth) + synproxy_options_size(opts);
608         nskb = alloc_skb(sizeof(*niph) + tcp_hdr_size + MAX_TCP_HEADER,
609                          GFP_ATOMIC);
610         if (!nskb)
611                 return;
612         skb_reserve(nskb, MAX_TCP_HEADER);
613
614         niph = synproxy_build_ip(net, nskb, iph->saddr, iph->daddr);
615
616         skb_reset_transport_header(nskb);
617         nth = skb_put(nskb, tcp_hdr_size);
618         nth->source     = th->source;
619         nth->dest       = th->dest;
620         nth->seq        = htonl(ntohl(th->seq) + 1);
621         nth->ack_seq    = th->ack_seq;
622         tcp_flag_word(nth) = TCP_FLAG_ACK;
623         nth->doff       = tcp_hdr_size / 4;
624         nth->window     = htons(ntohs(th->window) >> opts->wscale);
625         nth->check      = 0;
626         nth->urg_ptr    = 0;
627
628         synproxy_build_options(nth, opts);
629
630         synproxy_send_tcp(net, skb, nskb, skb_nfct(skb),
631                           IP_CT_ESTABLISHED_REPLY, niph, nth, tcp_hdr_size);
632 }
633
634 bool
635 synproxy_recv_client_ack(struct net *net,
636                          const struct sk_buff *skb, const struct tcphdr *th,
637                          struct synproxy_options *opts, u32 recv_seq)
638 {
639         struct synproxy_net *snet = synproxy_pernet(net);
640         int mss;
641
642         mss = __cookie_v4_check(ip_hdr(skb), th, ntohl(th->ack_seq) - 1);
643         if (mss == 0) {
644                 this_cpu_inc(snet->stats->cookie_invalid);
645                 return false;
646         }
647
648         this_cpu_inc(snet->stats->cookie_valid);
649         opts->mss_option = mss;
650         opts->options |= NF_SYNPROXY_OPT_MSS;
651
652         if (opts->options & NF_SYNPROXY_OPT_TIMESTAMP)
653                 synproxy_check_timestamp_cookie(opts);
654
655         synproxy_send_server_syn(net, skb, th, opts, recv_seq);
656         return true;
657 }
658 EXPORT_SYMBOL_GPL(synproxy_recv_client_ack);
659
660 unsigned int
661 ipv4_synproxy_hook(void *priv, struct sk_buff *skb,
662                    const struct nf_hook_state *nhs)
663 {
664         struct net *net = nhs->net;
665         struct synproxy_net *snet = synproxy_pernet(net);
666         enum ip_conntrack_info ctinfo;
667         struct nf_conn *ct;
668         struct nf_conn_synproxy *synproxy;
669         struct synproxy_options opts = {};
670         const struct ip_ct_tcp *state;
671         struct tcphdr *th, _th;
672         unsigned int thoff;
673
674         ct = nf_ct_get(skb, &ctinfo);
675         if (!ct)
676                 return NF_ACCEPT;
677
678         synproxy = nfct_synproxy(ct);
679         if (!synproxy)
680                 return NF_ACCEPT;
681
682         if (nf_is_loopback_packet(skb) ||
683             ip_hdr(skb)->protocol != IPPROTO_TCP)
684                 return NF_ACCEPT;
685
686         thoff = ip_hdrlen(skb);
687         th = skb_header_pointer(skb, thoff, sizeof(_th), &_th);
688         if (!th)
689                 return NF_DROP;
690
691         state = &ct->proto.tcp;
692         switch (state->state) {
693         case TCP_CONNTRACK_CLOSE:
694                 if (th->rst && CTINFO2DIR(ctinfo) != IP_CT_DIR_ORIGINAL) {
695                         nf_ct_seqadj_init(ct, ctinfo, synproxy->isn -
696                                                       ntohl(th->seq) + 1);
697                         break;
698                 }
699
700                 if (!th->syn || th->ack ||
701                     CTINFO2DIR(ctinfo) != IP_CT_DIR_ORIGINAL)
702                         break;
703
704                 /* Reopened connection - reset the sequence number and timestamp
705                  * adjustments, they will get initialized once the connection is
706                  * reestablished.
707                  */
708                 nf_ct_seqadj_init(ct, ctinfo, 0);
709                 synproxy->tsoff = 0;
710                 this_cpu_inc(snet->stats->conn_reopened);
711                 fallthrough;
712         case TCP_CONNTRACK_SYN_SENT:
713                 if (!synproxy_parse_options(skb, thoff, th, &opts))
714                         return NF_DROP;
715
716                 if (!th->syn && th->ack &&
717                     CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) {
718                         /* Keep-Alives are sent with SEG.SEQ = SND.NXT-1,
719                          * therefore we need to add 1 to make the SYN sequence
720                          * number match the one of first SYN.
721                          */
722                         if (synproxy_recv_client_ack(net, skb, th, &opts,
723                                                      ntohl(th->seq) + 1)) {
724                                 this_cpu_inc(snet->stats->cookie_retrans);
725                                 consume_skb(skb);
726                                 return NF_STOLEN;
727                         } else {
728                                 return NF_DROP;
729                         }
730                 }
731
732                 synproxy->isn = ntohl(th->ack_seq);
733                 if (opts.options & NF_SYNPROXY_OPT_TIMESTAMP)
734                         synproxy->its = opts.tsecr;
735
736                 nf_conntrack_event_cache(IPCT_SYNPROXY, ct);
737                 break;
738         case TCP_CONNTRACK_SYN_RECV:
739                 if (!th->syn || !th->ack)
740                         break;
741
742                 if (!synproxy_parse_options(skb, thoff, th, &opts))
743                         return NF_DROP;
744
745                 if (opts.options & NF_SYNPROXY_OPT_TIMESTAMP) {
746                         synproxy->tsoff = opts.tsval - synproxy->its;
747                         nf_conntrack_event_cache(IPCT_SYNPROXY, ct);
748                 }
749
750                 opts.options &= ~(NF_SYNPROXY_OPT_MSS |
751                                   NF_SYNPROXY_OPT_WSCALE |
752                                   NF_SYNPROXY_OPT_SACK_PERM);
753
754                 swap(opts.tsval, opts.tsecr);
755                 synproxy_send_server_ack(net, state, skb, th, &opts);
756
757                 nf_ct_seqadj_init(ct, ctinfo, synproxy->isn - ntohl(th->seq));
758                 nf_conntrack_event_cache(IPCT_SEQADJ, ct);
759
760                 swap(opts.tsval, opts.tsecr);
761                 synproxy_send_client_ack(net, skb, th, &opts);
762
763                 consume_skb(skb);
764                 return NF_STOLEN;
765         default:
766                 break;
767         }
768
769         synproxy_tstamp_adjust(skb, thoff, th, ct, ctinfo, synproxy);
770         return NF_ACCEPT;
771 }
772 EXPORT_SYMBOL_GPL(ipv4_synproxy_hook);
773
774 static const struct nf_hook_ops ipv4_synproxy_ops[] = {
775         {
776                 .hook           = ipv4_synproxy_hook,
777                 .pf             = NFPROTO_IPV4,
778                 .hooknum        = NF_INET_LOCAL_IN,
779                 .priority       = NF_IP_PRI_CONNTRACK_CONFIRM - 1,
780         },
781         {
782                 .hook           = ipv4_synproxy_hook,
783                 .pf             = NFPROTO_IPV4,
784                 .hooknum        = NF_INET_POST_ROUTING,
785                 .priority       = NF_IP_PRI_CONNTRACK_CONFIRM - 1,
786         },
787 };
788
789 int nf_synproxy_ipv4_init(struct synproxy_net *snet, struct net *net)
790 {
791         int err;
792
793         if (snet->hook_ref4 == 0) {
794                 err = nf_register_net_hooks(net, ipv4_synproxy_ops,
795                                             ARRAY_SIZE(ipv4_synproxy_ops));
796                 if (err)
797                         return err;
798         }
799
800         snet->hook_ref4++;
801         return 0;
802 }
803 EXPORT_SYMBOL_GPL(nf_synproxy_ipv4_init);
804
805 void nf_synproxy_ipv4_fini(struct synproxy_net *snet, struct net *net)
806 {
807         snet->hook_ref4--;
808         if (snet->hook_ref4 == 0)
809                 nf_unregister_net_hooks(net, ipv4_synproxy_ops,
810                                         ARRAY_SIZE(ipv4_synproxy_ops));
811 }
812 EXPORT_SYMBOL_GPL(nf_synproxy_ipv4_fini);
813
814 #if IS_ENABLED(CONFIG_IPV6)
815 static struct ipv6hdr *
816 synproxy_build_ip_ipv6(struct net *net, struct sk_buff *skb,
817                        const struct in6_addr *saddr,
818                        const struct in6_addr *daddr)
819 {
820         struct ipv6hdr *iph;
821
822         skb_reset_network_header(skb);
823         iph = skb_put(skb, sizeof(*iph));
824         ip6_flow_hdr(iph, 0, 0);
825         iph->hop_limit  = net->ipv6.devconf_all->hop_limit;
826         iph->nexthdr    = IPPROTO_TCP;
827         iph->saddr      = *saddr;
828         iph->daddr      = *daddr;
829
830         return iph;
831 }
832
833 static void
834 synproxy_send_tcp_ipv6(struct net *net,
835                        const struct sk_buff *skb, struct sk_buff *nskb,
836                        struct nf_conntrack *nfct, enum ip_conntrack_info ctinfo,
837                        struct ipv6hdr *niph, struct tcphdr *nth,
838                        unsigned int tcp_hdr_size)
839 {
840         struct dst_entry *dst;
841         struct flowi6 fl6;
842         int err;
843
844         nth->check = ~tcp_v6_check(tcp_hdr_size, &niph->saddr, &niph->daddr, 0);
845         nskb->ip_summed   = CHECKSUM_PARTIAL;
846         nskb->csum_start  = (unsigned char *)nth - nskb->head;
847         nskb->csum_offset = offsetof(struct tcphdr, check);
848
849         memset(&fl6, 0, sizeof(fl6));
850         fl6.flowi6_proto = IPPROTO_TCP;
851         fl6.saddr = niph->saddr;
852         fl6.daddr = niph->daddr;
853         fl6.fl6_sport = nth->source;
854         fl6.fl6_dport = nth->dest;
855         security_skb_classify_flow((struct sk_buff *)skb,
856                                    flowi6_to_flowi_common(&fl6));
857         err = nf_ip6_route(net, &dst, flowi6_to_flowi(&fl6), false);
858         if (err) {
859                 goto free_nskb;
860         }
861
862         dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0);
863         if (IS_ERR(dst))
864                 goto free_nskb;
865
866         skb_dst_set(nskb, dst);
867
868         if (nfct) {
869                 nf_ct_set(nskb, (struct nf_conn *)nfct, ctinfo);
870                 nf_conntrack_get(nfct);
871         }
872
873         ip6_local_out(net, nskb->sk, nskb);
874         return;
875
876 free_nskb:
877         kfree_skb(nskb);
878 }
879
880 void
881 synproxy_send_client_synack_ipv6(struct net *net,
882                                  const struct sk_buff *skb,
883                                  const struct tcphdr *th,
884                                  const struct synproxy_options *opts)
885 {
886         struct sk_buff *nskb;
887         struct ipv6hdr *iph, *niph;
888         struct tcphdr *nth;
889         unsigned int tcp_hdr_size;
890         u16 mss = opts->mss_encode;
891
892         iph = ipv6_hdr(skb);
893
894         tcp_hdr_size = sizeof(*nth) + synproxy_options_size(opts);
895         nskb = alloc_skb(sizeof(*niph) + tcp_hdr_size + MAX_TCP_HEADER,
896                          GFP_ATOMIC);
897         if (!nskb)
898                 return;
899         skb_reserve(nskb, MAX_TCP_HEADER);
900
901         niph = synproxy_build_ip_ipv6(net, nskb, &iph->daddr, &iph->saddr);
902
903         skb_reset_transport_header(nskb);
904         nth = skb_put(nskb, tcp_hdr_size);
905         nth->source     = th->dest;
906         nth->dest       = th->source;
907         nth->seq        = htonl(nf_ipv6_cookie_init_sequence(iph, th, &mss));
908         nth->ack_seq    = htonl(ntohl(th->seq) + 1);
909         tcp_flag_word(nth) = TCP_FLAG_SYN | TCP_FLAG_ACK;
910         if (opts->options & NF_SYNPROXY_OPT_ECN)
911                 tcp_flag_word(nth) |= TCP_FLAG_ECE;
912         nth->doff       = tcp_hdr_size / 4;
913         nth->window     = 0;
914         nth->check      = 0;
915         nth->urg_ptr    = 0;
916
917         synproxy_build_options(nth, opts);
918
919         synproxy_send_tcp_ipv6(net, skb, nskb, skb_nfct(skb),
920                                IP_CT_ESTABLISHED_REPLY, niph, nth,
921                                tcp_hdr_size);
922 }
923 EXPORT_SYMBOL_GPL(synproxy_send_client_synack_ipv6);
924
925 static void
926 synproxy_send_server_syn_ipv6(struct net *net, const struct sk_buff *skb,
927                               const struct tcphdr *th,
928                               const struct synproxy_options *opts, u32 recv_seq)
929 {
930         struct synproxy_net *snet = synproxy_pernet(net);
931         struct sk_buff *nskb;
932         struct ipv6hdr *iph, *niph;
933         struct tcphdr *nth;
934         unsigned int tcp_hdr_size;
935
936         iph = ipv6_hdr(skb);
937
938         tcp_hdr_size = sizeof(*nth) + synproxy_options_size(opts);
939         nskb = alloc_skb(sizeof(*niph) + tcp_hdr_size + MAX_TCP_HEADER,
940                          GFP_ATOMIC);
941         if (!nskb)
942                 return;
943         skb_reserve(nskb, MAX_TCP_HEADER);
944
945         niph = synproxy_build_ip_ipv6(net, nskb, &iph->saddr, &iph->daddr);
946
947         skb_reset_transport_header(nskb);
948         nth = skb_put(nskb, tcp_hdr_size);
949         nth->source     = th->source;
950         nth->dest       = th->dest;
951         nth->seq        = htonl(recv_seq - 1);
952         /* ack_seq is used to relay our ISN to the synproxy hook to initialize
953          * sequence number translation once a connection tracking entry exists.
954          */
955         nth->ack_seq    = htonl(ntohl(th->ack_seq) - 1);
956         tcp_flag_word(nth) = TCP_FLAG_SYN;
957         if (opts->options & NF_SYNPROXY_OPT_ECN)
958                 tcp_flag_word(nth) |= TCP_FLAG_ECE | TCP_FLAG_CWR;
959         nth->doff       = tcp_hdr_size / 4;
960         nth->window     = th->window;
961         nth->check      = 0;
962         nth->urg_ptr    = 0;
963
964         synproxy_build_options(nth, opts);
965
966         synproxy_send_tcp_ipv6(net, skb, nskb, &snet->tmpl->ct_general,
967                                IP_CT_NEW, niph, nth, tcp_hdr_size);
968 }
969
970 static void
971 synproxy_send_server_ack_ipv6(struct net *net, const struct ip_ct_tcp *state,
972                               const struct sk_buff *skb,
973                               const struct tcphdr *th,
974                               const struct synproxy_options *opts)
975 {
976         struct sk_buff *nskb;
977         struct ipv6hdr *iph, *niph;
978         struct tcphdr *nth;
979         unsigned int tcp_hdr_size;
980
981         iph = ipv6_hdr(skb);
982
983         tcp_hdr_size = sizeof(*nth) + synproxy_options_size(opts);
984         nskb = alloc_skb(sizeof(*niph) + tcp_hdr_size + MAX_TCP_HEADER,
985                          GFP_ATOMIC);
986         if (!nskb)
987                 return;
988         skb_reserve(nskb, MAX_TCP_HEADER);
989
990         niph = synproxy_build_ip_ipv6(net, nskb, &iph->daddr, &iph->saddr);
991
992         skb_reset_transport_header(nskb);
993         nth = skb_put(nskb, tcp_hdr_size);
994         nth->source     = th->dest;
995         nth->dest       = th->source;
996         nth->seq        = htonl(ntohl(th->ack_seq));
997         nth->ack_seq    = htonl(ntohl(th->seq) + 1);
998         tcp_flag_word(nth) = TCP_FLAG_ACK;
999         nth->doff       = tcp_hdr_size / 4;
1000         nth->window     = htons(state->seen[IP_CT_DIR_ORIGINAL].td_maxwin);
1001         nth->check      = 0;
1002         nth->urg_ptr    = 0;
1003
1004         synproxy_build_options(nth, opts);
1005
1006         synproxy_send_tcp_ipv6(net, skb, nskb, NULL, 0, niph, nth,
1007                                tcp_hdr_size);
1008 }
1009
1010 static void
1011 synproxy_send_client_ack_ipv6(struct net *net, const struct sk_buff *skb,
1012                               const struct tcphdr *th,
1013                               const struct synproxy_options *opts)
1014 {
1015         struct sk_buff *nskb;
1016         struct ipv6hdr *iph, *niph;
1017         struct tcphdr *nth;
1018         unsigned int tcp_hdr_size;
1019
1020         iph = ipv6_hdr(skb);
1021
1022         tcp_hdr_size = sizeof(*nth) + synproxy_options_size(opts);
1023         nskb = alloc_skb(sizeof(*niph) + tcp_hdr_size + MAX_TCP_HEADER,
1024                          GFP_ATOMIC);
1025         if (!nskb)
1026                 return;
1027         skb_reserve(nskb, MAX_TCP_HEADER);
1028
1029         niph = synproxy_build_ip_ipv6(net, nskb, &iph->saddr, &iph->daddr);
1030
1031         skb_reset_transport_header(nskb);
1032         nth = skb_put(nskb, tcp_hdr_size);
1033         nth->source     = th->source;
1034         nth->dest       = th->dest;
1035         nth->seq        = htonl(ntohl(th->seq) + 1);
1036         nth->ack_seq    = th->ack_seq;
1037         tcp_flag_word(nth) = TCP_FLAG_ACK;
1038         nth->doff       = tcp_hdr_size / 4;
1039         nth->window     = htons(ntohs(th->window) >> opts->wscale);
1040         nth->check      = 0;
1041         nth->urg_ptr    = 0;
1042
1043         synproxy_build_options(nth, opts);
1044
1045         synproxy_send_tcp_ipv6(net, skb, nskb, skb_nfct(skb),
1046                                IP_CT_ESTABLISHED_REPLY, niph, nth,
1047                                tcp_hdr_size);
1048 }
1049
1050 bool
1051 synproxy_recv_client_ack_ipv6(struct net *net,
1052                               const struct sk_buff *skb,
1053                               const struct tcphdr *th,
1054                               struct synproxy_options *opts, u32 recv_seq)
1055 {
1056         struct synproxy_net *snet = synproxy_pernet(net);
1057         int mss;
1058
1059         mss = nf_cookie_v6_check(ipv6_hdr(skb), th, ntohl(th->ack_seq) - 1);
1060         if (mss == 0) {
1061                 this_cpu_inc(snet->stats->cookie_invalid);
1062                 return false;
1063         }
1064
1065         this_cpu_inc(snet->stats->cookie_valid);
1066         opts->mss_option = mss;
1067         opts->options |= NF_SYNPROXY_OPT_MSS;
1068
1069         if (opts->options & NF_SYNPROXY_OPT_TIMESTAMP)
1070                 synproxy_check_timestamp_cookie(opts);
1071
1072         synproxy_send_server_syn_ipv6(net, skb, th, opts, recv_seq);
1073         return true;
1074 }
1075 EXPORT_SYMBOL_GPL(synproxy_recv_client_ack_ipv6);
1076
1077 unsigned int
1078 ipv6_synproxy_hook(void *priv, struct sk_buff *skb,
1079                    const struct nf_hook_state *nhs)
1080 {
1081         struct net *net = nhs->net;
1082         struct synproxy_net *snet = synproxy_pernet(net);
1083         enum ip_conntrack_info ctinfo;
1084         struct nf_conn *ct;
1085         struct nf_conn_synproxy *synproxy;
1086         struct synproxy_options opts = {};
1087         const struct ip_ct_tcp *state;
1088         struct tcphdr *th, _th;
1089         __be16 frag_off;
1090         u8 nexthdr;
1091         int thoff;
1092
1093         ct = nf_ct_get(skb, &ctinfo);
1094         if (!ct)
1095                 return NF_ACCEPT;
1096
1097         synproxy = nfct_synproxy(ct);
1098         if (!synproxy)
1099                 return NF_ACCEPT;
1100
1101         if (nf_is_loopback_packet(skb))
1102                 return NF_ACCEPT;
1103
1104         nexthdr = ipv6_hdr(skb)->nexthdr;
1105         thoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr,
1106                                  &frag_off);
1107         if (thoff < 0 || nexthdr != IPPROTO_TCP)
1108                 return NF_ACCEPT;
1109
1110         th = skb_header_pointer(skb, thoff, sizeof(_th), &_th);
1111         if (!th)
1112                 return NF_DROP;
1113
1114         state = &ct->proto.tcp;
1115         switch (state->state) {
1116         case TCP_CONNTRACK_CLOSE:
1117                 if (th->rst && CTINFO2DIR(ctinfo) != IP_CT_DIR_ORIGINAL) {
1118                         nf_ct_seqadj_init(ct, ctinfo, synproxy->isn -
1119                                                       ntohl(th->seq) + 1);
1120                         break;
1121                 }
1122
1123                 if (!th->syn || th->ack ||
1124                     CTINFO2DIR(ctinfo) != IP_CT_DIR_ORIGINAL)
1125                         break;
1126
1127                 /* Reopened connection - reset the sequence number and timestamp
1128                  * adjustments, they will get initialized once the connection is
1129                  * reestablished.
1130                  */
1131                 nf_ct_seqadj_init(ct, ctinfo, 0);
1132                 synproxy->tsoff = 0;
1133                 this_cpu_inc(snet->stats->conn_reopened);
1134                 fallthrough;
1135         case TCP_CONNTRACK_SYN_SENT:
1136                 if (!synproxy_parse_options(skb, thoff, th, &opts))
1137                         return NF_DROP;
1138
1139                 if (!th->syn && th->ack &&
1140                     CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) {
1141                         /* Keep-Alives are sent with SEG.SEQ = SND.NXT-1,
1142                          * therefore we need to add 1 to make the SYN sequence
1143                          * number match the one of first SYN.
1144                          */
1145                         if (synproxy_recv_client_ack_ipv6(net, skb, th, &opts,
1146                                                           ntohl(th->seq) + 1)) {
1147                                 this_cpu_inc(snet->stats->cookie_retrans);
1148                                 consume_skb(skb);
1149                                 return NF_STOLEN;
1150                         } else {
1151                                 return NF_DROP;
1152                         }
1153                 }
1154
1155                 synproxy->isn = ntohl(th->ack_seq);
1156                 if (opts.options & NF_SYNPROXY_OPT_TIMESTAMP)
1157                         synproxy->its = opts.tsecr;
1158
1159                 nf_conntrack_event_cache(IPCT_SYNPROXY, ct);
1160                 break;
1161         case TCP_CONNTRACK_SYN_RECV:
1162                 if (!th->syn || !th->ack)
1163                         break;
1164
1165                 if (!synproxy_parse_options(skb, thoff, th, &opts))
1166                         return NF_DROP;
1167
1168                 if (opts.options & NF_SYNPROXY_OPT_TIMESTAMP) {
1169                         synproxy->tsoff = opts.tsval - synproxy->its;
1170                         nf_conntrack_event_cache(IPCT_SYNPROXY, ct);
1171                 }
1172
1173                 opts.options &= ~(NF_SYNPROXY_OPT_MSS |
1174                                   NF_SYNPROXY_OPT_WSCALE |
1175                                   NF_SYNPROXY_OPT_SACK_PERM);
1176
1177                 swap(opts.tsval, opts.tsecr);
1178                 synproxy_send_server_ack_ipv6(net, state, skb, th, &opts);
1179
1180                 nf_ct_seqadj_init(ct, ctinfo, synproxy->isn - ntohl(th->seq));
1181                 nf_conntrack_event_cache(IPCT_SEQADJ, ct);
1182
1183                 swap(opts.tsval, opts.tsecr);
1184                 synproxy_send_client_ack_ipv6(net, skb, th, &opts);
1185
1186                 consume_skb(skb);
1187                 return NF_STOLEN;
1188         default:
1189                 break;
1190         }
1191
1192         synproxy_tstamp_adjust(skb, thoff, th, ct, ctinfo, synproxy);
1193         return NF_ACCEPT;
1194 }
1195 EXPORT_SYMBOL_GPL(ipv6_synproxy_hook);
1196
1197 static const struct nf_hook_ops ipv6_synproxy_ops[] = {
1198         {
1199                 .hook           = ipv6_synproxy_hook,
1200                 .pf             = NFPROTO_IPV6,
1201                 .hooknum        = NF_INET_LOCAL_IN,
1202                 .priority       = NF_IP_PRI_CONNTRACK_CONFIRM - 1,
1203         },
1204         {
1205                 .hook           = ipv6_synproxy_hook,
1206                 .pf             = NFPROTO_IPV6,
1207                 .hooknum        = NF_INET_POST_ROUTING,
1208                 .priority       = NF_IP_PRI_CONNTRACK_CONFIRM - 1,
1209         },
1210 };
1211
1212 int
1213 nf_synproxy_ipv6_init(struct synproxy_net *snet, struct net *net)
1214 {
1215         int err;
1216
1217         if (snet->hook_ref6 == 0) {
1218                 err = nf_register_net_hooks(net, ipv6_synproxy_ops,
1219                                             ARRAY_SIZE(ipv6_synproxy_ops));
1220                 if (err)
1221                         return err;
1222         }
1223
1224         snet->hook_ref6++;
1225         return 0;
1226 }
1227 EXPORT_SYMBOL_GPL(nf_synproxy_ipv6_init);
1228
1229 void
1230 nf_synproxy_ipv6_fini(struct synproxy_net *snet, struct net *net)
1231 {
1232         snet->hook_ref6--;
1233         if (snet->hook_ref6 == 0)
1234                 nf_unregister_net_hooks(net, ipv6_synproxy_ops,
1235                                         ARRAY_SIZE(ipv6_synproxy_ops));
1236 }
1237 EXPORT_SYMBOL_GPL(nf_synproxy_ipv6_fini);
1238 #endif /* CONFIG_IPV6 */
1239
1240 MODULE_LICENSE("GPL");
1241 MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>");
1242 MODULE_DESCRIPTION("nftables SYNPROXY expression support");