aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_semantics.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-01-21 20:34:00 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:10:21 -0500
commit86167a377f1c4fb40742302ae7682dd574abde86 (patch)
tree5a2df2997e4422fbb460a784f740beb972efe5c6 /net/ipv4/fib_semantics.c
parent5b707aaae4ca7b7204eb4a472721c84866d85f0f (diff)
[NETNS]: Pass correct namespace in context fib_check_nh.
Correct network namespace is already used in fib_check_nh. Re-work its usage for better readability and pass into fib_lookup & inetdev_by_index. Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_semantics.c')
-rw-r--r--net/ipv4/fib_semantics.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 8b47e112ae5c..c7912866d987 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -519,7 +519,9 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
519 struct fib_nh *nh) 519 struct fib_nh *nh)
520{ 520{
521 int err; 521 int err;
522 struct net *net;
522 523
524 net = cfg->fc_nlinfo.nl_net;
523 if (nh->nh_gw) { 525 if (nh->nh_gw) {
524 struct fib_result res; 526 struct fib_result res;
525 527
@@ -532,11 +534,9 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
532 534
533 if (cfg->fc_scope >= RT_SCOPE_LINK) 535 if (cfg->fc_scope >= RT_SCOPE_LINK)
534 return -EINVAL; 536 return -EINVAL;
535 if (inet_addr_type(cfg->fc_nlinfo.nl_net, 537 if (inet_addr_type(net, nh->nh_gw) != RTN_UNICAST)
536 nh->nh_gw) != RTN_UNICAST)
537 return -EINVAL; 538 return -EINVAL;
538 if ((dev = __dev_get_by_index(cfg->fc_nlinfo.nl_net, 539 if ((dev = __dev_get_by_index(net, nh->nh_oif)) == NULL)
539 nh->nh_oif)) == NULL)
540 return -ENODEV; 540 return -ENODEV;
541 if (!(dev->flags&IFF_UP)) 541 if (!(dev->flags&IFF_UP))
542 return -ENETDOWN; 542 return -ENETDOWN;
@@ -559,7 +559,7 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
559 /* It is not necessary, but requires a bit of thinking */ 559 /* It is not necessary, but requires a bit of thinking */
560 if (fl.fl4_scope < RT_SCOPE_LINK) 560 if (fl.fl4_scope < RT_SCOPE_LINK)
561 fl.fl4_scope = RT_SCOPE_LINK; 561 fl.fl4_scope = RT_SCOPE_LINK;
562 if ((err = fib_lookup(&init_net, &fl, &res)) != 0) 562 if ((err = fib_lookup(net, &fl, &res)) != 0)
563 return err; 563 return err;
564 } 564 }
565 err = -EINVAL; 565 err = -EINVAL;
@@ -583,7 +583,7 @@ out:
583 if (nh->nh_flags&(RTNH_F_PERVASIVE|RTNH_F_ONLINK)) 583 if (nh->nh_flags&(RTNH_F_PERVASIVE|RTNH_F_ONLINK))
584 return -EINVAL; 584 return -EINVAL;
585 585
586 in_dev = inetdev_by_index(&init_net, nh->nh_oif); 586 in_dev = inetdev_by_index(net, nh->nh_oif);
587 if (in_dev == NULL) 587 if (in_dev == NULL)
588 return -ENODEV; 588 return -ENODEV;
589 if (!(in_dev->dev->flags&IFF_UP)) { 589 if (!(in_dev->dev->flags&IFF_UP)) {