Commit 69311e7c authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso

netfilter: nfnetlink_hook: Use same family as request message

Use the same family as the request message, for consistency. The
netlink payload provides sufficient information to describe the hook
object, including the family.

This makes it easier to userspace to correlate the hooks are that
visited by the packets for a certain family.

Fixes: e2cf17d3 ("netfilter: add new hook nfnl subsystem")
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 3d9bbaf6
...@@ -113,7 +113,7 @@ static int nfnl_hook_put_nft_chain_info(struct sk_buff *nlskb, ...@@ -113,7 +113,7 @@ static int nfnl_hook_put_nft_chain_info(struct sk_buff *nlskb,
static int nfnl_hook_dump_one(struct sk_buff *nlskb, static int nfnl_hook_dump_one(struct sk_buff *nlskb,
const struct nfnl_dump_hook_data *ctx, const struct nfnl_dump_hook_data *ctx,
const struct nf_hook_ops *ops, const struct nf_hook_ops *ops,
unsigned int seq) int family, unsigned int seq)
{ {
u16 event = nfnl_msg_type(NFNL_SUBSYS_HOOK, NFNL_MSG_HOOK_GET); u16 event = nfnl_msg_type(NFNL_SUBSYS_HOOK, NFNL_MSG_HOOK_GET);
unsigned int portid = NETLINK_CB(nlskb).portid; unsigned int portid = NETLINK_CB(nlskb).portid;
...@@ -124,7 +124,7 @@ static int nfnl_hook_dump_one(struct sk_buff *nlskb, ...@@ -124,7 +124,7 @@ static int nfnl_hook_dump_one(struct sk_buff *nlskb,
char *module_name; char *module_name;
#endif #endif
nlh = nfnl_msg_put(nlskb, portid, seq, event, nlh = nfnl_msg_put(nlskb, portid, seq, event,
NLM_F_MULTI, ops->pf, NFNETLINK_V0, 0); NLM_F_MULTI, family, NFNETLINK_V0, 0);
if (!nlh) if (!nlh)
goto nla_put_failure; goto nla_put_failure;
...@@ -264,7 +264,7 @@ static int nfnl_hook_dump(struct sk_buff *nlskb, ...@@ -264,7 +264,7 @@ static int nfnl_hook_dump(struct sk_buff *nlskb,
ops = nf_hook_entries_get_hook_ops(e); ops = nf_hook_entries_get_hook_ops(e);
for (; i < e->num_hook_entries; i++) { for (; i < e->num_hook_entries; i++) {
err = nfnl_hook_dump_one(nlskb, ctx, ops[i], err = nfnl_hook_dump_one(nlskb, ctx, ops[i], family,
cb->nlh->nlmsg_seq); cb->nlh->nlmsg_seq);
if (err) if (err)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment