mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-14 20:18:39 +00:00
l3cfg: merge branch 'th/l3cfg-6-acd'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/612
This commit is contained in:
commit
8495e8fcb3
|
@ -2470,7 +2470,9 @@ src_nm_iface_helper_LDADD = \
|
|||
shared/nm-std-aux/libnm-std-aux.la \
|
||||
src/libnm-systemd-core.la \
|
||||
shared/systemd/libnm-systemd-shared.la \
|
||||
shared/libnacd.la \
|
||||
shared/libndhcp4.la \
|
||||
shared/libcrbtree.la \
|
||||
shared/libcsiphash.la \
|
||||
$(GLIB_LIBS) \
|
||||
$(LIBUDEV_LIBS) \
|
||||
|
|
|
@ -4520,6 +4520,22 @@ nm_g_timeout_source_new (guint timeout_msec,
|
|||
return source;
|
||||
}
|
||||
|
||||
GSource *
|
||||
nm_g_timeout_source_new_seconds (guint timeout_sec,
|
||||
int priority,
|
||||
GSourceFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy_notify)
|
||||
{
|
||||
GSource *source;
|
||||
|
||||
source = g_timeout_source_new_seconds (timeout_sec);
|
||||
if (priority != G_PRIORITY_DEFAULT)
|
||||
g_source_set_priority (source, priority);
|
||||
g_source_set_callback (source, func, user_data, destroy_notify);
|
||||
return source;
|
||||
}
|
||||
|
||||
GSource *
|
||||
nm_g_unix_signal_source_new (int signum,
|
||||
int priority,
|
||||
|
|
|
@ -1349,6 +1349,13 @@ GSource *nm_g_timeout_source_new (guint timeout_msec,
|
|||
GSourceFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy_notify);
|
||||
|
||||
GSource *nm_g_timeout_source_new_seconds (guint timeout_sec,
|
||||
int priority,
|
||||
GSourceFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy_notify);
|
||||
|
||||
GSource *nm_g_unix_fd_source_new (int fd,
|
||||
GIOCondition io_condition,
|
||||
int priority,
|
||||
|
@ -1630,6 +1637,12 @@ nm_g_hash_table_lookup (GHashTable *hash, gconstpointer key)
|
|||
return hash ? g_hash_table_lookup (hash, key) : NULL;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
nm_g_hash_table_contains (GHashTable *hash, gconstpointer key)
|
||||
{
|
||||
return hash ? g_hash_table_contains (hash, key) : FALSE;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
nm_g_hash_table_remove (GHashTable *hash, gconstpointer key)
|
||||
{
|
||||
|
@ -1961,6 +1974,31 @@ char *nm_utils_bin2hexstr_full (gconstpointer addr,
|
|||
gboolean upper_case,
|
||||
char *out);
|
||||
|
||||
#define nm_utils_bin2hexstr_a(addr, length, delimiter, upper_case, str_to_free) \
|
||||
({ \
|
||||
gconstpointer _addr = (addr); \
|
||||
gsize _length = (length); \
|
||||
char _delimiter = (delimiter); \
|
||||
char **_str_to_free = (str_to_free); \
|
||||
char *_s; \
|
||||
gsize _s_len; \
|
||||
\
|
||||
nm_assert (_str_to_free); \
|
||||
\
|
||||
_s_len = _length == 0 \
|
||||
? 1u \
|
||||
: ( _delimiter == '\0' \
|
||||
? _length * 2u + 1u \
|
||||
: _length * 3u); \
|
||||
if (_s_len < 100) \
|
||||
_s = g_alloca (_s_len); \
|
||||
else { \
|
||||
_s = g_malloc (_s_len); \
|
||||
*_str_to_free = _s; \
|
||||
} \
|
||||
nm_utils_bin2hexstr_full (_addr, _length, _delimiter, (upper_case), _s); \
|
||||
})
|
||||
|
||||
guint8 *nm_utils_hexstr2bin_full (const char *hexstr,
|
||||
gboolean allow_0x_prefix,
|
||||
gboolean delimiter_required,
|
||||
|
|
|
@ -194,19 +194,16 @@ libnetwork_manager = static_library(
|
|||
link_with: nm_links,
|
||||
)
|
||||
|
||||
deps = [
|
||||
daemon_nm_default_dep,
|
||||
dl_dep,
|
||||
libndp_dep,
|
||||
libudev_dep,
|
||||
]
|
||||
|
||||
name = 'nm-iface-helper'
|
||||
|
||||
executable(
|
||||
name,
|
||||
name + '.c',
|
||||
dependencies: deps,
|
||||
'nm-iface-helper',
|
||||
'nm-iface-helper.c',
|
||||
dependencies: [
|
||||
daemon_nm_default_dep,
|
||||
dl_dep,
|
||||
libndp_dep,
|
||||
libudev_dep,
|
||||
libn_acd_dep,
|
||||
],
|
||||
c_args: daemon_c_flags,
|
||||
link_with: nm_links,
|
||||
link_args: ldflags_linker_script_binary,
|
||||
|
|
1959
src/nm-l3cfg.c
1959
src/nm-l3cfg.c
File diff suppressed because it is too large
Load diff
|
@ -20,10 +20,26 @@
|
|||
|
||||
typedef enum {
|
||||
NM_L3_CONFIG_NOTIFY_TYPE_ROUTES_TEMPORARY_NOT_AVAILABLE_EXPIRED,
|
||||
NM_L3_CONFIG_NOTIFY_TYPE_ACD_FAILED,
|
||||
NM_L3_CONFIG_NOTIFY_TYPE_ACD_COMPLETED,
|
||||
_NM_L3_CONFIG_NOTIFY_TYPE_NUM,
|
||||
} NML3ConfigNotifyType;
|
||||
|
||||
#define NM_L3_CONFIG_NOTIFY_TYPE_ROUTES_TEMPORARY_NOT_AVAILABLE_EXPIRED_DETAIL "routes-temporary-not-available"
|
||||
typedef struct {
|
||||
const NMPObject *obj;
|
||||
const NML3ConfigData *l3cd;
|
||||
gconstpointer tag;
|
||||
} NML3ConfigNotifyPayloadAcdFailedSource;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
in_addr_t addr;
|
||||
guint sources_len;
|
||||
const NML3ConfigNotifyPayloadAcdFailedSource *sources;
|
||||
} acd_failed;
|
||||
};
|
||||
} NML3ConfigNotifyPayload;
|
||||
|
||||
struct _NML3CfgPrivate;
|
||||
|
||||
|
@ -87,6 +103,8 @@ nm_l3cfg_get_platform (const NML3Cfg *self)
|
|||
return self->priv.platform;
|
||||
}
|
||||
|
||||
gboolean nm_l3cfg_get_acd_is_pending (NML3Cfg *self);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef enum {
|
||||
|
@ -117,6 +135,7 @@ void nm_l3cfg_add_config (NML3Cfg *self,
|
|||
int priority,
|
||||
guint32 default_route_penalty_4,
|
||||
guint32 default_route_penalty_6,
|
||||
guint32 acd_timeout_msec,
|
||||
NML3ConfigMergeFlags merge_flags);
|
||||
|
||||
void nm_l3cfg_remove_config (NML3Cfg *self,
|
||||
|
@ -145,6 +164,7 @@ typedef enum {
|
|||
/* This is a full sync. It configures the IP addresses/routes that are indicated,
|
||||
* while removing the existing ones from the interface. */
|
||||
NM_L3_CFG_COMMIT_TYPE_REAPPLY,
|
||||
|
||||
} NML3CfgCommitType;
|
||||
|
||||
gboolean nm_l3cfg_platform_commit (NML3Cfg *self,
|
||||
|
|
|
@ -8149,6 +8149,42 @@ nm_platform_ip_address_cmp_expiry (const NMPlatformIPAddress *a, const NMPlatfor
|
|||
return ta < tb ? -1 : 1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
GHashTable *
|
||||
nm_platform_ip4_address_addr_to_hash (NMPlatform *self,
|
||||
int ifindex)
|
||||
{
|
||||
const NMDedupMultiHeadEntry *head_entry;
|
||||
NMDedupMultiIter iter;
|
||||
const NMPObject *obj;
|
||||
NMPLookup lookup;
|
||||
GHashTable *hash;
|
||||
|
||||
g_return_val_if_fail (NM_IS_PLATFORM (self), NULL);
|
||||
g_return_val_if_fail (ifindex > 0, NULL);
|
||||
|
||||
nmp_lookup_init_object (&lookup, NMP_OBJECT_TYPE_IP4_ADDRESS, ifindex);
|
||||
|
||||
head_entry = nmp_cache_lookup (NM_PLATFORM_GET_PRIVATE (self)->cache,
|
||||
&lookup);
|
||||
|
||||
if (!head_entry)
|
||||
return NULL;
|
||||
|
||||
hash = g_hash_table_new (nm_direct_hash, NULL);
|
||||
|
||||
nmp_cache_iter_for_each (&iter, head_entry, &obj) {
|
||||
const NMPlatformIP4Address *a = NMP_OBJECT_CAST_IP4_ADDRESS (obj);
|
||||
|
||||
g_hash_table_add (hash, GUINT_TO_POINTER (a->address));
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *
|
||||
nm_platform_signal_change_type_to_string (NMPlatformSignalChangeType change_type)
|
||||
{
|
||||
|
|
|
@ -2038,6 +2038,9 @@ int nm_platform_ip6_address_pretty_sort_cmp (const NMPlatformIP6Address *a1,
|
|||
const NMPlatformIP6Address *a2,
|
||||
gboolean prefer_temp);
|
||||
|
||||
GHashTable *nm_platform_ip4_address_addr_to_hash (NMPlatform *self,
|
||||
int ifindex);
|
||||
|
||||
int nm_platform_ip4_route_cmp (const NMPlatformIP4Route *a, const NMPlatformIP4Route *b, NMPlatformIPRouteCmpType cmp_type);
|
||||
int nm_platform_ip6_route_cmp (const NMPlatformIP6Route *a, const NMPlatformIP6Route *b, NMPlatformIPRouteCmpType cmp_type);
|
||||
|
||||
|
|
Loading…
Reference in a new issue