1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Tue, 20 Feb 2018 15:56:02 +0100
3 Subject: [PATCH] netfilter: add xt_FLOWOFFLOAD target
5 Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 create mode 100644 net/netfilter/xt_OFFLOAD.c
9 --- a/net/ipv4/netfilter/Kconfig
10 +++ b/net/ipv4/netfilter/Kconfig
11 @@ -56,8 +56,6 @@ config NF_TABLES_ARP
13 This option enables the ARP support for nf_tables.
17 config NF_FLOW_TABLE_IPV4
18 tristate "Netfilter flow table IPv4 module"
19 depends on NF_FLOW_TABLE
20 @@ -66,6 +64,8 @@ config NF_FLOW_TABLE_IPV4
22 To compile it as a module, choose M here.
27 tristate "Netfilter IPv4 packet duplication to alternate destination"
28 depends on !NF_CONNTRACK || NF_CONNTRACK
29 --- a/net/ipv6/netfilter/Kconfig
30 +++ b/net/ipv6/netfilter/Kconfig
31 @@ -45,7 +45,6 @@ config NFT_FIB_IPV6
32 multicast or blackhole.
34 endif # NF_TABLES_IPV6
37 config NF_FLOW_TABLE_IPV6
38 tristate "Netfilter flow table IPv6 module"
39 @@ -55,6 +54,8 @@ config NF_FLOW_TABLE_IPV6
41 To compile it as a module, choose M here.
46 tristate "Netfilter IPv6 packet duplication to alternate destination"
47 depends on !NF_CONNTRACK || NF_CONNTRACK
48 --- a/net/netfilter/Kconfig
49 +++ b/net/netfilter/Kconfig
50 @@ -683,8 +683,6 @@ config NFT_FIB_NETDEV
52 endif # NF_TABLES_NETDEV
56 config NF_FLOW_TABLE_INET
57 tristate "Netfilter flow table mixed IPv4/IPv6 module"
58 depends on NF_FLOW_TABLE
59 @@ -693,11 +691,12 @@ config NF_FLOW_TABLE_INET
61 To compile it as a module, choose M here.
66 tristate "Netfilter flow table module"
67 depends on NETFILTER_INGRESS
68 depends on NF_CONNTRACK
69 - depends on NF_TABLES
71 This option adds the flow table core infrastructure.
73 @@ -977,6 +976,15 @@ config NETFILTER_XT_TARGET_NOTRACK
74 depends on NETFILTER_ADVANCED
75 select NETFILTER_XT_TARGET_CT
77 +config NETFILTER_XT_TARGET_FLOWOFFLOAD
78 + tristate '"FLOWOFFLOAD" target support'
79 + depends on NF_FLOW_TABLE
80 + depends on NETFILTER_INGRESS
82 + This option adds a `FLOWOFFLOAD' target, which uses the nf_flow_offload
83 + module to speed up processing of packets by bypassing the usual
86 config NETFILTER_XT_TARGET_RATEEST
87 tristate '"RATEEST" target support'
88 depends on NETFILTER_ADVANCED
89 --- a/net/netfilter/Makefile
90 +++ b/net/netfilter/Makefile
91 @@ -145,6 +145,7 @@ obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIF
92 obj-$(CONFIG_NETFILTER_XT_TARGET_CONNSECMARK) += xt_CONNSECMARK.o
93 obj-$(CONFIG_NETFILTER_XT_TARGET_CT) += xt_CT.o
94 obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o
95 +obj-$(CONFIG_NETFILTER_XT_TARGET_FLOWOFFLOAD) += xt_FLOWOFFLOAD.o
96 obj-$(CONFIG_NETFILTER_XT_TARGET_HL) += xt_HL.o
97 obj-$(CONFIG_NETFILTER_XT_TARGET_HMARK) += xt_HMARK.o
98 obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o
100 +++ b/net/netfilter/xt_FLOWOFFLOAD.c
103 + * Copyright (C) 2018-2021 Felix Fietkau <nbd@nbd.name>
105 + * This program is free software; you can redistribute it and/or modify
106 + * it under the terms of the GNU General Public License version 2 as
107 + * published by the Free Software Foundation.
109 +#include <linux/module.h>
110 +#include <linux/init.h>
111 +#include <linux/netfilter.h>
112 +#include <linux/netfilter/xt_FLOWOFFLOAD.h>
114 +#include <net/netfilter/nf_conntrack.h>
115 +#include <net/netfilter/nf_conntrack_extend.h>
116 +#include <net/netfilter/nf_conntrack_helper.h>
117 +#include <net/netfilter/nf_flow_table.h>
119 +struct xt_flowoffload_hook {
120 + struct hlist_node list;
121 + struct nf_hook_ops ops;
127 +struct xt_flowoffload_table {
128 + struct nf_flowtable ft;
129 + struct hlist_head hooks;
130 + struct delayed_work work;
133 +static DEFINE_SPINLOCK(hooks_lock);
135 +struct xt_flowoffload_table flowtable[2];
138 +xt_flowoffload_net_hook(void *priv, struct sk_buff *skb,
139 + const struct nf_hook_state *state)
141 + struct nf_flowtable *ft = priv;
143 + if (!atomic_read(&ft->rhashtable.nelems))
146 + switch (skb->protocol) {
147 + case htons(ETH_P_IP):
148 + return nf_flow_offload_ip_hook(priv, skb, state);
149 + case htons(ETH_P_IPV6):
150 + return nf_flow_offload_ipv6_hook(priv, skb, state);
157 +xt_flowoffload_create_hook(struct xt_flowoffload_table *table,
158 + struct net_device *dev)
160 + struct xt_flowoffload_hook *hook;
161 + struct nf_hook_ops *ops;
163 + hook = kzalloc(sizeof(*hook), GFP_ATOMIC);
168 + ops->pf = NFPROTO_NETDEV;
169 + ops->hooknum = NF_NETDEV_INGRESS;
170 + ops->priority = 10;
171 + ops->priv = &table->ft;
172 + ops->hook = xt_flowoffload_net_hook;
175 + hlist_add_head(&hook->list, &table->hooks);
176 + mod_delayed_work(system_power_efficient_wq, &table->work, 0);
181 +static struct xt_flowoffload_hook *
182 +flow_offload_lookup_hook(struct xt_flowoffload_table *table,
183 + struct net_device *dev)
185 + struct xt_flowoffload_hook *hook;
187 + hlist_for_each_entry(hook, &table->hooks, list) {
188 + if (hook->ops.dev == dev)
196 +xt_flowoffload_check_device(struct xt_flowoffload_table *table,
197 + struct net_device *dev)
199 + struct xt_flowoffload_hook *hook;
204 + spin_lock_bh(&hooks_lock);
205 + hook = flow_offload_lookup_hook(table, dev);
209 + xt_flowoffload_create_hook(table, dev);
210 + spin_unlock_bh(&hooks_lock);
214 +xt_flowoffload_register_hooks(struct xt_flowoffload_table *table)
216 + struct xt_flowoffload_hook *hook;
219 + hlist_for_each_entry(hook, &table->hooks, list) {
220 + if (hook->registered)
223 + hook->registered = true;
224 + hook->net = dev_net(hook->ops.dev);
225 + spin_unlock_bh(&hooks_lock);
226 + nf_register_net_hook(hook->net, &hook->ops);
227 + if (table->ft.flags & NF_FLOWTABLE_HW_OFFLOAD)
228 + table->ft.type->setup(&table->ft, hook->ops.dev,
230 + spin_lock_bh(&hooks_lock);
237 +xt_flowoffload_cleanup_hooks(struct xt_flowoffload_table *table)
239 + struct xt_flowoffload_hook *hook;
240 + bool active = false;
243 + spin_lock_bh(&hooks_lock);
244 + hlist_for_each_entry(hook, &table->hooks, list) {
245 + if (hook->used || !hook->registered) {
250 + hlist_del(&hook->list);
251 + spin_unlock_bh(&hooks_lock);
252 + if (table->ft.flags & NF_FLOWTABLE_HW_OFFLOAD)
253 + table->ft.type->setup(&table->ft, hook->ops.dev,
254 + FLOW_BLOCK_UNBIND);
255 + nf_unregister_net_hook(hook->net, &hook->ops);
259 + spin_unlock_bh(&hooks_lock);
265 +xt_flowoffload_check_hook(struct flow_offload *flow, void *data)
267 + struct xt_flowoffload_table *table = data;
268 + struct flow_offload_tuple *tuple0 = &flow->tuplehash[0].tuple;
269 + struct flow_offload_tuple *tuple1 = &flow->tuplehash[1].tuple;
270 + struct xt_flowoffload_hook *hook;
272 + spin_lock_bh(&hooks_lock);
273 + hlist_for_each_entry(hook, &table->hooks, list) {
274 + if (hook->ops.dev->ifindex != tuple0->iifidx &&
275 + hook->ops.dev->ifindex != tuple1->iifidx)
280 + spin_unlock_bh(&hooks_lock);
286 +xt_flowoffload_hook_work(struct work_struct *work)
288 + struct xt_flowoffload_table *table;
289 + struct xt_flowoffload_hook *hook;
292 + table = container_of(work, struct xt_flowoffload_table, work.work);
294 + spin_lock_bh(&hooks_lock);
295 + xt_flowoffload_register_hooks(table);
296 + hlist_for_each_entry(hook, &table->hooks, list)
297 + hook->used = false;
298 + spin_unlock_bh(&hooks_lock);
300 + err = nf_flow_table_iterate(&table->ft, xt_flowoffload_check_hook,
302 + if (err && err != -EAGAIN)
305 + if (!xt_flowoffload_cleanup_hooks(table))
309 + queue_delayed_work(system_power_efficient_wq, &table->work, HZ);
313 +xt_flowoffload_skip(struct sk_buff *skb, int family)
315 + if (skb_sec_path(skb))
318 + if (family == NFPROTO_IPV4) {
319 + const struct ip_options *opt = &(IPCB(skb)->opt);
321 + if (unlikely(opt->optlen))
328 +static bool flow_is_valid_ether_device(const struct net_device *dev)
330 + if (!dev || (dev->flags & IFF_LOOPBACK) || dev->type != ARPHRD_ETHER ||
331 + dev->addr_len != ETH_ALEN || !is_valid_ether_addr(dev->dev_addr))
338 +xt_flowoffload_route_check_path(struct nf_flow_route *route,
339 + const struct nf_conn *ct,
340 + enum ip_conntrack_dir dir,
341 + struct net_device **out_dev)
343 + const struct dst_entry *dst = route->tuple[dir].dst;
344 + const void *daddr = &ct->tuplehash[!dir].tuple.src.u3;
345 + struct net_device_path_stack stack;
346 + enum net_device_path_type prev_type;
347 + struct net_device *dev = dst->dev;
348 + struct neighbour *n;
353 + route->tuple[!dir].in.ifindex = dev->ifindex;
354 + route->tuple[dir].out.ifindex = dev->ifindex;
356 + if (route->tuple[dir].xmit_type == FLOW_OFFLOAD_XMIT_XFRM)
359 + if ((dev->flags & IFF_LOOPBACK) ||
360 + dev->type != ARPHRD_ETHER || dev->addr_len != ETH_ALEN ||
361 + !is_valid_ether_addr(dev->dev_addr))
364 + n = dst_neigh_lookup(dst, daddr);
368 + read_lock_bh(&n->lock);
369 + nud_state = n->nud_state;
370 + memcpy(route->tuple[dir].out.h_dest, n->ha, ETH_ALEN);
371 + read_unlock_bh(&n->lock);
374 + if (!(nud_state & NUD_VALID))
377 + if (dev_fill_forward_path(dev, route->tuple[dir].out.h_dest, &stack) ||
381 + prev_type = DEV_PATH_ETHERNET;
382 + for (i = 0; i <= stack.num_paths; i++) {
383 + const struct net_device_path *path = &stack.path[i];
384 + int n_encaps = route->tuple[!dir].in.num_encaps;
386 + dev = (struct net_device *)path->dev;
387 + if (flow_is_valid_ether_device(dev)) {
388 + if (route->tuple[dir].xmit_type != FLOW_OFFLOAD_XMIT_DIRECT) {
389 + memcpy(route->tuple[dir].out.h_source,
390 + dev->dev_addr, ETH_ALEN);
391 + route->tuple[dir].out.ifindex = dev->ifindex;
393 + route->tuple[dir].xmit_type = FLOW_OFFLOAD_XMIT_DIRECT;
396 + switch (path->type) {
397 + case DEV_PATH_PPPOE:
398 + case DEV_PATH_VLAN:
399 + if (n_encaps >= NF_FLOW_TABLE_ENCAP_MAX ||
400 + i == stack.num_paths) {
405 + route->tuple[!dir].in.num_encaps++;
406 + route->tuple[!dir].in.encap[n_encaps].id = path->encap.id;
407 + route->tuple[!dir].in.encap[n_encaps].proto = path->encap.proto;
408 + if (path->type == DEV_PATH_PPPOE)
409 + memcpy(route->tuple[dir].out.h_dest,
410 + path->encap.h_dest, ETH_ALEN);
412 + case DEV_PATH_BRIDGE:
413 + switch (path->bridge.vlan_mode) {
414 + case DEV_PATH_BR_VLAN_TAG:
415 + if (n_encaps >= NF_FLOW_TABLE_ENCAP_MAX ||
416 + i == stack.num_paths) {
421 + route->tuple[!dir].in.num_encaps++;
422 + route->tuple[!dir].in.encap[n_encaps].id =
423 + path->bridge.vlan_id;
424 + route->tuple[!dir].in.encap[n_encaps].proto =
425 + path->bridge.vlan_proto;
427 + case DEV_PATH_BR_VLAN_UNTAG:
428 + route->tuple[!dir].in.num_encaps--;
430 + case DEV_PATH_BR_VLAN_UNTAG_HW:
431 + route->tuple[!dir].in.ingress_vlans |= BIT(n_encaps - 1);
433 + case DEV_PATH_BR_VLAN_KEEP:
447 + route->tuple[dir].out.hw_ifindex = dev->ifindex;
448 + route->tuple[!dir].in.ifindex = dev->ifindex;
452 +xt_flowoffload_route_dir(struct nf_flow_route *route, const struct nf_conn *ct,
453 + enum ip_conntrack_dir dir,
454 + const struct xt_action_param *par, int ifindex)
456 + struct dst_entry *dst = NULL;
459 + memset(&fl, 0, sizeof(fl));
460 + switch (xt_family(par)) {
462 + fl.u.ip4.daddr = ct->tuplehash[!dir].tuple.src.u3.ip;
463 + fl.u.ip4.flowi4_oif = ifindex;
466 + fl.u.ip6.saddr = ct->tuplehash[!dir].tuple.dst.u3.in6;
467 + fl.u.ip6.daddr = ct->tuplehash[!dir].tuple.src.u3.in6;
468 + fl.u.ip6.flowi6_oif = ifindex;
472 + nf_route(xt_net(par), &dst, &fl, false, xt_family(par));
476 + route->tuple[dir].dst = dst;
478 + route->tuple[dir].xmit_type = FLOW_OFFLOAD_XMIT_XFRM;
480 + route->tuple[dir].xmit_type = FLOW_OFFLOAD_XMIT_NEIGH;
486 +xt_flowoffload_route(struct sk_buff *skb, const struct nf_conn *ct,
487 + const struct xt_action_param *par,
488 + struct nf_flow_route *route, enum ip_conntrack_dir dir,
489 + struct net_device **dev)
493 + ret = xt_flowoffload_route_dir(route, ct, dir, par,
494 + dev[dir]->ifindex);
498 + ret = xt_flowoffload_route_dir(route, ct, !dir, par,
499 + dev[!dir]->ifindex);
503 + xt_flowoffload_route_check_path(route, ct, dir, &dev[!dir]);
504 + xt_flowoffload_route_check_path(route, ct, !dir, &dev[dir]);
510 +flowoffload_tg(struct sk_buff *skb, const struct xt_action_param *par)
512 + struct xt_flowoffload_table *table;
513 + const struct xt_flowoffload_target_info *info = par->targinfo;
514 + struct tcphdr _tcph, *tcph = NULL;
515 + enum ip_conntrack_info ctinfo;
516 + enum ip_conntrack_dir dir;
517 + struct nf_flow_route route = {};
518 + struct flow_offload *flow = NULL;
519 + struct net_device *devs[2] = {};
520 + struct nf_conn *ct;
523 + if (xt_flowoffload_skip(skb, xt_family(par)))
524 + return XT_CONTINUE;
526 + ct = nf_ct_get(skb, &ctinfo);
528 + return XT_CONTINUE;
530 + switch (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum) {
532 + if (ct->proto.tcp.state != TCP_CONNTRACK_ESTABLISHED)
533 + return XT_CONTINUE;
535 + tcph = skb_header_pointer(skb, par->thoff,
536 + sizeof(_tcph), &_tcph);
537 + if (unlikely(!tcph || tcph->fin || tcph->rst))
538 + return XT_CONTINUE;
543 + return XT_CONTINUE;
546 + if (nf_ct_ext_exist(ct, NF_CT_EXT_HELPER) ||
547 + ct->status & IPS_SEQ_ADJUST)
548 + return XT_CONTINUE;
550 + if (!nf_ct_is_confirmed(ct))
551 + return XT_CONTINUE;
553 + devs[dir] = xt_out(par);
554 + devs[!dir] = xt_in(par);
556 + if (!devs[dir] || !devs[!dir])
557 + return XT_CONTINUE;
559 + if (test_and_set_bit(IPS_OFFLOAD_BIT, &ct->status))
560 + return XT_CONTINUE;
562 + dir = CTINFO2DIR(ctinfo);
564 + if (xt_flowoffload_route(skb, ct, par, &route, dir, devs) < 0)
565 + goto err_flow_route;
567 + flow = flow_offload_alloc(ct);
569 + goto err_flow_alloc;
571 + if (flow_offload_route_init(flow, &route) < 0)
575 + ct->proto.tcp.seen[0].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
576 + ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
579 + table = &flowtable[!!(info->flags & XT_FLOWOFFLOAD_HW)];
580 + if (flow_offload_add(&table->ft, flow) < 0)
583 + xt_flowoffload_check_device(table, devs[0]);
584 + xt_flowoffload_check_device(table, devs[1]);
586 + net = read_pnet(&table->ft.net);
588 + write_pnet(&table->ft.net, xt_net(par));
590 + dst_release(route.tuple[dir].dst);
591 + dst_release(route.tuple[!dir].dst);
593 + return XT_CONTINUE;
596 + flow_offload_free(flow);
598 + dst_release(route.tuple[dir].dst);
599 + dst_release(route.tuple[!dir].dst);
601 + clear_bit(IPS_OFFLOAD_BIT, &ct->status);
603 + return XT_CONTINUE;
606 +static int flowoffload_chk(const struct xt_tgchk_param *par)
608 + struct xt_flowoffload_target_info *info = par->targinfo;
610 + if (info->flags & ~XT_FLOWOFFLOAD_MASK)
616 +static struct xt_target offload_tg_reg __read_mostly = {
617 + .family = NFPROTO_UNSPEC,
618 + .name = "FLOWOFFLOAD",
620 + .targetsize = sizeof(struct xt_flowoffload_target_info),
621 + .usersize = sizeof(struct xt_flowoffload_target_info),
622 + .checkentry = flowoffload_chk,
623 + .target = flowoffload_tg,
627 +static int flow_offload_netdev_event(struct notifier_block *this,
628 + unsigned long event, void *ptr)
630 + struct xt_flowoffload_hook *hook0, *hook1;
631 + struct net_device *dev = netdev_notifier_info_to_dev(ptr);
633 + if (event != NETDEV_UNREGISTER)
634 + return NOTIFY_DONE;
636 + spin_lock_bh(&hooks_lock);
637 + hook0 = flow_offload_lookup_hook(&flowtable[0], dev);
639 + hlist_del(&hook0->list);
641 + hook1 = flow_offload_lookup_hook(&flowtable[1], dev);
643 + hlist_del(&hook1->list);
644 + spin_unlock_bh(&hooks_lock);
647 + nf_unregister_net_hook(hook0->net, &hook0->ops);
652 + nf_unregister_net_hook(hook1->net, &hook1->ops);
656 + nf_flow_table_cleanup(dev);
658 + return NOTIFY_DONE;
661 +static struct notifier_block flow_offload_netdev_notifier = {
662 + .notifier_call = flow_offload_netdev_event,
666 +nf_flow_offload_inet_hook(void *priv, struct sk_buff *skb,
667 + const struct nf_hook_state *state)
669 + switch (skb->protocol) {
670 + case htons(ETH_P_IP):
671 + return nf_flow_offload_ip_hook(priv, skb, state);
672 + case htons(ETH_P_IPV6):
673 + return nf_flow_offload_ipv6_hook(priv, skb, state);
679 +static int nf_flow_rule_route_inet(struct net *net,
680 + const struct flow_offload *flow,
681 + enum flow_offload_tuple_dir dir,
682 + struct nf_flow_rule *flow_rule)
684 + const struct flow_offload_tuple *flow_tuple = &flow->tuplehash[dir].tuple;
687 + switch (flow_tuple->l3proto) {
689 + err = nf_flow_rule_route_ipv4(net, flow, dir, flow_rule);
692 + err = nf_flow_rule_route_ipv6(net, flow, dir, flow_rule);
702 +static struct nf_flowtable_type flowtable_inet = {
703 + .family = NFPROTO_INET,
704 + .init = nf_flow_table_init,
705 + .setup = nf_flow_table_offload_setup,
706 + .action = nf_flow_rule_route_inet,
707 + .free = nf_flow_table_free,
708 + .hook = nf_flow_offload_inet_hook,
709 + .owner = THIS_MODULE,
712 +static int init_flowtable(struct xt_flowoffload_table *tbl)
714 + INIT_DELAYED_WORK(&tbl->work, xt_flowoffload_hook_work);
715 + tbl->ft.type = &flowtable_inet;
717 + return nf_flow_table_init(&tbl->ft);
720 +static int __init xt_flowoffload_tg_init(void)
724 + register_netdevice_notifier(&flow_offload_netdev_notifier);
726 + ret = init_flowtable(&flowtable[0]);
730 + ret = init_flowtable(&flowtable[1]);
734 + flowtable[1].ft.flags = NF_FLOWTABLE_HW_OFFLOAD;
736 + ret = xt_register_target(&offload_tg_reg);
743 + nf_flow_table_free(&flowtable[1].ft);
745 + nf_flow_table_free(&flowtable[0].ft);
749 +static void __exit xt_flowoffload_tg_exit(void)
751 + xt_unregister_target(&offload_tg_reg);
752 + unregister_netdevice_notifier(&flow_offload_netdev_notifier);
753 + nf_flow_table_free(&flowtable[0].ft);
754 + nf_flow_table_free(&flowtable[1].ft);
757 +MODULE_LICENSE("GPL");
758 +module_init(xt_flowoffload_tg_init);
759 +module_exit(xt_flowoffload_tg_exit);
760 --- a/net/netfilter/nf_flow_table_core.c
761 +++ b/net/netfilter/nf_flow_table_core.c
763 #include <linux/netdevice.h>
765 #include <net/ip6_route.h>
766 -#include <net/netfilter/nf_tables.h>
767 #include <net/netfilter/nf_flow_table.h>
768 #include <net/netfilter/nf_conntrack.h>
769 #include <net/netfilter/nf_conntrack_core.h>
770 @@ -355,8 +354,7 @@ flow_offload_lookup(struct nf_flowtable
772 EXPORT_SYMBOL_GPL(flow_offload_lookup);
775 -nf_flow_table_iterate(struct nf_flowtable *flow_table,
776 +int nf_flow_table_iterate(struct nf_flowtable *flow_table,
777 void (*iter)(struct flow_offload *flow, void *data),
780 @@ -388,6 +386,7 @@ nf_flow_table_iterate(struct nf_flowtabl
784 +EXPORT_SYMBOL_GPL(nf_flow_table_iterate);
786 static void nf_flow_offload_gc_step(struct flow_offload *flow, void *data)
789 +++ b/include/uapi/linux/netfilter/xt_FLOWOFFLOAD.h
791 +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
792 +#ifndef _XT_FLOWOFFLOAD_H
793 +#define _XT_FLOWOFFLOAD_H
795 +#include <linux/types.h>
798 + XT_FLOWOFFLOAD_HW = 1 << 0,
800 + XT_FLOWOFFLOAD_MASK = XT_FLOWOFFLOAD_HW
803 +struct xt_flowoffload_target_info {
807 +#endif /* _XT_FLOWOFFLOAD_H */
808 --- a/include/net/netfilter/nf_flow_table.h
809 +++ b/include/net/netfilter/nf_flow_table.h
810 @@ -265,6 +265,10 @@ void nf_flow_table_free(struct nf_flowta
812 void flow_offload_teardown(struct flow_offload *flow);
814 +int nf_flow_table_iterate(struct nf_flowtable *flow_table,
815 + void (*iter)(struct flow_offload *flow, void *data),
818 void nf_flow_snat_port(const struct flow_offload *flow,
819 struct sk_buff *skb, unsigned int thoff,
820 u8 protocol, enum flow_offload_tuple_dir dir);