net/ipv6: Pass ifa6_config struct to inet6_addr_modify
Update inet6_addr_modify to take ifa6_config argument versus a parameter list. This is an argument move only; no functional change intended. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
19b1518c29
commit
d169a1f8ba
@ -4527,8 +4527,7 @@ inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||
ifm->ifa_prefixlen);
|
||||
}
|
||||
|
||||
static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
|
||||
u32 prefered_lft, u32 valid_lft)
|
||||
static int inet6_addr_modify(struct inet6_ifaddr *ifp, struct ifa6_config *cfg)
|
||||
{
|
||||
u32 flags;
|
||||
clock_t expires;
|
||||
@ -4538,32 +4537,32 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
|
||||
|
||||
ASSERT_RTNL();
|
||||
|
||||
if (!valid_lft || (prefered_lft > valid_lft))
|
||||
if (!cfg->valid_lft || cfg->preferred_lft > cfg->valid_lft)
|
||||
return -EINVAL;
|
||||
|
||||
if (ifa_flags & IFA_F_MANAGETEMPADDR &&
|
||||
if (cfg->ifa_flags & IFA_F_MANAGETEMPADDR &&
|
||||
(ifp->flags & IFA_F_TEMPORARY || ifp->prefix_len != 64))
|
||||
return -EINVAL;
|
||||
|
||||
if (!(ifp->flags & IFA_F_TENTATIVE) || ifp->flags & IFA_F_DADFAILED)
|
||||
ifa_flags &= ~IFA_F_OPTIMISTIC;
|
||||
cfg->ifa_flags &= ~IFA_F_OPTIMISTIC;
|
||||
|
||||
timeout = addrconf_timeout_fixup(valid_lft, HZ);
|
||||
timeout = addrconf_timeout_fixup(cfg->valid_lft, HZ);
|
||||
if (addrconf_finite_timeout(timeout)) {
|
||||
expires = jiffies_to_clock_t(timeout * HZ);
|
||||
valid_lft = timeout;
|
||||
cfg->valid_lft = timeout;
|
||||
flags = RTF_EXPIRES;
|
||||
} else {
|
||||
expires = 0;
|
||||
flags = 0;
|
||||
ifa_flags |= IFA_F_PERMANENT;
|
||||
cfg->ifa_flags |= IFA_F_PERMANENT;
|
||||
}
|
||||
|
||||
timeout = addrconf_timeout_fixup(prefered_lft, HZ);
|
||||
timeout = addrconf_timeout_fixup(cfg->preferred_lft, HZ);
|
||||
if (addrconf_finite_timeout(timeout)) {
|
||||
if (timeout == 0)
|
||||
ifa_flags |= IFA_F_DEPRECATED;
|
||||
prefered_lft = timeout;
|
||||
cfg->ifa_flags |= IFA_F_DEPRECATED;
|
||||
cfg->preferred_lft = timeout;
|
||||
}
|
||||
|
||||
spin_lock_bh(&ifp->lock);
|
||||
@ -4573,16 +4572,16 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
|
||||
ifp->flags &= ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_NODAD |
|
||||
IFA_F_HOMEADDRESS | IFA_F_MANAGETEMPADDR |
|
||||
IFA_F_NOPREFIXROUTE);
|
||||
ifp->flags |= ifa_flags;
|
||||
ifp->flags |= cfg->ifa_flags;
|
||||
ifp->tstamp = jiffies;
|
||||
ifp->valid_lft = valid_lft;
|
||||
ifp->prefered_lft = prefered_lft;
|
||||
ifp->valid_lft = cfg->valid_lft;
|
||||
ifp->prefered_lft = cfg->preferred_lft;
|
||||
|
||||
spin_unlock_bh(&ifp->lock);
|
||||
if (!(ifp->flags&IFA_F_TENTATIVE))
|
||||
ipv6_ifa_notify(0, ifp);
|
||||
|
||||
if (!(ifa_flags & IFA_F_NOPREFIXROUTE)) {
|
||||
if (!(cfg->ifa_flags & IFA_F_NOPREFIXROUTE)) {
|
||||
addrconf_prefix_route(&ifp->addr, ifp->prefix_len,
|
||||
ifp->idev->dev, expires, flags,
|
||||
GFP_KERNEL);
|
||||
@ -4601,10 +4600,14 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_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,
|
||||
!was_managetempaddr, jiffies);
|
||||
if (was_managetempaddr &&
|
||||
!(ifp->flags & IFA_F_MANAGETEMPADDR)) {
|
||||
cfg->valid_lft = 0;
|
||||
cfg->preferred_lft = 0;
|
||||
}
|
||||
manage_tempaddrs(ifp->idev, ifp, cfg->valid_lft,
|
||||
cfg->preferred_lft, !was_managetempaddr,
|
||||
jiffies);
|
||||
}
|
||||
|
||||
addrconf_verify_rtnl();
|
||||
@ -4691,8 +4694,7 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||
!(nlh->nlmsg_flags & NLM_F_REPLACE))
|
||||
err = -EEXIST;
|
||||
else
|
||||
err = inet6_addr_modify(ifa, cfg.ifa_flags, cfg.preferred_lft,
|
||||
cfg.valid_lft);
|
||||
err = inet6_addr_modify(ifa, &cfg);
|
||||
|
||||
in6_ifa_put(ifa);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user