diff options
author | Denis V. Lunev <den@openvz.org> | 2007-12-13 12:45:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:57:55 -0500 |
commit | 528c4ceb427dad4a3893ba3d1913782efae0cd0e (patch) | |
tree | 96888eee6eeb8359c44413091bf6cd6ffa97873d /net/ipv6/route.c | |
parent | aef21785995778f710a60b563e03bf53ba455a47 (diff) |
[IPV6]: Always pass a valid nl_info to inet6_rt_notify.
This makes the code in the inet6_rt_notify more straightforward and provides
groud for namespace passing.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 11ef456d67c5..b80ef5784207 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -609,7 +609,8 @@ static int __ip6_ins_rt(struct rt6_info *rt, struct nl_info *info) | |||
609 | 609 | ||
610 | int ip6_ins_rt(struct rt6_info *rt) | 610 | int ip6_ins_rt(struct rt6_info *rt) |
611 | { | 611 | { |
612 | return __ip6_ins_rt(rt, NULL); | 612 | struct nl_info info = {}; |
613 | return __ip6_ins_rt(rt, &info); | ||
613 | } | 614 | } |
614 | 615 | ||
615 | static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *daddr, | 616 | static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *daddr, |
@@ -1266,7 +1267,8 @@ static int __ip6_del_rt(struct rt6_info *rt, struct nl_info *info) | |||
1266 | 1267 | ||
1267 | int ip6_del_rt(struct rt6_info *rt) | 1268 | int ip6_del_rt(struct rt6_info *rt) |
1268 | { | 1269 | { |
1269 | return __ip6_del_rt(rt, NULL); | 1270 | struct nl_info info = {}; |
1271 | return __ip6_del_rt(rt, &info); | ||
1270 | } | 1272 | } |
1271 | 1273 | ||
1272 | static int ip6_route_del(struct fib6_config *cfg) | 1274 | static int ip6_route_del(struct fib6_config *cfg) |
@@ -2243,29 +2245,26 @@ errout: | |||
2243 | void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info) | 2245 | void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info) |
2244 | { | 2246 | { |
2245 | struct sk_buff *skb; | 2247 | struct sk_buff *skb; |
2246 | u32 pid = 0, seq = 0; | 2248 | u32 seq; |
2247 | struct nlmsghdr *nlh = NULL; | 2249 | int err; |
2248 | int err = -ENOBUFS; | 2250 | |
2249 | 2251 | err = -ENOBUFS; | |
2250 | if (info) { | 2252 | seq = info->nlh != NULL ? info->nlh->nlmsg_seq : 0; |
2251 | pid = info->pid; | ||
2252 | nlh = info->nlh; | ||
2253 | if (nlh) | ||
2254 | seq = nlh->nlmsg_seq; | ||
2255 | } | ||
2256 | 2253 | ||
2257 | skb = nlmsg_new(rt6_nlmsg_size(), gfp_any()); | 2254 | skb = nlmsg_new(rt6_nlmsg_size(), gfp_any()); |
2258 | if (skb == NULL) | 2255 | if (skb == NULL) |
2259 | goto errout; | 2256 | goto errout; |
2260 | 2257 | ||
2261 | err = rt6_fill_node(skb, rt, NULL, NULL, 0, event, pid, seq, 0, 0); | 2258 | err = rt6_fill_node(skb, rt, NULL, NULL, 0, |
2259 | event, info->pid, seq, 0, 0); | ||
2262 | if (err < 0) { | 2260 | if (err < 0) { |
2263 | /* -EMSGSIZE implies BUG in rt6_nlmsg_size() */ | 2261 | /* -EMSGSIZE implies BUG in rt6_nlmsg_size() */ |
2264 | WARN_ON(err == -EMSGSIZE); | 2262 | WARN_ON(err == -EMSGSIZE); |
2265 | kfree_skb(skb); | 2263 | kfree_skb(skb); |
2266 | goto errout; | 2264 | goto errout; |
2267 | } | 2265 | } |
2268 | err = rtnl_notify(skb, &init_net, pid, RTNLGRP_IPV6_ROUTE, nlh, gfp_any()); | 2266 | err = rtnl_notify(skb, &init_net, info->pid, |
2267 | RTNLGRP_IPV6_ROUTE, info->nlh, gfp_any()); | ||
2269 | errout: | 2268 | errout: |
2270 | if (err < 0) | 2269 | if (err < 0) |
2271 | rtnl_set_sk_err(&init_net, RTNLGRP_IPV6_ROUTE, err); | 2270 | rtnl_set_sk_err(&init_net, RTNLGRP_IPV6_ROUTE, err); |