summaryrefslogtreecommitdiff
path: root/src/platform/nm-platform.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-04-27 18:06:59 +0200
committerThomas Haller <thaller@redhat.com>2015-06-17 10:54:55 +0200
commit36e77218a0d54b6f9be3a9d98efb145dda6b52ad (patch)
tree4e53215ac6566d7f79378e33794f1fb57c85f53d /src/platform/nm-platform.c
parent3cdde18f52235e5bc9892a871a88ec84df63bf5d (diff)
downloadNetworkManager-36e77218a0d54b6f9be3a9d98efb145dda6b52ad.tar.gz
platform: add addr parameter to NMPlatformLink
Diffstat (limited to 'src/platform/nm-platform.c')
-rw-r--r--src/platform/nm-platform.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 0d9ae57e36..3c91f6d242 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -38,6 +38,8 @@
#include "nm-enum-types.h"
#include "nm-core-internal.h"
+G_STATIC_ASSERT (sizeof ( ((NMPlatformLink *) NULL)->addr.data ) == NM_UTILS_HWADDR_LEN_MAX);
+
#define debug(...) nm_log_dbg (LOGD_PLATFORM, __VA_ARGS__)
#define NM_PLATFORM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_PLATFORM, NMPlatformPrivate))
@@ -2759,6 +2761,14 @@ nm_platform_ip6_route_to_string (const NMPlatformIP6Route *route)
return c < 0 ? -1 : 1; \
} G_STMT_END
+#define _CMP_FIELD_MEMCMP_LEN(a, b, field, len) \
+ G_STMT_START { \
+ int c = memcmp (&((a)->field), &((b)->field), \
+ MIN (len, sizeof ((a)->field))); \
+ if (c != 0) \
+ return c < 0 ? -1 : 1; \
+ } G_STMT_END
+
#define _CMP_FIELD_MEMCMP(a, b, field) \
G_STMT_START { \
int c = memcmp (&((a)->field), &((b)->field), \
@@ -2783,9 +2793,12 @@ nm_platform_link_cmp (const NMPlatformLink *a, const NMPlatformLink *b)
_CMP_FIELD (a, b, arp);
_CMP_FIELD (a, b, mtu);
_CMP_FIELD_BOOL (a, b, initialized);
+ _CMP_FIELD (a, b, addr.len);
_CMP_FIELD_STR_INTERNED (a, b, kind);
_CMP_FIELD_STR0 (a, b, udi);
_CMP_FIELD_STR_INTERNED (a, b, driver);
+ if (a->addr.len)
+ _CMP_FIELD_MEMCMP_LEN (a, b, addr.data, a->addr.len);
return 0;
}