Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/in.c
Show First 20 Lines • Show All 948 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Return 1 if the address might be a local broadcast address. | * Return 1 if the address might be a local broadcast address. | ||||
*/ | */ | ||||
int | int | ||||
in_broadcast(struct in_addr in, struct ifnet *ifp) | in_broadcast(struct in_addr in, struct ifnet *ifp) | ||||
{ | { | ||||
register struct ifaddr *ifa; | register struct ifaddr *ifa; | ||||
int found; | |||||
if (in.s_addr == INADDR_BROADCAST || | if (in.s_addr == INADDR_BROADCAST || | ||||
in.s_addr == INADDR_ANY) | in.s_addr == INADDR_ANY) | ||||
return (1); | return (1); | ||||
if ((ifp->if_flags & IFF_BROADCAST) == 0) | if ((ifp->if_flags & IFF_BROADCAST) == 0) | ||||
return (0); | return (0); | ||||
found = 0; | |||||
/* | /* | ||||
* Look through the list of addresses for a match | * Look through the list of addresses for a match | ||||
* with a broadcast address. | * with a broadcast address. | ||||
*/ | */ | ||||
IF_ADDR_RLOCK(ifp); | |||||
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) | TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) | ||||
if (ifa->ifa_addr->sa_family == AF_INET && | if (ifa->ifa_addr->sa_family == AF_INET && | ||||
in_ifaddr_broadcast(in, (struct in_ifaddr *)ifa)) | in_ifaddr_broadcast(in, (struct in_ifaddr *)ifa)) { | ||||
return (1); | found = 1; | ||||
return (0); | break; | ||||
} | |||||
IF_ADDR_RUNLOCK(ifp); | |||||
return (found); | |||||
} | } | ||||
/* | /* | ||||
* On interface removal, clean up IPv4 data structures hung off of the ifnet. | * On interface removal, clean up IPv4 data structures hung off of the ifnet. | ||||
*/ | */ | ||||
void | void | ||||
in_ifdetach(struct ifnet *ifp) | in_ifdetach(struct ifnet *ifp) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 500 Lines • Show Last 20 Lines |