* Return 1 if the address might be a local broadcast address. */
| 1152 | * Return 1 if the address might be a local broadcast address. |
| 1153 | */ |
| 1154 | int |
| 1155 | in_broadcast(struct in_addr in, struct ifnet *ifp) |
| 1156 | { |
| 1157 | struct ifaddr *ifa; |
| 1158 | int found; |
| 1159 | |
| 1160 | NET_EPOCH_ASSERT(); |
| 1161 | |
| 1162 | if (in.s_addr == INADDR_BROADCAST || |
| 1163 | in.s_addr == INADDR_ANY) |
| 1164 | return (1); |
| 1165 | if ((ifp->if_flags & IFF_BROADCAST) == 0) |
| 1166 | return (0); |
| 1167 | found = 0; |
| 1168 | /* |
| 1169 | * Look through the list of addresses for a match |
| 1170 | * with a broadcast address. |
| 1171 | */ |
| 1172 | CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) |
| 1173 | if (ifa->ifa_addr->sa_family == AF_INET && |
| 1174 | in_ifaddr_broadcast(in, (struct in_ifaddr *)ifa)) { |
| 1175 | found = 1; |
| 1176 | break; |
| 1177 | } |
| 1178 | return (found); |
| 1179 | } |
| 1180 | |
| 1181 | /* |
| 1182 | * On interface removal, clean up IPv4 data structures hung off of the ifnet. |
no test coverage detected