Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34555
b: refs/heads/master
c: 77d16f4
h: refs/heads/master
i:
  34553: 31b6898
  34551: d6dbca0
v: v3
  • Loading branch information
YOSHIFUJI Hideaki authored and David S. Miller committed Sep 22, 2006
1 parent 19d64ed commit 20a4229
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 25 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: 4e96c2b4180aff4f080b77314712073c6ca430e7
refs/heads/master: 77d16f450ae0452d7d4b009f78debb1294fb435c
3 changes: 0 additions & 3 deletions trunk/include/net/ip6_fib.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ struct fib6_table {
#define RT6_TABLE_LOCAL RT6_TABLE_MAIN
#endif

#define RT6_F_STRICT 1
#define RT6_F_HAS_SADDR 2

typedef struct rt6_info *(*pol_lookup_t)(struct fib6_table *,
struct flowi *, int);

Expand Down
4 changes: 4 additions & 0 deletions trunk/include/net/ip6_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ struct route_info {
#include <linux/ip.h>
#include <linux/ipv6.h>

#define RT6_LOOKUP_F_IFACE 0x1
#define RT6_LOOKUP_F_REACHABLE 0x2
#define RT6_LOOKUP_F_HAS_SADDR 0x4

struct pol_chain {
int type;
int priority;
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv6/fib6_rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
if (!ipv6_prefix_equal(&fl->fl6_dst, &r->dst.addr, r->dst.plen))
return 0;

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

Expand Down
32 changes: 12 additions & 20 deletions trunk/net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@

#define CLONE_OFFLINK_ROUTE 0

#define RT6_SELECT_F_IFACE 0x1
#define RT6_SELECT_F_REACHABLE 0x2

static int ip6_rt_max_size = 4096;
static int ip6_rt_gc_min_interval = HZ / 2;
static int ip6_rt_gc_timeout = 60*HZ;
Expand Down Expand Up @@ -340,15 +337,15 @@ static int rt6_score_route(struct rt6_info *rt, int oif,
int m, n;

m = rt6_check_dev(rt, oif);
if (!m && (strict & RT6_SELECT_F_IFACE))
if (!m && (strict & RT6_LOOKUP_F_IFACE))
return -1;
#ifdef CONFIG_IPV6_ROUTER_PREF
m |= IPV6_DECODE_PREF(IPV6_EXTRACT_PREF(rt->rt6i_flags)) << 2;
#endif
n = rt6_check_neigh(rt);
if (n > 1)
m |= 16;
else if (!n && strict & RT6_SELECT_F_REACHABLE)
else if (!n && strict & RT6_LOOKUP_F_REACHABLE)
return -1;
return m;
}
Expand Down Expand Up @@ -388,7 +385,7 @@ static struct rt6_info *rt6_select(struct rt6_info **head, int oif,
}

if (!match &&
(strict & RT6_SELECT_F_REACHABLE) &&
(strict & RT6_LOOKUP_F_REACHABLE) &&
last && last != rt0) {
/* no entries matched; do round-robin */
static DEFINE_SPINLOCK(lock);
Expand Down Expand Up @@ -511,7 +508,7 @@ static struct rt6_info *ip6_pol_route_lookup(struct fib6_table *table,
fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src);
restart:
rt = fn->leaf;
rt = rt6_device_match(rt, fl->oif, flags & RT6_F_STRICT);
rt = rt6_device_match(rt, fl->oif, flags);
BACKTRACK(&fl->fl6_src);
dst_hold(&rt->u.dst);
out:
Expand All @@ -537,7 +534,7 @@ struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr,
},
};
struct dst_entry *dst;
int flags = strict ? RT6_F_STRICT : 0;
int flags = strict ? RT6_LOOKUP_F_IFACE : 0;

dst = fib6_rule_lookup(&fl, flags, ip6_pol_route_lookup);
if (dst->error == 0)
Expand Down Expand Up @@ -633,10 +630,9 @@ static struct rt6_info *ip6_pol_route_input(struct fib6_table *table,
int strict = 0;
int attempts = 3;
int err;
int reachable = RT6_SELECT_F_REACHABLE;
int reachable = RT6_LOOKUP_F_REACHABLE;

if (flags & RT6_F_STRICT)
strict = RT6_SELECT_F_IFACE;
strict |= flags & RT6_LOOKUP_F_IFACE;

relookup:
read_lock_bh(&table->tb6_lock);
Expand Down Expand Up @@ -712,10 +708,7 @@ void ip6_route_input(struct sk_buff *skb)
},
.proto = iph->nexthdr,
};
int flags = 0;

if (rt6_need_strict(&iph->daddr))
flags |= RT6_F_STRICT;
int flags = rt6_need_strict(&iph->daddr) ? RT6_LOOKUP_F_IFACE : 0;

skb->dst = fib6_rule_lookup(&fl, flags, ip6_pol_route_input);
}
Expand All @@ -728,10 +721,9 @@ static struct rt6_info *ip6_pol_route_output(struct fib6_table *table,
int strict = 0;
int attempts = 3;
int err;
int reachable = RT6_SELECT_F_REACHABLE;
int reachable = RT6_LOOKUP_F_REACHABLE;

if (flags & RT6_F_STRICT)
strict = RT6_SELECT_F_IFACE;
strict |= flags & RT6_LOOKUP_F_IFACE;

relookup:
read_lock_bh(&table->tb6_lock);
Expand Down Expand Up @@ -797,7 +789,7 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl)
int flags = 0;

if (rt6_need_strict(&fl->fl6_dst))
flags |= RT6_F_STRICT;
flags |= RT6_LOOKUP_F_IFACE;

return fib6_rule_lookup(fl, flags, ip6_pol_route_output);
}
Expand Down Expand Up @@ -1362,7 +1354,7 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest,
},
.gateway = *gateway,
};
int flags = rt6_need_strict(dest) ? RT6_F_STRICT : 0;
int flags = rt6_need_strict(dest) ? RT6_LOOKUP_F_IFACE : 0;

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

0 comments on commit 20a4229

Please sign in to comment.