platform: expose nmp_utils_ip4_address_is_link_local() function
This commit is contained in:
@@ -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);
|
||||
|
@@ -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.
|
||||
|
@@ -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__ */
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user