mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 04:58:01 +02:00
code format: run code format script
This commit is contained in:
parent
27ec4a126b
commit
91efd19bfc
36 changed files with 245 additions and 224 deletions
|
|
@ -45,9 +45,11 @@ def show(c, ts=None):
|
||||||
" timeout: %u seconds%s"
|
" timeout: %u seconds%s"
|
||||||
% (
|
% (
|
||||||
rt,
|
rt,
|
||||||
""
|
(
|
||||||
if ts is None
|
""
|
||||||
else (" (circa %s sec left)" % ((cr + (rt * 1000) - ts) / 1000.0)),
|
if ts is None
|
||||||
|
else (" (circa %s sec left)" % ((cr + (rt * 1000) - ts) / 1000.0))
|
||||||
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
print(
|
print(
|
||||||
|
|
|
||||||
|
|
@ -299,13 +299,11 @@ typedef struct {
|
||||||
} Option;
|
} Option;
|
||||||
|
|
||||||
#define OPTION(_name, _sysname, ...) \
|
#define OPTION(_name, _sysname, ...) \
|
||||||
{ \
|
{.name = ""_name \
|
||||||
.name = ""_name \
|
"", \
|
||||||
"", \
|
.sysname = ""_sysname \
|
||||||
.sysname = ""_sysname \
|
"", \
|
||||||
"", \
|
__VA_ARGS__}
|
||||||
__VA_ARGS__ \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define OPTION_TYPE_INT(min, max, def) .nm_min = (min), .nm_max = (max), .nm_default = (def)
|
#define OPTION_TYPE_INT(min, max, def) .nm_min = (min), .nm_max = (max), .nm_default = (def)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,8 @@ nm_device_factory_class_init(NMDeviceFactoryClass *klass)
|
||||||
static GHashTable *factories_by_link = NULL;
|
static GHashTable *factories_by_link = NULL;
|
||||||
static GHashTable *factories_by_setting = NULL;
|
static GHashTable *factories_by_setting = NULL;
|
||||||
|
|
||||||
static void __attribute__((destructor)) _cleanup(void)
|
static void __attribute__((destructor))
|
||||||
|
_cleanup(void)
|
||||||
{
|
{
|
||||||
nm_clear_pointer(&factories_by_link, g_hash_table_unref);
|
nm_clear_pointer(&factories_by_link, g_hash_table_unref);
|
||||||
nm_clear_pointer(&factories_by_setting, g_hash_table_unref);
|
nm_clear_pointer(&factories_by_setting, g_hash_table_unref);
|
||||||
|
|
|
||||||
|
|
@ -15512,7 +15512,7 @@ nm_device_update_firewall_zone(NMDevice *self)
|
||||||
void
|
void
|
||||||
nm_device_update_metered(NMDevice *self)
|
nm_device_update_metered(NMDevice *self)
|
||||||
{
|
{
|
||||||
#define NM_METERED_INVALID ((NMMetered) -1)
|
#define NM_METERED_INVALID ((NMMetered) - 1)
|
||||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
||||||
NMSettingConnection *setting;
|
NMSettingConnection *setting;
|
||||||
NMMetered conn_value, value = NM_METERED_INVALID;
|
NMMetered conn_value, value = NM_METERED_INVALID;
|
||||||
|
|
|
||||||
|
|
@ -719,13 +719,14 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||||
g_value_set_uchar(value, priv->strength);
|
g_value_set_uchar(value, priv->strength);
|
||||||
break;
|
break;
|
||||||
case PROP_LAST_SEEN:
|
case PROP_LAST_SEEN:
|
||||||
g_value_set_int(value,
|
g_value_set_int(
|
||||||
priv->last_seen_msec != G_MININT64 ? (int) NM_MAX(
|
value,
|
||||||
nm_utils_monotonic_timestamp_as_boottime(priv->last_seen_msec,
|
priv->last_seen_msec != G_MININT64
|
||||||
NM_UTILS_NSEC_PER_MSEC)
|
? (int) NM_MAX(nm_utils_monotonic_timestamp_as_boottime(priv->last_seen_msec,
|
||||||
/ 1000,
|
NM_UTILS_NSEC_PER_MSEC)
|
||||||
1)
|
/ 1000,
|
||||||
: -1);
|
1)
|
||||||
|
: -1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||||
|
|
|
||||||
|
|
@ -824,9 +824,10 @@ _nm_dhcp_client_notify(NMDhcpClient *self,
|
||||||
|
|
||||||
_acd_check_lease(self, &acd_state);
|
_acd_check_lease(self, &acd_state);
|
||||||
|
|
||||||
options = priv->l3cd_next ? nm_dhcp_lease_get_options(
|
options = priv->l3cd_next
|
||||||
nm_l3_config_data_get_dhcp_lease(priv->l3cd_next, priv->config.addr_family))
|
? nm_dhcp_lease_get_options(
|
||||||
: NULL;
|
nm_l3_config_data_get_dhcp_lease(priv->l3cd_next, priv->config.addr_family))
|
||||||
|
: NULL;
|
||||||
|
|
||||||
if (_LOGI_ENABLED()) {
|
if (_LOGI_ENABLED()) {
|
||||||
const char *req_str =
|
const char *req_str =
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,11 @@
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define REQ(_num, _name, _include) \
|
#define REQ(_num, _name, _include) \
|
||||||
{ \
|
{ \
|
||||||
.name = NM_DHCP_OPTION_REQPREFIX ""_name, .option_num = _num, .include = _include, \
|
.name = NM_DHCP_OPTION_REQPREFIX ""_name, \
|
||||||
|
.option_num = _num, \
|
||||||
|
.include = _include, \
|
||||||
}
|
}
|
||||||
|
|
||||||
const NMDhcpOption _nm_dhcp_option_dhcp4_options[] = {
|
const NMDhcpOption _nm_dhcp_option_dhcp4_options[] = {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ typedef enum {
|
||||||
|
|
||||||
const char *nm_ndisc_dhcp_level_to_string(NMNDiscDHCPLevel level);
|
const char *nm_ndisc_dhcp_level_to_string(NMNDiscDHCPLevel level);
|
||||||
|
|
||||||
#define NM_NDISC_INFINITY_U32 ((uint32_t) -1)
|
#define NM_NDISC_INFINITY_U32 ((uint32_t) - 1)
|
||||||
|
|
||||||
/* It's important that this is G_MAXINT64, so that we can meaningfully do
|
/* It's important that this is G_MAXINT64, so that we can meaningfully do
|
||||||
* MIN(e1, e2) to find the minimum expiry time (and properly handle if any
|
* MIN(e1, e2) to find the minimum expiry time (and properly handle if any
|
||||||
|
|
|
||||||
|
|
@ -1588,7 +1588,7 @@ dispose(GObject *object)
|
||||||
if (priv->master) {
|
if (priv->master) {
|
||||||
g_signal_handlers_disconnect_by_func(priv->master, G_CALLBACK(master_state_cb), self);
|
g_signal_handlers_disconnect_by_func(priv->master, G_CALLBACK(master_state_cb), self);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->controller_dev) {
|
if (priv->controller_dev) {
|
||||||
g_signal_handlers_disconnect_by_func(priv->controller_dev,
|
g_signal_handlers_disconnect_by_func(priv->controller_dev,
|
||||||
G_CALLBACK(controller_dev_state_cb),
|
G_CALLBACK(controller_dev_state_cb),
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@ nm_connectivity_state_cmp(NMConnectivityState a, NMConnectivityState b)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define NM_CONNECTIVITY_ERROR ((NMConnectivityState) -1)
|
#define NM_CONNECTIVITY_ERROR ((NMConnectivityState) - 1)
|
||||||
#define NM_CONNECTIVITY_FAKE ((NMConnectivityState) -2)
|
#define NM_CONNECTIVITY_FAKE ((NMConnectivityState) - 2)
|
||||||
#define NM_CONNECTIVITY_CANCELLED ((NMConnectivityState) -3)
|
#define NM_CONNECTIVITY_CANCELLED ((NMConnectivityState) - 3)
|
||||||
#define NM_CONNECTIVITY_DISPOSING ((NMConnectivityState) -4)
|
#define NM_CONNECTIVITY_DISPOSING ((NMConnectivityState) - 4)
|
||||||
|
|
||||||
#define NM_TYPE_CONNECTIVITY (nm_connectivity_get_type())
|
#define NM_TYPE_CONNECTIVITY (nm_connectivity_get_type())
|
||||||
#define NM_CONNECTIVITY(obj) \
|
#define NM_CONNECTIVITY(obj) \
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,8 @@ _nm_singleton_instance_weak_cb(gpointer data, GObject *where_the_object_was)
|
||||||
_singletons = g_slist_remove(_singletons, where_the_object_was);
|
_singletons = g_slist_remove(_singletons, where_the_object_was);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((destructor)) _nm_singleton_instance_destroy(void)
|
static void __attribute__((destructor))
|
||||||
|
_nm_singleton_instance_destroy(void)
|
||||||
{
|
{
|
||||||
_singletons_shutdown = TRUE;
|
_singletons_shutdown = TRUE;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ typedef enum {
|
||||||
NM_UTILS_STABLE_TYPE_RANDOM = 3,
|
NM_UTILS_STABLE_TYPE_RANDOM = 3,
|
||||||
} NMUtilsStableType;
|
} NMUtilsStableType;
|
||||||
|
|
||||||
#define NM_UTILS_STABLE_TYPE_NONE ((NMUtilsStableType) -1)
|
#define NM_UTILS_STABLE_TYPE_NONE ((NMUtilsStableType) - 1)
|
||||||
|
|
||||||
NMUtilsStableType nm_utils_stable_id_parse(const char *stable_id,
|
NMUtilsStableType nm_utils_stable_id_parse(const char *stable_id,
|
||||||
const char *deviceid,
|
const char *deviceid,
|
||||||
|
|
|
||||||
|
|
@ -9012,9 +9012,10 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||||
case PROP_CHECKPOINTS:
|
case PROP_CHECKPOINTS:
|
||||||
g_value_take_boxed(
|
g_value_take_boxed(
|
||||||
value,
|
value,
|
||||||
priv->checkpoint_mgr ? nm_strv_make_deep_copied(
|
priv->checkpoint_mgr
|
||||||
nm_checkpoint_manager_get_checkpoint_paths(priv->checkpoint_mgr, NULL))
|
? nm_strv_make_deep_copied(
|
||||||
: NULL);
|
nm_checkpoint_manager_get_checkpoint_paths(priv->checkpoint_mgr, NULL))
|
||||||
|
: NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,6 @@ typedef struct _NMSecretAgent NMSecretAgent;
|
||||||
typedef struct _NMSettings NMSettings;
|
typedef struct _NMSettings NMSettings;
|
||||||
typedef struct _NMSettingsConnection NMSettingsConnection;
|
typedef struct _NMSettingsConnection NMSettingsConnection;
|
||||||
|
|
||||||
#define NM_SETTING_CONNECTION_MDNS_UNKNOWN ((NMSettingConnectionMdns) -42)
|
#define NM_SETTING_CONNECTION_MDNS_UNKNOWN ((NMSettingConnectionMdns) - 42)
|
||||||
|
|
||||||
#endif /* NM_TYPES_H */
|
#endif /* NM_TYPES_H */
|
||||||
|
|
|
||||||
|
|
@ -59,10 +59,8 @@ typedef struct {
|
||||||
|
|
||||||
} IPTunnelModInfo;
|
} IPTunnelModInfo;
|
||||||
|
|
||||||
#define INF(_module_name, _iftype, _ifname, ...) \
|
#define INF(_module_name, _iftype, _ifname, ...) \
|
||||||
{ \
|
{.module_name = ""_module_name, .iftype = _iftype, .ifname = ""_ifname, __VA_ARGS__}
|
||||||
.module_name = ""_module_name, .iftype = _iftype, .ifname = ""_ifname, __VA_ARGS__ \
|
|
||||||
}
|
|
||||||
|
|
||||||
static const IPTunnelModInfo ip_tunnel_mod_infos[] = {
|
static const IPTunnelModInfo ip_tunnel_mod_infos[] = {
|
||||||
INF("ip_gre", NM_LINK_TYPE_GRE, "gre0"),
|
INF("ip_gre", NM_LINK_TYPE_GRE, "gre0"),
|
||||||
|
|
|
||||||
|
|
@ -700,9 +700,10 @@ nms_ifcfg_rh_utils_is_numbered_tag_impl(const char *key,
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define _KEY_TYPE(key, flags) \
|
#define _KEY_TYPE(key, flags) \
|
||||||
{ \
|
{ \
|
||||||
.key_name = "" key "", .key_flags = ((NMS_IFCFG_KEY_TYPE_WELL_KNOWN) | (flags)), \
|
.key_name = "" key "", \
|
||||||
|
.key_flags = ((NMS_IFCFG_KEY_TYPE_WELL_KNOWN) | (flags)), \
|
||||||
}
|
}
|
||||||
|
|
||||||
const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[] = {
|
const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[] = {
|
||||||
|
|
|
||||||
|
|
@ -20,21 +20,30 @@ struct Opt {
|
||||||
|
|
||||||
typedef gboolean (*validate_func)(const struct Opt *, const char *, const guint32);
|
typedef gboolean (*validate_func)(const struct Opt *, const char *, const guint32);
|
||||||
|
|
||||||
#define OPT_INT(_key, _int_low, _int_high) \
|
#define OPT_INT(_key, _int_low, _int_high) \
|
||||||
{ \
|
{ \
|
||||||
.key = _key, .type = NM_SUPPL_OPT_TYPE_INT, .int_high = _int_high, .int_low = _int_low, \
|
.key = _key, \
|
||||||
|
.type = NM_SUPPL_OPT_TYPE_INT, \
|
||||||
|
.int_high = _int_high, \
|
||||||
|
.int_low = _int_low, \
|
||||||
}
|
}
|
||||||
#define OPT_BYTES(_key, _int_high) \
|
#define OPT_BYTES(_key, _int_high) \
|
||||||
{ \
|
{ \
|
||||||
.key = _key, .type = NM_SUPPL_OPT_TYPE_BYTES, .int_high = _int_high, \
|
.key = _key, \
|
||||||
|
.type = NM_SUPPL_OPT_TYPE_BYTES, \
|
||||||
|
.int_high = _int_high, \
|
||||||
}
|
}
|
||||||
#define OPT_UTF8(_key, _int_high) \
|
#define OPT_UTF8(_key, _int_high) \
|
||||||
{ \
|
{ \
|
||||||
.key = _key, .type = NM_SUPPL_OPT_TYPE_UTF8, .int_high = _int_high, \
|
.key = _key, \
|
||||||
|
.type = NM_SUPPL_OPT_TYPE_UTF8, \
|
||||||
|
.int_high = _int_high, \
|
||||||
}
|
}
|
||||||
#define OPT_KEYWORD(_key, _str_allowed) \
|
#define OPT_KEYWORD(_key, _str_allowed) \
|
||||||
{ \
|
{ \
|
||||||
.key = _key, .type = NM_SUPPL_OPT_TYPE_KEYWORD, .str_allowed = _str_allowed, \
|
.key = _key, \
|
||||||
|
.type = NM_SUPPL_OPT_TYPE_KEYWORD, \
|
||||||
|
.str_allowed = _str_allowed, \
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct Opt opt_table[] = {
|
static const struct Opt opt_table[] = {
|
||||||
|
|
|
||||||
|
|
@ -147,8 +147,8 @@ typedef enum {
|
||||||
_NM_ETHTOOL_ID_NUM = (_NM_ETHTOOL_ID_LAST - _NM_ETHTOOL_ID_FIRST + 1),
|
_NM_ETHTOOL_ID_NUM = (_NM_ETHTOOL_ID_LAST - _NM_ETHTOOL_ID_FIRST + 1),
|
||||||
} NMEthtoolID;
|
} NMEthtoolID;
|
||||||
|
|
||||||
#define _NM_ETHTOOL_ID_FEATURE_AS_IDX(ethtool_id) ((ethtool_id) -_NM_ETHTOOL_ID_FEATURE_FIRST)
|
#define _NM_ETHTOOL_ID_FEATURE_AS_IDX(ethtool_id) ((ethtool_id) - _NM_ETHTOOL_ID_FEATURE_FIRST)
|
||||||
#define _NM_ETHTOOL_ID_COALESCE_AS_IDX(ethtool_id) ((ethtool_id) -_NM_ETHTOOL_ID_COALESCE_FIRST)
|
#define _NM_ETHTOOL_ID_COALESCE_AS_IDX(ethtool_id) ((ethtool_id) - _NM_ETHTOOL_ID_COALESCE_FIRST)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NM_ETHTOOL_TYPE_UNKNOWN,
|
NM_ETHTOOL_TYPE_UNKNOWN,
|
||||||
|
|
|
||||||
|
|
@ -194,8 +194,8 @@ nm_conn_wireguard_import(const char *filename, GError **error)
|
||||||
* This code here instead generates a NetworkManager connection profile so that
|
* This code here instead generates a NetworkManager connection profile so that
|
||||||
* NetworkManager will apply a similar configuration when later activating the profile. */
|
* NetworkManager will apply a similar configuration when later activating the profile. */
|
||||||
|
|
||||||
#define _TABLE_AUTO ((gint64) -1)
|
#define _TABLE_AUTO ((gint64) - 1)
|
||||||
#define _TABLE_OFF ((gint64) -2)
|
#define _TABLE_OFF ((gint64) - 2)
|
||||||
|
|
||||||
data_table = _TABLE_AUTO;
|
data_table = _TABLE_AUTO;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -379,11 +379,10 @@ typedef struct {
|
||||||
} NMLDBusMetaProperty;
|
} NMLDBusMetaProperty;
|
||||||
|
|
||||||
#define NML_DBUS_META_PROPERTY_INIT(v_dbus_property_name, v_dbus_type, v_obj_properties_idx, ...) \
|
#define NML_DBUS_META_PROPERTY_INIT(v_dbus_property_name, v_dbus_type, v_obj_properties_idx, ...) \
|
||||||
{ \
|
{.dbus_property_name = "" v_dbus_property_name "", \
|
||||||
.dbus_property_name = "" v_dbus_property_name "", \
|
.dbus_type = NM_G_VARIANT_TYPE("" v_dbus_type ""), \
|
||||||
.dbus_type = NM_G_VARIANT_TYPE("" v_dbus_type ""), \
|
.obj_properties_idx = v_obj_properties_idx, \
|
||||||
.obj_properties_idx = v_obj_properties_idx, ##__VA_ARGS__ \
|
##__VA_ARGS__}
|
||||||
}
|
|
||||||
|
|
||||||
#define _NML_DBUS_META_PROPERTY_INIT_DEFAULT(v_dbus_type, \
|
#define _NML_DBUS_META_PROPERTY_INIT_DEFAULT(v_dbus_type, \
|
||||||
v_exp_type, \
|
v_exp_type, \
|
||||||
|
|
@ -568,10 +567,10 @@ struct _NMLDBusMetaIface {
|
||||||
(sizeof((const NMLDBusMetaProperty[]){__VA_ARGS__}) / sizeof(NMLDBusMetaProperty))
|
(sizeof((const NMLDBusMetaProperty[]){__VA_ARGS__}) / sizeof(NMLDBusMetaProperty))
|
||||||
|
|
||||||
#define NML_DBUS_META_IFACE_INIT(v_dbus_iface_name, v_get_type_fcn, v_interface_prio, ...) \
|
#define NML_DBUS_META_IFACE_INIT(v_dbus_iface_name, v_get_type_fcn, v_interface_prio, ...) \
|
||||||
{ \
|
{.dbus_iface_name = "" v_dbus_iface_name "", \
|
||||||
.dbus_iface_name = "" v_dbus_iface_name "", .get_type_fcn = v_get_type_fcn, \
|
.get_type_fcn = v_get_type_fcn, \
|
||||||
.interface_prio = v_interface_prio, ##__VA_ARGS__ \
|
.interface_prio = v_interface_prio, \
|
||||||
}
|
##__VA_ARGS__}
|
||||||
|
|
||||||
#define NML_DBUS_META_IFACE_INIT_PROP(v_dbus_iface_name, v_get_type_fcn, v_interface_prio, ...) \
|
#define NML_DBUS_META_IFACE_INIT_PROP(v_dbus_iface_name, v_get_type_fcn, v_interface_prio, ...) \
|
||||||
NML_DBUS_META_IFACE_INIT(v_dbus_iface_name, \
|
NML_DBUS_META_IFACE_INIT(v_dbus_iface_name, \
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,11 @@ _test_fixup_string(const TestFixupData *data, guint n_data, char *(*func)(const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define T_DATA(_desc, _expected) \
|
#define T_DATA(_desc, _expected) \
|
||||||
{ \
|
{ \
|
||||||
.desc = _desc, .expected = _expected, .line = __LINE__, \
|
.desc = _desc, \
|
||||||
|
.expected = _expected, \
|
||||||
|
.line = __LINE__, \
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -2397,10 +2399,10 @@ _do_read_vpn_details_impl1(const char *file,
|
||||||
|
|
||||||
g_print(">>>> n_read=%zd; \"%s\"",
|
g_print(">>>> n_read=%zd; \"%s\"",
|
||||||
n_read,
|
n_read,
|
||||||
n_read > 0 ? (
|
n_read > 0 ? (ss = nm_utils_buf_utf8safe_escape_cp(
|
||||||
ss = nm_utils_buf_utf8safe_escape_cp(read_buf,
|
read_buf,
|
||||||
n_read,
|
n_read,
|
||||||
NM_UTILS_STR_UTF8_SAFE_FLAG_ESCAPE_CTRL))
|
NM_UTILS_STR_UTF8_SAFE_FLAG_ESCAPE_CTRL))
|
||||||
: "");
|
: "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1023,7 +1023,7 @@ _test_connection_invalid_find_connections(gpointer element, gpointer needle, gpo
|
||||||
G_STMT_START \
|
G_STMT_START \
|
||||||
{ \
|
{ \
|
||||||
g_assert_cmpint(idx[i], >=, 0); \
|
g_assert_cmpint(idx[i], >=, 0); \
|
||||||
g_assert(path##i &&*path##i); \
|
g_assert(path##i && *path##i); \
|
||||||
g_assert(NM_IS_REMOTE_CONNECTION(connections->pdata[idx[i]])); \
|
g_assert(NM_IS_REMOTE_CONNECTION(connections->pdata[idx[i]])); \
|
||||||
g_assert_cmpstr(nm_connection_get_path(connections->pdata[idx[i]]), ==, path##i); \
|
g_assert_cmpstr(nm_connection_get_path(connections->pdata[idx[i]]), ==, path##i); \
|
||||||
} \
|
} \
|
||||||
|
|
|
||||||
|
|
@ -470,10 +470,7 @@ void _nm_setting_class_commit(NMSettingClass *setting_class,
|
||||||
|
|
||||||
#define NM_SETT_INFO_SETT_DETAIL(...) (&((const NMSettInfoSettDetail){__VA_ARGS__}))
|
#define NM_SETT_INFO_SETT_DETAIL(...) (&((const NMSettInfoSettDetail){__VA_ARGS__}))
|
||||||
|
|
||||||
#define NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(_dbus_type, ...) \
|
#define NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(_dbus_type, ...) {.dbus_type = _dbus_type, __VA_ARGS__}
|
||||||
{ \
|
|
||||||
.dbus_type = _dbus_type, __VA_ARGS__ \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NM_SETT_INFO_PROPERT_TYPE_GPROP_INIT(_dbus_type, ...) \
|
#define NM_SETT_INFO_PROPERT_TYPE_GPROP_INIT(_dbus_type, ...) \
|
||||||
NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(_dbus_type, \
|
NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(_dbus_type, \
|
||||||
|
|
@ -741,7 +738,7 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
|
||||||
!NM_FLAGS_ANY((param_flags), \
|
!NM_FLAGS_ANY((param_flags), \
|
||||||
~(NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_INFERRABLE))); \
|
~(NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_INFERRABLE))); \
|
||||||
G_STATIC_ASSERT((min_value) <= (default_value)); \
|
G_STATIC_ASSERT((min_value) <= (default_value)); \
|
||||||
G_STATIC_ASSERT((default_value) == 0 || (default_value) -1u < (max_value)); \
|
G_STATIC_ASSERT((default_value) == 0 || (default_value) - 1u < (max_value)); \
|
||||||
G_STATIC_ASSERT((max_value) <= G_MAXUINT64); \
|
G_STATIC_ASSERT((max_value) <= G_MAXUINT64); \
|
||||||
\
|
\
|
||||||
_param_spec = g_param_spec_uint64("" prop_name "", \
|
_param_spec = g_param_spec_uint64("" prop_name "", \
|
||||||
|
|
|
||||||
|
|
@ -172,17 +172,17 @@ static const TeamAttrData team_attr_datas[] = {
|
||||||
|
|
||||||
#define _VAL_INT32_RANGE(_default, _min, _max) \
|
#define _VAL_INT32_RANGE(_default, _min, _max) \
|
||||||
_VAL_INT32(_default), .has_range = TRUE, \
|
_VAL_INT32(_default), .has_range = TRUE, \
|
||||||
.range.r_int32 = { \
|
.range.r_int32 = { \
|
||||||
.min = _min, \
|
.min = _min, \
|
||||||
.max = _max, \
|
.max = _max, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _VAL_STRING() .default_val.v_string = NULL
|
#define _VAL_STRING() .default_val.v_string = NULL
|
||||||
|
|
||||||
#define _VAL_STRING_RANGE(_valid_names) \
|
#define _VAL_STRING_RANGE(_valid_names) \
|
||||||
_VAL_STRING(), .has_range = TRUE, \
|
_VAL_STRING(), .has_range = TRUE, \
|
||||||
.range.r_string = { \
|
.range.r_string = { \
|
||||||
.valid_names = (_valid_names), \
|
.valid_names = (_valid_names), \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _VAL_UNSPEC() .default_val.v_string = (NULL)
|
#define _VAL_UNSPEC() .default_val.v_string = (NULL)
|
||||||
|
|
@ -1957,23 +1957,23 @@ _js_parse_locate_keys(const NMJsonVt *vt,
|
||||||
|
|
||||||
nm_assert(vt);
|
nm_assert(vt);
|
||||||
|
|
||||||
#define _handle(_self, _cur_key, _cur_val, _keys, _level, _found_keys, _out_unrecognized_content) \
|
#define _handle(_self, _cur_key, _cur_val, _keys, _level, _found_keys, _out_unrecognized_content) \
|
||||||
({ \
|
({ \
|
||||||
const TeamAttrData *_attr_data; \
|
const TeamAttrData *_attr_data; \
|
||||||
gboolean _handled = FALSE; \
|
gboolean _handled = FALSE; \
|
||||||
\
|
\
|
||||||
(_keys)[(_level) -1] = (_cur_key); \
|
(_keys)[(_level) - 1] = (_cur_key); \
|
||||||
_attr_data = _attr_data_find_by_json_key((_self)->d.is_port, (_keys), (_level)); \
|
_attr_data = _attr_data_find_by_json_key((_self)->d.is_port, (_keys), (_level)); \
|
||||||
if (_attr_data && _attr_data->js_keys_len == (_level)) { \
|
if (_attr_data && _attr_data->js_keys_len == (_level)) { \
|
||||||
if ((_found_keys)[_attr_data->team_attr]) \
|
if ((_found_keys)[_attr_data->team_attr]) \
|
||||||
*(_out_unrecognized_content) = TRUE; \
|
*(_out_unrecognized_content) = TRUE; \
|
||||||
(_found_keys)[_attr_data->team_attr] = (_cur_val); \
|
(_found_keys)[_attr_data->team_attr] = (_cur_val); \
|
||||||
_handled = TRUE; \
|
_handled = TRUE; \
|
||||||
} else if (!_attr_data || !nm_json_is_object((_cur_val))) { \
|
} else if (!_attr_data || !nm_json_is_object((_cur_val))) { \
|
||||||
*(_out_unrecognized_content) = TRUE; \
|
*(_out_unrecognized_content) = TRUE; \
|
||||||
_handled = TRUE; \
|
_handled = TRUE; \
|
||||||
} \
|
} \
|
||||||
_handled; \
|
_handled; \
|
||||||
})
|
})
|
||||||
|
|
||||||
nm_json_object_foreach (vt, root_js_obj, cur_key1, cur_val1) {
|
nm_json_object_foreach (vt, root_js_obj, cur_key1, cur_val1) {
|
||||||
|
|
|
||||||
|
|
@ -329,9 +329,10 @@ good:
|
||||||
|
|
||||||
typedef const char *const StrvArray4Type[4];
|
typedef const char *const StrvArray4Type[4];
|
||||||
|
|
||||||
#define LL(l, ...) \
|
#define LL(l, ...) \
|
||||||
{ \
|
{ \
|
||||||
.name = l, .value = {__VA_ARGS__, NULL}, \
|
.name = l, \
|
||||||
|
.value = {__VA_ARGS__, NULL}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 5-letter language codes */
|
/* 5-letter language codes */
|
||||||
|
|
@ -506,7 +507,8 @@ nmtst_system_encodings_get(void)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void __attribute__((constructor)) _nm_utils_init(void)
|
static void __attribute__((constructor))
|
||||||
|
_nm_utils_init(void)
|
||||||
{
|
{
|
||||||
static int initialized = 0;
|
static int initialized = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,11 @@
|
||||||
|
|
||||||
static const NMCryptoCipherInfo cipher_infos[] = {
|
static const NMCryptoCipherInfo cipher_infos[] = {
|
||||||
#define _CI(_cipher, _name, _digest_len, _real_iv_len) \
|
#define _CI(_cipher, _name, _digest_len, _real_iv_len) \
|
||||||
[(_cipher) -1] = {.cipher = _cipher, \
|
[(_cipher) - 1] = {.cipher = _cipher, \
|
||||||
.name = ""_name \
|
.name = ""_name \
|
||||||
"", \
|
"", \
|
||||||
.digest_len = _digest_len, \
|
.digest_len = _digest_len, \
|
||||||
.real_iv_len = _real_iv_len}
|
.real_iv_len = _real_iv_len}
|
||||||
_CI(NM_CRYPTO_CIPHER_DES_EDE3_CBC, "DES-EDE3-CBC", 24, 8),
|
_CI(NM_CRYPTO_CIPHER_DES_EDE3_CBC, "DES-EDE3-CBC", 24, 8),
|
||||||
_CI(NM_CRYPTO_CIPHER_DES_CBC, "DES-CBC", 8, 8),
|
_CI(NM_CRYPTO_CIPHER_DES_CBC, "DES-CBC", 8, 8),
|
||||||
_CI(NM_CRYPTO_CIPHER_AES_128_CBC, "AES-128-CBC", 16, 16),
|
_CI(NM_CRYPTO_CIPHER_AES_128_CBC, "AES-128-CBC", 16, 16),
|
||||||
|
|
|
||||||
|
|
@ -964,8 +964,8 @@ nm_g_variant_equal(GVariant *a, GVariant *b)
|
||||||
|
|
||||||
/* check if @flags has exactly one flag (@check) set. You should call this
|
/* check if @flags has exactly one flag (@check) set. You should call this
|
||||||
* only with @check being a compile time constant and a power of two. */
|
* only with @check being a compile time constant and a power of two. */
|
||||||
#define NM_FLAGS_HAS(flags, check) \
|
#define NM_FLAGS_HAS(flags, check) \
|
||||||
(G_STATIC_ASSERT_EXPR((check) > 0 && ((check) & ((check) -1)) == 0), \
|
(G_STATIC_ASSERT_EXPR((check) > 0 && ((check) & ((check) - 1)) == 0), \
|
||||||
NM_FLAGS_ANY((flags), (check)))
|
NM_FLAGS_ANY((flags), (check)))
|
||||||
|
|
||||||
#define NM_FLAGS_ANY(flags, check) (((flags) & (check)) != 0)
|
#define NM_FLAGS_ANY(flags, check) (((flags) & (check)) != 0)
|
||||||
|
|
@ -1695,7 +1695,7 @@ nm_decode_version(guint version, guint *major, guint *minor, guint *micro)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define NM_PID_T_INVAL ((pid_t) -1)
|
#define NM_PID_T_INVAL ((pid_t) - 1)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,12 @@ typedef struct {
|
||||||
} _priv;
|
} _priv;
|
||||||
} NMPrioq;
|
} NMPrioq;
|
||||||
|
|
||||||
#define NM_PRIOQ_ZERO \
|
#define NM_PRIOQ_ZERO \
|
||||||
{ \
|
{ \
|
||||||
._priv = { \
|
._priv = \
|
||||||
.compare_func = NULL, \
|
{ \
|
||||||
}, \
|
.compare_func = NULL, \
|
||||||
|
}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
void nm_prioq_init(NMPrioq *q, GCompareFunc compare_func);
|
void nm_prioq_init(NMPrioq *q, GCompareFunc compare_func);
|
||||||
|
|
|
||||||
|
|
@ -198,14 +198,15 @@ typedef struct {
|
||||||
|
|
||||||
#define _NM_ETHER_ADDR_INIT(a0, a1, a2, a3, a4, a5) \
|
#define _NM_ETHER_ADDR_INIT(a0, a1, a2, a3, a4, a5) \
|
||||||
{ \
|
{ \
|
||||||
.ether_addr_octet = { \
|
.ether_addr_octet = \
|
||||||
(a0), \
|
{ \
|
||||||
(a1), \
|
(a0), \
|
||||||
(a2), \
|
(a1), \
|
||||||
(a3), \
|
(a2), \
|
||||||
(a4), \
|
(a3), \
|
||||||
(a5), \
|
(a4), \
|
||||||
}, \
|
(a5), \
|
||||||
|
}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NM_ETHER_ADDR_INIT(...) ((NMEtherAddr) _NM_ETHER_ADDR_INIT(__VA_ARGS__))
|
#define NM_ETHER_ADDR_INIT(...) ((NMEtherAddr) _NM_ETHER_ADDR_INIT(__VA_ARGS__))
|
||||||
|
|
@ -806,7 +807,8 @@ typedef struct {
|
||||||
|
|
||||||
#define NM_UTILS_FLAGS2STR(f, n) \
|
#define NM_UTILS_FLAGS2STR(f, n) \
|
||||||
{ \
|
{ \
|
||||||
.flag = f, .name = "" n, \
|
.flag = f, \
|
||||||
|
.name = "" n, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NM_UTILS_FLAGS2STR_DEFINE(fcn_name, flags_type, ...) \
|
#define NM_UTILS_FLAGS2STR_DEFINE(fcn_name, flags_type, ...) \
|
||||||
|
|
@ -1749,10 +1751,7 @@ typedef struct {
|
||||||
};
|
};
|
||||||
} NMUtilsNamedValue;
|
} NMUtilsNamedValue;
|
||||||
|
|
||||||
#define NM_UTILS_NAMED_VALUE_INIT(n, v) \
|
#define NM_UTILS_NAMED_VALUE_INIT(n, v) {.name = (n), .value_ptr = (v)}
|
||||||
{ \
|
|
||||||
.name = (n), .value_ptr = (v) \
|
|
||||||
}
|
|
||||||
|
|
||||||
NMUtilsNamedValue *nm_utils_hash_to_array_full(GHashTable *hash,
|
NMUtilsNamedValue *nm_utils_hash_to_array_full(GHashTable *hash,
|
||||||
guint *out_len,
|
guint *out_len,
|
||||||
|
|
@ -2444,10 +2443,7 @@ int nm_utils_fd_read_loop_exact(int fd, void *buf, size_t nbytes, bool do_po
|
||||||
__VA_ARGS__ NULL, \
|
__VA_ARGS__ NULL, \
|
||||||
}))
|
}))
|
||||||
|
|
||||||
#define NM_DEFINE_GDBUS_SIGNAL_INFO_INIT(name_, ...) \
|
#define NM_DEFINE_GDBUS_SIGNAL_INFO_INIT(name_, ...) {.ref_count = -1, .name = name_, __VA_ARGS__}
|
||||||
{ \
|
|
||||||
.ref_count = -1, .name = name_, __VA_ARGS__ \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NM_DEFINE_GDBUS_SIGNAL_INFO(name_, ...) \
|
#define NM_DEFINE_GDBUS_SIGNAL_INFO(name_, ...) \
|
||||||
((GDBusSignalInfo *) (&( \
|
((GDBusSignalInfo *) (&( \
|
||||||
|
|
@ -2458,10 +2454,7 @@ int nm_utils_fd_read_loop_exact(int fd, void *buf, size_t nbytes, bool do_po
|
||||||
__VA_ARGS__ NULL, \
|
__VA_ARGS__ NULL, \
|
||||||
}))
|
}))
|
||||||
|
|
||||||
#define NM_DEFINE_GDBUS_METHOD_INFO_INIT(name_, ...) \
|
#define NM_DEFINE_GDBUS_METHOD_INFO_INIT(name_, ...) {.ref_count = -1, .name = name_, __VA_ARGS__}
|
||||||
{ \
|
|
||||||
.ref_count = -1, .name = name_, __VA_ARGS__ \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NM_DEFINE_GDBUS_METHOD_INFO(name_, ...) \
|
#define NM_DEFINE_GDBUS_METHOD_INFO(name_, ...) \
|
||||||
((GDBusMethodInfo *) (&( \
|
((GDBusMethodInfo *) (&( \
|
||||||
|
|
@ -2473,9 +2466,7 @@ int nm_utils_fd_read_loop_exact(int fd, void *buf, size_t nbytes, bool do_po
|
||||||
}))
|
}))
|
||||||
|
|
||||||
#define NM_DEFINE_GDBUS_INTERFACE_INFO_INIT(name_, ...) \
|
#define NM_DEFINE_GDBUS_INTERFACE_INFO_INIT(name_, ...) \
|
||||||
{ \
|
{.ref_count = -1, .name = name_, __VA_ARGS__}
|
||||||
.ref_count = -1, .name = name_, __VA_ARGS__ \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NM_DEFINE_GDBUS_INTERFACE_INFO(name_, ...) \
|
#define NM_DEFINE_GDBUS_INTERFACE_INFO(name_, ...) \
|
||||||
((GDBusInterfaceInfo *) (&( \
|
((GDBusInterfaceInfo *) (&( \
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,10 @@ typedef struct {
|
||||||
char ifname[IFNAMSIZ];
|
char ifname[IFNAMSIZ];
|
||||||
} SocketHandle;
|
} SocketHandle;
|
||||||
|
|
||||||
#define SOCKET_HANDLE_INIT(_ifindex) \
|
#define SOCKET_HANDLE_INIT(_ifindex) \
|
||||||
{ \
|
{ \
|
||||||
.fd = -1, .ifindex = (_ifindex), \
|
.fd = -1, \
|
||||||
|
.ifindex = (_ifindex), \
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -430,10 +431,11 @@ ethtool_get_stringset_index(SocketHandle *shandle, int stringset_id, const char
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static const NMEthtoolFeatureInfo _ethtool_feature_infos[_NM_ETHTOOL_ID_FEATURE_NUM] = {
|
static const NMEthtoolFeatureInfo _ethtool_feature_infos[_NM_ETHTOOL_ID_FEATURE_NUM] = {
|
||||||
#define ETHT_FEAT(eid, ...) \
|
#define ETHT_FEAT(eid, ...) \
|
||||||
{ \
|
{ \
|
||||||
.ethtool_id = eid, .n_kernel_names = NM_NARG(__VA_ARGS__), \
|
.ethtool_id = eid, \
|
||||||
.kernel_names = ((const char *const[]){__VA_ARGS__}), \
|
.n_kernel_names = NM_NARG(__VA_ARGS__), \
|
||||||
|
.kernel_names = ((const char *const[]){__VA_ARGS__}), \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the order does only matter for one thing: if it happens that more than one NMEthtoolID
|
/* the order does only matter for one thing: if it happens that more than one NMEthtoolID
|
||||||
|
|
|
||||||
|
|
@ -6147,9 +6147,9 @@ nm_platform_link_to_string(const NMPlatformLink *link, char *buf, gsize len)
|
||||||
link->initialized ? " init" : " not-init",
|
link->initialized ? " init" : " not-init",
|
||||||
link->inet6_addr_gen_mode_inv ? " addrgenmode " : "",
|
link->inet6_addr_gen_mode_inv ? " addrgenmode " : "",
|
||||||
link->inet6_addr_gen_mode_inv ? nm_platform_link_inet6_addrgenmode2str(
|
link->inet6_addr_gen_mode_inv ? nm_platform_link_inet6_addrgenmode2str(
|
||||||
_nm_platform_uint8_inv(link->inet6_addr_gen_mode_inv),
|
_nm_platform_uint8_inv(link->inet6_addr_gen_mode_inv),
|
||||||
str_addrmode,
|
str_addrmode,
|
||||||
sizeof(str_addrmode))
|
sizeof(str_addrmode))
|
||||||
: "",
|
: "",
|
||||||
str_address[0] ? " addr " : "",
|
str_address[0] ? " addr " : "",
|
||||||
str_address[0] ? str_address : "",
|
str_address[0] ? str_address : "",
|
||||||
|
|
@ -7385,11 +7385,12 @@ nm_platform_ip6_route_to_string(const NMPlatformIP6Route *route, char *buf, gsiz
|
||||||
route->lock_mtu ? "lock " : "",
|
route->lock_mtu ? "lock " : "",
|
||||||
route->mtu)
|
route->mtu)
|
||||||
: "",
|
: "",
|
||||||
route->rt_pref ? nm_sprintf_buf(
|
route->rt_pref
|
||||||
str_pref,
|
? nm_sprintf_buf(
|
||||||
" pref %s",
|
str_pref,
|
||||||
nm_icmpv6_router_pref_to_string(route->rt_pref, str_pref2, sizeof(str_pref2)))
|
" pref %s",
|
||||||
: "");
|
nm_icmpv6_router_pref_to_string(route->rt_pref, str_pref2, sizeof(str_pref2)))
|
||||||
|
: "");
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2002,7 +2002,8 @@ _vt_dedup_obj_clone(const NMDedupMultiObj *obj)
|
||||||
|
|
||||||
#define DEDUP_MULTI_OBJ_CLASS_INIT() \
|
#define DEDUP_MULTI_OBJ_CLASS_INIT() \
|
||||||
{ \
|
{ \
|
||||||
.obj_clone = _vt_dedup_obj_clone, .obj_destroy = _vt_dedup_obj_destroy, \
|
.obj_clone = _vt_dedup_obj_clone, \
|
||||||
|
.obj_destroy = _vt_dedup_obj_destroy, \
|
||||||
.obj_full_hash_update = \
|
.obj_full_hash_update = \
|
||||||
(void (*)(const NMDedupMultiObj *obj, NMHashState *h)) nmp_object_hash_update, \
|
(void (*)(const NMDedupMultiObj *obj, NMHashState *h)) nmp_object_hash_update, \
|
||||||
.obj_full_equal = (gboolean(*)(const NMDedupMultiObj *obj_a, \
|
.obj_full_equal = (gboolean(*)(const NMDedupMultiObj *obj_a, \
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,12 @@ G_STATIC_ASSERT(sizeof(NMSockAddrUnion) == sizeof(((NMSockAddrUnion *) NULL)->in
|
||||||
|
|
||||||
/* we initialize the largest union member, to ensure that all fields are initialized. */
|
/* we initialize the largest union member, to ensure that all fields are initialized. */
|
||||||
|
|
||||||
#define NM_SOCK_ADDR_UNION_INIT_UNSPEC \
|
#define NM_SOCK_ADDR_UNION_INIT_UNSPEC \
|
||||||
{ \
|
{ \
|
||||||
.in6 = { \
|
.in6 = \
|
||||||
.sin6_family = AF_UNSPEC, \
|
{ \
|
||||||
}, \
|
.sin6_family = AF_UNSPEC, \
|
||||||
|
}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
int nm_sock_addr_union_cmp(const NMSockAddrUnion *a, const NMSockAddrUnion *b);
|
int nm_sock_addr_union_cmp(const NMSockAddrUnion *a, const NMSockAddrUnion *b);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
#include <linux/const.h>
|
#include <linux/const.h>
|
||||||
|
|
||||||
#ifndef __KERNEL_DIV_ROUND_UP
|
#ifndef __KERNEL_DIV_ROUND_UP
|
||||||
#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) -1) / (d))
|
#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "linux-headers/ethtool.h"
|
#include "linux-headers/ethtool.h"
|
||||||
|
|
|
||||||
|
|
@ -35,49 +35,50 @@
|
||||||
#define NMCLI_VERSION VERSION
|
#define NMCLI_VERSION VERSION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _NMC_COLOR_PALETTE_INIT() \
|
#define _NMC_COLOR_PALETTE_INIT() \
|
||||||
{ \
|
{ \
|
||||||
.ansi_seq = { \
|
.ansi_seq = \
|
||||||
[NM_META_COLOR_CONNECTION_ACTIVATED] = "32", \
|
{ \
|
||||||
[NM_META_COLOR_CONNECTION_ACTIVATING] = "33", \
|
[NM_META_COLOR_CONNECTION_ACTIVATED] = "32", \
|
||||||
[NM_META_COLOR_CONNECTION_DISCONNECTING] = "31", \
|
[NM_META_COLOR_CONNECTION_ACTIVATING] = "33", \
|
||||||
[NM_META_COLOR_CONNECTION_INVISIBLE] = "2", \
|
[NM_META_COLOR_CONNECTION_DISCONNECTING] = "31", \
|
||||||
[NM_META_COLOR_CONNECTION_EXTERNAL] = "32;2", \
|
[NM_META_COLOR_CONNECTION_INVISIBLE] = "2", \
|
||||||
[NM_META_COLOR_CONNECTION_DEPRECATED] = "2", \
|
[NM_META_COLOR_CONNECTION_EXTERNAL] = "32;2", \
|
||||||
[NM_META_COLOR_CONNECTIVITY_FULL] = "32", \
|
[NM_META_COLOR_CONNECTION_DEPRECATED] = "2", \
|
||||||
[NM_META_COLOR_CONNECTIVITY_LIMITED] = "33", \
|
[NM_META_COLOR_CONNECTIVITY_FULL] = "32", \
|
||||||
[NM_META_COLOR_CONNECTIVITY_NONE] = "31", \
|
[NM_META_COLOR_CONNECTIVITY_LIMITED] = "33", \
|
||||||
[NM_META_COLOR_CONNECTIVITY_PORTAL] = "33", \
|
[NM_META_COLOR_CONNECTIVITY_NONE] = "31", \
|
||||||
[NM_META_COLOR_DEVICE_ACTIVATED] = "32", \
|
[NM_META_COLOR_CONNECTIVITY_PORTAL] = "33", \
|
||||||
[NM_META_COLOR_DEVICE_ACTIVATING] = "33", \
|
[NM_META_COLOR_DEVICE_ACTIVATED] = "32", \
|
||||||
[NM_META_COLOR_DEVICE_DISCONNECTED] = "31", \
|
[NM_META_COLOR_DEVICE_ACTIVATING] = "33", \
|
||||||
[NM_META_COLOR_DEVICE_FIRMWARE_MISSING] = "31", \
|
[NM_META_COLOR_DEVICE_DISCONNECTED] = "31", \
|
||||||
[NM_META_COLOR_DEVICE_PLUGIN_MISSING] = "31", \
|
[NM_META_COLOR_DEVICE_FIRMWARE_MISSING] = "31", \
|
||||||
[NM_META_COLOR_DEVICE_UNAVAILABLE] = "2", \
|
[NM_META_COLOR_DEVICE_PLUGIN_MISSING] = "31", \
|
||||||
[NM_META_COLOR_DEVICE_DISABLED] = "31", \
|
[NM_META_COLOR_DEVICE_UNAVAILABLE] = "2", \
|
||||||
[NM_META_COLOR_DEVICE_EXTERNAL] = "32;2", \
|
[NM_META_COLOR_DEVICE_DISABLED] = "31", \
|
||||||
[NM_META_COLOR_MANAGER_RUNNING] = "32", \
|
[NM_META_COLOR_DEVICE_EXTERNAL] = "32;2", \
|
||||||
[NM_META_COLOR_MANAGER_STARTING] = "33", \
|
[NM_META_COLOR_MANAGER_RUNNING] = "32", \
|
||||||
[NM_META_COLOR_MANAGER_STOPPED] = "31", \
|
[NM_META_COLOR_MANAGER_STARTING] = "33", \
|
||||||
[NM_META_COLOR_PERMISSION_AUTH] = "33", \
|
[NM_META_COLOR_MANAGER_STOPPED] = "31", \
|
||||||
[NM_META_COLOR_PERMISSION_NO] = "31", \
|
[NM_META_COLOR_PERMISSION_AUTH] = "33", \
|
||||||
[NM_META_COLOR_PERMISSION_YES] = "32", \
|
[NM_META_COLOR_PERMISSION_NO] = "31", \
|
||||||
[NM_META_COLOR_STATE_ASLEEP] = "31", \
|
[NM_META_COLOR_PERMISSION_YES] = "32", \
|
||||||
[NM_META_COLOR_STATE_CONNECTED_GLOBAL] = "32", \
|
[NM_META_COLOR_STATE_ASLEEP] = "31", \
|
||||||
[NM_META_COLOR_STATE_CONNECTED_LOCAL] = "32", \
|
[NM_META_COLOR_STATE_CONNECTED_GLOBAL] = "32", \
|
||||||
[NM_META_COLOR_STATE_CONNECTED_SITE] = "32", \
|
[NM_META_COLOR_STATE_CONNECTED_LOCAL] = "32", \
|
||||||
[NM_META_COLOR_STATE_CONNECTING] = "33", \
|
[NM_META_COLOR_STATE_CONNECTED_SITE] = "32", \
|
||||||
[NM_META_COLOR_STATE_DISCONNECTED] = "31", \
|
[NM_META_COLOR_STATE_CONNECTING] = "33", \
|
||||||
[NM_META_COLOR_STATE_DISCONNECTING] = "33", \
|
[NM_META_COLOR_STATE_DISCONNECTED] = "31", \
|
||||||
[NM_META_COLOR_WIFI_SIGNAL_EXCELLENT] = "32", \
|
[NM_META_COLOR_STATE_DISCONNECTING] = "33", \
|
||||||
[NM_META_COLOR_WIFI_SIGNAL_FAIR] = "35", \
|
[NM_META_COLOR_WIFI_SIGNAL_EXCELLENT] = "32", \
|
||||||
[NM_META_COLOR_WIFI_SIGNAL_GOOD] = "33", \
|
[NM_META_COLOR_WIFI_SIGNAL_FAIR] = "35", \
|
||||||
[NM_META_COLOR_WIFI_SIGNAL_POOR] = "36", \
|
[NM_META_COLOR_WIFI_SIGNAL_GOOD] = "33", \
|
||||||
[NM_META_COLOR_WIFI_SIGNAL_UNKNOWN] = "2", \
|
[NM_META_COLOR_WIFI_SIGNAL_POOR] = "36", \
|
||||||
[NM_META_COLOR_WIFI_DEPRECATED] = "2", \
|
[NM_META_COLOR_WIFI_SIGNAL_UNKNOWN] = "2", \
|
||||||
[NM_META_COLOR_ENABLED] = "32", \
|
[NM_META_COLOR_WIFI_DEPRECATED] = "2", \
|
||||||
[NM_META_COLOR_DISABLED] = "31", \
|
[NM_META_COLOR_ENABLED] = "32", \
|
||||||
}, \
|
[NM_META_COLOR_DISABLED] = "31", \
|
||||||
|
}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
static NmCli nm_cli = {
|
static NmCli nm_cli = {
|
||||||
|
|
|
||||||
|
|
@ -2329,12 +2329,16 @@ class IP4Config(ExportedObj):
|
||||||
a = {
|
a = {
|
||||||
"dest": Util.random_ip(seed, net="192.168.0.0/16")[0],
|
"dest": Util.random_ip(seed, net="192.168.0.0/16")[0],
|
||||||
"prefix": Util.random_int(seed, 17, 32),
|
"prefix": Util.random_int(seed, 17, 32),
|
||||||
"next-hop": None
|
"next-hop": (
|
||||||
if (Util.random_int(seed) % 3 == 0)
|
None
|
||||||
else Util.random_ip(seed, net="192.168.0.0/16")[0],
|
if (Util.random_int(seed) % 3 == 0)
|
||||||
"metric": -1
|
else Util.random_ip(seed, net="192.168.0.0/16")[0]
|
||||||
if (Util.random_int(seed) % 3 == 0)
|
),
|
||||||
else Util.random_int(seed, 0, 0xFFFFFFFF),
|
"metric": (
|
||||||
|
-1
|
||||||
|
if (Util.random_int(seed) % 3 == 0)
|
||||||
|
else Util.random_int(seed, 0, 0xFFFFFFFF)
|
||||||
|
),
|
||||||
}
|
}
|
||||||
routes.append(a)
|
routes.append(a)
|
||||||
|
|
||||||
|
|
@ -2527,12 +2531,16 @@ class IP6Config(ExportedObj):
|
||||||
a = {
|
a = {
|
||||||
"dest": Util.random_ip(seed, net="2001:a::/64")[0],
|
"dest": Util.random_ip(seed, net="2001:a::/64")[0],
|
||||||
"prefix": Util.random_int(seed, 65, 128),
|
"prefix": Util.random_int(seed, 65, 128),
|
||||||
"next-hop": None
|
"next-hop": (
|
||||||
if (Util.random_int(seed) % 3 == 0)
|
None
|
||||||
else Util.random_ip(seed, net="2001:a::/64")[0],
|
if (Util.random_int(seed) % 3 == 0)
|
||||||
"metric": -1
|
else Util.random_ip(seed, net="2001:a::/64")[0]
|
||||||
if (Util.random_int(seed) % 3 == 0)
|
),
|
||||||
else Util.random_int(seed, 0, 0xFFFFFFFF),
|
"metric": (
|
||||||
|
-1
|
||||||
|
if (Util.random_int(seed) % 3 == 0)
|
||||||
|
else Util.random_int(seed, 0, 0xFFFFFFFF)
|
||||||
|
),
|
||||||
}
|
}
|
||||||
routes.append(a)
|
routes.append(a)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue