Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 39691
b: refs/heads/master
c: adaa70b
h: refs/heads/master
i:
  39689: 5db5d37
  39687: 9193ff7
v: v3
  • Loading branch information
Thomas Graf authored and David S. Miller committed Oct 16, 2006
1 parent 5d17e07 commit 9a9a74a
Show file tree
Hide file tree
Showing 3 changed files with 24 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: 918049f0135854a1583f9b3b88f44dbf2b027329
refs/heads/master: adaa70bbdfbc725e485179b06c8b23a20fbb7952
11 changes: 7 additions & 4 deletions trunk/net/ipv6/fib6_rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,15 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
{
struct fib6_rule *r = (struct fib6_rule *) rule;

if (!ipv6_prefix_equal(&fl->fl6_dst, &r->dst.addr, r->dst.plen))
if (r->dst.plen &&
!ipv6_prefix_equal(&fl->fl6_dst, &r->dst.addr, r->dst.plen))
return 0;

if ((flags & RT6_LOOKUP_F_HAS_SADDR) &&
!ipv6_prefix_equal(&fl->fl6_src, &r->src.addr, r->src.plen))
return 0;
if (r->src.plen) {
if (!(flags & RT6_LOOKUP_F_HAS_SADDR) ||
!ipv6_prefix_equal(&fl->fl6_src, &r->src.addr, r->src.plen))
return 0;
}

if (r->tclass && r->tclass != ((ntohl(fl->fl6_flowlabel) >> 20) & 0xff))
return 0;
Expand Down
19 changes: 16 additions & 3 deletions trunk/net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,13 +529,17 @@ struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr,
.nl_u = {
.ip6_u = {
.daddr = *daddr,
/* TODO: saddr */
},
},
};
struct dst_entry *dst;
int flags = strict ? RT6_LOOKUP_F_IFACE : 0;

if (saddr) {
memcpy(&fl.fl6_src, saddr, sizeof(*saddr));
flags |= RT6_LOOKUP_F_HAS_SADDR;
}

dst = fib6_rule_lookup(&fl, flags, ip6_pol_route_lookup);
if (dst->error == 0)
return (struct rt6_info *) dst;
Expand Down Expand Up @@ -697,6 +701,7 @@ static struct rt6_info *ip6_pol_route_input(struct fib6_table *table,
void ip6_route_input(struct sk_buff *skb)
{
struct ipv6hdr *iph = skb->nh.ipv6h;
int flags = RT6_LOOKUP_F_HAS_SADDR;
struct flowi fl = {
.iif = skb->dev->ifindex,
.nl_u = {
Expand All @@ -711,7 +716,9 @@ void ip6_route_input(struct sk_buff *skb)
},
.proto = iph->nexthdr,
};
int flags = rt6_need_strict(&iph->daddr) ? RT6_LOOKUP_F_IFACE : 0;

if (rt6_need_strict(&iph->daddr))
flags |= RT6_LOOKUP_F_IFACE;

skb->dst = fib6_rule_lookup(&fl, flags, ip6_pol_route_input);
}
Expand Down Expand Up @@ -794,6 +801,9 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl)
if (rt6_need_strict(&fl->fl6_dst))
flags |= RT6_LOOKUP_F_IFACE;

if (!ipv6_addr_any(&fl->fl6_src))
flags |= RT6_LOOKUP_F_HAS_SADDR;

return fib6_rule_lookup(fl, flags, ip6_pol_route_output);
}

Expand Down Expand Up @@ -1345,6 +1355,7 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest,
struct in6_addr *gateway,
struct net_device *dev)
{
int flags = RT6_LOOKUP_F_HAS_SADDR;
struct ip6rd_flowi rdfl = {
.fl = {
.oif = dev->ifindex,
Expand All @@ -1357,7 +1368,9 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest,
},
.gateway = *gateway,
};
int flags = rt6_need_strict(dest) ? RT6_LOOKUP_F_IFACE : 0;

if (rt6_need_strict(dest))
flags |= RT6_LOOKUP_F_IFACE;

return (struct rt6_info *)fib6_rule_lookup((struct flowi *)&rdfl, flags, __ip6_route_redirect);
}
Expand Down

0 comments on commit 9a9a74a

Please sign in to comment.