diff options
author | Thomas Graf <tgraf@suug.ch> | 2006-08-15 03:35:24 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 17:54:56 -0400 |
commit | 21713ebc4f119950e87d21c4637d5a750eea20e8 (patch) | |
tree | 9aee5c6012e7676e6ec70afb907adab912f347c1 /net/ipv6/route.c | |
parent | 5d620266431c03d1dac66287367c6da26c64a069 (diff) |
[IPv6] route: Convert route notifications to use rtnl_notify()
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>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 024c8e26c2ec..1aca787ead85 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/netdevice.h> | 35 | #include <linux/netdevice.h> |
36 | #include <linux/in6.h> | 36 | #include <linux/in6.h> |
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/netlink.h> | ||
39 | #include <linux/if_arp.h> | 38 | #include <linux/if_arp.h> |
40 | 39 | ||
41 | #ifdef CONFIG_PROC_FS | 40 | #ifdef CONFIG_PROC_FS |
@@ -54,6 +53,7 @@ | |||
54 | #include <net/dst.h> | 53 | #include <net/dst.h> |
55 | #include <net/xfrm.h> | 54 | #include <net/xfrm.h> |
56 | #include <net/netevent.h> | 55 | #include <net/netevent.h> |
56 | #include <net/netlink.h> | ||
57 | 57 | ||
58 | #include <asm/uaccess.h> | 58 | #include <asm/uaccess.h> |
59 | 59 | ||
@@ -2056,27 +2056,25 @@ void inet6_rt_notify(int event, struct rt6_info *rt, struct nlmsghdr *nlh, | |||
2056 | struct netlink_skb_parms *req) | 2056 | struct netlink_skb_parms *req) |
2057 | { | 2057 | { |
2058 | struct sk_buff *skb; | 2058 | struct sk_buff *skb; |
2059 | int size = NLMSG_SPACE(sizeof(struct rtmsg)+256); | 2059 | u32 pid = req ? req->pid : 0; |
2060 | u32 pid = current->pid; | 2060 | u32 seq = nlh ? nlh->nlmsg_seq : 0; |
2061 | u32 seq = 0; | 2061 | int payload = sizeof(struct rtmsg) + 256; |
2062 | 2062 | int err = -ENOBUFS; | |
2063 | if (req) | 2063 | |
2064 | pid = req->pid; | 2064 | skb = nlmsg_new(nlmsg_total_size(payload), gfp_any()); |
2065 | if (nlh) | 2065 | if (skb == NULL) |
2066 | seq = nlh->nlmsg_seq; | 2066 | goto errout; |
2067 | 2067 | ||
2068 | skb = alloc_skb(size, gfp_any()); | 2068 | err = rt6_fill_node(skb, rt, NULL, NULL, 0, event, pid, seq, 0, 0); |
2069 | if (!skb) { | 2069 | if (err < 0) { |
2070 | netlink_set_err(rtnl, 0, RTNLGRP_IPV6_ROUTE, ENOBUFS); | ||
2071 | return; | ||
2072 | } | ||
2073 | if (rt6_fill_node(skb, rt, NULL, NULL, 0, event, pid, seq, 0, 0) < 0) { | ||
2074 | kfree_skb(skb); | 2070 | kfree_skb(skb); |
2075 | netlink_set_err(rtnl, 0, RTNLGRP_IPV6_ROUTE, EINVAL); | 2071 | goto errout; |
2076 | return; | ||
2077 | } | 2072 | } |
2078 | NETLINK_CB(skb).dst_group = RTNLGRP_IPV6_ROUTE; | 2073 | |
2079 | netlink_broadcast(rtnl, skb, 0, RTNLGRP_IPV6_ROUTE, gfp_any()); | 2074 | err = rtnl_notify(skb, pid, RTNLGRP_IPV6_ROUTE, nlh, gfp_any()); |
2075 | errout: | ||
2076 | if (err < 0) | ||
2077 | rtnl_set_sk_err(RTNLGRP_IPV6_ROUTE, err); | ||
2080 | } | 2078 | } |
2081 | 2079 | ||
2082 | /* | 2080 | /* |