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);
284 +xt_flowoffload_hook_work(struct work_struct *work)
286 + struct xt_flowoffload_table *table;
287 + struct xt_flowoffload_hook *hook;
290 + table = container_of(work, struct xt_flowoffload_table, work.work);
292 + spin_lock_bh(&hooks_lock);
293 + xt_flowoffload_register_hooks(table);
294 + hlist_for_each_entry(hook, &table->hooks, list)
295 + hook->used = false;
296 + spin_unlock_bh(&hooks_lock);
298 + err = nf_flow_table_iterate(&table->ft, xt_flowoffload_check_hook,
300 + if (err && err != -EAGAIN)
303 + if (!xt_flowoffload_cleanup_hooks(table))
307 + queue_delayed_work(system_power_efficient_wq, &table->work, HZ);
311 +xt_flowoffload_skip(struct sk_buff *skb, int family)
313 + if (skb_sec_path(skb))
316 + if (family == NFPROTO_IPV4) {
317 + const struct ip_options *opt = &(IPCB(skb)->opt);
319 + if (unlikely(opt->optlen))
326 +static bool flow_is_valid_ether_device(const struct net_device *dev)
328 + if (!dev || (dev->flags & IFF_LOOPBACK) || dev->type != ARPHRD_ETHER ||
329 + dev->addr_len != ETH_ALEN || !is_valid_ether_addr(dev->dev_addr))
336 +xt_flowoffload_route_check_path(struct nf_flow_route *route,
337 + const struct nf_conn *ct,
338 + enum ip_conntrack_dir dir,
339 + struct net_device **out_dev)
341 + const struct dst_entry *dst = route->tuple[dir].dst;
342 + const void *daddr = &ct->tuplehash[!dir].tuple.src.u3;
343 + struct net_device_path_stack stack;
344 + enum net_device_path_type prev_type;
345 + struct net_device *dev = dst->dev;
346 + struct neighbour *n;
351 + route->tuple[!dir].in.ifindex = dev->ifindex;
352 + route->tuple[dir].out.ifindex = dev->ifindex;
354 + if (route->tuple[dir].xmit_type == FLOW_OFFLOAD_XMIT_XFRM)
357 + if ((dev->flags & IFF_LOOPBACK) ||
358 + dev->type != ARPHRD_ETHER || dev->addr_len != ETH_ALEN ||
359 + !is_valid_ether_addr(dev->dev_addr))
362 + n = dst_neigh_lookup(dst, daddr);
366 + read_lock_bh(&n->lock);
367 + nud_state = n->nud_state;
368 + memcpy(route->tuple[dir].out.h_dest, n->ha, ETH_ALEN);
369 + read_unlock_bh(&n->lock);
372 + if (!(nud_state & NUD_VALID))
375 + if (dev_fill_forward_path(dev, route->tuple[dir].out.h_dest, &stack) ||
379 + prev_type = DEV_PATH_ETHERNET;
380 + for (i = 0; i <= stack.num_paths; i++) {
381 + const struct net_device_path *path = &stack.path[i];
382 + int n_encaps = route->tuple[!dir].in.num_encaps;
384 + dev = (struct net_device *)path->dev;
385 + if (flow_is_valid_ether_device(dev)) {
386 + if (route->tuple[dir].xmit_type != FLOW_OFFLOAD_XMIT_DIRECT) {
387 + memcpy(route->tuple[dir].out.h_source,
388 + dev->dev_addr, ETH_ALEN);
389 + route->tuple[dir].out.ifindex = dev->ifindex;
391 + route->tuple[dir].xmit_type = FLOW_OFFLOAD_XMIT_DIRECT;
394 + switch (path->type) {
395 + case DEV_PATH_PPPOE:
396 + case DEV_PATH_VLAN:
397 + if (n_encaps >= NF_FLOW_TABLE_ENCAP_MAX ||
398 + i == stack.num_paths) {
403 + route->tuple[!dir].in.num_encaps++;
404 + route->tuple[!dir].in.encap[n_encaps].id = path->encap.id;
405 + route->tuple[!dir].in.encap[n_encaps].proto = path->encap.proto;
406 + if (path->type == DEV_PATH_PPPOE)
407 + memcpy(route->tuple[dir].out.h_dest,
408 + path->encap.h_dest, ETH_ALEN);
410 + case DEV_PATH_BRIDGE:
411 + switch (path->bridge.vlan_mode) {
412 + case DEV_PATH_BR_VLAN_TAG:
413 + if (n_encaps >= NF_FLOW_TABLE_ENCAP_MAX ||
414 + i == stack.num_paths) {
419 + route->tuple[!dir].in.num_encaps++;
420 + route->tuple[!dir].in.encap[n_encaps].id =
421 + path->bridge.vlan_id;
422 + route->tuple[!dir].in.encap[n_encaps].proto =
423 + path->bridge.vlan_proto;
425 + case DEV_PATH_BR_VLAN_UNTAG:
426 + route->tuple[!dir].in.num_encaps--;
428 + case DEV_PATH_BR_VLAN_UNTAG_HW:
429 + route->tuple[!dir].in.ingress_vlans |= BIT(n_encaps - 1);
431 + case DEV_PATH_BR_VLAN_KEEP:
445 + route->tuple[dir].out.hw_ifindex = dev->ifindex;
446 + route->tuple[!dir].in.ifindex = dev->ifindex;
450 +xt_flowoffload_route_dir(struct nf_flow_route *route, const struct nf_conn *ct,
451 + enum ip_conntrack_dir dir,
452 + const struct xt_action_param *par, int ifindex)
454 + struct dst_entry *dst = NULL;
457 + memset(&fl, 0, sizeof(fl));
458 + switch (xt_family(par)) {
460 + fl.u.ip4.daddr = ct->tuplehash[!dir].tuple.src.u3.ip;
461 + fl.u.ip4.flowi4_oif = ifindex;
464 + fl.u.ip6.saddr = ct->tuplehash[!dir].tuple.dst.u3.in6;
465 + fl.u.ip6.daddr = ct->tuplehash[!dir].tuple.src.u3.in6;
466 + fl.u.ip6.flowi6_oif = ifindex;
470 + nf_route(xt_net(par), &dst, &fl, false, xt_family(par));
474 + route->tuple[dir].dst = dst;
476 + route->tuple[dir].xmit_type = FLOW_OFFLOAD_XMIT_XFRM;
478 + route->tuple[dir].xmit_type = FLOW_OFFLOAD_XMIT_NEIGH;
484 +xt_flowoffload_route(struct sk_buff *skb, const struct nf_conn *ct,
485 + const struct xt_action_param *par,
486 + struct nf_flow_route *route, enum ip_conntrack_dir dir,
487 + struct net_device **dev)
491 + ret = xt_flowoffload_route_dir(route, ct, dir, par,
492 + dev[dir]->ifindex);
496 + ret = xt_flowoffload_route_dir(route, ct, !dir, par,
497 + dev[!dir]->ifindex);
501 + xt_flowoffload_route_check_path(route, ct, dir, &dev[!dir]);
502 + xt_flowoffload_route_check_path(route, ct, !dir, &dev[dir]);
508 +flowoffload_tg(struct sk_buff *skb, const struct xt_action_param *par)
510 + struct xt_flowoffload_table *table;
511 + const struct xt_flowoffload_target_info *info = par->targinfo;
512 + struct tcphdr _tcph, *tcph = NULL;
513 + enum ip_conntrack_info ctinfo;
514 + enum ip_conntrack_dir dir;
515 + struct nf_flow_route route = {};
516 + struct flow_offload *flow = NULL;
517 + struct net_device *devs[2] = {};
518 + struct nf_conn *ct;
521 + if (xt_flowoffload_skip(skb, xt_family(par)))
522 + return XT_CONTINUE;
524 + ct = nf_ct_get(skb, &ctinfo);
526 + return XT_CONTINUE;
528 + switch (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum) {
530 + if (ct->proto.tcp.state != TCP_CONNTRACK_ESTABLISHED)
531 + return XT_CONTINUE;
533 + tcph = skb_header_pointer(skb, par->thoff,
534 + sizeof(_tcph), &_tcph);
535 + if (unlikely(!tcph || tcph->fin || tcph->rst))
536 + return XT_CONTINUE;
541 + return XT_CONTINUE;
544 + if (nf_ct_ext_exist(ct, NF_CT_EXT_HELPER) ||
545 + ct->status & IPS_SEQ_ADJUST)
546 + return XT_CONTINUE;
548 + if (!nf_ct_is_confirmed(ct))
549 + return XT_CONTINUE;
551 + devs[dir] = xt_out(par);
552 + devs[!dir] = xt_in(par);
554 + if (!devs[dir] || !devs[!dir])
555 + return XT_CONTINUE;
557 + if (test_and_set_bit(IPS_OFFLOAD_BIT, &ct->status))
558 + return XT_CONTINUE;
560 + dir = CTINFO2DIR(ctinfo);
562 + if (xt_flowoffload_route(skb, ct, par, &route, dir, devs) < 0)
563 + goto err_flow_route;
565 + flow = flow_offload_alloc(ct);
567 + goto err_flow_alloc;
569 + if (flow_offload_route_init(flow, &route) < 0)
573 + ct->proto.tcp.seen[0].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
574 + ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
577 + table = &flowtable[!!(info->flags & XT_FLOWOFFLOAD_HW)];
579 + net = read_pnet(&table->ft.net);
581 + write_pnet(&table->ft.net, xt_net(par));
583 + if (flow_offload_add(&table->ft, flow) < 0)
586 + xt_flowoffload_check_device(table, devs[0]);
587 + xt_flowoffload_check_device(table, devs[1]);
589 + dst_release(route.tuple[dir].dst);
590 + dst_release(route.tuple[!dir].dst);
592 + return XT_CONTINUE;
595 + flow_offload_free(flow);
597 + dst_release(route.tuple[dir].dst);
598 + dst_release(route.tuple[!dir].dst);
600 + clear_bit(IPS_OFFLOAD_BIT, &ct->status);
602 + return XT_CONTINUE;
605 +static int flowoffload_chk(const struct xt_tgchk_param *par)
607 + struct xt_flowoffload_target_info *info = par->targinfo;
609 + if (info->flags & ~XT_FLOWOFFLOAD_MASK)
615 +static struct xt_target offload_tg_reg __read_mostly = {
616 + .family = NFPROTO_UNSPEC,
617 + .name = "FLOWOFFLOAD",
619 + .targetsize = sizeof(struct xt_flowoffload_target_info),
620 + .usersize = sizeof(struct xt_flowoffload_target_info),
621 + .checkentry = flowoffload_chk,
622 + .target = flowoffload_tg,
626 +static int flow_offload_netdev_event(struct notifier_block *this,
627 + unsigned long event, void *ptr)
629 + struct xt_flowoffload_hook *hook0, *hook1;
630 + struct net_device *dev = netdev_notifier_info_to_dev(ptr);
632 + if (event != NETDEV_UNREGISTER)
633 + return NOTIFY_DONE;
635 + spin_lock_bh(&hooks_lock);
636 + hook0 = flow_offload_lookup_hook(&flowtable[0], dev);
638 + hlist_del(&hook0->list);
640 + hook1 = flow_offload_lookup_hook(&flowtable[1], dev);
642 + hlist_del(&hook1->list);
643 + spin_unlock_bh(&hooks_lock);
646 + nf_unregister_net_hook(hook0->net, &hook0->ops);
651 + nf_unregister_net_hook(hook1->net, &hook1->ops);
655 + nf_flow_table_cleanup(dev);
657 + return NOTIFY_DONE;
660 +static struct notifier_block flow_offload_netdev_notifier = {
661 + .notifier_call = flow_offload_netdev_event,
665 +nf_flow_offload_inet_hook(void *priv, struct sk_buff *skb,
666 + const struct nf_hook_state *state)
668 + switch (skb->protocol) {
669 + case htons(ETH_P_IP):
670 + return nf_flow_offload_ip_hook(priv, skb, state);
671 + case htons(ETH_P_IPV6):
672 + return nf_flow_offload_ipv6_hook(priv, skb, state);
678 +static int nf_flow_rule_route_inet(struct net *net,
679 + const struct flow_offload *flow,
680 + enum flow_offload_tuple_dir dir,
681 + struct nf_flow_rule *flow_rule)
683 + const struct flow_offload_tuple *flow_tuple = &flow->tuplehash[dir].tuple;
686 + switch (flow_tuple->l3proto) {
688 + err = nf_flow_rule_route_ipv4(net, flow, dir, flow_rule);
691 + err = nf_flow_rule_route_ipv6(net, flow, dir, flow_rule);
701 +static struct nf_flowtable_type flowtable_inet = {
702 + .family = NFPROTO_INET,
703 + .init = nf_flow_table_init,
704 + .setup = nf_flow_table_offload_setup,
705 + .action = nf_flow_rule_route_inet,
706 + .free = nf_flow_table_free,
707 + .hook = nf_flow_offload_inet_hook,
708 + .owner = THIS_MODULE,
711 +static int init_flowtable(struct xt_flowoffload_table *tbl)
713 + INIT_DELAYED_WORK(&tbl->work, xt_flowoffload_hook_work);
714 + tbl->ft.type = &flowtable_inet;
716 + return nf_flow_table_init(&tbl->ft);
719 +static int __init xt_flowoffload_tg_init(void)
723 + register_netdevice_notifier(&flow_offload_netdev_notifier);
725 + ret = init_flowtable(&flowtable[0]);
729 + ret = init_flowtable(&flowtable[1]);
733 + flowtable[1].ft.flags = NF_FLOWTABLE_HW_OFFLOAD;
735 + ret = xt_register_target(&offload_tg_reg);
742 + nf_flow_table_free(&flowtable[1].ft);
744 + nf_flow_table_free(&flowtable[0].ft);
748 +static void __exit xt_flowoffload_tg_exit(void)
750 + xt_unregister_target(&offload_tg_reg);
751 + unregister_netdevice_notifier(&flow_offload_netdev_notifier);
752 + nf_flow_table_free(&flowtable[0].ft);
753 + nf_flow_table_free(&flowtable[1].ft);
756 +MODULE_LICENSE("GPL");
757 +module_init(xt_flowoffload_tg_init);
758 +module_exit(xt_flowoffload_tg_exit);
759 --- a/net/netfilter/nf_flow_table_core.c
760 +++ b/net/netfilter/nf_flow_table_core.c
762 #include <linux/netdevice.h>
764 #include <net/ip6_route.h>
765 -#include <net/netfilter/nf_tables.h>
766 #include <net/netfilter/nf_flow_table.h>
767 #include <net/netfilter/nf_conntrack.h>
768 #include <net/netfilter/nf_conntrack_core.h>
769 @@ -395,8 +394,7 @@ flow_offload_lookup(struct nf_flowtable
771 EXPORT_SYMBOL_GPL(flow_offload_lookup);
774 -nf_flow_table_iterate(struct nf_flowtable *flow_table,
775 +int nf_flow_table_iterate(struct nf_flowtable *flow_table,
776 void (*iter)(struct flow_offload *flow, void *data),
779 @@ -428,6 +426,7 @@ nf_flow_table_iterate(struct nf_flowtabl
783 +EXPORT_SYMBOL_GPL(nf_flow_table_iterate);
785 static bool flow_offload_stale_dst(struct flow_offload_tuple *tuple)
788 +++ b/include/uapi/linux/netfilter/xt_FLOWOFFLOAD.h
790 +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
791 +#ifndef _XT_FLOWOFFLOAD_H
792 +#define _XT_FLOWOFFLOAD_H
794 +#include <linux/types.h>
797 + XT_FLOWOFFLOAD_HW = 1 << 0,
799 + XT_FLOWOFFLOAD_MASK = XT_FLOWOFFLOAD_HW
802 +struct xt_flowoffload_target_info {
806 +#endif /* _XT_FLOWOFFLOAD_H */
807 --- a/include/net/netfilter/nf_flow_table.h
808 +++ b/include/net/netfilter/nf_flow_table.h
809 @@ -270,6 +270,10 @@ void nf_flow_table_free(struct nf_flowta
811 void flow_offload_teardown(struct flow_offload *flow);
813 +int nf_flow_table_iterate(struct nf_flowtable *flow_table,
814 + void (*iter)(struct flow_offload *flow, void *data),
817 void nf_flow_snat_port(const struct flow_offload *flow,
818 struct sk_buff *skb, unsigned int thoff,
819 u8 protocol, enum flow_offload_tuple_dir dir);