Skip to content

Commit 717478d

Browse files
Phil SutterNipaLocal
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]> Signed-off-by: NipaLocal <nipa@local>
1 parent 638dfc4 commit 717478d

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
@@ -9694,64 +9694,6 @@ struct nf_hook_ops *nft_hook_find_ops_rcu(const struct nft_hook *hook,
96949694
}
96959695
EXPORT_SYMBOL_GPL(nft_hook_find_ops_rcu);
96969696

9697-
static void
9698-
nf_tables_device_notify(const struct nft_table *table, int attr,
9699-
const char *name, const struct nft_hook *hook,
9700-
const struct net_device *dev, int event)
9701-
{
9702-
struct net *net = dev_net(dev);
9703-
struct nlmsghdr *nlh;
9704-
struct sk_buff *skb;
9705-
u16 flags = 0;
9706-
9707-
if (!nfnetlink_has_listeners(net, NFNLGRP_NFT_DEV))
9708-
return;
9709-
9710-
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
9711-
if (!skb)
9712-
goto err;
9713-
9714-
event = event == NETDEV_REGISTER ? NFT_MSG_NEWDEV : NFT_MSG_DELDEV;
9715-
event = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, event);
9716-
nlh = nfnl_msg_put(skb, 0, 0, event, flags, table->family,
9717-
NFNETLINK_V0, nft_base_seq(net));
9718-
if (!nlh)
9719-
goto err;
9720-
9721-
if (nla_put_string(skb, NFTA_DEVICE_TABLE, table->name) ||
9722-
nla_put_string(skb, attr, name) ||
9723-
nla_put(skb, NFTA_DEVICE_SPEC, hook->ifnamelen, hook->ifname) ||
9724-
nla_put_string(skb, NFTA_DEVICE_NAME, dev->name))
9725-
goto err;
9726-
9727-
nlmsg_end(skb, nlh);
9728-
nfnetlink_send(skb, net, 0, NFNLGRP_NFT_DEV,
9729-
nlmsg_report(nlh), GFP_KERNEL);
9730-
return;
9731-
err:
9732-
if (skb)
9733-
kfree_skb(skb);
9734-
nfnetlink_set_err(net, 0, NFNLGRP_NFT_DEV, -ENOBUFS);
9735-
}
9736-
9737-
void
9738-
nf_tables_chain_device_notify(const struct nft_chain *chain,
9739-
const struct nft_hook *hook,
9740-
const struct net_device *dev, int event)
9741-
{
9742-
nf_tables_device_notify(chain->table, NFTA_DEVICE_CHAIN,
9743-
chain->name, hook, dev, event);
9744-
}
9745-
9746-
static void
9747-
nf_tables_flowtable_device_notify(const struct nft_flowtable *ft,
9748-
const struct nft_hook *hook,
9749-
const struct net_device *dev, int event)
9750-
{
9751-
nf_tables_device_notify(ft->table, NFTA_DEVICE_FLOWTABLE,
9752-
ft->name, hook, dev, event);
9753-
}
9754-
97559697
static int nft_flowtable_event(unsigned long event, struct net_device *dev,
97569698
struct nft_flowtable *flowtable, bool changename)
97579699
{
@@ -9799,7 +9741,6 @@ static int nft_flowtable_event(unsigned long event, struct net_device *dev,
97999741
list_add_tail_rcu(&ops->list, &hook->ops_list);
98009742
break;
98019743
}
9802-
nf_tables_flowtable_device_notify(flowtable, hook, dev, event);
98039744
break;
98049745
}
98059746
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)