diff options
author | David S. Miller <davem@davemloft.net> | 2013-11-04 19:48:57 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-11-04 19:48:57 -0500 |
commit | f8785c55141d698d988c6a1ffe4530bc7fa6e886 (patch) | |
tree | dc629fe50865a6f3e5e47eaf8c4a9e3e1995bbec /net/bridge | |
parent | 72c39a0ade6229a938736fe1aa1d5e471fc7face (diff) | |
parent | c359c4157cf0d852387aff2f2d83fef039aadc2c (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nftables
Pablo Neira Ayuso says:
====================
This batch contains fives nf_tables patches for your net-next tree,
they are:
* Fix possible use after free in the module removal path of the
x_tables compatibility layer, from Dan Carpenter.
* Add filter chain type for the bridge family, from myself.
* Fix Kconfig dependencies of the nf_tables bridge family with
the core, from myself.
* Fix sparse warnings in nft_nat, from Tomasz Bursztyka.
* Remove duplicated include in the IPv4 family support for nf_tables,
from Wei Yongjun.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/netfilter/Kconfig | 1 | ||||
-rw-r--r-- | net/bridge/netfilter/nf_tables_bridge.c | 41 |
2 files changed, 40 insertions, 2 deletions
diff --git a/net/bridge/netfilter/Kconfig b/net/bridge/netfilter/Kconfig index 68f8128147be..5ca74a0e595f 100644 --- a/net/bridge/netfilter/Kconfig +++ b/net/bridge/netfilter/Kconfig | |||
@@ -3,6 +3,7 @@ | |||
3 | # | 3 | # |
4 | # | 4 | # |
5 | config NF_TABLES_BRIDGE | 5 | config NF_TABLES_BRIDGE |
6 | depends on NF_TABLES | ||
6 | tristate "Ethernet Bridge nf_tables support" | 7 | tristate "Ethernet Bridge nf_tables support" |
7 | 8 | ||
8 | menuconfig BRIDGE_NF_EBTABLES | 9 | menuconfig BRIDGE_NF_EBTABLES |
diff --git a/net/bridge/netfilter/nf_tables_bridge.c b/net/bridge/netfilter/nf_tables_bridge.c index e8cb016fa34d..cf54b22818c8 100644 --- a/net/bridge/netfilter/nf_tables_bridge.c +++ b/net/bridge/netfilter/nf_tables_bridge.c | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2008 Patrick McHardy <kaber@trash.net> | 2 | * Copyright (c) 2008 Patrick McHardy <kaber@trash.net> |
3 | * Copyright (c) 2013 Pablo Neira Ayuso <pablo@netfilter.org> | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License version 2 as | 6 | * it under the terms of the GNU General Public License version 2 as |
@@ -47,14 +48,50 @@ static struct pernet_operations nf_tables_bridge_net_ops = { | |||
47 | .exit = nf_tables_bridge_exit_net, | 48 | .exit = nf_tables_bridge_exit_net, |
48 | }; | 49 | }; |
49 | 50 | ||
51 | static unsigned int | ||
52 | nft_do_chain_bridge(const struct nf_hook_ops *ops, | ||
53 | struct sk_buff *skb, | ||
54 | const struct net_device *in, | ||
55 | const struct net_device *out, | ||
56 | int (*okfn)(struct sk_buff *)) | ||
57 | { | ||
58 | struct nft_pktinfo pkt; | ||
59 | |||
60 | nft_set_pktinfo(&pkt, ops, skb, in, out); | ||
61 | |||
62 | return nft_do_chain_pktinfo(&pkt, ops); | ||
63 | } | ||
64 | |||
65 | static struct nf_chain_type filter_bridge = { | ||
66 | .family = NFPROTO_BRIDGE, | ||
67 | .name = "filter", | ||
68 | .type = NFT_CHAIN_T_DEFAULT, | ||
69 | .hook_mask = (1 << NF_BR_LOCAL_IN) | | ||
70 | (1 << NF_BR_FORWARD) | | ||
71 | (1 << NF_BR_LOCAL_OUT), | ||
72 | .fn = { | ||
73 | [NF_BR_LOCAL_IN] = nft_do_chain_bridge, | ||
74 | [NF_BR_FORWARD] = nft_do_chain_bridge, | ||
75 | [NF_BR_LOCAL_OUT] = nft_do_chain_bridge, | ||
76 | }, | ||
77 | }; | ||
78 | |||
50 | static int __init nf_tables_bridge_init(void) | 79 | static int __init nf_tables_bridge_init(void) |
51 | { | 80 | { |
52 | return register_pernet_subsys(&nf_tables_bridge_net_ops); | 81 | int ret; |
82 | |||
83 | nft_register_chain_type(&filter_bridge); | ||
84 | ret = register_pernet_subsys(&nf_tables_bridge_net_ops); | ||
85 | if (ret < 0) | ||
86 | nft_unregister_chain_type(&filter_bridge); | ||
87 | |||
88 | return ret; | ||
53 | } | 89 | } |
54 | 90 | ||
55 | static void __exit nf_tables_bridge_exit(void) | 91 | static void __exit nf_tables_bridge_exit(void) |
56 | { | 92 | { |
57 | return unregister_pernet_subsys(&nf_tables_bridge_net_ops); | 93 | unregister_pernet_subsys(&nf_tables_bridge_net_ops); |
94 | nft_unregister_chain_type(&filter_bridge); | ||
58 | } | 95 | } |
59 | 96 | ||
60 | module_init(nf_tables_bridge_init); | 97 | module_init(nf_tables_bridge_init); |