]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - net/netfilter/nf_flow_table_core.c
net: dsa: resolve forwarding path for dsa slave ports
[mirror_ubuntu-jammy-kernel.git] / net / netfilter / nf_flow_table_core.c
CommitLineData
09c434b8 1// SPDX-License-Identifier: GPL-2.0-only
ac2a6666
PNA
2#include <linux/kernel.h>
3#include <linux/init.h>
4#include <linux/module.h>
5#include <linux/netfilter.h>
6#include <linux/rhashtable.h>
7#include <linux/netdevice.h>
4f3780c0
FF
8#include <net/ip.h>
9#include <net/ip6_route.h>
c0ea1bcb 10#include <net/netfilter/nf_tables.h>
ac2a6666
PNA
11#include <net/netfilter/nf_flow_table.h>
12#include <net/netfilter/nf_conntrack.h>
13#include <net/netfilter/nf_conntrack_core.h>
40d102cd 14#include <net/netfilter/nf_conntrack_l4proto.h>
ac2a6666
PNA
15#include <net/netfilter/nf_conntrack_tuple.h>
16
84453a90
FF
17static DEFINE_MUTEX(flowtable_lock);
18static LIST_HEAD(flowtables);
19
047b300e 20static void
458a1828 21flow_offload_fill_dir(struct flow_offload *flow,
047b300e
FF
22 enum flow_offload_tuple_dir dir)
23{
24 struct flow_offload_tuple *ft = &flow->tuplehash[dir].tuple;
458a1828 25 struct nf_conntrack_tuple *ctt = &flow->ct->tuplehash[dir].tuple;
047b300e
FF
26
27 ft->dir = dir;
28
29 switch (ctt->src.l3num) {
30 case NFPROTO_IPV4:
31 ft->src_v4 = ctt->src.u3.in;
32 ft->dst_v4 = ctt->dst.u3.in;
33 break;
34 case NFPROTO_IPV6:
35 ft->src_v6 = ctt->src.u3.in6;
36 ft->dst_v6 = ctt->dst.u3.in6;
37 break;
38 }
39
40 ft->l3proto = ctt->src.l3num;
41 ft->l4proto = ctt->dst.protonum;
42 ft->src_port = ctt->src.u.tcp.port;
43 ft->dst_port = ctt->dst.u.tcp.port;
047b300e
FF
44}
45
f1363e05 46struct flow_offload *flow_offload_alloc(struct nf_conn *ct)
ac2a6666 47{
ac2a6666
PNA
48 struct flow_offload *flow;
49
50 if (unlikely(nf_ct_is_dying(ct) ||
51 !atomic_inc_not_zero(&ct->ct_general.use)))
52 return NULL;
53
62248df8
PNA
54 flow = kzalloc(sizeof(*flow), GFP_ATOMIC);
55 if (!flow)
ac2a6666
PNA
56 goto err_ct_refcnt;
57
b32d2f34 58 flow->ct = ct;
ac2a6666 59
458a1828 60 flow_offload_fill_dir(flow, FLOW_OFFLOAD_DIR_ORIGINAL);
61 flow_offload_fill_dir(flow, FLOW_OFFLOAD_DIR_REPLY);
ac2a6666
PNA
62
63 if (ct->status & IPS_SRC_NAT)
355a8b13 64 __set_bit(NF_FLOW_SNAT, &flow->flags);
df1e2025 65 if (ct->status & IPS_DST_NAT)
355a8b13 66 __set_bit(NF_FLOW_DNAT, &flow->flags);
ac2a6666
PNA
67
68 return flow;
69
ac2a6666
PNA
70err_ct_refcnt:
71 nf_ct_put(ct);
72
73 return NULL;
74}
75EXPORT_SYMBOL_GPL(flow_offload_alloc);
76
f1363e05
PNA
77static int flow_offload_fill_route(struct flow_offload *flow,
78 const struct nf_flow_route *route,
79 enum flow_offload_tuple_dir dir)
80{
81 struct flow_offload_tuple *flow_tuple = &flow->tuplehash[dir].tuple;
82 struct dst_entry *other_dst = route->tuple[!dir].dst;
83 struct dst_entry *dst = route->tuple[dir].dst;
84
85 if (!dst_hold_safe(route->tuple[dir].dst))
86 return -1;
87
88 switch (flow_tuple->l3proto) {
89 case NFPROTO_IPV4:
90 flow_tuple->mtu = ip_dst_mtu_maybe_forward(dst, true);
91 break;
92 case NFPROTO_IPV6:
93 flow_tuple->mtu = ip6_dst_mtu_forward(dst);
94 break;
95 }
96
97 flow_tuple->iifidx = other_dst->dev->ifindex;
98 flow_tuple->dst_cache = dst;
99
100 return 0;
101}
102
103int flow_offload_route_init(struct flow_offload *flow,
104 const struct nf_flow_route *route)
105{
106 int err;
107
108 err = flow_offload_fill_route(flow, route, FLOW_OFFLOAD_DIR_ORIGINAL);
109 if (err < 0)
110 return err;
111
112 err = flow_offload_fill_route(flow, route, FLOW_OFFLOAD_DIR_REPLY);
113 if (err < 0)
114 goto err_route_reply;
115
116 flow->type = NF_FLOW_OFFLOAD_ROUTE;
117
118 return 0;
119
120err_route_reply:
121 dst_release(route->tuple[FLOW_OFFLOAD_DIR_ORIGINAL].dst);
122
123 return err;
124}
125EXPORT_SYMBOL_GPL(flow_offload_route_init);
126
da5984e5
FF
127static void flow_offload_fixup_tcp(struct ip_ct_tcp *tcp)
128{
129 tcp->state = TCP_CONNTRACK_ESTABLISHED;
130 tcp->seen[0].td_maxwin = 0;
131 tcp->seen[1].td_maxwin = 0;
132}
133
e97d9404
FW
134#define NF_FLOWTABLE_TCP_PICKUP_TIMEOUT (120 * HZ)
135#define NF_FLOWTABLE_UDP_PICKUP_TIMEOUT (30 * HZ)
136
1e5b2471 137static void flow_offload_fixup_ct_timeout(struct nf_conn *ct)
da5984e5
FF
138{
139 const struct nf_conntrack_l4proto *l4proto;
1e5b2471 140 int l4num = nf_ct_protonum(ct);
da5984e5 141 unsigned int timeout;
da5984e5 142
4a60dc74 143 l4proto = nf_ct_l4proto_find(l4num);
da5984e5
FF
144 if (!l4proto)
145 return;
146
da5984e5 147 if (l4num == IPPROTO_TCP)
e97d9404 148 timeout = NF_FLOWTABLE_TCP_PICKUP_TIMEOUT;
da5984e5 149 else if (l4num == IPPROTO_UDP)
e97d9404 150 timeout = NF_FLOWTABLE_UDP_PICKUP_TIMEOUT;
da5984e5
FF
151 else
152 return;
153
1e5b2471
PNA
154 if (nf_flow_timeout_delta(ct->timeout) > (__s32)timeout)
155 ct->timeout = nfct_time_stamp + timeout;
156}
157
158static void flow_offload_fixup_ct_state(struct nf_conn *ct)
159{
160 if (nf_ct_protonum(ct) == IPPROTO_TCP)
161 flow_offload_fixup_tcp(&ct->proto.tcp);
162}
163
164static void flow_offload_fixup_ct(struct nf_conn *ct)
165{
166 flow_offload_fixup_ct_state(ct);
167 flow_offload_fixup_ct_timeout(ct);
da5984e5
FF
168}
169
f1363e05 170static void flow_offload_route_release(struct flow_offload *flow)
ac2a6666 171{
ac2a6666
PNA
172 dst_release(flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_cache);
173 dst_release(flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.dst_cache);
f1363e05
PNA
174}
175
176void flow_offload_free(struct flow_offload *flow)
177{
178 switch (flow->type) {
179 case NF_FLOW_OFFLOAD_ROUTE:
180 flow_offload_route_release(flow);
181 break;
182 default:
183 break;
184 }
b32d2f34 185 nf_ct_put(flow->ct);
62248df8 186 kfree_rcu(flow, rcu_head);
ac2a6666
PNA
187}
188EXPORT_SYMBOL_GPL(flow_offload_free);
189
a268de77
FF
190static u32 flow_offload_hash(const void *data, u32 len, u32 seed)
191{
192 const struct flow_offload_tuple *tuple = data;
193
dbc859d9 194 return jhash(tuple, offsetof(struct flow_offload_tuple, __hash), seed);
a268de77
FF
195}
196
197static u32 flow_offload_hash_obj(const void *data, u32 len, u32 seed)
198{
199 const struct flow_offload_tuple_rhash *tuplehash = data;
200
dbc859d9 201 return jhash(&tuplehash->tuple, offsetof(struct flow_offload_tuple, __hash), seed);
a268de77
FF
202}
203
204static int flow_offload_hash_cmp(struct rhashtable_compare_arg *arg,
205 const void *ptr)
206{
207 const struct flow_offload_tuple *tuple = arg->key;
208 const struct flow_offload_tuple_rhash *x = ptr;
209
dbc859d9 210 if (memcmp(&x->tuple, tuple, offsetof(struct flow_offload_tuple, __hash)))
a268de77
FF
211 return 1;
212
213 return 0;
214}
215
216static const struct rhashtable_params nf_flow_offload_rhash_params = {
217 .head_offset = offsetof(struct flow_offload_tuple_rhash, node),
218 .hashfn = flow_offload_hash,
219 .obj_hashfn = flow_offload_hash_obj,
220 .obj_cmpfn = flow_offload_hash_cmp,
221 .automatic_shrinking = true,
222};
223
ac2a6666
PNA
224int flow_offload_add(struct nf_flowtable *flow_table, struct flow_offload *flow)
225{
43c8f131
TY
226 int err;
227
fb46f1b7 228 flow->timeout = nf_flowtable_time_stamp + NF_FLOW_TIMEOUT;
daf61b02 229
43c8f131
TY
230 err = rhashtable_insert_fast(&flow_table->rhashtable,
231 &flow->tuplehash[0].node,
232 nf_flow_offload_rhash_params);
233 if (err < 0)
234 return err;
235
236 err = rhashtable_insert_fast(&flow_table->rhashtable,
237 &flow->tuplehash[1].node,
238 nf_flow_offload_rhash_params);
239 if (err < 0) {
240 rhashtable_remove_fast(&flow_table->rhashtable,
241 &flow->tuplehash[0].node,
242 nf_flow_offload_rhash_params);
243 return err;
244 }
ac2a6666 245
4203b19c
RD
246 nf_ct_offload_timeout(flow->ct);
247
f698fe40
PNA
248 if (nf_flowtable_hw_offload(flow_table)) {
249 __set_bit(NF_FLOW_HW, &flow->flags);
c29f74e0 250 nf_flow_offload_add(flow_table, flow);
f698fe40 251 }
c29f74e0 252
ac2a6666
PNA
253 return 0;
254}
255EXPORT_SYMBOL_GPL(flow_offload_add);
256
8b3646d6
PB
257void flow_offload_refresh(struct nf_flowtable *flow_table,
258 struct flow_offload *flow)
259{
260 flow->timeout = nf_flowtable_time_stamp + NF_FLOW_TIMEOUT;
261
262 if (likely(!nf_flowtable_hw_offload(flow_table) ||
263 !test_and_clear_bit(NF_FLOW_HW_REFRESH, &flow->flags)))
264 return;
265
266 nf_flow_offload_add(flow_table, flow);
267}
268EXPORT_SYMBOL_GPL(flow_offload_refresh);
269
3e68db2f
PNA
270static inline bool nf_flow_has_expired(const struct flow_offload *flow)
271{
1e5b2471 272 return nf_flow_timeout_delta(flow->timeout) <= 0;
3e68db2f
PNA
273}
274
0ff90b6c
FF
275static void flow_offload_del(struct nf_flowtable *flow_table,
276 struct flow_offload *flow)
ac2a6666 277{
ac2a6666
PNA
278 rhashtable_remove_fast(&flow_table->rhashtable,
279 &flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].node,
a268de77 280 nf_flow_offload_rhash_params);
ac2a6666
PNA
281 rhashtable_remove_fast(&flow_table->rhashtable,
282 &flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].node,
a268de77 283 nf_flow_offload_rhash_params);
ac2a6666 284
b32d2f34 285 clear_bit(IPS_OFFLOAD_BIT, &flow->ct->status);
da5984e5 286
3e68db2f 287 if (nf_flow_has_expired(flow))
b32d2f34 288 flow_offload_fixup_ct(flow->ct);
9ed81c8e 289 else
b32d2f34 290 flow_offload_fixup_ct_timeout(flow->ct);
3e68db2f 291
0ff90b6c 292 flow_offload_free(flow);
ac2a6666 293}
ac2a6666 294
59c466dd
FF
295void flow_offload_teardown(struct flow_offload *flow)
296{
355a8b13 297 set_bit(NF_FLOW_TEARDOWN, &flow->flags);
da5984e5 298
b32d2f34 299 flow_offload_fixup_ct_state(flow->ct);
59c466dd
FF
300}
301EXPORT_SYMBOL_GPL(flow_offload_teardown);
302
ac2a6666
PNA
303struct flow_offload_tuple_rhash *
304flow_offload_lookup(struct nf_flowtable *flow_table,
305 struct flow_offload_tuple *tuple)
306{
ba03137f
FF
307 struct flow_offload_tuple_rhash *tuplehash;
308 struct flow_offload *flow;
309 int dir;
310
a2d88182
TY
311 tuplehash = rhashtable_lookup(&flow_table->rhashtable, tuple,
312 nf_flow_offload_rhash_params);
ba03137f
FF
313 if (!tuplehash)
314 return NULL;
315
316 dir = tuplehash->tuple.dir;
317 flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]);
355a8b13 318 if (test_bit(NF_FLOW_TEARDOWN, &flow->flags))
ba03137f
FF
319 return NULL;
320
b32d2f34 321 if (unlikely(nf_ct_is_dying(flow->ct)))
8cd2bc98
TY
322 return NULL;
323
ba03137f 324 return tuplehash;
ac2a6666
PNA
325}
326EXPORT_SYMBOL_GPL(flow_offload_lookup);
327
49de9c09
TY
328static int
329nf_flow_table_iterate(struct nf_flowtable *flow_table,
330 void (*iter)(struct flow_offload *flow, void *data),
331 void *data)
ac2a6666
PNA
332{
333 struct flow_offload_tuple_rhash *tuplehash;
334 struct rhashtable_iter hti;
335 struct flow_offload *flow;
0de22baa 336 int err = 0;
ac2a6666 337
0de22baa 338 rhashtable_walk_enter(&flow_table->rhashtable, &hti);
ac2a6666
PNA
339 rhashtable_walk_start(&hti);
340
341 while ((tuplehash = rhashtable_walk_next(&hti))) {
342 if (IS_ERR(tuplehash)) {
0de22baa
TY
343 if (PTR_ERR(tuplehash) != -EAGAIN) {
344 err = PTR_ERR(tuplehash);
345 break;
346 }
ac2a6666
PNA
347 continue;
348 }
349 if (tuplehash->tuple.dir)
350 continue;
351
352 flow = container_of(tuplehash, struct flow_offload, tuplehash[0]);
353
354 iter(flow, data);
355 }
ac2a6666
PNA
356 rhashtable_walk_stop(&hti);
357 rhashtable_walk_exit(&hti);
358
359 return err;
360}
ac2a6666 361
b9660987 362static void nf_flow_offload_gc_step(struct flow_offload *flow, void *data)
ac2a6666 363{
b9660987 364 struct nf_flowtable *flow_table = data;
ac2a6666 365
9ed81c8e
PNA
366 if (nf_flow_has_expired(flow) || nf_ct_is_dying(flow->ct))
367 set_bit(NF_FLOW_TEARDOWN, &flow->flags);
368
369 if (test_bit(NF_FLOW_TEARDOWN, &flow->flags)) {
355a8b13
PNA
370 if (test_bit(NF_FLOW_HW, &flow->flags)) {
371 if (!test_bit(NF_FLOW_HW_DYING, &flow->flags))
c29f74e0 372 nf_flow_offload_del(flow_table, flow);
355a8b13 373 else if (test_bit(NF_FLOW_HW_DEAD, &flow->flags))
c29f74e0
PNA
374 flow_offload_del(flow_table, flow);
375 } else {
376 flow_offload_del(flow_table, flow);
377 }
355a8b13 378 } else if (test_bit(NF_FLOW_HW, &flow->flags)) {
79b9b685 379 nf_flow_offload_stats(flow_table, flow);
c29f74e0 380 }
b408c5b0
PNA
381}
382
a268de77 383static void nf_flow_offload_work_gc(struct work_struct *work)
b408c5b0
PNA
384{
385 struct nf_flowtable *flow_table;
386
387 flow_table = container_of(work, struct nf_flowtable, gc_work.work);
b9660987 388 nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, flow_table);
ac2a6666
PNA
389 queue_delayed_work(system_power_efficient_wq, &flow_table->gc_work, HZ);
390}
ac2a6666 391
f4401262
PNA
392static void nf_flow_nat_port_tcp(struct sk_buff *skb, unsigned int thoff,
393 __be16 port, __be16 new_port)
ac2a6666
PNA
394{
395 struct tcphdr *tcph;
396
ac2a6666 397 tcph = (void *)(skb_network_header(skb) + thoff);
8d6bca15 398 inet_proto_csum_replace2(&tcph->check, skb, port, new_port, false);
ac2a6666
PNA
399}
400
f4401262
PNA
401static void nf_flow_nat_port_udp(struct sk_buff *skb, unsigned int thoff,
402 __be16 port, __be16 new_port)
ac2a6666
PNA
403{
404 struct udphdr *udph;
405
ac2a6666
PNA
406 udph = (void *)(skb_network_header(skb) + thoff);
407 if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) {
408 inet_proto_csum_replace2(&udph->check, skb, port,
8d6bca15 409 new_port, false);
ac2a6666
PNA
410 if (!udph->check)
411 udph->check = CSUM_MANGLED_0;
412 }
ac2a6666
PNA
413}
414
f4401262
PNA
415static void nf_flow_nat_port(struct sk_buff *skb, unsigned int thoff,
416 u8 protocol, __be16 port, __be16 new_port)
ac2a6666
PNA
417{
418 switch (protocol) {
419 case IPPROTO_TCP:
f4401262 420 nf_flow_nat_port_tcp(skb, thoff, port, new_port);
ac2a6666
PNA
421 break;
422 case IPPROTO_UDP:
f4401262 423 nf_flow_nat_port_udp(skb, thoff, port, new_port);
ac2a6666
PNA
424 break;
425 }
ac2a6666
PNA
426}
427
f4401262
PNA
428void nf_flow_snat_port(const struct flow_offload *flow,
429 struct sk_buff *skb, unsigned int thoff,
430 u8 protocol, enum flow_offload_tuple_dir dir)
ac2a6666
PNA
431{
432 struct flow_ports *hdr;
433 __be16 port, new_port;
434
ac2a6666
PNA
435 hdr = (void *)(skb_network_header(skb) + thoff);
436
437 switch (dir) {
438 case FLOW_OFFLOAD_DIR_ORIGINAL:
439 port = hdr->source;
440 new_port = flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.dst_port;
441 hdr->source = new_port;
442 break;
443 case FLOW_OFFLOAD_DIR_REPLY:
444 port = hdr->dest;
445 new_port = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_port;
446 hdr->dest = new_port;
447 break;
ac2a6666
PNA
448 }
449
f4401262 450 nf_flow_nat_port(skb, thoff, protocol, port, new_port);
ac2a6666
PNA
451}
452EXPORT_SYMBOL_GPL(nf_flow_snat_port);
453
f4401262
PNA
454void nf_flow_dnat_port(const struct flow_offload *flow, struct sk_buff *skb,
455 unsigned int thoff, u8 protocol,
456 enum flow_offload_tuple_dir dir)
ac2a6666
PNA
457{
458 struct flow_ports *hdr;
459 __be16 port, new_port;
460
ac2a6666
PNA
461 hdr = (void *)(skb_network_header(skb) + thoff);
462
463 switch (dir) {
464 case FLOW_OFFLOAD_DIR_ORIGINAL:
465 port = hdr->dest;
466 new_port = flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.src_port;
467 hdr->dest = new_port;
468 break;
469 case FLOW_OFFLOAD_DIR_REPLY:
470 port = hdr->source;
471 new_port = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_port;
472 hdr->source = new_port;
473 break;
ac2a6666
PNA
474 }
475
f4401262 476 nf_flow_nat_port(skb, thoff, protocol, port, new_port);
ac2a6666
PNA
477}
478EXPORT_SYMBOL_GPL(nf_flow_dnat_port);
479
a268de77
FF
480int nf_flow_table_init(struct nf_flowtable *flowtable)
481{
482 int err;
483
484 INIT_DEFERRABLE_WORK(&flowtable->gc_work, nf_flow_offload_work_gc);
c29f74e0 485 flow_block_init(&flowtable->flow_block);
422c032a 486 init_rwsem(&flowtable->flow_block_lock);
a268de77
FF
487
488 err = rhashtable_init(&flowtable->rhashtable,
489 &nf_flow_offload_rhash_params);
490 if (err < 0)
491 return err;
492
493 queue_delayed_work(system_power_efficient_wq,
494 &flowtable->gc_work, HZ);
495
84453a90
FF
496 mutex_lock(&flowtable_lock);
497 list_add(&flowtable->list, &flowtables);
498 mutex_unlock(&flowtable_lock);
499
a268de77
FF
500 return 0;
501}
502EXPORT_SYMBOL_GPL(nf_flow_table_init);
503
c0ea1bcb
PNA
504static void nf_flow_table_do_cleanup(struct flow_offload *flow, void *data)
505{
506 struct net_device *dev = data;
507
59c466dd
FF
508 if (!dev) {
509 flow_offload_teardown(flow);
c0ea1bcb 510 return;
59c466dd 511 }
b32d2f34
PNA
512
513 if (net_eq(nf_ct_net(flow->ct), dev_net(dev)) &&
a3fb3698
TY
514 (flow->tuplehash[0].tuple.iifidx == dev->ifindex ||
515 flow->tuplehash[1].tuple.iifidx == dev->ifindex))
445db8d0 516 flow_offload_teardown(flow);
c0ea1bcb
PNA
517}
518
a8284c68
PNA
519void nf_flow_table_gc_cleanup(struct nf_flowtable *flowtable,
520 struct net_device *dev)
c0ea1bcb 521{
84453a90 522 nf_flow_table_iterate(flowtable, nf_flow_table_do_cleanup, dev);
c0ea1bcb 523 flush_delayed_work(&flowtable->gc_work);
91bfaa15 524 nf_flow_table_offload_flush(flowtable);
c0ea1bcb
PNA
525}
526
5f1be84a 527void nf_flow_table_cleanup(struct net_device *dev)
c0ea1bcb 528{
84453a90
FF
529 struct nf_flowtable *flowtable;
530
531 mutex_lock(&flowtable_lock);
532 list_for_each_entry(flowtable, &flowtables, list)
a8284c68 533 nf_flow_table_gc_cleanup(flowtable, dev);
84453a90 534 mutex_unlock(&flowtable_lock);
c0ea1bcb
PNA
535}
536EXPORT_SYMBOL_GPL(nf_flow_table_cleanup);
537
b408c5b0
PNA
538void nf_flow_table_free(struct nf_flowtable *flow_table)
539{
84453a90
FF
540 mutex_lock(&flowtable_lock);
541 list_del(&flow_table->list);
542 mutex_unlock(&flowtable_lock);
978703f4 543
a268de77 544 cancel_delayed_work_sync(&flow_table->gc_work);
b408c5b0 545 nf_flow_table_iterate(flow_table, nf_flow_table_do_cleanup, NULL);
b9660987 546 nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, flow_table);
0f34f30a 547 nf_flow_table_offload_flush(flow_table);
c921ffe8
PB
548 if (nf_flowtable_hw_offload(flow_table))
549 nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step,
550 flow_table);
a268de77 551 rhashtable_destroy(&flow_table->rhashtable);
b408c5b0
PNA
552}
553EXPORT_SYMBOL_GPL(nf_flow_table_free);
554
c29f74e0
PNA
555static int __init nf_flow_table_module_init(void)
556{
557 return nf_flow_table_offload_init();
558}
559
560static void __exit nf_flow_table_module_exit(void)
561{
562 nf_flow_table_offload_exit();
563}
564
565module_init(nf_flow_table_module_init);
566module_exit(nf_flow_table_module_exit);
567
ac2a6666
PNA
568MODULE_LICENSE("GPL");
569MODULE_AUTHOR("Pablo Neira Ayuso <pablo@netfilter.org>");
4cacc395 570MODULE_DESCRIPTION("Netfilter flow table module");