IfAPI: Add if_maddr_empty() to check for any maddrs

if_llmaddr_count() only counts link-level multicast addresses.
hv_netvsc(4) needs to know if there are any multicast addresses.  Since
hv_netvsc(4) is the only instance where this would be used, make it a
simple boolean.  If others need a if_maddr_count(), that can be added in
the future.

Reviewed by:	melifaro
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39493
This commit is contained in:
Justin Hibbits 2023-04-10 14:20:00 -04:00
parent c32b6c742f
commit f766d1d5a7
2 changed files with 8 additions and 0 deletions

View File

@ -4685,6 +4685,13 @@ if_llmaddr_count(if_t ifp)
return (count);
}
bool
if_maddr_empty(if_t ifp)
{
return (CK_STAILQ_EMPTY(&ifp->if_multiaddrs));
}
u_int
if_foreach_llmaddr(if_t ifp, iflladdr_cb_t cb, void *cb_arg)
{

View File

@ -657,6 +657,7 @@ u_int if_foreach_lladdr(if_t, iflladdr_cb_t, void *);
u_int if_foreach_llmaddr(if_t, iflladdr_cb_t, void *);
u_int if_lladdr_count(if_t);
u_int if_llmaddr_count(if_t);
bool if_maddr_empty(if_t);
int if_getamcount(const if_t ifp);
struct ifaddr * if_getifaddr(const if_t ifp);