Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 298483
b: refs/heads/master
c: 72331bc
h: refs/heads/master
i:
  298481: 89700f3
  298479: 33a4a3f
v: v3
  • Loading branch information
Shmulik Ladkani authored and David S. Miller committed Apr 1, 2012
1 parent 834a5cb commit a829968
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 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: cdaf0b835df04177397b90214f8b457fd23b67e0
refs/heads/master: 72331bc0cd072c3f4b670cd1256e47681fc53b80
34 changes: 27 additions & 7 deletions trunk/net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,16 @@ static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table *
return ip6_pol_route(net, table, fl6->flowi6_iif, fl6, flags);
}

static struct dst_entry *ip6_route_input_lookup(struct net *net,
struct net_device *dev,
struct flowi6 *fl6, int flags)
{
if (rt6_need_strict(&fl6->daddr) && dev->type != ARPHRD_PIMREG)
flags |= RT6_LOOKUP_F_IFACE;

return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_input);
}

void ip6_route_input(struct sk_buff *skb)
{
const struct ipv6hdr *iph = ipv6_hdr(skb);
Expand All @@ -895,10 +905,7 @@ void ip6_route_input(struct sk_buff *skb)
.flowi6_proto = iph->nexthdr,
};

if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG)
flags |= RT6_LOOKUP_F_IFACE;

skb_dst_set(skb, fib6_rule_lookup(net, &fl6, flags, ip6_pol_route_input));
skb_dst_set(skb, ip6_route_input_lookup(net, skb->dev, &fl6, flags));
}

static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table,
Expand Down Expand Up @@ -2537,7 +2544,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
struct sk_buff *skb;
struct rtmsg *rtm;
struct flowi6 fl6;
int err, iif = 0;
int err, iif = 0, oif = 0;

err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy);
if (err < 0)
Expand All @@ -2564,15 +2571,29 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
iif = nla_get_u32(tb[RTA_IIF]);

if (tb[RTA_OIF])
fl6.flowi6_oif = nla_get_u32(tb[RTA_OIF]);
oif = nla_get_u32(tb[RTA_OIF]);

if (iif) {
struct net_device *dev;
int flags = 0;

dev = __dev_get_by_index(net, iif);
if (!dev) {
err = -ENODEV;
goto errout;
}

fl6.flowi6_iif = iif;

if (!ipv6_addr_any(&fl6.saddr))
flags |= RT6_LOOKUP_F_HAS_SADDR;

rt = (struct rt6_info *)ip6_route_input_lookup(net, dev, &fl6,
flags);
} else {
fl6.flowi6_oif = oif;

rt = (struct rt6_info *)ip6_route_output(net, NULL, &fl6);
}

skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
Expand All @@ -2587,7 +2608,6 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
skb_reset_mac_header(skb);
skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr));

rt = (struct rt6_info*) ip6_route_output(net, NULL, &fl6);
skb_dst_set(skb, &rt->dst);

err = rt6_fill_node(net, skb, rt, &fl6.daddr, &fl6.saddr, iif,
Expand Down

0 comments on commit a829968

Please sign in to comment.