aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm
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 /net/xfrm
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 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_state.c10
-rw-r--r--net/xfrm/xfrm_user.c62
2 files changed, 36 insertions, 36 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 7856c33898fa..30edad44e7fc 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -166,7 +166,7 @@ static DEFINE_SPINLOCK(xfrm_state_gc_lock);
166int __xfrm_state_delete(struct xfrm_state *x); 166int __xfrm_state_delete(struct xfrm_state *x);
167 167
168int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); 168int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol);
169void km_state_expired(struct xfrm_state *x, int hard, u32 pid); 169void km_state_expired(struct xfrm_state *x, int hard, u32 portid);
170 170
171static struct xfrm_state_afinfo *xfrm_state_lock_afinfo(unsigned int family) 171static struct xfrm_state_afinfo *xfrm_state_lock_afinfo(unsigned int family)
172{ 172{
@@ -1674,13 +1674,13 @@ void km_state_notify(struct xfrm_state *x, const struct km_event *c)
1674EXPORT_SYMBOL(km_policy_notify); 1674EXPORT_SYMBOL(km_policy_notify);
1675EXPORT_SYMBOL(km_state_notify); 1675EXPORT_SYMBOL(km_state_notify);
1676 1676
1677void km_state_expired(struct xfrm_state *x, int hard, u32 pid) 1677void km_state_expired(struct xfrm_state *x, int hard, u32 portid)
1678{ 1678{
1679 struct net *net = xs_net(x); 1679 struct net *net = xs_net(x);
1680 struct km_event c; 1680 struct km_event c;
1681 1681
1682 c.data.hard = hard; 1682 c.data.hard = hard;
1683 c.pid = pid; 1683 c.portid = portid;
1684 c.event = XFRM_MSG_EXPIRE; 1684 c.event = XFRM_MSG_EXPIRE;
1685 km_state_notify(x, &c); 1685 km_state_notify(x, &c);
1686 1686
@@ -1726,13 +1726,13 @@ int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport)
1726} 1726}
1727EXPORT_SYMBOL(km_new_mapping); 1727EXPORT_SYMBOL(km_new_mapping);
1728 1728
1729void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid) 1729void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 portid)
1730{ 1730{
1731 struct net *net = xp_net(pol); 1731 struct net *net = xp_net(pol);
1732 struct km_event c; 1732 struct km_event c;
1733 1733
1734 c.data.hard = hard; 1734 c.data.hard = hard;
1735 c.pid = pid; 1735 c.portid = portid;
1736 c.event = XFRM_MSG_POLEXPIRE; 1736 c.event = XFRM_MSG_POLEXPIRE;
1737 km_policy_notify(pol, dir, &c); 1737 km_policy_notify(pol, dir, &c);
1738 1738
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 354070adb5ef..b313d932d678 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -603,7 +603,7 @@ static int xfrm_add_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
603 } 603 }
604 604
605 c.seq = nlh->nlmsg_seq; 605 c.seq = nlh->nlmsg_seq;
606 c.pid = nlh->nlmsg_pid; 606 c.portid = nlh->nlmsg_pid;
607 c.event = nlh->nlmsg_type; 607 c.event = nlh->nlmsg_type;
608 608
609 km_state_notify(x, &c); 609 km_state_notify(x, &c);
@@ -676,7 +676,7 @@ static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
676 goto out; 676 goto out;
677 677
678 c.seq = nlh->nlmsg_seq; 678 c.seq = nlh->nlmsg_seq;
679 c.pid = nlh->nlmsg_pid; 679 c.portid = nlh->nlmsg_pid;
680 c.event = nlh->nlmsg_type; 680 c.event = nlh->nlmsg_type;
681 km_state_notify(x, &c); 681 km_state_notify(x, &c);
682 682
@@ -826,7 +826,7 @@ static int dump_one_state(struct xfrm_state *x, int count, void *ptr)
826 struct nlmsghdr *nlh; 826 struct nlmsghdr *nlh;
827 int err; 827 int err;
828 828
829 nlh = nlmsg_put(skb, NETLINK_CB(in_skb).pid, sp->nlmsg_seq, 829 nlh = nlmsg_put(skb, NETLINK_CB(in_skb).portid, sp->nlmsg_seq,
830 XFRM_MSG_NEWSA, sizeof(*p), sp->nlmsg_flags); 830 XFRM_MSG_NEWSA, sizeof(*p), sp->nlmsg_flags);
831 if (nlh == NULL) 831 if (nlh == NULL)
832 return -EMSGSIZE; 832 return -EMSGSIZE;
@@ -904,7 +904,7 @@ static inline size_t xfrm_spdinfo_msgsize(void)
904} 904}
905 905
906static int build_spdinfo(struct sk_buff *skb, struct net *net, 906static int build_spdinfo(struct sk_buff *skb, struct net *net,
907 u32 pid, u32 seq, u32 flags) 907 u32 portid, u32 seq, u32 flags)
908{ 908{
909 struct xfrmk_spdinfo si; 909 struct xfrmk_spdinfo si;
910 struct xfrmu_spdinfo spc; 910 struct xfrmu_spdinfo spc;
@@ -913,7 +913,7 @@ static int build_spdinfo(struct sk_buff *skb, struct net *net,
913 int err; 913 int err;
914 u32 *f; 914 u32 *f;
915 915
916 nlh = nlmsg_put(skb, pid, seq, XFRM_MSG_NEWSPDINFO, sizeof(u32), 0); 916 nlh = nlmsg_put(skb, portid, seq, XFRM_MSG_NEWSPDINFO, sizeof(u32), 0);
917 if (nlh == NULL) /* shouldn't really happen ... */ 917 if (nlh == NULL) /* shouldn't really happen ... */
918 return -EMSGSIZE; 918 return -EMSGSIZE;
919 919
@@ -946,17 +946,17 @@ static int xfrm_get_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
946 struct net *net = sock_net(skb->sk); 946 struct net *net = sock_net(skb->sk);
947 struct sk_buff *r_skb; 947 struct sk_buff *r_skb;
948 u32 *flags = nlmsg_data(nlh); 948 u32 *flags = nlmsg_data(nlh);
949 u32 spid = NETLINK_CB(skb).pid; 949 u32 sportid = NETLINK_CB(skb).portid;
950 u32 seq = nlh->nlmsg_seq; 950 u32 seq = nlh->nlmsg_seq;
951 951
952 r_skb = nlmsg_new(xfrm_spdinfo_msgsize(), GFP_ATOMIC); 952 r_skb = nlmsg_new(xfrm_spdinfo_msgsize(), GFP_ATOMIC);
953 if (r_skb == NULL) 953 if (r_skb == NULL)
954 return -ENOMEM; 954 return -ENOMEM;
955 955
956 if (build_spdinfo(r_skb, net, spid, seq, *flags) < 0) 956 if (build_spdinfo(r_skb, net, sportid, seq, *flags) < 0)
957 BUG(); 957 BUG();
958 958
959 return nlmsg_unicast(net->xfrm.nlsk, r_skb, spid); 959 return nlmsg_unicast(net->xfrm.nlsk, r_skb, sportid);
960} 960}
961 961
962static inline size_t xfrm_sadinfo_msgsize(void) 962static inline size_t xfrm_sadinfo_msgsize(void)
@@ -967,7 +967,7 @@ static inline size_t xfrm_sadinfo_msgsize(void)
967} 967}
968 968
969static int build_sadinfo(struct sk_buff *skb, struct net *net, 969static int build_sadinfo(struct sk_buff *skb, struct net *net,
970 u32 pid, u32 seq, u32 flags) 970 u32 portid, u32 seq, u32 flags)
971{ 971{
972 struct xfrmk_sadinfo si; 972 struct xfrmk_sadinfo si;
973 struct xfrmu_sadhinfo sh; 973 struct xfrmu_sadhinfo sh;
@@ -975,7 +975,7 @@ static int build_sadinfo(struct sk_buff *skb, struct net *net,
975 int err; 975 int err;
976 u32 *f; 976 u32 *f;
977 977
978 nlh = nlmsg_put(skb, pid, seq, XFRM_MSG_NEWSADINFO, sizeof(u32), 0); 978 nlh = nlmsg_put(skb, portid, seq, XFRM_MSG_NEWSADINFO, sizeof(u32), 0);
979 if (nlh == NULL) /* shouldn't really happen ... */ 979 if (nlh == NULL) /* shouldn't really happen ... */
980 return -EMSGSIZE; 980 return -EMSGSIZE;
981 981
@@ -1003,17 +1003,17 @@ static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
1003 struct net *net = sock_net(skb->sk); 1003 struct net *net = sock_net(skb->sk);
1004 struct sk_buff *r_skb; 1004 struct sk_buff *r_skb;
1005 u32 *flags = nlmsg_data(nlh); 1005 u32 *flags = nlmsg_data(nlh);
1006 u32 spid = NETLINK_CB(skb).pid; 1006 u32 sportid = NETLINK_CB(skb).portid;
1007 u32 seq = nlh->nlmsg_seq; 1007 u32 seq = nlh->nlmsg_seq;
1008 1008
1009 r_skb = nlmsg_new(xfrm_sadinfo_msgsize(), GFP_ATOMIC); 1009 r_skb = nlmsg_new(xfrm_sadinfo_msgsize(), GFP_ATOMIC);
1010 if (r_skb == NULL) 1010 if (r_skb == NULL)
1011 return -ENOMEM; 1011 return -ENOMEM;
1012 1012
1013 if (build_sadinfo(r_skb, net, spid, seq, *flags) < 0) 1013 if (build_sadinfo(r_skb, net, sportid, seq, *flags) < 0)
1014 BUG(); 1014 BUG();
1015 1015
1016 return nlmsg_unicast(net->xfrm.nlsk, r_skb, spid); 1016 return nlmsg_unicast(net->xfrm.nlsk, r_skb, sportid);
1017} 1017}
1018 1018
1019static int xfrm_get_sa(struct sk_buff *skb, struct nlmsghdr *nlh, 1019static int xfrm_get_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
@@ -1033,7 +1033,7 @@ static int xfrm_get_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
1033 if (IS_ERR(resp_skb)) { 1033 if (IS_ERR(resp_skb)) {
1034 err = PTR_ERR(resp_skb); 1034 err = PTR_ERR(resp_skb);
1035 } else { 1035 } else {
1036 err = nlmsg_unicast(net->xfrm.nlsk, resp_skb, NETLINK_CB(skb).pid); 1036 err = nlmsg_unicast(net->xfrm.nlsk, resp_skb, NETLINK_CB(skb).portid);
1037 } 1037 }
1038 xfrm_state_put(x); 1038 xfrm_state_put(x);
1039out_noput: 1039out_noput:
@@ -1114,7 +1114,7 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh,
1114 goto out; 1114 goto out;
1115 } 1115 }
1116 1116
1117 err = nlmsg_unicast(net->xfrm.nlsk, resp_skb, NETLINK_CB(skb).pid); 1117 err = nlmsg_unicast(net->xfrm.nlsk, resp_skb, NETLINK_CB(skb).portid);
1118 1118
1119out: 1119out:
1120 xfrm_state_put(x); 1120 xfrm_state_put(x);
@@ -1401,7 +1401,7 @@ static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1401 1401
1402 c.event = nlh->nlmsg_type; 1402 c.event = nlh->nlmsg_type;
1403 c.seq = nlh->nlmsg_seq; 1403 c.seq = nlh->nlmsg_seq;
1404 c.pid = nlh->nlmsg_pid; 1404 c.portid = nlh->nlmsg_pid;
1405 km_policy_notify(xp, p->dir, &c); 1405 km_policy_notify(xp, p->dir, &c);
1406 1406
1407 xfrm_pol_put(xp); 1407 xfrm_pol_put(xp);
@@ -1486,7 +1486,7 @@ static int dump_one_policy(struct xfrm_policy *xp, int dir, int count, void *ptr
1486 struct nlmsghdr *nlh; 1486 struct nlmsghdr *nlh;
1487 int err; 1487 int err;
1488 1488
1489 nlh = nlmsg_put(skb, NETLINK_CB(in_skb).pid, sp->nlmsg_seq, 1489 nlh = nlmsg_put(skb, NETLINK_CB(in_skb).portid, sp->nlmsg_seq,
1490 XFRM_MSG_NEWPOLICY, sizeof(*p), sp->nlmsg_flags); 1490 XFRM_MSG_NEWPOLICY, sizeof(*p), sp->nlmsg_flags);
1491 if (nlh == NULL) 1491 if (nlh == NULL)
1492 return -EMSGSIZE; 1492 return -EMSGSIZE;
@@ -1621,7 +1621,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1621 err = PTR_ERR(resp_skb); 1621 err = PTR_ERR(resp_skb);
1622 } else { 1622 } else {
1623 err = nlmsg_unicast(net->xfrm.nlsk, resp_skb, 1623 err = nlmsg_unicast(net->xfrm.nlsk, resp_skb,
1624 NETLINK_CB(skb).pid); 1624 NETLINK_CB(skb).portid);
1625 } 1625 }
1626 } else { 1626 } else {
1627 uid_t loginuid = audit_get_loginuid(current); 1627 uid_t loginuid = audit_get_loginuid(current);
@@ -1638,7 +1638,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1638 c.data.byid = p->index; 1638 c.data.byid = p->index;
1639 c.event = nlh->nlmsg_type; 1639 c.event = nlh->nlmsg_type;
1640 c.seq = nlh->nlmsg_seq; 1640 c.seq = nlh->nlmsg_seq;
1641 c.pid = nlh->nlmsg_pid; 1641 c.portid = nlh->nlmsg_pid;
1642 km_policy_notify(xp, p->dir, &c); 1642 km_policy_notify(xp, p->dir, &c);
1643 } 1643 }
1644 1644
@@ -1668,7 +1668,7 @@ static int xfrm_flush_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
1668 c.data.proto = p->proto; 1668 c.data.proto = p->proto;
1669 c.event = nlh->nlmsg_type; 1669 c.event = nlh->nlmsg_type;
1670 c.seq = nlh->nlmsg_seq; 1670 c.seq = nlh->nlmsg_seq;
1671 c.pid = nlh->nlmsg_pid; 1671 c.portid = nlh->nlmsg_pid;
1672 c.net = net; 1672 c.net = net;
1673 km_state_notify(NULL, &c); 1673 km_state_notify(NULL, &c);
1674 1674
@@ -1695,7 +1695,7 @@ static int build_aevent(struct sk_buff *skb, struct xfrm_state *x, const struct
1695 struct nlmsghdr *nlh; 1695 struct nlmsghdr *nlh;
1696 int err; 1696 int err;
1697 1697
1698 nlh = nlmsg_put(skb, c->pid, c->seq, XFRM_MSG_NEWAE, sizeof(*id), 0); 1698 nlh = nlmsg_put(skb, c->portid, c->seq, XFRM_MSG_NEWAE, sizeof(*id), 0);
1699 if (nlh == NULL) 1699 if (nlh == NULL)
1700 return -EMSGSIZE; 1700 return -EMSGSIZE;
1701 1701
@@ -1777,11 +1777,11 @@ static int xfrm_get_ae(struct sk_buff *skb, struct nlmsghdr *nlh,
1777 spin_lock_bh(&x->lock); 1777 spin_lock_bh(&x->lock);
1778 c.data.aevent = p->flags; 1778 c.data.aevent = p->flags;
1779 c.seq = nlh->nlmsg_seq; 1779 c.seq = nlh->nlmsg_seq;
1780 c.pid = nlh->nlmsg_pid; 1780 c.portid = nlh->nlmsg_pid;
1781 1781
1782 if (build_aevent(r_skb, x, &c) < 0) 1782 if (build_aevent(r_skb, x, &c) < 0)
1783 BUG(); 1783 BUG();
1784 err = nlmsg_unicast(net->xfrm.nlsk, r_skb, NETLINK_CB(skb).pid); 1784 err = nlmsg_unicast(net->xfrm.nlsk, r_skb, NETLINK_CB(skb).portid);
1785 spin_unlock_bh(&x->lock); 1785 spin_unlock_bh(&x->lock);
1786 xfrm_state_put(x); 1786 xfrm_state_put(x);
1787 return err; 1787 return err;
@@ -1827,7 +1827,7 @@ static int xfrm_new_ae(struct sk_buff *skb, struct nlmsghdr *nlh,
1827 1827
1828 c.event = nlh->nlmsg_type; 1828 c.event = nlh->nlmsg_type;
1829 c.seq = nlh->nlmsg_seq; 1829 c.seq = nlh->nlmsg_seq;
1830 c.pid = nlh->nlmsg_pid; 1830 c.portid = nlh->nlmsg_pid;
1831 c.data.aevent = XFRM_AE_CU; 1831 c.data.aevent = XFRM_AE_CU;
1832 km_state_notify(x, &c); 1832 km_state_notify(x, &c);
1833 err = 0; 1833 err = 0;
@@ -1862,7 +1862,7 @@ static int xfrm_flush_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1862 c.data.type = type; 1862 c.data.type = type;
1863 c.event = nlh->nlmsg_type; 1863 c.event = nlh->nlmsg_type;
1864 c.seq = nlh->nlmsg_seq; 1864 c.seq = nlh->nlmsg_seq;
1865 c.pid = nlh->nlmsg_pid; 1865 c.portid = nlh->nlmsg_pid;
1866 c.net = net; 1866 c.net = net;
1867 km_policy_notify(NULL, 0, &c); 1867 km_policy_notify(NULL, 0, &c);
1868 return 0; 1868 return 0;
@@ -2370,7 +2370,7 @@ static int build_expire(struct sk_buff *skb, struct xfrm_state *x, const struct
2370 struct nlmsghdr *nlh; 2370 struct nlmsghdr *nlh;
2371 int err; 2371 int err;
2372 2372
2373 nlh = nlmsg_put(skb, c->pid, 0, XFRM_MSG_EXPIRE, sizeof(*ue), 0); 2373 nlh = nlmsg_put(skb, c->portid, 0, XFRM_MSG_EXPIRE, sizeof(*ue), 0);
2374 if (nlh == NULL) 2374 if (nlh == NULL)
2375 return -EMSGSIZE; 2375 return -EMSGSIZE;
2376 2376
@@ -2429,7 +2429,7 @@ static int xfrm_notify_sa_flush(const struct km_event *c)
2429 if (skb == NULL) 2429 if (skb == NULL)
2430 return -ENOMEM; 2430 return -ENOMEM;
2431 2431
2432 nlh = nlmsg_put(skb, c->pid, c->seq, XFRM_MSG_FLUSHSA, sizeof(*p), 0); 2432 nlh = nlmsg_put(skb, c->portid, c->seq, XFRM_MSG_FLUSHSA, sizeof(*p), 0);
2433 if (nlh == NULL) { 2433 if (nlh == NULL) {
2434 kfree_skb(skb); 2434 kfree_skb(skb);
2435 return -EMSGSIZE; 2435 return -EMSGSIZE;
@@ -2497,7 +2497,7 @@ static int xfrm_notify_sa(struct xfrm_state *x, const struct km_event *c)
2497 if (skb == NULL) 2497 if (skb == NULL)
2498 return -ENOMEM; 2498 return -ENOMEM;
2499 2499
2500 nlh = nlmsg_put(skb, c->pid, c->seq, c->event, headlen, 0); 2500 nlh = nlmsg_put(skb, c->portid, c->seq, c->event, headlen, 0);
2501 err = -EMSGSIZE; 2501 err = -EMSGSIZE;
2502 if (nlh == NULL) 2502 if (nlh == NULL)
2503 goto out_free_skb; 2503 goto out_free_skb;
@@ -2696,7 +2696,7 @@ static int build_polexpire(struct sk_buff *skb, struct xfrm_policy *xp,
2696 struct nlmsghdr *nlh; 2696 struct nlmsghdr *nlh;
2697 int err; 2697 int err;
2698 2698
2699 nlh = nlmsg_put(skb, c->pid, 0, XFRM_MSG_POLEXPIRE, sizeof(*upe), 0); 2699 nlh = nlmsg_put(skb, c->portid, 0, XFRM_MSG_POLEXPIRE, sizeof(*upe), 0);
2700 if (nlh == NULL) 2700 if (nlh == NULL)
2701 return -EMSGSIZE; 2701 return -EMSGSIZE;
2702 2702
@@ -2756,7 +2756,7 @@ static int xfrm_notify_policy(struct xfrm_policy *xp, int dir, const struct km_e
2756 if (skb == NULL) 2756 if (skb == NULL)
2757 return -ENOMEM; 2757 return -ENOMEM;
2758 2758
2759 nlh = nlmsg_put(skb, c->pid, c->seq, c->event, headlen, 0); 2759 nlh = nlmsg_put(skb, c->portid, c->seq, c->event, headlen, 0);
2760 err = -EMSGSIZE; 2760 err = -EMSGSIZE;
2761 if (nlh == NULL) 2761 if (nlh == NULL)
2762 goto out_free_skb; 2762 goto out_free_skb;
@@ -2810,7 +2810,7 @@ static int xfrm_notify_policy_flush(const struct km_event *c)
2810 if (skb == NULL) 2810 if (skb == NULL)
2811 return -ENOMEM; 2811 return -ENOMEM;
2812 2812
2813 nlh = nlmsg_put(skb, c->pid, c->seq, XFRM_MSG_FLUSHPOLICY, 0, 0); 2813 nlh = nlmsg_put(skb, c->portid, c->seq, XFRM_MSG_FLUSHPOLICY, 0, 0);
2814 err = -EMSGSIZE; 2814 err = -EMSGSIZE;
2815 if (nlh == NULL) 2815 if (nlh == NULL)
2816 goto out_free_skb; 2816 goto out_free_skb;