提交 ca2f18be 编写于 作者: F Florian Westphal 提交者: Pablo Neira Ayuso

netfilter: nf_tables: make valid_genid callback mandatory

always call this function, followup patch can use this to
aquire a per-netns transaction log to guard the entire batch
instead of using the nfnl susbsys mutex (which is shared among all
namespaces).
Signed-off-by: NFlorian Westphal <fw@strlen.de>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
上级 452238e8
...@@ -6591,7 +6591,7 @@ static int nf_tables_abort(struct net *net, struct sk_buff *skb) ...@@ -6591,7 +6591,7 @@ static int nf_tables_abort(struct net *net, struct sk_buff *skb)
static bool nf_tables_valid_genid(struct net *net, u32 genid) static bool nf_tables_valid_genid(struct net *net, u32 genid)
{ {
return net->nft.base_seq == genid; return genid == 0 || net->nft.base_seq == genid;
} }
static const struct nfnetlink_subsystem nf_tables_subsys = { static const struct nfnetlink_subsystem nf_tables_subsys = {
......
...@@ -331,13 +331,13 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -331,13 +331,13 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
} }
} }
if (!ss->commit || !ss->abort) { if (!ss->valid_genid || !ss->commit || !ss->abort) {
nfnl_unlock(subsys_id); nfnl_unlock(subsys_id);
netlink_ack(oskb, nlh, -EOPNOTSUPP, NULL); netlink_ack(oskb, nlh, -EOPNOTSUPP, NULL);
return kfree_skb(skb); return kfree_skb(skb);
} }
if (genid && ss->valid_genid && !ss->valid_genid(net, genid)) { if (!ss->valid_genid(net, genid)) {
nfnl_unlock(subsys_id); nfnl_unlock(subsys_id);
netlink_ack(oskb, nlh, -ERESTART, NULL); netlink_ack(oskb, nlh, -ERESTART, NULL);
return kfree_skb(skb); return kfree_skb(skb);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册