summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-09-24 12:55:12 +0200
committerThomas Haller <thaller@redhat.com>2020-09-30 09:49:20 +0200
commitd9ca728005a59b6bbf3573d1feab846f6728f9ab (patch)
tree754391e438a10d7372905c9b34b620f09d59c3fa
parentf37dd5d394fc1a7bd19c6d65129ca76e0a3c3b82 (diff)
downloadNetworkManager-d9ca728005a59b6bbf3573d1feab846f6728f9ab.tar.gz
shared: add nm_ether_addr_cmp()/nm_ether_addr_equal() helpers
-rw-r--r--shared/nm-glib-aux/nm-shared-utils.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-shared-utils.h b/shared/nm-glib-aux/nm-shared-utils.h
index c114086cf4..06e442f5f1 100644
--- a/shared/nm-glib-aux/nm-shared-utils.h
+++ b/shared/nm-glib-aux/nm-shared-utils.h
@@ -96,6 +96,22 @@ typedef struct {
.ether_addr_octet = {__VA_ARGS__}, \
}
+static inline int
+nm_ether_addr_cmp(const NMEtherAddr *a, const NMEtherAddr *b)
+{
+ NM_CMP_SELF(a, b);
+ NM_CMP_DIRECT_MEMCMP(a, b, sizeof(NMEtherAddr));
+ return 0;
+}
+
+static inline gboolean
+nm_ether_addr_equal(const NMEtherAddr *a, const NMEtherAddr *b)
+{
+ return nm_ether_addr_cmp(a, b) == 0;
+}
+
+/*****************************************************************************/
+
typedef struct {
union {
guint8 addr_ptr[1];