mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 13:30:28 +01:00
shared: add nm_utils_ether_addr_equal(), nm_utils_ether_addr_cmp()
This commit is contained in:
parent
fce73b1c82
commit
39127758bd
2 changed files with 24 additions and 0 deletions
|
|
@ -13,6 +13,7 @@
|
|||
#include <sys/syscall.h>
|
||||
#include <glib-unix.h>
|
||||
#include <net/if.h>
|
||||
#include <net/ethernet.h>
|
||||
|
||||
#include "nm-errno.h"
|
||||
#include "nm-str-buf.h"
|
||||
|
|
@ -88,6 +89,11 @@ nm_ip_addr_set_from_untrusted (int addr_family,
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
G_STATIC_ASSERT (ETH_ALEN == sizeof (struct ether_addr));
|
||||
G_STATIC_ASSERT (ETH_ALEN == 6);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
gsize
|
||||
nm_utils_get_next_realloc_size (gboolean true_realloc, gsize requested)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -178,6 +178,24 @@ nm_ip4_addr_is_localhost (in_addr_t addr4)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct ether_addr;
|
||||
|
||||
static inline int
|
||||
nm_utils_ether_addr_cmp (const struct ether_addr *a1, const struct ether_addr *a2)
|
||||
{
|
||||
nm_assert (a1);
|
||||
nm_assert (a2);
|
||||
return memcmp (a1, a2, 6 /*ETH_ALEN*/);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
nm_utils_ether_addr_equal (const struct ether_addr *a1, const struct ether_addr *a2)
|
||||
{
|
||||
return nm_utils_ether_addr_cmp (a1, a2) == 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_UTILS_INET_ADDRSTRLEN INET6_ADDRSTRLEN
|
||||
|
||||
static inline const char *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue