netinet: Make in_localaddr() return bool

It is used as a boolean function everywhere.

No functional change intended.

MFC after:	1 week

(cherry picked from commit 69beb162848b15c967d3b45ac56501dbd8b94e91)
This commit is contained in:
Zhenlei Huang 2025-02-27 23:58:20 +08:00 committed by Franco Fichtner
parent f4138e6c1e
commit dacf15eb76
2 changed files with 5 additions and 5 deletions

View File

@ -129,10 +129,10 @@ static struct sx in_control_sx;
SX_SYSINIT(in_control_sx, &in_control_sx, "in_control");
/*
* Return 1 if an internet address is for a ``local'' host
* Return true if an internet address is for a ``local'' host
* (one to which we have a connection).
*/
int
bool
in_localaddr(struct in_addr in)
{
u_long i = ntohl(in.s_addr);
@ -142,10 +142,10 @@ in_localaddr(struct in_addr in)
CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) {
if ((i & ia->ia_subnetmask) == ia->ia_subnet)
return (1);
return (true);
}
return (0);
return (false);
}
/*

View File

@ -677,7 +677,7 @@ struct in_ifaddr;
int in_broadcast(struct in_addr, struct ifnet *);
int in_ifaddr_broadcast(struct in_addr, struct in_ifaddr *);
int in_canforward(struct in_addr);
int in_localaddr(struct in_addr);
bool in_localaddr(struct in_addr);
bool in_localip(struct in_addr);
bool in_localip_fib(struct in_addr, uint16_t);
int in_ifhasaddr(struct ifnet *, struct in_addr);