aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorErik Kline <ek@google.com>2014-12-05 19:45:10 +0900
committerZiyan <jaraidaniel@gmail.com>2016-03-11 15:56:20 +0100
commit3091c123fd3a4c35adf1d78eb1cfe5f6d5b57676 (patch)
tree06ab9679add53aaf0c2ccdb60ac2fcce03e01b60 /net
parent10990f3e45c31bb3f6f564346d6ae4dab4ac3c7c (diff)
downloadkernel_samsung_espresso10-3091c123fd3a4c35adf1d78eb1cfe5f6d5b57676.zip
kernel_samsung_espresso10-3091c123fd3a4c35adf1d78eb1cfe5f6d5b57676.tar.gz
kernel_samsung_espresso10-3091c123fd3a4c35adf1d78eb1cfe5f6d5b57676.tar.bz2
net: ipv6: allow choosing optimistic addresses with use_optimistic
The use_optimistic sysctl makes optimistic IPv6 addresses equivalent to preferred addresses for source address selection (e.g., when calling connect()), but it does not allow an application to bind to optimistic addresses. This behaviour is inconsistent - for example, it doesn't make sense for bind() to an optimistic address fail with EADDRNOTAVAIL, but connect() to choose that address outgoing address on the same socket. Bug: 17769720 Bug: 18609055 Change-Id: I9de0d6c92ac45e29d28e318ac626c71806666f13 Signed-off-by: Erik Kline <ek@google.com> Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/addrconf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 66905eb..cf6718f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1291,7 +1291,9 @@ int ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
if (!net_eq(dev_net(ifp->idev->dev), net))
continue;
if (ipv6_addr_equal(&ifp->addr, addr) &&
- !(ifp->flags&IFA_F_TENTATIVE) &&
+ (!(ifp->flags&IFA_F_TENTATIVE) ||
+ (ipv6_use_optimistic_addr(ifp->idev) &&
+ ifp->flags&IFA_F_OPTIMISTIC)) &&
(dev == NULL || ifp->idev->dev == dev ||
!(ifp->scope&(IFA_LINK|IFA_HOST) || strict))) {
rcu_read_unlock_bh();