Skip to content

Commit 36a686c

Browse files
Phil Sutterummakynes
authored andcommitted
Revert "netfilter: nf_tables: Add notifications for hook changes"
This reverts commit 465b9ee. Such notifications fit better into core or nfnetlink_hook code, following the NFNL_MSG_HOOK_GET message format. Signed-off-by: Phil Sutter <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 6ac86ac commit 36a686c

File tree

6 files changed

+0
-79
lines changed

6 files changed

+0
-79
lines changed

include/net/netfilter/nf_tables.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,11 +1142,6 @@ int nft_set_catchall_validate(const struct nft_ctx *ctx, struct nft_set *set);
11421142
int nf_tables_bind_chain(const struct nft_ctx *ctx, struct nft_chain *chain);
11431143
void nf_tables_unbind_chain(const struct nft_ctx *ctx, struct nft_chain *chain);
11441144

1145-
struct nft_hook;
1146-
void nf_tables_chain_device_notify(const struct nft_chain *chain,
1147-
const struct nft_hook *hook,
1148-
const struct net_device *dev, int event);
1149-
11501145
enum nft_chain_types {
11511146
NFT_CHAIN_T_DEFAULT = 0,
11521147
NFT_CHAIN_T_ROUTE,

include/uapi/linux/netfilter/nf_tables.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ enum nf_tables_msg_types {
142142
NFT_MSG_DESTROYOBJ,
143143
NFT_MSG_DESTROYFLOWTABLE,
144144
NFT_MSG_GETSETELEM_RESET,
145-
NFT_MSG_NEWDEV,
146-
NFT_MSG_DELDEV,
147145
NFT_MSG_MAX,
148146
};
149147

@@ -1786,18 +1784,10 @@ enum nft_synproxy_attributes {
17861784
* enum nft_device_attributes - nf_tables device netlink attributes
17871785
*
17881786
* @NFTA_DEVICE_NAME: name of this device (NLA_STRING)
1789-
* @NFTA_DEVICE_TABLE: table containing the flowtable or chain hooking into the device (NLA_STRING)
1790-
* @NFTA_DEVICE_FLOWTABLE: flowtable hooking into the device (NLA_STRING)
1791-
* @NFTA_DEVICE_CHAIN: chain hooking into the device (NLA_STRING)
1792-
* @NFTA_DEVICE_SPEC: hook spec matching the device (NLA_STRING)
17931787
*/
17941788
enum nft_devices_attributes {
17951789
NFTA_DEVICE_UNSPEC,
17961790
NFTA_DEVICE_NAME,
1797-
NFTA_DEVICE_TABLE,
1798-
NFTA_DEVICE_FLOWTABLE,
1799-
NFTA_DEVICE_CHAIN,
1800-
NFTA_DEVICE_SPEC,
18011791
__NFTA_DEVICE_MAX
18021792
};
18031793
#define NFTA_DEVICE_MAX (__NFTA_DEVICE_MAX - 1)

include/uapi/linux/netfilter/nfnetlink.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ enum nfnetlink_groups {
2525
#define NFNLGRP_ACCT_QUOTA NFNLGRP_ACCT_QUOTA
2626
NFNLGRP_NFTRACE,
2727
#define NFNLGRP_NFTRACE NFNLGRP_NFTRACE
28-
NFNLGRP_NFT_DEV,
29-
#define NFNLGRP_NFT_DEV NFNLGRP_NFT_DEV
3028
__NFNLGRP_MAX,
3129
};
3230
#define NFNLGRP_MAX (__NFNLGRP_MAX - 1)

net/netfilter/nf_tables_api.c

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -9686,64 +9686,6 @@ struct nf_hook_ops *nft_hook_find_ops_rcu(const struct nft_hook *hook,
96869686
}
96879687
EXPORT_SYMBOL_GPL(nft_hook_find_ops_rcu);
96889688

9689-
static void
9690-
nf_tables_device_notify(const struct nft_table *table, int attr,
9691-
const char *name, const struct nft_hook *hook,
9692-
const struct net_device *dev, int event)
9693-
{
9694-
struct net *net = dev_net(dev);
9695-
struct nlmsghdr *nlh;
9696-
struct sk_buff *skb;
9697-
u16 flags = 0;
9698-
9699-
if (!nfnetlink_has_listeners(net, NFNLGRP_NFT_DEV))
9700-
return;
9701-
9702-
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
9703-
if (!skb)
9704-
goto err;
9705-
9706-
event = event == NETDEV_REGISTER ? NFT_MSG_NEWDEV : NFT_MSG_DELDEV;
9707-
event = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, event);
9708-
nlh = nfnl_msg_put(skb, 0, 0, event, flags, table->family,
9709-
NFNETLINK_V0, nft_base_seq(net));
9710-
if (!nlh)
9711-
goto err;
9712-
9713-
if (nla_put_string(skb, NFTA_DEVICE_TABLE, table->name) ||
9714-
nla_put_string(skb, attr, name) ||
9715-
nla_put(skb, NFTA_DEVICE_SPEC, hook->ifnamelen, hook->ifname) ||
9716-
nla_put_string(skb, NFTA_DEVICE_NAME, dev->name))
9717-
goto err;
9718-
9719-
nlmsg_end(skb, nlh);
9720-
nfnetlink_send(skb, net, 0, NFNLGRP_NFT_DEV,
9721-
nlmsg_report(nlh), GFP_KERNEL);
9722-
return;
9723-
err:
9724-
if (skb)
9725-
kfree_skb(skb);
9726-
nfnetlink_set_err(net, 0, NFNLGRP_NFT_DEV, -ENOBUFS);
9727-
}
9728-
9729-
void
9730-
nf_tables_chain_device_notify(const struct nft_chain *chain,
9731-
const struct nft_hook *hook,
9732-
const struct net_device *dev, int event)
9733-
{
9734-
nf_tables_device_notify(chain->table, NFTA_DEVICE_CHAIN,
9735-
chain->name, hook, dev, event);
9736-
}
9737-
9738-
static void
9739-
nf_tables_flowtable_device_notify(const struct nft_flowtable *ft,
9740-
const struct nft_hook *hook,
9741-
const struct net_device *dev, int event)
9742-
{
9743-
nf_tables_device_notify(ft->table, NFTA_DEVICE_FLOWTABLE,
9744-
ft->name, hook, dev, event);
9745-
}
9746-
97479689
static int nft_flowtable_event(unsigned long event, struct net_device *dev,
97489690
struct nft_flowtable *flowtable, bool changename)
97499691
{
@@ -9791,7 +9733,6 @@ static int nft_flowtable_event(unsigned long event, struct net_device *dev,
97919733
list_add_tail_rcu(&ops->list, &hook->ops_list);
97929734
break;
97939735
}
9794-
nf_tables_flowtable_device_notify(flowtable, hook, dev, event);
97959736
break;
97969737
}
97979738
return 0;

net/netfilter/nfnetlink.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ static const int nfnl_group2type[NFNLGRP_MAX+1] = {
8686
[NFNLGRP_NFTABLES] = NFNL_SUBSYS_NFTABLES,
8787
[NFNLGRP_ACCT_QUOTA] = NFNL_SUBSYS_ACCT,
8888
[NFNLGRP_NFTRACE] = NFNL_SUBSYS_NFTABLES,
89-
[NFNLGRP_NFT_DEV] = NFNL_SUBSYS_NFTABLES,
9089
};
9190

9291
static struct nfnl_net *nfnl_pernet(struct net *net)

net/netfilter/nft_chain_filter.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,6 @@ static int nft_netdev_event(unsigned long event, struct net_device *dev,
363363
list_add_tail_rcu(&ops->list, &hook->ops_list);
364364
break;
365365
}
366-
nf_tables_chain_device_notify(&basechain->chain,
367-
hook, dev, event);
368366
break;
369367
}
370368
return 0;

0 commit comments

Comments
 (0)