Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 289763
b: refs/heads/master
c: 3923297
h: refs/heads/master
i:
  289761: 906f2cb
  289759: 0251985
v: v3
  • Loading branch information
David S. Miller committed Jan 26, 2012
1 parent 304d36e commit 1dd9fa4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 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: 09e9b813d34d9a09d64a64580a9959d8bae1f4f5
refs/heads/master: 39232973b779ab0c02cb6dcd8f819b7cb0fcd09a
5 changes: 5 additions & 0 deletions trunk/net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1117,10 +1117,15 @@ static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, const vo
static const __be32 inaddr_any = 0;
struct net_device *dev = dst->dev;
const __be32 *pkey = daddr;
const struct rtable *rt;
struct neighbour *n;

rt = (const struct rtable *) dst;

if (dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT))
pkey = &inaddr_any;
else if (rt->rt_gateway)
pkey = (const __be32 *) &rt->rt_gateway;

n = __ipv4_neigh_lookup(&arp_tbl, dev, *(__force u32 *)pkey);
if (n)
Expand Down
16 changes: 15 additions & 1 deletion trunk/net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,23 @@ static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old)
return p;
}

static inline const void *choose_neigh_daddr(struct rt6_info *rt, const void *daddr)
{
struct in6_addr *p = &rt->rt6i_gateway;

if (p->s6_addr32[0] | p->s6_addr32[1] |
p->s6_addr32[2] | p->s6_addr32[3])
return (const void *) p;
return daddr;
}

static struct neighbour *ip6_neigh_lookup(const struct dst_entry *dst, const void *daddr)
{
struct neighbour *n = __ipv6_neigh_lookup(&nd_tbl, dst->dev, daddr);
struct rt6_info *rt = (struct rt6_info *) dst;
struct neighbour *n;

daddr = choose_neigh_daddr(rt, daddr);
n = __ipv6_neigh_lookup(&nd_tbl, dst->dev, daddr);
if (n)
return n;
return neigh_create(&nd_tbl, daddr, dst->dev);
Expand Down

0 comments on commit 1dd9fa4

Please sign in to comment.