]> err.no Git - linux-2.6/commitdiff
[IPv6] prefix: Convert prefix notifications to use rtnl_notify()
authorThomas Graf <tgraf@suug.ch>
Tue, 15 Aug 2006 07:36:07 +0000 (00:36 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 22 Sep 2006 21:54:58 +0000 (14:54 -0700)
Fixes a wrong use of current->pid as netlink pid.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/addrconf.c

index 2a3be0f1c5169c0798bc8d290d06344b14bcaa29..4af741ef8d6b31b2dc35130793e727dbd83d150a 100644 (file)
@@ -3506,20 +3506,23 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev,
                         struct prefix_info *pinfo)
 {
        struct sk_buff *skb;
-       int size = NLMSG_SPACE(sizeof(struct prefixmsg) + INET6_PREFIX_RTA_SPACE);
+       int payload = sizeof(struct prefixmsg) + INET6_PREFIX_RTA_SPACE;
+       int err = -ENOBUFS;
 
-       skb = alloc_skb(size, GFP_ATOMIC);
-       if (!skb) {
-               netlink_set_err(rtnl, 0, RTNLGRP_IPV6_PREFIX, ENOBUFS);
-               return;
-       }
-       if (inet6_fill_prefix(skb, idev, pinfo, current->pid, 0, event, 0) < 0) {
+       skb = nlmsg_new(nlmsg_total_size(payload), GFP_ATOMIC);
+       if (skb == NULL)
+               goto errout;
+
+       err = inet6_fill_prefix(skb, idev, pinfo, 0, 0, event, 0);
+       if (err < 0) {
                kfree_skb(skb);
-               netlink_set_err(rtnl, 0, RTNLGRP_IPV6_PREFIX, EINVAL);
-               return;
+               goto errout;
        }
-       NETLINK_CB(skb).dst_group = RTNLGRP_IPV6_PREFIX;
-       netlink_broadcast(rtnl, skb, 0, RTNLGRP_IPV6_PREFIX, GFP_ATOMIC);
+
+       err = rtnl_notify(skb, 0, RTNLGRP_IPV6_PREFIX, NULL, GFP_ATOMIC);
+errout:
+       if (err < 0)
+               rtnl_set_sk_err(RTNLGRP_IPV6_PREFIX, err);
 }
 
 static struct rtnetlink_link inet6_rtnetlink_table[RTM_NR_MSGTYPES] = {