diff options
author | Thomas Haller <thaller@redhat.com> | 2016-02-18 20:21:27 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-02-18 20:21:27 +0100 |
commit | 328c733a6a3073a8ce8cda04b4b2128a3f4d6b08 (patch) | |
tree | 7e046f9812d4e68429630cf9e8a6338cdb3e6ee2 | |
parent | b76d4b6b096a1bee7e2c6f0d2a7bdf89e001203d (diff) | |
download | NetworkManager-328c733a6a3073a8ce8cda04b4b2128a3f4d6b08.tar.gz |
platform: expose nmp_utils_ip4_address_is_link_local() function
-rw-r--r-- | src/platform/nm-linux-platform.c | 13 | ||||
-rw-r--r-- | src/platform/nm-platform-utils.c | 9 | ||||
-rw-r--r-- | src/platform/nm-platform-utils.h | 2 | ||||
-rw-r--r-- | src/platform/nm-platform.c | 6 |
4 files changed, 18 insertions, 12 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index f442f88b6a..f2d87fc587 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -288,17 +288,6 @@ _support_user_ipv6ll_detect (struct nlattr **tb) * Various utilities ******************************************************************/ -const NMIPAddr nm_ip_addr_zero = NMIPAddrInit; - -#define IPV4LL_NETWORK (htonl (0xA9FE0000L)) -#define IPV4LL_NETMASK (htonl (0xFFFF0000L)) - -static gboolean -ip4_address_is_link_local (in_addr_t addr) -{ - return (addr & IPV4LL_NETMASK) == IPV4LL_NETWORK; -} - static guint _nm_ip_config_source_to_rtprot (NMIPConfigSource source) { @@ -5203,7 +5192,7 @@ ip4_address_add (NMPlatform *platform, plen, &peer_addr, 0, - ip4_address_is_link_local (addr) ? RT_SCOPE_LINK : RT_SCOPE_UNIVERSE, + nmp_utils_ip4_address_is_link_local (addr) ? RT_SCOPE_LINK : RT_SCOPE_UNIVERSE, lifetime, preferred, label); diff --git a/src/platform/nm-platform-utils.c b/src/platform/nm-platform-utils.c index 8a1bca18b3..77b722200d 100644 --- a/src/platform/nm-platform-utils.c +++ b/src/platform/nm-platform-utils.c @@ -415,6 +415,15 @@ out: * utils ******************************************************************/ +#define IPV4LL_NETWORK (htonl (0xA9FE0000L)) +#define IPV4LL_NETMASK (htonl (0xFFFF0000L)) + +gboolean +nmp_utils_ip4_address_is_link_local (in_addr_t addr) +{ + return (addr & IPV4LL_NETMASK) == IPV4LL_NETWORK; +} + /** * Takes a pair @timestamp and @duration, and returns the remaining duration based * on the new timestamp @now. diff --git a/src/platform/nm-platform-utils.h b/src/platform/nm-platform-utils.h index 3769a8e193..9265ff242a 100644 --- a/src/platform/nm-platform-utils.h +++ b/src/platform/nm-platform-utils.h @@ -69,4 +69,6 @@ gboolean nmp_utils_lifetime_get (guint32 timestamp, gboolean nmp_utils_device_exists (const char *name); +gboolean nmp_utils_ip4_address_is_link_local (in_addr_t addr); + #endif /* __NM_PLATFORM_UTILS_H__ */ diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index bb52cfb3a6..24492af86e 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -42,6 +42,12 @@ #include "nm-enum-types.h" #include "nm-core-internal.h" +/*****************************************************************************/ + +const NMIPAddr nm_ip_addr_zero = NMIPAddrInit; + +/*****************************************************************************/ + #define ADDRESS_LIFETIME_PADDING 5 G_STATIC_ASSERT (sizeof ( ((NMPlatformLink *) NULL)->addr.data ) == NM_UTILS_HWADDR_LEN_MAX); |