Skip to contentSkip to conversation

net: ipv6: allow explicitly choosing optimistic addresses

PATCH Lorenzo Colitti 2 participants 2 messages Dec 12, 2014 – Dec 16, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Review int ipv6_chk_addr(struct net *net, const struct in6_addr *addr, · line 1534

Quoted 11 lines · Erik Kline
(quoted diff) +2 -1
@@ -1527,7 +1527,8 @@ 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) ||
+                    ifp->flags&IFA_F_OPTIMISTIC) &&
                    (dev == NULL || ifp->idev->dev == dev ||
                     !(ifp->scope&(IFA_LINK|IFA_HOST) || strict))) {
                        rcu_read_unlock_bh();

I looked at the callers of ipv6_chk_addr (lxr finds 19 files); from what I saw, this change will make all of them more correct except for ndisc_solicit. With this change, ndisc_solicit could now send neighbour solicitations from optimistic addresses, which is not allowed by the RFC.

#2 lore raw
Quoted 18 lines · Lorenzo Colitti

Review int ipv6_chk_addr(struct net *net, const struct in6_addr *addr, · line 1534

Quoted 11 lines · Erik Kline
(quoted diff) +2 -1
@@ -1527,7 +1527,8 @@ 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) ||
+                    ifp->flags&IFA_F_OPTIMISTIC) &&
                    (dev == NULL || ifp->idev->dev == dev ||
                     !(ifp->scope&(IFA_LINK|IFA_HOST) || strict))) {
                        rcu_read_unlock_bh();

I looked at the callers of ipv6_chk_addr (lxr finds 19 files); from what I saw, this change will make all of them more correct except for ndisc_solicit. With this change, ndisc_solicit could now send neighbour solicitations from optimistic addresses, which is not allowed by the RFC.

True. I have a version that fixes this, but ended up splitting ipv6_chk_addr into two:

- ipv6_chk_addr (same as today), and
- ipv6_chk_addr_and_flags (which takes a "u32 banned_flags" argument)

The ugliness of this naming is not lost on me. I briefly tried a version that reuses the "strict" argument to achieve the same thing, but that doesn't seem to be quite correct in all cases either.