aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-24 20:37:42 -0400
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-24 21:24:01 -0400
commit7cbca67c073263c179f605bdbbdc565ab29d801d (patch)
tree124ce8c81f3e033790416d3d16bd23e2f7bfed07 /net/ipv6/route.c
parent1d5d236d309ab90fa6aedf712f586b3595721373 (diff)
[IPV6]: Support Source Address Selection API (RFC5014).
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index aa3f08718e44..06faa46920e1 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -782,6 +782,15 @@ struct dst_entry * ip6_route_output(struct net *net, struct sock *sk,
782 782
783 if (!ipv6_addr_any(&fl->fl6_src)) 783 if (!ipv6_addr_any(&fl->fl6_src))
784 flags |= RT6_LOOKUP_F_HAS_SADDR; 784 flags |= RT6_LOOKUP_F_HAS_SADDR;
785 else if (sk) {
786 unsigned int prefs = inet6_sk(sk)->srcprefs;
787 if (prefs & IPV6_PREFER_SRC_TMP)
788 flags |= RT6_LOOKUP_F_SRCPREF_TMP;
789 if (prefs & IPV6_PREFER_SRC_PUBLIC)
790 flags |= RT6_LOOKUP_F_SRCPREF_PUBLIC;
791 if (prefs & IPV6_PREFER_SRC_COA)
792 flags |= RT6_LOOKUP_F_SRCPREF_COA;
793 }
785 794
786 return fib6_rule_lookup(net, fl, flags, ip6_pol_route_output); 795 return fib6_rule_lookup(net, fl, flags, ip6_pol_route_output);
787} 796}
@@ -2162,7 +2171,7 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt,
2162 else if (dst) { 2171 else if (dst) {
2163 struct in6_addr saddr_buf; 2172 struct in6_addr saddr_buf;
2164 if (ipv6_dev_get_saddr(ip6_dst_idev(&rt->u.dst)->dev, 2173 if (ipv6_dev_get_saddr(ip6_dst_idev(&rt->u.dst)->dev,
2165 dst, &saddr_buf) == 0) 2174 dst, 0, &saddr_buf) == 0)
2166 NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf); 2175 NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf);
2167 } 2176 }
2168 2177