Skip to contentSkip to conversation

nft: Fix nlmsg_type in GET operation callbacks

PATCH In review Vijay Subramanian 2 participants 3 messages Aug 29, 2015 – Sep 1, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nft: Fix nlmsg_type in GET operation callbacks

nf_tables_gettable(), nf_tables_getchain() and nf_tables_getrule() send replies with nlmsg_type that correspond to ADD operation instead of GET. Set the type correctly.

---
 net/netfilter/nf_tables_api.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/netfilter/nf_tables_api.c +3 -3
index cfe6368..b97182a 100644
@@ -571,7 +571,7 @@ static int nf_tables_gettable(struct sock *nlsk, struct sk_buff *skb,
 		return -ENOMEM;
 
 	err = nf_tables_fill_table_info(skb2, net, NETLINK_CB(skb).portid,
-					nlh->nlmsg_seq, NFT_MSG_NEWTABLE, 0,
+					nlh->nlmsg_seq, NFT_MSG_GETTABLE, 0,
 					family, table);
 	if (err < 0)
 		goto err;
@@ -1136,7 +1136,7 @@ static int nf_tables_getchain(struct sock *nlsk, struct sk_buff *skb,
 		return -ENOMEM;
 
 	err = nf_tables_fill_chain_info(skb2, net, NETLINK_CB(skb).portid,
-					nlh->nlmsg_seq, NFT_MSG_NEWCHAIN, 0,
+					nlh->nlmsg_seq, NFT_MSG_GETCHAIN, 0,
 					family, table, chain);
 	if (err < 0)
 		goto err;
@@ -1974,7 +1974,7 @@ static int nf_tables_getrule(struct sock *nlsk, struct sk_buff *skb,
 		return -ENOMEM;
 
 	err = nf_tables_fill_rule_info(skb2, net, NETLINK_CB(skb).portid,
-				       nlh->nlmsg_seq, NFT_MSG_NEWRULE, 0,
+				       nlh->nlmsg_seq, NFT_MSG_GETRULE, 0,
 				       family, table, chain, rule);
 	if (err < 0)
 		goto err;
Signature · 1 line
1.7.9.5
#1 lore raw

Hi Vijay,

Quoted 3 lines · Vijay Subramanian

nf_tables_gettable(), nf_tables_getchain() and nf_tables_getrule() send replies with nlmsg_type that correspond to ADD operation instead of GET. Set the type correctly.

We always NFT_MSG_NEWTABLE as message type other major netlink subsystems that I can remember, so that is there for consistency.

Is there any why reason you need this change?

#2 lore raw

nstead of GET. Set the type correctly.

Quoted 5 lines

We always NFT_MSG_NEWTABLE as message type other major netlink subsystems that I can remember, so that is there for consistency.

Is there any why reason you need this change?

Not really. I was not sure if the current behavior was by design or an oversight.
Thanks for clarifying.

Vijay