Skip to content

Commit

Permalink
netfilter: nf_tables: add check_genid to the nfnetlink subsystem
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ummakynes committed Feb 12, 2017
1 parent 8c4d4e8 commit 74e8bcd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/netfilter/nf_tables_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -4972,13 +4972,19 @@ static int nf_tables_abort(struct net *net, struct sk_buff *skb)
return 0;
}

static bool nf_tables_valid_genid(struct net *net, u32 genid)
{
return net->nft.base_seq == genid;
}

static const struct nfnetlink_subsystem nf_tables_subsys = {
.name = "nf_tables",
.subsys_id = NFNL_SUBSYS_NFTABLES,
.cb_count = NFT_MSG_MAX,
.cb = nf_tables_cb,
.commit = nf_tables_commit,
.abort = nf_tables_abort,
.valid_genid = nf_tables_valid_genid,
};

int nft_chain_validate_dependency(const struct nft_chain *chain,
Expand Down

0 comments on commit 74e8bcd

Please sign in to comment.