Skip to content

Commit 74e8bcd

Browse files
committed
netfilter: nf_tables: add check_genid to the nfnetlink subsystem
This patch implements the check generation id as provided by nfnetlink. This allows us to reject ruleset updates against stale baseline, so userspace can retry update with a fresh ruleset cache. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 8c4d4e8 commit 74e8bcd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4972,13 +4972,19 @@ static int nf_tables_abort(struct net *net, struct sk_buff *skb)
49724972
return 0;
49734973
}
49744974

4975+
static bool nf_tables_valid_genid(struct net *net, u32 genid)
4976+
{
4977+
return net->nft.base_seq == genid;
4978+
}
4979+
49754980
static const struct nfnetlink_subsystem nf_tables_subsys = {
49764981
.name = "nf_tables",
49774982
.subsys_id = NFNL_SUBSYS_NFTABLES,
49784983
.cb_count = NFT_MSG_MAX,
49794984
.cb = nf_tables_cb,
49804985
.commit = nf_tables_commit,
49814986
.abort = nf_tables_abort,
4987+
.valid_genid = nf_tables_valid_genid,
49824988
};
49834989

49844990
int nft_chain_validate_dependency(const struct nft_chain *chain,

0 commit comments

Comments
 (0)