]> nv-tegra.nvidia Code Review - linux-3.10.git/commitdiff
[NETLINK]: Set correct pid for ioctl originating netlink events
authorJamal Hadi Salim <hadi@cyberus.ca>
Sun, 19 Jun 2005 05:55:51 +0000 (22:55 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 19 Jun 2005 05:55:51 +0000 (22:55 -0700)
This patch ensures that netlink events created as a result of programns
using ioctls (such as ifconfig, route etc) contains the correct PID of
those events.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c
net/ipv4/devinet.c
net/ipv4/fib_semantics.c
net/ipv6/addrconf.c

index 63bd88665182c7746736ad4f55b3970d45086397..e013d836a7abc3592d5fa5db0f24aca874095f52 100644 (file)
@@ -452,7 +452,7 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change)
        if (!skb)
                return;
 
-       if (rtnetlink_fill_ifinfo(skb, dev, type, 0, 0, change, 0) < 0) {
+       if (rtnetlink_fill_ifinfo(skb, dev, type, current->pid, 0, change, 0) < 0) {
                kfree_skb(skb);
                return;
        }
index fd47a1e890fa4978aef0da27c90440af5f138393..650dcb12d9a15318ef49c889fffc7a0867b0fb5e 100644 (file)
@@ -1112,7 +1112,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa)
 
        if (!skb)
                netlink_set_err(rtnl, 0, RTMGRP_IPV4_IFADDR, ENOBUFS);
-       else if (inet_fill_ifaddr(skb, ifa, 0, 0, event, 0) < 0) {
+       else if (inet_fill_ifaddr(skb, ifa, current->pid, 0, event, 0) < 0) {
                kfree_skb(skb);
                netlink_set_err(rtnl, 0, RTMGRP_IPV4_IFADDR, EINVAL);
        } else {
index a9a44b4bef4602f8e02602cfd6f692d8a768eca5..c886b28ba9f500d7fc80019f6a66fbd72077b8a5 100644 (file)
@@ -276,7 +276,7 @@ void rtmsg_fib(int event, u32 key, struct fib_alias *fa,
               struct nlmsghdr *n, struct netlink_skb_parms *req)
 {
        struct sk_buff *skb;
-       u32 pid = req ? req->pid : 0;
+       u32 pid = req ? req->pid : n->nlmsg_pid;
        int size = NLMSG_SPACE(sizeof(struct rtmsg)+256);
 
        skb = alloc_skb(size, GFP_KERNEL);
@@ -1035,7 +1035,7 @@ fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm,
        }
 
        nl->nlmsg_flags = NLM_F_REQUEST;
-       nl->nlmsg_pid = 0;
+       nl->nlmsg_pid = current->pid;
        nl->nlmsg_seq = 0;
        nl->nlmsg_len = NLMSG_LENGTH(sizeof(*rtm));
        if (cmd == SIOCDELRT) {
index 4d4cb46f04397974fccb81f47d9317ccdbdf68f1..47a30c3188ea72a3b27e8414541b2eca0ecf7672 100644 (file)
@@ -2873,7 +2873,7 @@ static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)
                netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFADDR, ENOBUFS);
                return;
        }
-       if (inet6_fill_ifaddr(skb, ifa, 0, 0, event, 0) < 0) {
+       if (inet6_fill_ifaddr(skb, ifa, current->pid, 0, event, 0) < 0) {
                kfree_skb(skb);
                netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFADDR, EINVAL);
                return;
@@ -3008,7 +3008,7 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
                netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFINFO, ENOBUFS);
                return;
        }
-       if (inet6_fill_ifinfo(skb, idev, 0, 0, event, 0) < 0) {
+       if (inet6_fill_ifinfo(skb, idev, current->pid, 0, event, 0) < 0) {
                kfree_skb(skb);
                netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFINFO, EINVAL);
                return;
@@ -3065,7 +3065,7 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev,
                netlink_set_err(rtnl, 0, RTMGRP_IPV6_PREFIX, ENOBUFS);
                return;
        }
-       if (inet6_fill_prefix(skb, idev, pinfo, 0, 0, event, 0) < 0) {
+       if (inet6_fill_prefix(skb, idev, pinfo, current->pid, 0, event, 0) < 0) {
                kfree_skb(skb);
                netlink_set_err(rtnl, 0, RTMGRP_IPV6_PREFIX, EINVAL);
                return;