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);
|
ifm->ifa_prefixlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
|
static int inet6_addr_modify(struct inet6_ifaddr *ifp, struct ifa6_config *cfg)
|
||||||
u32 prefered_lft, u32 valid_lft)
|
|
||||||
{
|
{
|
||||||
u32 flags;
|
u32 flags;
|
||||||
clock_t expires;
|
clock_t expires;
|
||||||
@ -4538,32 +4537,32 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
|
|||||||
|
|
||||||
ASSERT_RTNL();
|
ASSERT_RTNL();
|
||||||
|
|
||||||
if (!valid_lft || (prefered_lft > valid_lft))
|
if (!cfg->valid_lft || cfg->preferred_lft > cfg->valid_lft)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (ifa_flags & IFA_F_MANAGETEMPADDR &&
|
if (cfg->ifa_flags & IFA_F_MANAGETEMPADDR &&
|
||||||
(ifp->flags & IFA_F_TEMPORARY || ifp->prefix_len != 64))
|
(ifp->flags & IFA_F_TEMPORARY || ifp->prefix_len != 64))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!(ifp->flags & IFA_F_TENTATIVE) || ifp->flags & IFA_F_DADFAILED)
|
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)) {
|
if (addrconf_finite_timeout(timeout)) {
|
||||||
expires = jiffies_to_clock_t(timeout * HZ);
|
expires = jiffies_to_clock_t(timeout * HZ);
|
||||||
valid_lft = timeout;
|
cfg->valid_lft = timeout;
|
||||||
flags = RTF_EXPIRES;
|
flags = RTF_EXPIRES;
|
||||||
} else {
|
} else {
|
||||||
expires = 0;
|
expires = 0;
|
||||||
flags = 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 (addrconf_finite_timeout(timeout)) {
|
||||||
if (timeout == 0)
|
if (timeout == 0)
|
||||||
ifa_flags |= IFA_F_DEPRECATED;
|
cfg->ifa_flags |= IFA_F_DEPRECATED;
|
||||||
prefered_lft = timeout;
|
cfg->preferred_lft = timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_lock_bh(&ifp->lock);
|
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 |
|
ifp->flags &= ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_NODAD |
|
||||||
IFA_F_HOMEADDRESS | IFA_F_MANAGETEMPADDR |
|
IFA_F_HOMEADDRESS | IFA_F_MANAGETEMPADDR |
|
||||||
IFA_F_NOPREFIXROUTE);
|
IFA_F_NOPREFIXROUTE);
|
||||||
ifp->flags |= ifa_flags;
|
ifp->flags |= cfg->ifa_flags;
|
||||||
ifp->tstamp = jiffies;
|
ifp->tstamp = jiffies;
|
||||||
ifp->valid_lft = valid_lft;
|
ifp->valid_lft = cfg->valid_lft;
|
||||||
ifp->prefered_lft = prefered_lft;
|
ifp->prefered_lft = cfg->preferred_lft;
|
||||||
|
|
||||||
spin_unlock_bh(&ifp->lock);
|
spin_unlock_bh(&ifp->lock);
|
||||||
if (!(ifp->flags&IFA_F_TENTATIVE))
|
if (!(ifp->flags&IFA_F_TENTATIVE))
|
||||||
ipv6_ifa_notify(0, ifp);
|
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,
|
addrconf_prefix_route(&ifp->addr, ifp->prefix_len,
|
||||||
ifp->idev->dev, expires, flags,
|
ifp->idev->dev, expires, flags,
|
||||||
GFP_KERNEL);
|
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) {
|
||||||
if (was_managetempaddr && !(ifp->flags & IFA_F_MANAGETEMPADDR))
|
if (was_managetempaddr &&
|
||||||
valid_lft = prefered_lft = 0;
|
!(ifp->flags & IFA_F_MANAGETEMPADDR)) {
|
||||||
manage_tempaddrs(ifp->idev, ifp, valid_lft, prefered_lft,
|
cfg->valid_lft = 0;
|
||||||
!was_managetempaddr, jiffies);
|
cfg->preferred_lft = 0;
|
||||||
|
}
|
||||||
|
manage_tempaddrs(ifp->idev, ifp, cfg->valid_lft,
|
||||||
|
cfg->preferred_lft, !was_managetempaddr,
|
||||||
|
jiffies);
|
||||||
}
|
}
|
||||||
|
|
||||||
addrconf_verify_rtnl();
|
addrconf_verify_rtnl();
|
||||||
@ -4691,8 +4694,7 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|||||||
!(nlh->nlmsg_flags & NLM_F_REPLACE))
|
!(nlh->nlmsg_flags & NLM_F_REPLACE))
|
||||||
err = -EEXIST;
|
err = -EEXIST;
|
||||||
else
|
else
|
||||||
err = inet6_addr_modify(ifa, cfg.ifa_flags, cfg.preferred_lft,
|
err = inet6_addr_modify(ifa, &cfg);
|
||||||
cfg.valid_lft);
|
|
||||||
|
|
||||||
in6_ifa_put(ifa);
|
in6_ifa_put(ifa);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user