aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2007-12-13 12:45:12 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:57:55 -0500
commit528c4ceb427dad4a3893ba3d1913782efae0cd0e (patch)
tree96888eee6eeb8359c44413091bf6cd6ffa97873d
parentaef21785995778f710a60b563e03bf53ba455a47 (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>
-rw-r--r--net/ipv6/ip6_fib.c3
-rw-r--r--net/ipv6/route.c27
2 files changed, 15 insertions, 15 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 5fae04506ad9..df05c6f2189c 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1315,6 +1315,7 @@ static int fib6_walk(struct fib6_walker_t *w)
1315 1315
1316static int fib6_clean_node(struct fib6_walker_t *w) 1316static int fib6_clean_node(struct fib6_walker_t *w)
1317{ 1317{
1318 struct nl_info info = {};
1318 int res; 1319 int res;
1319 struct rt6_info *rt; 1320 struct rt6_info *rt;
1320 struct fib6_cleaner_t *c = container_of(w, struct fib6_cleaner_t, w); 1321 struct fib6_cleaner_t *c = container_of(w, struct fib6_cleaner_t, w);
@@ -1323,7 +1324,7 @@ static int fib6_clean_node(struct fib6_walker_t *w)
1323 res = c->func(rt, c->arg); 1324 res = c->func(rt, c->arg);
1324 if (res < 0) { 1325 if (res < 0) {
1325 w->leaf = rt; 1326 w->leaf = rt;
1326 res = fib6_del(rt, NULL); 1327 res = fib6_del(rt, &info);
1327 if (res) { 1328 if (res) {
1328#if RT6_DEBUG >= 2 1329#if RT6_DEBUG >= 2
1329 printk(KERN_DEBUG "fib6_clean_node: del failed: rt=%p@%p err=%d\n", rt, rt->rt6i_node, res); 1330 printk(KERN_DEBUG "fib6_clean_node: del failed: rt=%p@%p err=%d\n", rt, rt->rt6i_node, res);
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
610int ip6_ins_rt(struct rt6_info *rt) 610int 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
615static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *daddr, 616static 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
1267int ip6_del_rt(struct rt6_info *rt) 1268int 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
1272static int ip6_route_del(struct fib6_config *cfg) 1274static int ip6_route_del(struct fib6_config *cfg)
@@ -2243,29 +2245,26 @@ errout:
2243void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info) 2245void 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());
2269errout: 2268errout:
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);