netlink: Rename pid to portid to avoid confusion
It is a frequent mistake to confuse the netlink port identifier with a process identifier. Try to reduce this confusion by renaming fields that hold port identifiers portid instead of pid. I have carefully avoided changing the structures exported to userspace to avoid changing the userspace API. I have successfully built an allyesconfig kernel with this change. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
9f00d9776b
commit
15e473046c
@@ -1874,7 +1874,7 @@ static struct rt6_info *rt6_add_route_info(struct net *net,
|
||||
.fc_dst_len = prefixlen,
|
||||
.fc_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_ROUTEINFO |
|
||||
RTF_UP | RTF_PREF(pref),
|
||||
.fc_nlinfo.pid = 0,
|
||||
.fc_nlinfo.portid = 0,
|
||||
.fc_nlinfo.nlh = NULL,
|
||||
.fc_nlinfo.nl_net = net,
|
||||
};
|
||||
@@ -1924,7 +1924,7 @@ struct rt6_info *rt6_add_dflt_router(const struct in6_addr *gwaddr,
|
||||
.fc_ifindex = dev->ifindex,
|
||||
.fc_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT |
|
||||
RTF_UP | RTF_EXPIRES | RTF_PREF(pref),
|
||||
.fc_nlinfo.pid = 0,
|
||||
.fc_nlinfo.portid = 0,
|
||||
.fc_nlinfo.nlh = NULL,
|
||||
.fc_nlinfo.nl_net = dev_net(dev),
|
||||
};
|
||||
@@ -2285,7 +2285,7 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||
if (rtm->rtm_type == RTN_LOCAL)
|
||||
cfg->fc_flags |= RTF_LOCAL;
|
||||
|
||||
cfg->fc_nlinfo.pid = NETLINK_CB(skb).pid;
|
||||
cfg->fc_nlinfo.portid = NETLINK_CB(skb).portid;
|
||||
cfg->fc_nlinfo.nlh = nlh;
|
||||
cfg->fc_nlinfo.nl_net = sock_net(skb->sk);
|
||||
|
||||
@@ -2376,7 +2376,7 @@ static inline size_t rt6_nlmsg_size(void)
|
||||
static int rt6_fill_node(struct net *net,
|
||||
struct sk_buff *skb, struct rt6_info *rt,
|
||||
struct in6_addr *dst, struct in6_addr *src,
|
||||
int iif, int type, u32 pid, u32 seq,
|
||||
int iif, int type, u32 portid, u32 seq,
|
||||
int prefix, int nowait, unsigned int flags)
|
||||
{
|
||||
struct rtmsg *rtm;
|
||||
@@ -2392,7 +2392,7 @@ static int rt6_fill_node(struct net *net,
|
||||
}
|
||||
}
|
||||
|
||||
nlh = nlmsg_put(skb, pid, seq, type, sizeof(*rtm), flags);
|
||||
nlh = nlmsg_put(skb, portid, seq, type, sizeof(*rtm), flags);
|
||||
if (!nlh)
|
||||
return -EMSGSIZE;
|
||||
|
||||
@@ -2537,7 +2537,7 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg)
|
||||
|
||||
return rt6_fill_node(arg->net,
|
||||
arg->skb, rt, NULL, NULL, 0, RTM_NEWROUTE,
|
||||
NETLINK_CB(arg->cb->skb).pid, arg->cb->nlh->nlmsg_seq,
|
||||
NETLINK_CB(arg->cb->skb).portid, arg->cb->nlh->nlmsg_seq,
|
||||
prefix, 0, NLM_F_MULTI);
|
||||
}
|
||||
|
||||
@@ -2617,14 +2617,14 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
|
||||
skb_dst_set(skb, &rt->dst);
|
||||
|
||||
err = rt6_fill_node(net, skb, rt, &fl6.daddr, &fl6.saddr, iif,
|
||||
RTM_NEWROUTE, NETLINK_CB(in_skb).pid,
|
||||
RTM_NEWROUTE, NETLINK_CB(in_skb).portid,
|
||||
nlh->nlmsg_seq, 0, 0, 0);
|
||||
if (err < 0) {
|
||||
kfree_skb(skb);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).pid);
|
||||
err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid);
|
||||
errout:
|
||||
return err;
|
||||
}
|
||||
@@ -2644,14 +2644,14 @@ void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info)
|
||||
goto errout;
|
||||
|
||||
err = rt6_fill_node(net, skb, rt, NULL, NULL, 0,
|
||||
event, info->pid, seq, 0, 0, 0);
|
||||
event, info->portid, seq, 0, 0, 0);
|
||||
if (err < 0) {
|
||||
/* -EMSGSIZE implies BUG in rt6_nlmsg_size() */
|
||||
WARN_ON(err == -EMSGSIZE);
|
||||
kfree_skb(skb);
|
||||
goto errout;
|
||||
}
|
||||
rtnl_notify(skb, net, info->pid, RTNLGRP_IPV6_ROUTE,
|
||||
rtnl_notify(skb, net, info->portid, RTNLGRP_IPV6_ROUTE,
|
||||
info->nlh, gfp_any());
|
||||
return;
|
||||
errout:
|
||||
|
Reference in New Issue
Block a user