diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-24 20:37:42 -0400 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-24 21:24:01 -0400 |
commit | 7cbca67c073263c179f605bdbbdc565ab29d801d (patch) | |
tree | 124ce8c81f3e033790416d3d16bd23e2f7bfed07 /net/ipv6/fib6_rules.c | |
parent | 1d5d236d309ab90fa6aedf712f586b3595721373 (diff) |
[IPV6]: Support Source Address Selection API (RFC5014).
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net/ipv6/fib6_rules.c')
-rw-r--r-- | net/ipv6/fib6_rules.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index 55137408f054..e7a7fe26cebf 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c | |||
@@ -84,8 +84,18 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, | |||
84 | if ((rule->flags & FIB_RULE_FIND_SADDR) && | 84 | if ((rule->flags & FIB_RULE_FIND_SADDR) && |
85 | r->src.plen && !(flags & RT6_LOOKUP_F_HAS_SADDR)) { | 85 | r->src.plen && !(flags & RT6_LOOKUP_F_HAS_SADDR)) { |
86 | struct in6_addr saddr; | 86 | struct in6_addr saddr; |
87 | unsigned int srcprefs = 0; | ||
88 | |||
89 | if (flags & RT6_LOOKUP_F_SRCPREF_TMP) | ||
90 | srcprefs |= IPV6_PREFER_SRC_TMP; | ||
91 | if (flags & RT6_LOOKUP_F_SRCPREF_PUBLIC) | ||
92 | srcprefs |= IPV6_PREFER_SRC_PUBLIC; | ||
93 | if (flags & RT6_LOOKUP_F_SRCPREF_COA) | ||
94 | srcprefs |= IPV6_PREFER_SRC_COA; | ||
95 | |||
87 | if (ipv6_dev_get_saddr(ip6_dst_idev(&rt->u.dst)->dev, | 96 | if (ipv6_dev_get_saddr(ip6_dst_idev(&rt->u.dst)->dev, |
88 | &flp->fl6_dst, &saddr)) | 97 | &flp->fl6_dst, srcprefs, |
98 | &saddr)) | ||
89 | goto again; | 99 | goto again; |
90 | if (!ipv6_prefix_equal(&saddr, &r->src.addr, | 100 | if (!ipv6_prefix_equal(&saddr, &r->src.addr, |
91 | r->src.plen)) | 101 | r->src.plen)) |