[PATCH 01/11] netfilter: nf_tables: rename pid variables to portid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Patrick McHardy <kaber@xxxxxxxxx>

Use consistent naming for portids.

Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
---
 net/netfilter/nf_tables_api.c | 59 ++++++++++++++++++++++---------------------
 1 Datei geändert, 30 Zeilen hinzugefügt(+), 29 Zeilen entfernt(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 2253593..70ca084 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -156,7 +156,7 @@ static const struct nla_policy nft_table_policy[NFTA_TABLE_MAX + 1] = {
 	[NFTA_TABLE_FLAGS]	= { .type = NLA_U32 },
 };
 
-static int nf_tables_fill_table_info(struct sk_buff *skb, u32 pid, u32 seq,
+static int nf_tables_fill_table_info(struct sk_buff *skb, u32 portid, u32 seq,
 				     int event, int family,
 				     const struct nft_table *table)
 {
@@ -164,10 +164,10 @@ static int nf_tables_fill_table_info(struct sk_buff *skb, u32 pid, u32 seq,
 	struct nfgenmsg *nfmsg;
 
 	event |= NFNL_SUBSYS_NFTABLES << 8;
-	nlh = nlmsg_put(skb, pid, seq, event, sizeof(struct nfgenmsg), 0);
+	nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct nfgenmsg), 0);
 	if (nlh == NULL)
 		goto nla_put_failure;
-	nlh->nlmsg_flags	= pid ? NLM_F_MULTI : 0;
+	nlh->nlmsg_flags	= portid ? NLM_F_MULTI : 0;
 
 	nfmsg = nlmsg_data(nlh);
 	nfmsg->nfgen_family	= family;
@@ -191,7 +191,7 @@ static int nf_tables_table_notify(const struct sk_buff *oskb,
 				  int event, int family)
 {
 	struct sk_buff *skb;
-	u32 pid = oskb ? NETLINK_CB(oskb).portid : 0;
+	u32 portid = oskb ? NETLINK_CB(oskb).portid : 0;
 	u32 seq = nlh ? nlh->nlmsg_seq : 0;
 	struct net *net = oskb ? sock_net(oskb->sk) : &init_net;
 	bool report;
@@ -206,17 +206,17 @@ static int nf_tables_table_notify(const struct sk_buff *oskb,
 	if (skb == NULL)
 		goto err;
 
-	err = nf_tables_fill_table_info(skb, pid, seq, event, family, table);
+	err = nf_tables_fill_table_info(skb, portid, seq, event, family, table);
 	if (err < 0) {
 		kfree_skb(skb);
 		goto err;
 	}
 
-	err = nfnetlink_send(skb, net, pid, NFNLGRP_NFTABLES, report,
+	err = nfnetlink_send(skb, net, portid, NFNLGRP_NFTABLES, report,
 			     GFP_KERNEL);
 err:
 	if (err < 0)
-		nfnetlink_set_err(net, pid, NFNLGRP_NFTABLES, err);
+		nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, err);
 	return err;
 }
 
@@ -507,7 +507,7 @@ static const struct nla_policy nft_hook_policy[NFTA_HOOK_MAX + 1] = {
 	[NFTA_HOOK_PRIORITY]	= { .type = NLA_U32 },
 };
 
-static int nf_tables_fill_chain_info(struct sk_buff *skb, u32 pid, u32 seq,
+static int nf_tables_fill_chain_info(struct sk_buff *skb, u32 portid, u32 seq,
 				     int event, int family,
 				     const struct nft_table *table,
 				     const struct nft_chain *chain)
@@ -516,10 +516,10 @@ static int nf_tables_fill_chain_info(struct sk_buff *skb, u32 pid, u32 seq,
 	struct nfgenmsg *nfmsg;
 
 	event |= NFNL_SUBSYS_NFTABLES << 8;
-	nlh = nlmsg_put(skb, pid, seq, event, sizeof(struct nfgenmsg), 0);
+	nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct nfgenmsg), 0);
 	if (nlh == NULL)
 		goto nla_put_failure;
-	nlh->nlmsg_flags	= pid ? NLM_F_MULTI : 0;
+	nlh->nlmsg_flags	= portid ? NLM_F_MULTI : 0;
 
 	nfmsg = nlmsg_data(nlh);
 	nfmsg->nfgen_family	= family;
@@ -567,7 +567,7 @@ static int nf_tables_chain_notify(const struct sk_buff *oskb,
 				  int event, int family)
 {
 	struct sk_buff *skb;
-	u32 pid = oskb ? NETLINK_CB(oskb).portid : 0;
+	u32 portid = oskb ? NETLINK_CB(oskb).portid : 0;
 	u32 seq = nlh ? nlh->nlmsg_seq : 0;
 	struct net *net = oskb ? sock_net(oskb->sk) : &init_net;
 	bool report;
@@ -582,18 +582,18 @@ static int nf_tables_chain_notify(const struct sk_buff *oskb,
 	if (skb == NULL)
 		goto err;
 
-	err = nf_tables_fill_chain_info(skb, pid, seq, event, family, table,
+	err = nf_tables_fill_chain_info(skb, portid, seq, event, family, table,
 					chain);
 	if (err < 0) {
 		kfree_skb(skb);
 		goto err;
 	}
 
-	err = nfnetlink_send(skb, net, pid, NFNLGRP_NFTABLES, report,
+	err = nfnetlink_send(skb, net, portid, NFNLGRP_NFTABLES, report,
 			     GFP_KERNEL);
 err:
 	if (err < 0)
-		nfnetlink_set_err(net, pid, NFNLGRP_NFTABLES, err);
+		nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, err);
 	return err;
 }
 
@@ -1130,7 +1130,7 @@ static const struct nla_policy nft_rule_policy[NFTA_RULE_MAX + 1] = {
 	[NFTA_RULE_EXPRESSIONS]	= { .type = NLA_NESTED },
 };
 
-static int nf_tables_fill_rule_info(struct sk_buff *skb, u32 pid, u32 seq,
+static int nf_tables_fill_rule_info(struct sk_buff *skb, u32 portid, u32 seq,
 				    int event, int family,
 				    const struct nft_table *table,
 				    const struct nft_chain *chain,
@@ -1142,10 +1142,10 @@ static int nf_tables_fill_rule_info(struct sk_buff *skb, u32 pid, u32 seq,
 	struct nlattr *list;
 
 	event |= NFNL_SUBSYS_NFTABLES << 8;
-	nlh = nlmsg_put(skb, pid, seq, event, sizeof(struct nfgenmsg), 0);
+	nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct nfgenmsg), 0);
 	if (nlh == NULL)
 		goto nla_put_failure;
-	nlh->nlmsg_flags	= pid ? NLM_F_MULTI : 0;
+	nlh->nlmsg_flags	= portid ? NLM_F_MULTI : 0;
 
 	nfmsg = nlmsg_data(nlh);
 	nfmsg->nfgen_family	= family;
@@ -1187,7 +1187,7 @@ static int nf_tables_rule_notify(const struct sk_buff *oskb,
 				 int event, int family)
 {
 	struct sk_buff *skb;
-	u32 pid = NETLINK_CB(oskb).portid;
+	u32 portid = NETLINK_CB(oskb).portid;
 	u32 seq = nlh->nlmsg_seq;
 	struct net *net = sock_net(oskb->sk);
 	bool report;
@@ -1202,18 +1202,18 @@ static int nf_tables_rule_notify(const struct sk_buff *oskb,
 	if (skb == NULL)
 		goto err;
 
-	err = nf_tables_fill_rule_info(skb, pid, seq, event,
+	err = nf_tables_fill_rule_info(skb, portid, seq, event,
 				       family, table, chain, rule);
 	if (err < 0) {
 		kfree_skb(skb);
 		goto err;
 	}
 
-	err = nfnetlink_send(skb, net, pid, NFNLGRP_NFTABLES, report,
+	err = nfnetlink_send(skb, net, portid, NFNLGRP_NFTABLES, report,
 			     GFP_KERNEL);
 err:
 	if (err < 0)
-		nfnetlink_set_err(net, pid, NFNLGRP_NFTABLES, err);
+		nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, err);
 	return err;
 }
 
@@ -1643,11 +1643,12 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx,
 {
 	struct nfgenmsg *nfmsg;
 	struct nlmsghdr *nlh;
-	u32 pid = NETLINK_CB(ctx->skb).portid;
+	u32 portid = NETLINK_CB(ctx->skb).portid;
 	u32 seq = ctx->nlh->nlmsg_seq;
 
 	event |= NFNL_SUBSYS_NFTABLES << 8;
-	nlh = nlmsg_put(skb, pid, seq, event, sizeof(struct nfgenmsg), flags);
+	nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct nfgenmsg),
+			flags);
 	if (nlh == NULL)
 		goto nla_put_failure;
 
@@ -1687,7 +1688,7 @@ static int nf_tables_set_notify(const struct nft_ctx *ctx,
 				int event)
 {
 	struct sk_buff *skb;
-	u32 pid = NETLINK_CB(ctx->skb).portid;
+	u32 portid = NETLINK_CB(ctx->skb).portid;
 	struct net *net = sock_net(ctx->skb->sk);
 	bool report;
 	int err;
@@ -1707,11 +1708,11 @@ static int nf_tables_set_notify(const struct nft_ctx *ctx,
 		goto err;
 	}
 
-	err = nfnetlink_send(skb, net, pid, NFNLGRP_NFTABLES, report,
+	err = nfnetlink_send(skb, net, portid, NFNLGRP_NFTABLES, report,
 			     GFP_KERNEL);
 err:
 	if (err < 0)
-		nfnetlink_set_err(net, pid, NFNLGRP_NFTABLES, err);
+		nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, err);
 	return err;
 }
 
@@ -2113,7 +2114,7 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb)
 	struct nfgenmsg *nfmsg;
 	struct nlmsghdr *nlh;
 	struct nlattr *nest;
-	u32 pid, seq;
+	u32 portid, seq;
 	int event, err;
 
 	nfmsg = nlmsg_data(cb->nlh);
@@ -2132,10 +2133,10 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb)
 
 	event  = NFT_MSG_NEWSETELEM;
 	event |= NFNL_SUBSYS_NFTABLES << 8;
-	pid    = NETLINK_CB(cb->skb).portid;
+	portid = NETLINK_CB(cb->skb).portid;
 	seq    = cb->nlh->nlmsg_seq;
 
-	nlh = nlmsg_put(skb, pid, seq, event, sizeof(struct nfgenmsg),
+	nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct nfgenmsg),
 			NLM_F_MULTI);
 	if (nlh == NULL)
 		goto nla_put_failure;
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux