[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1385557373.13113.12.camel@rh1.brq.redhat.com>
Date: Wed, 27 Nov 2013 14:02:53 +0100
From: Thomas Haller <thaller@...hat.com>
To: Jiri Pirko <jiri@...nulli.us>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuznet@....inr.ac.ru,
jmorris@...ei.org, yoshfuji@...ux-ipv6.org, kaber@...sh.net,
stephen@...workplumber.org, hannes@...essinduktion.org,
vyasevich@...il.com, dcbw@...hat.com, David.Laight@...LAB.COM
Subject: Re: [patch net-next RFC v2 2/2] ipv6 addrconf: introduce
IFA_F_MANAGETEMPADDR to tell kernel to manage temporary addresses
Hi Jiri,
just two comments:
> addrconf_verify(0);
> return 0;
> @@ -3609,6 +3617,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
> u32 flags;
> clock_t expires;
> unsigned long timeout;
> + bool was_managetempaddr;
>
> if (!valid_lft || (prefered_lft > valid_lft))
> return -EINVAL;
> @@ -3632,7 +3641,10 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
> }
>
> spin_lock_bh(&ifp->lock);
We should make sure here, not to allow IFA_F_MANAGETEMPADDR, if ifp has
prefixlen!=64 or is IFA_F_TEMPORARY itself. Note, that inet6_rtm_newaddr
does check for ifm->ifa_prefixlen != 64, but when modifying an existing
address, the ifm->ifa_prefixlen is not relevant.
> - ifp->flags = (ifp->flags & ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_NODAD | IFA_F_HOMEADDRESS)) | ifa_flags;
> + was_managetempaddr = ifp->flags & IFA_F_MANAGETEMPADDR;
> + ifp->flags &= ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_NODAD |
> + IFA_F_HOMEADDRESS | IFA_F_MANAGETEMPADDR);
> + ifp->flags |= ifa_flags;
> ifp->tstamp = jiffies;
> ifp->valid_lft = valid_lft;
> ifp->prefered_lft = prefered_lft;
> @@ -3643,6 +3655,14 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
>
> addrconf_prefix_route(&ifp->addr, ifp->prefix_len, ifp->idev->dev,
> expires, flags);
> +
> + if (was_managetempaddr || ifp->flags & IFA_F_MANAGETEMPADDR) {
> + if (was_managetempaddr && !(ifp->flags & IFA_F_MANAGETEMPADDR))
> + valid_lft = prefered_lft = 0;
> + manage_tempaddrs(ifp->idev, ifp, valid_lft, prefered_lft,
> + false, jiffies);
I think, the parameter "create" of manage_tempaddrs should be set to
"!was_managetempaddr", because we want to force creation of a new
temporary address, if ifp just gets the flag IFA_F_MANAGETEMPADDR
(without having it before).
Thomas
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists