MCPcopy Create free account
hub / github.com/F-Stack/f-stack / in_broadcast

Function in_broadcast

freebsd/netinet/in.c:1154–1179  ·  view source on GitHub ↗

* Return 1 if the address might be a local broadcast address. */

Source from the content-addressed store, hash-verified

1152 * Return 1 if the address might be a local broadcast address.
1153 */
1154int
1155in_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.

Callers 5

udp_inputFunction · 0.85
div_output_inboundFunction · 0.85
rib4_preaddFunction · 0.85
tcp_inputFunction · 0.85
tcp_dropwithresetFunction · 0.85

Calls 1

in_ifaddr_broadcastFunction · 0.85

Tested by

no test coverage detected