* Returns ifa in case it's a carp address and it is MASTER, or if the address * matches and is not a carp address. Returns NULL otherwise. */
| 1179 | * matches and is not a carp address. Returns NULL otherwise. |
| 1180 | */ |
| 1181 | struct ifaddr * |
| 1182 | carp_iamatch6(struct ifnet *ifp, struct in6_addr *taddr) |
| 1183 | { |
| 1184 | struct ifaddr *ifa; |
| 1185 | |
| 1186 | NET_EPOCH_ASSERT(); |
| 1187 | |
| 1188 | ifa = NULL; |
| 1189 | CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { |
| 1190 | if (ifa->ifa_addr->sa_family != AF_INET6) |
| 1191 | continue; |
| 1192 | if (!IN6_ARE_ADDR_EQUAL(taddr, IFA_IN6(ifa))) |
| 1193 | continue; |
| 1194 | if (ifa->ifa_carp && ifa->ifa_carp->sc_state != MASTER) |
| 1195 | ifa = NULL; |
| 1196 | else |
| 1197 | ifa_ref(ifa); |
| 1198 | break; |
| 1199 | } |
| 1200 | |
| 1201 | return (ifa); |
| 1202 | } |
| 1203 | |
| 1204 | char * |
| 1205 | carp_macmatch6(struct ifnet *ifp, struct mbuf *m, const struct in6_addr *taddr) |