Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 214817
b: refs/heads/master
c: dd28d1a
h: refs/heads/master
i:
  214815: a3ded04
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Oct 1, 2010
1 parent 982abe8 commit a9d86a4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e1a5964f0c32a75b17360cfc565d25aaedbff747
refs/heads/master: dd28d1a0b5ecc0f5512f658b1a8fd38bc4f4c98c
33 changes: 15 additions & 18 deletions trunk/net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -2358,9 +2358,8 @@ static int __mkroute_output(struct rtable **result,
struct rtable *rth;
struct in_device *in_dev;
u32 tos = RT_FL_TOS(oldflp);
int err = 0;

if (ipv4_is_loopback(fl->fl4_src) && !(dev_out->flags&IFF_LOOPBACK))
if (ipv4_is_loopback(fl->fl4_src) && !(dev_out->flags & IFF_LOOPBACK))
return -EINVAL;

if (fl->fl4_dst == htonl(0xFFFFFFFF))
Expand All @@ -2373,25 +2372,26 @@ static int __mkroute_output(struct rtable **result,
if (dev_out->flags & IFF_LOOPBACK)
flags |= RTCF_LOCAL;

/* get work reference to inet device */
in_dev = in_dev_get(dev_out);
if (!in_dev)
rcu_read_lock();
in_dev = __in_dev_get_rcu(dev_out);
if (!in_dev) {
rcu_read_unlock();
return -EINVAL;

}
if (res->type == RTN_BROADCAST) {
flags |= RTCF_BROADCAST | RTCF_LOCAL;
if (res->fi) {
fib_info_put(res->fi);
res->fi = NULL;
}
} else if (res->type == RTN_MULTICAST) {
flags |= RTCF_MULTICAST|RTCF_LOCAL;
flags |= RTCF_MULTICAST | RTCF_LOCAL;
if (!ip_check_mc(in_dev, oldflp->fl4_dst, oldflp->fl4_src,
oldflp->proto))
flags &= ~RTCF_LOCAL;
/* If multicast route do not exist use
default one, but do not gateway in this case.
Yes, it is hack.
* default one, but do not gateway in this case.
* Yes, it is hack.
*/
if (res->fi && res->prefixlen < 4) {
fib_info_put(res->fi);
Expand All @@ -2402,9 +2402,12 @@ static int __mkroute_output(struct rtable **result,

rth = dst_alloc(&ipv4_dst_ops);
if (!rth) {
err = -ENOBUFS;
goto cleanup;
rcu_read_unlock();
return -ENOBUFS;
}
in_dev_hold(in_dev);
rcu_read_unlock();
rth->idev = in_dev;

atomic_set(&rth->dst.__refcnt, 1);
rth->dst.flags= DST_HOST;
Expand All @@ -2425,7 +2428,6 @@ static int __mkroute_output(struct rtable **result,
cache entry */
rth->dst.dev = dev_out;
dev_hold(dev_out);
rth->idev = in_dev_get(dev_out);
rth->rt_gateway = fl->fl4_dst;
rth->rt_spec_dst= fl->fl4_src;

Expand Down Expand Up @@ -2460,13 +2462,8 @@ static int __mkroute_output(struct rtable **result,
rt_set_nexthop(rth, res, 0);

rth->rt_flags = flags;

*result = rth;
cleanup:
/* release work reference to inet device */
in_dev_put(in_dev);

return err;
return 0;
}

static int ip_mkroute_output(struct rtable **rp,
Expand Down

0 comments on commit a9d86a4

Please sign in to comment.