git: 1b2715c0581e - stable/14 - netinet: Make in_localaddr() return bool
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 07 Mar 2025 04:03:19 UTC
The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=1b2715c0581ec725968131b2ca8d2238df2d2287 commit 1b2715c0581ec725968131b2ca8d2238df2d2287 Author: Zhenlei Huang <zlei@FreeBSD.org> AuthorDate: 2025-02-27 15:58:20 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2025-03-07 04:02:40 +0000 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) --- sys/netinet/in.c | 8 ++++---- sys/netinet/in.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index de6224ad9ebc..664dffb4e6cc 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -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); } /* diff --git a/sys/netinet/in.h b/sys/netinet/in.h index 80c872367f93..db36962aadb1 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -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);