Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/in6.c
| Show First 20 Lines • Show All 1,023 Lines • ▼ Show 20 Lines | in6_alloc_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, int flags) | ||||
| IN6_IFADDR_WLOCK(); | IN6_IFADDR_WLOCK(); | ||||
| CK_STAILQ_INSERT_TAIL(&V_in6_ifaddrhead, ia, ia_link); | CK_STAILQ_INSERT_TAIL(&V_in6_ifaddrhead, ia, ia_link); | ||||
| CK_LIST_INSERT_HEAD(IN6ADDR_HASH(&ia->ia_addr.sin6_addr), ia, ia6_hash); | CK_LIST_INSERT_HEAD(IN6ADDR_HASH(&ia->ia_addr.sin6_addr), ia, ia6_hash); | ||||
| IN6_IFADDR_WUNLOCK(); | IN6_IFADDR_WUNLOCK(); | ||||
| return (ia); | return (ia); | ||||
| } | } | ||||
| time_t | |||||
| in6_expire_time(uint32_t ltime) | |||||
| { | |||||
| if (ltime == ND6_INFINITE_LIFETIME) | |||||
| return (0); | |||||
| else | |||||
| return (time_uptime + ltime); | |||||
| } | |||||
| /* | /* | ||||
| * Update/configure interface address parameters: | * Update/configure interface address parameters: | ||||
| * | * | ||||
| * 1) Update lifetime | * 1) Update lifetime | ||||
| * 2) Update interface metric ad flags | * 2) Update interface metric ad flags | ||||
| * 3) Notify other subsystems | * 3) Notify other subsystems | ||||
| */ | */ | ||||
| static int | static int | ||||
| in6_update_ifa_internal(struct ifnet *ifp, struct in6_aliasreq *ifra, | in6_update_ifa_internal(struct ifnet *ifp, struct in6_aliasreq *ifra, | ||||
| struct in6_ifaddr *ia, int hostIsNew, int flags) | struct in6_ifaddr *ia, int hostIsNew, int flags) | ||||
| { | { | ||||
| int error; | int error; | ||||
| /* update timestamp */ | /* update timestamp */ | ||||
| ia->ia6_updatetime = time_uptime; | ia->ia6_updatetime = time_uptime; | ||||
| /* | /* | ||||
| * Set lifetimes. We do not refer to ia6t_expire and ia6t_preferred | * Set lifetimes. We do not refer to ia6t_expire and ia6t_preferred | ||||
| * to see if the address is deprecated or invalidated, but initialize | * to see if the address is deprecated or invalidated, but initialize | ||||
| * these members for applications. | * these members for applications. | ||||
| */ | */ | ||||
| ia->ia6_lifetime = ifra->ifra_lifetime; | ia->ia6_lifetime = ifra->ifra_lifetime; | ||||
| if (ia->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) { | |||||
| ia->ia6_lifetime.ia6t_expire = | ia->ia6_lifetime.ia6t_expire = | ||||
| time_uptime + ia->ia6_lifetime.ia6t_vltime; | in6_expire_time(ifra->ifra_lifetime.ia6t_vltime); | ||||
| } else | |||||
| ia->ia6_lifetime.ia6t_expire = 0; | |||||
| if (ia->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) { | |||||
| ia->ia6_lifetime.ia6t_preferred = | ia->ia6_lifetime.ia6t_preferred = | ||||
| time_uptime + ia->ia6_lifetime.ia6t_pltime; | in6_expire_time(ifra->ifra_lifetime.ia6t_pltime); | ||||
| } else | |||||
| ia->ia6_lifetime.ia6t_preferred = 0; | |||||
| /* | /* | ||||
| * backward compatibility - if IN6_IFF_DEPRECATED is set from the | * backward compatibility - if IN6_IFF_DEPRECATED is set from the | ||||
| * userland, make it deprecated. | * userland, make it deprecated. | ||||
| */ | */ | ||||
| if ((ifra->ifra_flags & IN6_IFF_DEPRECATED) != 0) { | if ((ifra->ifra_flags & IN6_IFF_DEPRECATED) != 0) { | ||||
| ia->ia6_lifetime.ia6t_pltime = 0; | ia->ia6_lifetime.ia6t_pltime = 0; | ||||
| ia->ia6_lifetime.ia6t_preferred = time_uptime; | ia->ia6_lifetime.ia6t_preferred = time_uptime; | ||||
| ▲ Show 20 Lines • Show All 1,661 Lines • Show Last 20 Lines | |||||