aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/netlink.h
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-09-07 16:12:54 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-10 15:30:41 -0400
commit15e473046cb6e5d18a4d0057e61d76315230382b (patch)
tree893d2df5d46a6ce156933ac57a1398f0ad22b889 /include/net/netlink.h
parent9f00d9776bc5beb92e8bfc884a7e96ddc5589e2e (diff)
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>
Diffstat (limited to 'include/net/netlink.h')
-rw-r--r--include/net/netlink.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 09175d5d1fbf..9690b0f6698a 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -217,19 +217,19 @@ struct nla_policy {
217/** 217/**
218 * struct nl_info - netlink source information 218 * struct nl_info - netlink source information
219 * @nlh: Netlink message header of original request 219 * @nlh: Netlink message header of original request
220 * @pid: Netlink PID of requesting application 220 * @portid: Netlink PORTID of requesting application
221 */ 221 */
222struct nl_info { 222struct nl_info {
223 struct nlmsghdr *nlh; 223 struct nlmsghdr *nlh;
224 struct net *nl_net; 224 struct net *nl_net;
225 u32 pid; 225 u32 portid;
226}; 226};
227 227
228extern int netlink_rcv_skb(struct sk_buff *skb, 228extern int netlink_rcv_skb(struct sk_buff *skb,
229 int (*cb)(struct sk_buff *, 229 int (*cb)(struct sk_buff *,
230 struct nlmsghdr *)); 230 struct nlmsghdr *));
231extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, 231extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb,
232 u32 pid, unsigned int group, int report, 232 u32 portid, unsigned int group, int report,
233 gfp_t flags); 233 gfp_t flags);
234 234
235extern int nla_validate(const struct nlattr *head, 235extern int nla_validate(const struct nlattr *head,
@@ -444,7 +444,7 @@ static inline int nlmsg_report(const struct nlmsghdr *nlh)
444/** 444/**
445 * nlmsg_put - Add a new netlink message to an skb 445 * nlmsg_put - Add a new netlink message to an skb
446 * @skb: socket buffer to store message in 446 * @skb: socket buffer to store message in
447 * @pid: netlink process id 447 * @portid: netlink process id
448 * @seq: sequence number of message 448 * @seq: sequence number of message
449 * @type: message type 449 * @type: message type
450 * @payload: length of message payload 450 * @payload: length of message payload
@@ -453,13 +453,13 @@ static inline int nlmsg_report(const struct nlmsghdr *nlh)
453 * Returns NULL if the tailroom of the skb is insufficient to store 453 * Returns NULL if the tailroom of the skb is insufficient to store
454 * the message header and payload. 454 * the message header and payload.
455 */ 455 */
456static inline struct nlmsghdr *nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, 456static inline struct nlmsghdr *nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
457 int type, int payload, int flags) 457 int type, int payload, int flags)
458{ 458{
459 if (unlikely(skb_tailroom(skb) < nlmsg_total_size(payload))) 459 if (unlikely(skb_tailroom(skb) < nlmsg_total_size(payload)))
460 return NULL; 460 return NULL;
461 461
462 return __nlmsg_put(skb, pid, seq, type, payload, flags); 462 return __nlmsg_put(skb, portid, seq, type, payload, flags);
463} 463}
464 464
465/** 465/**
@@ -478,7 +478,7 @@ static inline struct nlmsghdr *nlmsg_put_answer(struct sk_buff *skb,
478 int type, int payload, 478 int type, int payload,
479 int flags) 479 int flags)
480{ 480{
481 return nlmsg_put(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, 481 return nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
482 type, payload, flags); 482 type, payload, flags);
483} 483}
484 484
@@ -563,18 +563,18 @@ static inline void nlmsg_free(struct sk_buff *skb)
563 * nlmsg_multicast - multicast a netlink message 563 * nlmsg_multicast - multicast a netlink message
564 * @sk: netlink socket to spread messages to 564 * @sk: netlink socket to spread messages to
565 * @skb: netlink message as socket buffer 565 * @skb: netlink message as socket buffer
566 * @pid: own netlink pid to avoid sending to yourself 566 * @portid: own netlink portid to avoid sending to yourself
567 * @group: multicast group id 567 * @group: multicast group id
568 * @flags: allocation flags 568 * @flags: allocation flags
569 */ 569 */
570static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb, 570static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb,
571 u32 pid, unsigned int group, gfp_t flags) 571 u32 portid, unsigned int group, gfp_t flags)
572{ 572{
573 int err; 573 int err;
574 574
575 NETLINK_CB(skb).dst_group = group; 575 NETLINK_CB(skb).dst_group = group;
576 576
577 err = netlink_broadcast(sk, skb, pid, group, flags); 577 err = netlink_broadcast(sk, skb, portid, group, flags);
578 if (err > 0) 578 if (err > 0)
579 err = 0; 579 err = 0;
580 580
@@ -585,13 +585,13 @@ static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb,
585 * nlmsg_unicast - unicast a netlink message 585 * nlmsg_unicast - unicast a netlink message
586 * @sk: netlink socket to spread message to 586 * @sk: netlink socket to spread message to
587 * @skb: netlink message as socket buffer 587 * @skb: netlink message as socket buffer
588 * @pid: netlink pid of the destination socket 588 * @portid: netlink portid of the destination socket
589 */ 589 */
590static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 pid) 590static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 portid)
591{ 591{
592 int err; 592 int err;
593 593
594 err = netlink_unicast(sk, skb, pid, MSG_DONTWAIT); 594 err = netlink_unicast(sk, skb, portid, MSG_DONTWAIT);
595 if (err > 0) 595 if (err > 0)
596 err = 0; 596 err = 0;
597 597