* Update/configure interface address parameters: * * 1) Update lifetime * 2) Update interface metric ad flags * 3) Notify other subsystems */
| 1122 | * 3) Notify other subsystems |
| 1123 | */ |
| 1124 | static int |
| 1125 | in6_update_ifa_internal(struct ifnet *ifp, struct in6_aliasreq *ifra, |
| 1126 | struct in6_ifaddr *ia, int hostIsNew, int flags) |
| 1127 | { |
| 1128 | int error; |
| 1129 | |
| 1130 | /* update timestamp */ |
| 1131 | ia->ia6_updatetime = time_uptime; |
| 1132 | |
| 1133 | /* |
| 1134 | * Set lifetimes. We do not refer to ia6t_expire and ia6t_preferred |
| 1135 | * to see if the address is deprecated or invalidated, but initialize |
| 1136 | * these members for applications. |
| 1137 | */ |
| 1138 | ia->ia6_lifetime = ifra->ifra_lifetime; |
| 1139 | if (ia->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) { |
| 1140 | ia->ia6_lifetime.ia6t_expire = |
| 1141 | time_uptime + ia->ia6_lifetime.ia6t_vltime; |
| 1142 | } else |
| 1143 | ia->ia6_lifetime.ia6t_expire = 0; |
| 1144 | if (ia->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) { |
| 1145 | ia->ia6_lifetime.ia6t_preferred = |
| 1146 | time_uptime + ia->ia6_lifetime.ia6t_pltime; |
| 1147 | } else |
| 1148 | ia->ia6_lifetime.ia6t_preferred = 0; |
| 1149 | |
| 1150 | /* |
| 1151 | * backward compatibility - if IN6_IFF_DEPRECATED is set from the |
| 1152 | * userland, make it deprecated. |
| 1153 | */ |
| 1154 | if ((ifra->ifra_flags & IN6_IFF_DEPRECATED) != 0) { |
| 1155 | ia->ia6_lifetime.ia6t_pltime = 0; |
| 1156 | ia->ia6_lifetime.ia6t_preferred = time_uptime; |
| 1157 | } |
| 1158 | |
| 1159 | /* |
| 1160 | * configure address flags. |
| 1161 | */ |
| 1162 | ia->ia6_flags = ifra->ifra_flags; |
| 1163 | |
| 1164 | /* |
| 1165 | * Make the address tentative before joining multicast addresses, |
| 1166 | * so that corresponding MLD responses would not have a tentative |
| 1167 | * source address. |
| 1168 | */ |
| 1169 | ia->ia6_flags &= ~IN6_IFF_DUPLICATED; /* safety */ |
| 1170 | |
| 1171 | /* |
| 1172 | * DAD should be performed for an new address or addresses on |
| 1173 | * an interface with ND6_IFF_IFDISABLED. |
| 1174 | */ |
| 1175 | if (in6if_do_dad(ifp) && |
| 1176 | (hostIsNew || (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED))) |
| 1177 | ia->ia6_flags |= IN6_IFF_TENTATIVE; |
| 1178 | |
| 1179 | /* notify other subsystems */ |
| 1180 | error = in6_notify_ifa(ifp, ia, ifra, hostIsNew); |
| 1181 |
no test coverage detected