[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKD1Yr0k44kwwtfWN-t9C1f7WKT0o=yimPwbfLtBnnvUvXrm=w@mail.gmail.com>
Date: Wed, 4 Feb 2015 00:40:12 +0900
From: Lorenzo Colitti <lorenzo@...gle.com>
To: Erik Kline <ek@...gle.com>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Hannes Frederic Sowa <hannes@...essinduktion.org>
Subject: Re: [PATCH net v3] net: ipv6: allow explicitly choosing optimistic addresses
On Mon, Feb 2, 2015 at 3:39 PM, Erik Kline <ek@...gle.com> wrote:
> @@ -1526,8 +1534,13 @@ int ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
> hlist_for_each_entry_rcu(ifp, &inet6_addr_lst[hash], addr_lst) {
> if (!net_eq(dev_net(ifp->idev->dev), net))
> continue;
> + /* Permit optimistic addresses, but only under explicitly
> + * defined circumstances.
> + */
I don't think this comment adds much of value, the code right below it
is pretty clear.
> + bool optimistic_ok = (ifp->flags & IFA_F_OPTIMISTIC) &&
> + (banned_flags == IFA_F_TENTATIVE);
Not sure if this can happen in any real use case, but I think that
technically this is incorrect if banned_flags contains both
IFA_F_TENTATIVE and other flags that aren't IFA_F_OPTIMISTIC. For
example, suppose banned_flags = IFA_F_TENTATIVE | IFA_F_PERMANENT. In
that case, I think the code would reject an address with
IFA_F_TENTATIVE | IFA_F_OPTIMISTIC. You might be able to fix that
using something like:
int ifp_flags;
...
ifp_flags = ifp->flags;
if (ifp_flags & IFA_F_OPTIMISTIC) ifp_flags &= ~IFA_F_TENTATIVE;
if (ipv6_addr_equal(&ifp->addr, addr) &&
!(ifp_flags & banned_flags) &&
Though I think that at this point your original formulation (the one
that treated IFA_F_TENTATIVE specially and did not pass it in via
banned_flags) might be faster/simpler/better.
Hannes, any better ideas?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists