libnm: refactor some NMSetting to use direct properties for uint32

This commit is contained in:
Thomas Haller 2021-12-28 10:50:05 +01:00
parent 208df83491
commit 20d6793065
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
15 changed files with 486 additions and 661 deletions

View file

@ -516,9 +516,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_SIM_OPERATOR_ID:
g_value_set_string(value, nm_setting_gsm_get_sim_operator_id(setting));
break;
case PROP_MTU:
g_value_set_uint(value, nm_setting_gsm_get_mtu(setting));
break;
default:
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
break;
@ -573,9 +570,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
g_free(priv->sim_operator_id);
priv->sim_operator_id = g_value_dup_string(value);
break;
case PROP_MTU:
priv->mtu = g_value_get_uint(value);
break;
default:
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
break;
@ -840,14 +834,16 @@ nm_setting_gsm_class_init(NMSettingGsmClass *klass)
*
* Since: 1.8
**/
obj_properties[PROP_MTU] = g_param_spec_uint(NM_SETTING_GSM_MTU,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE
| G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_GSM_MTU,
PROP_MTU,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_FUZZY_IGNORE,
NMSettingGsmPrivate,
mtu);
/* Ignore incoming deprecated properties */
_nm_properties_override_dbus(properties_override,

View file

@ -313,9 +313,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_MAC_ADDRESS:
g_value_set_string(value, nm_setting_infiniband_get_mac_address(setting));
break;
case PROP_MTU:
g_value_set_uint(value, nm_setting_infiniband_get_mtu(setting));
break;
case PROP_TRANSPORT_MODE:
g_value_set_string(value, nm_setting_infiniband_get_transport_mode(setting));
break;
@ -339,9 +336,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
priv->mac_address =
_nm_utils_hwaddr_canonical_or_invalid(g_value_get_string(value), INFINIBAND_ALEN);
break;
case PROP_MTU:
priv->mtu = g_value_get_uint(value);
break;
case PROP_TRANSPORT_MODE:
g_free(priv->transport_mode);
priv->transport_mode = g_value_dup_string(value);
@ -452,14 +446,16 @@ nm_setting_infiniband_class_init(NMSettingInfinibandClass *klass)
* description: MTU of the interface.
* ---end---
*/
obj_properties[PROP_MTU] = g_param_spec_uint(NM_SETTING_INFINIBAND_MTU,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE
| G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_INFINIBAND_MTU,
PROP_MTU,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_FUZZY_IGNORE,
NMSettingInfinibandPrivate,
mtu);
/**
* NMSettingInfiniband:transport-mode:

View file

@ -5555,9 +5555,10 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
if (!_nm_utils_validate_dhcp_hostname_flags(priv->dhcp_hostname_flags,
NM_SETTING_IP_CONFIG_GET_FAMILY(setting),
error)) {
if (priv->dhcp_hostname_flags != (NMDhcpHostnameFlags) priv->dhcp_hostname_flags
|| !_nm_utils_validate_dhcp_hostname_flags(priv->dhcp_hostname_flags,
NM_SETTING_IP_CONFIG_GET_FAMILY(setting),
error)) {
g_prefix_error(error,
"%s.%s: ",
nm_setting_get_name(setting),
@ -5825,6 +5826,13 @@ _nm_sett_info_property_override_create_array_ip_config(int addr_family)
.direct_offset =
NM_STRUCT_OFFSET_ENSURE_TYPE(bool, NMSettingIPConfigPrivate, ignore_auto_routes));
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_ROUTE_TABLE],
&nm_sett_info_propert_type_direct_uint32,
.direct_offset =
NM_STRUCT_OFFSET_ENSURE_TYPE(guint32, NMSettingIPConfigPrivate, route_table));
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_IGNORE_AUTO_DNS],
@ -5867,6 +5875,13 @@ _nm_sett_info_property_override_create_array_ip_config(int addr_family)
.direct_offset =
NM_STRUCT_OFFSET_ENSURE_TYPE(bool, NMSettingIPConfigPrivate, dhcp_send_hostname));
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_DHCP_HOSTNAME_FLAGS],
&nm_sett_info_propert_type_direct_uint32,
.direct_offset =
NM_STRUCT_OFFSET_ENSURE_TYPE(guint32, NMSettingIPConfigPrivate, dhcp_hostname_flags));
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_NEVER_DEFAULT],
@ -5924,9 +5939,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_ROUTE_METRIC:
g_value_set_int64(value, priv->route_metric);
break;
case PROP_ROUTE_TABLE:
g_value_set_uint(value, priv->route_table);
break;
case PROP_IGNORE_AUTO_ROUTES:
g_value_set_boolean(value, nm_setting_ip_config_get_ignore_auto_routes(setting));
break;
@ -5948,9 +5960,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_DHCP_IAID:
g_value_set_string(value, nm_setting_ip_config_get_dhcp_iaid(setting));
break;
case PROP_DHCP_HOSTNAME_FLAGS:
g_value_set_uint(value, nm_setting_ip_config_get_dhcp_hostname_flags(setting));
break;
case PROP_DHCP_REJECT_SERVERS:
g_value_set_boxed(value, nm_strvarray_get_strv_non_empty(priv->dhcp_reject_servers, NULL));
break;
@ -6022,9 +6031,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
case PROP_ROUTE_METRIC:
priv->route_metric = g_value_get_int64(value);
break;
case PROP_ROUTE_TABLE:
priv->route_table = g_value_get_uint(value);
break;
case PROP_IGNORE_AUTO_ROUTES:
priv->ignore_auto_routes = g_value_get_boolean(value);
break;
@ -6048,9 +6054,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
g_free(priv->dhcp_iaid);
priv->dhcp_iaid = g_value_dup_string(value);
break;
case PROP_DHCP_HOSTNAME_FLAGS:
priv->dhcp_hostname_flags = g_value_get_uint(value);
break;
case PROP_DHCP_REJECT_SERVERS:
nm_strvarray_set_strv(&priv->dhcp_reject_servers, g_value_get_boxed(value));
break;

View file

@ -32,19 +32,19 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_PARENT,
PROP_FLAGS, );
typedef struct {
char *parent;
char *local;
char *remote;
char *input_key;
char *output_key;
guint ttl;
guint tos;
guint encapsulation_limit;
guint flow_label;
NMIPTunnelMode mode;
guint32 mtu;
guint32 flags;
bool path_mtu_discovery;
char *parent;
char *local;
char *remote;
char *input_key;
char *output_key;
guint32 ttl;
guint32 tos;
guint32 encapsulation_limit;
guint32 flow_label;
guint32 mode;
guint32 mtu;
guint32 flags;
bool path_mtu_discovery;
} NMSettingIPTunnelPrivate;
/**
@ -512,44 +512,20 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_PARENT:
g_value_set_string(value, priv->parent);
break;
case PROP_MODE:
g_value_set_uint(value, priv->mode);
break;
case PROP_LOCAL:
g_value_set_string(value, priv->local);
break;
case PROP_REMOTE:
g_value_set_string(value, priv->remote);
break;
case PROP_TTL:
g_value_set_uint(value, priv->ttl);
break;
case PROP_TOS:
g_value_set_uint(value, priv->tos);
break;
case PROP_PATH_MTU_DISCOVERY:
g_value_set_boolean(value, priv->path_mtu_discovery);
break;
case PROP_INPUT_KEY:
g_value_set_string(value, priv->input_key);
break;
case PROP_OUTPUT_KEY:
g_value_set_string(value, priv->output_key);
break;
case PROP_ENCAPSULATION_LIMIT:
g_value_set_uint(value, priv->encapsulation_limit);
break;
case PROP_FLOW_LABEL:
g_value_set_uint(value, priv->flow_label);
break;
case PROP_MTU:
g_value_set_uint(value, priv->mtu);
break;
case PROP_FLAGS:
g_value_set_uint(value, priv->flags);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
break;
}
}
@ -565,9 +541,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
g_free(priv->parent);
priv->parent = g_value_dup_string(value);
break;
case PROP_MODE:
priv->mode = g_value_get_uint(value);
break;
case PROP_LOCAL:
g_free(priv->local);
priv->local = g_value_dup_string(value);
@ -576,15 +549,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
g_free(priv->remote);
priv->remote = g_value_dup_string(value);
break;
case PROP_TTL:
priv->ttl = g_value_get_uint(value);
break;
case PROP_TOS:
priv->tos = g_value_get_uint(value);
break;
case PROP_PATH_MTU_DISCOVERY:
priv->path_mtu_discovery = g_value_get_boolean(value);
break;
case PROP_INPUT_KEY:
g_free(priv->input_key);
priv->input_key = g_value_dup_string(value);
@ -593,20 +557,8 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
g_free(priv->output_key);
priv->output_key = g_value_dup_string(value);
break;
case PROP_ENCAPSULATION_LIMIT:
priv->encapsulation_limit = g_value_get_uint(value);
break;
case PROP_FLOW_LABEL:
priv->flow_label = g_value_get_uint(value);
break;
case PROP_MTU:
priv->mtu = g_value_get_uint(value);
break;
case PROP_FLAGS:
priv->flags = g_value_get_uint(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
break;
}
}
@ -671,14 +623,16 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_MODE] =
g_param_spec_uint(NM_SETTING_IP_TUNNEL_MODE,
"",
"",
0,
G_MAXUINT,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_MODE,
PROP_MODE,
0,
G_MAXUINT32,
NM_IP_TUNNEL_MODE_UNKNOWN,
NM_SETTING_PARAM_INFERRABLE,
NMSettingIPTunnelPrivate,
mode);
/**
* NMSettingIPTunnel:local:
@ -720,14 +674,16 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_TTL] =
g_param_spec_uint(NM_SETTING_IP_TUNNEL_TTL,
"",
"",
0,
255,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_TTL,
PROP_TTL,
0,
255,
0,
NM_SETTING_PARAM_INFERRABLE,
NMSettingIPTunnelPrivate,
ttl);
/**
* NMSettingIPTunnel:tos
@ -737,14 +693,16 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_TOS] =
g_param_spec_uint(NM_SETTING_IP_TUNNEL_TOS,
"",
"",
0,
255,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_TOS,
PROP_TOS,
0,
255,
0,
NM_SETTING_PARAM_INFERRABLE,
NMSettingIPTunnelPrivate,
tos);
/**
* NMSettingIPTunnel:path-mtu-discovery
@ -802,14 +760,16 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_ENCAPSULATION_LIMIT] =
g_param_spec_uint(NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT,
"",
"",
0,
255,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT,
PROP_ENCAPSULATION_LIMIT,
0,
255,
0,
NM_SETTING_PARAM_INFERRABLE,
NMSettingIPTunnelPrivate,
encapsulation_limit);
/**
* NMSettingIPTunnel:flow-label:
@ -819,14 +779,16 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_FLOW_LABEL] =
g_param_spec_uint(NM_SETTING_IP_TUNNEL_FLOW_LABEL,
"",
"",
0,
(1 << 20) - 1,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_FLOW_LABEL,
PROP_FLOW_LABEL,
0,
(1 << 20) - 1,
0,
NM_SETTING_PARAM_INFERRABLE,
NMSettingIPTunnelPrivate,
flow_label);
/**
* NMSettingIPTunnel:mtu:
@ -836,14 +798,16 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_MTU] = g_param_spec_uint(NM_SETTING_IP_TUNNEL_MTU,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE
| G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_MTU,
PROP_MTU,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_FUZZY_IGNORE,
NMSettingIPTunnelPrivate,
mtu);
/**
* NMSettingIPTunnel:flags:
@ -856,14 +820,16 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.12
**/
obj_properties[PROP_FLAGS] = g_param_spec_uint(NM_SETTING_IP_TUNNEL_FLAGS,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE
| G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_FLAGS,
PROP_FLAGS,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_FUZZY_IGNORE,
NMSettingIPTunnelPrivate,
flags);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);

View file

@ -28,10 +28,10 @@
NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_PARENT, PROP_MODE, PROP_PROMISCUOUS, PROP_TAP, );
typedef struct {
char *parent;
NMSettingMacvlanMode mode;
bool promiscuous;
bool tap;
char *parent;
guint32 mode;
bool promiscuous;
bool tap;
} NMSettingMacvlanPrivate;
/**
@ -84,6 +84,7 @@ NMSettingMacvlanMode
nm_setting_macvlan_get_mode(NMSettingMacvlan *setting)
{
g_return_val_if_fail(NM_IS_SETTING_MACVLAN(setting), NM_SETTING_MACVLAN_MODE_UNKNOWN);
return NM_SETTING_MACVLAN_GET_PRIVATE(setting)->mode;
}
@ -189,9 +190,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_PARENT:
g_value_set_string(value, priv->parent);
break;
case PROP_MODE:
g_value_set_uint(value, priv->mode);
break;
case PROP_PROMISCUOUS:
g_value_set_boolean(value, priv->promiscuous);
break;
@ -199,7 +197,7 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
g_value_set_boolean(value, priv->tap);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
break;
}
}
@ -215,9 +213,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
g_free(priv->parent);
priv->parent = g_value_dup_string(value);
break;
case PROP_MODE:
priv->mode = g_value_get_uint(value);
break;
case PROP_PROMISCUOUS:
priv->promiscuous = g_value_get_boolean(value);
break;
@ -225,7 +220,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
priv->tap = g_value_get_boolean(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
break;
}
}
@ -302,14 +297,16 @@ nm_setting_macvlan_class_init(NMSettingMacvlanClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_MODE] =
g_param_spec_uint(NM_SETTING_MACVLAN_MODE,
"",
"",
0,
G_MAXUINT,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_MACVLAN_MODE,
PROP_MODE,
0,
G_MAXUINT32,
NM_SETTING_MACVLAN_MODE_UNKNOWN,
NM_SETTING_PARAM_INFERRABLE,
NMSettingMacvlanPrivate,
mode);
/**
* NMSettingMacvlan:promiscuous:

View file

@ -140,12 +140,12 @@ typedef struct {
char *dhcp_hostname;
char *dhcp_iaid;
gint64 route_metric;
guint dhcp_hostname_flags;
gint32 required_timeout;
gint32 dad_timeout;
gint32 dhcp_timeout;
gint32 dns_priority;
guint32 route_table;
guint32 dhcp_hostname_flags;
bool ignore_auto_routes;
bool ignore_auto_dns;
bool dhcp_send_hostname;
@ -270,8 +270,6 @@ extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_interfac
extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_ignore_i;
extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_ignore_u;
extern const NMSettInfoPropertType nm_sett_info_propert_type_plain_u;
extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_boolean;
extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_int32;
extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_uint32;

View file

@ -30,8 +30,8 @@ NM_GOBJECT_PROPERTIES_DEFINE(NMSettingSriov, PROP_TOTAL_VFS, PROP_VFS, PROP_AUTO
struct _NMSettingSriov {
NMSetting parent;
GPtrArray *vfs;
guint total_vfs;
int autoprobe_drivers;
guint32 total_vfs;
};
struct _NMSettingSriovClass {
@ -1138,9 +1138,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
NMSettingSriov *self = NM_SETTING_SRIOV(object);
switch (prop_id) {
case PROP_TOTAL_VFS:
g_value_set_uint(value, self->total_vfs);
break;
case PROP_VFS:
g_value_take_boxed(value,
_nm_utils_copy_array(self->vfs,
@ -1159,9 +1156,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
NMSettingSriov *self = NM_SETTING_SRIOV(object);
switch (prop_id) {
case PROP_TOTAL_VFS:
self->total_vfs = g_value_get_uint(value);
break;
case PROP_VFS:
g_ptr_array_unref(self->vfs);
self->vfs = _nm_utils_copy_array(g_value_get_boxed(value),
@ -1240,14 +1234,16 @@ nm_setting_sriov_class_init(NMSettingSriovClass *klass)
* example: SRIOV_TOTAL_VFS=16
* ---end---
*/
obj_properties[PROP_TOTAL_VFS] = g_param_spec_uint(
NM_SETTING_SRIOV_TOTAL_VFS,
"",
"",
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_SRIOV_TOTAL_VFS,
PROP_TOTAL_VFS,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_FUZZY_IGNORE,
NMSettingSriov,
total_vfs);
/**
* NMSettingSriov:vfs: (type GPtrArray(NMSriovVF))

View file

@ -65,7 +65,6 @@ typedef struct {
*/
GHashTable *secrets;
/* Timeout for the VPN service to establish the connection */
guint32 timeout;
/* Whether the VPN stays up across link changes, until the user
@ -985,11 +984,8 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_SECRETS:
g_value_take_boxed(value, _nm_utils_copy_strdict(priv->secrets));
break;
case PROP_TIMEOUT:
g_value_set_uint(value, nm_setting_vpn_get_timeout(setting));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
break;
}
}
@ -1046,11 +1042,8 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
}
}
} break;
case PROP_TIMEOUT:
priv->timeout = g_value_get_uint(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
break;
}
}
@ -1221,13 +1214,16 @@ nm_setting_vpn_class_init(NMSettingVpnClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_TIMEOUT] = g_param_spec_uint(NM_SETTING_VPN_TIMEOUT,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_VPN_TIMEOUT,
PROP_TIMEOUT,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_NONE,
NMSettingVpnPrivate,
timeout);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);

View file

@ -42,22 +42,22 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_PARENT,
PROP_L3_MISS, );
typedef struct {
char *parent;
char *local;
char *remote;
guint id;
guint source_port_min;
guint source_port_max;
guint destination_port;
guint tos;
guint ttl;
guint ageing;
guint limit;
bool proxy;
bool learning;
bool rsc;
bool l2_miss;
bool l3_miss;
char *parent;
char *local;
char *remote;
guint32 id;
guint32 source_port_min;
guint32 source_port_max;
guint32 destination_port;
guint32 tos;
guint32 ttl;
guint32 ageing;
guint32 limit;
bool proxy;
bool learning;
bool rsc;
bool l2_miss;
bool l3_miss;
} NMSettingVxlanPrivate;
/**
@ -110,6 +110,7 @@ guint
nm_setting_vxlan_get_id(NMSettingVxlan *setting)
{
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), 0);
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->id;
}
@ -155,6 +156,7 @@ guint
nm_setting_vxlan_get_source_port_min(NMSettingVxlan *setting)
{
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), 0);
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->source_port_min;
}
@ -170,6 +172,7 @@ guint
nm_setting_vxlan_get_source_port_max(NMSettingVxlan *setting)
{
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), 0);
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->source_port_max;
}
@ -185,6 +188,7 @@ guint
nm_setting_vxlan_get_destination_port(NMSettingVxlan *setting)
{
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), DST_PORT_DEFAULT);
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->destination_port;
}
@ -215,6 +219,7 @@ guint
nm_setting_vxlan_get_ageing(NMSettingVxlan *setting)
{
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), 0);
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->ageing;
}
@ -230,6 +235,7 @@ guint
nm_setting_vxlan_get_limit(NMSettingVxlan *setting)
{
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), 0);
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->limit;
}
@ -245,6 +251,7 @@ guint
nm_setting_vxlan_get_tos(NMSettingVxlan *setting)
{
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), 0);
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->tos;
}
@ -260,6 +267,7 @@ guint
nm_setting_vxlan_get_ttl(NMSettingVxlan *setting)
{
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), 0);
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->ttl;
}
@ -414,39 +422,15 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_PARENT:
g_value_set_string(value, priv->parent);
break;
case PROP_ID:
g_value_set_uint(value, priv->id);
break;
case PROP_LOCAL:
g_value_set_string(value, priv->local);
break;
case PROP_REMOTE:
g_value_set_string(value, priv->remote);
break;
case PROP_SOURCE_PORT_MIN:
g_value_set_uint(value, priv->source_port_min);
break;
case PROP_SOURCE_PORT_MAX:
g_value_set_uint(value, priv->source_port_max);
break;
case PROP_DESTINATION_PORT:
g_value_set_uint(value, priv->destination_port);
break;
case PROP_TOS:
g_value_set_uint(value, priv->tos);
break;
case PROP_AGEING:
g_value_set_uint(value, priv->ageing);
break;
case PROP_LIMIT:
g_value_set_uint(value, priv->limit);
break;
case PROP_PROXY:
g_value_set_boolean(value, priv->proxy);
break;
case PROP_TTL:
g_value_set_uint(value, priv->ttl);
break;
case PROP_LEARNING:
g_value_set_boolean(value, priv->learning);
break;
@ -460,7 +444,7 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
g_value_set_boolean(value, priv->l3_miss);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
break;
}
}
@ -476,39 +460,15 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
g_free(priv->parent);
priv->parent = g_value_dup_string(value);
break;
case PROP_ID:
priv->id = g_value_get_uint(value);
break;
case PROP_LOCAL:
_addrstr_set(&priv->local, g_value_get_string(value));
break;
case PROP_REMOTE:
_addrstr_set(&priv->remote, g_value_get_string(value));
break;
case PROP_SOURCE_PORT_MIN:
priv->source_port_min = g_value_get_uint(value);
break;
case PROP_SOURCE_PORT_MAX:
priv->source_port_max = g_value_get_uint(value);
break;
case PROP_DESTINATION_PORT:
priv->destination_port = g_value_get_uint(value);
break;
case PROP_TOS:
priv->tos = g_value_get_uint(value);
break;
case PROP_AGEING:
priv->ageing = g_value_get_uint(value);
break;
case PROP_LIMIT:
priv->limit = g_value_get_uint(value);
break;
case PROP_PROXY:
priv->proxy = g_value_get_boolean(value);
break;
case PROP_TTL:
priv->ttl = g_value_get_uint(value);
break;
case PROP_LEARNING:
priv->learning = g_value_get_boolean(value);
break;
@ -522,7 +482,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
priv->l3_miss = g_value_get_boolean(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
break;
}
}
@ -531,12 +491,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
static void
nm_setting_vxlan_init(NMSettingVxlan *self)
{
NMSettingVxlanPrivate *priv = NM_SETTING_VXLAN_GET_PRIVATE(self);
priv->destination_port = DST_PORT_DEFAULT;
priv->ageing = 300;
}
{}
/**
* nm_setting_vxlan_new:
@ -603,14 +558,16 @@ nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_ID] =
g_param_spec_uint(NM_SETTING_VXLAN_ID,
"",
"",
0,
(1 << 24) - 1,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_VXLAN_ID,
PROP_ID,
0,
(1 << 24) - 1,
0,
NM_SETTING_PARAM_INFERRABLE,
NMSettingVxlanPrivate,
id);
/**
* NMSettingVxlan:local:
@ -650,14 +607,16 @@ nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_SOURCE_PORT_MIN] =
g_param_spec_uint(NM_SETTING_VXLAN_SOURCE_PORT_MIN,
"",
"",
0,
G_MAXUINT16,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_VXLAN_SOURCE_PORT_MIN,
PROP_SOURCE_PORT_MIN,
0,
G_MAXUINT16,
0,
NM_SETTING_PARAM_INFERRABLE,
NMSettingVxlanPrivate,
source_port_min);
/**
* NMSettingVxlan:source-port-max:
@ -667,14 +626,16 @@ nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_SOURCE_PORT_MAX] =
g_param_spec_uint(NM_SETTING_VXLAN_SOURCE_PORT_MAX,
"",
"",
0,
G_MAXUINT16,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_VXLAN_SOURCE_PORT_MAX,
PROP_SOURCE_PORT_MAX,
0,
G_MAXUINT16,
0,
NM_SETTING_PARAM_INFERRABLE,
NMSettingVxlanPrivate,
source_port_max);
/**
* NMSettingVxlan:destination-port:
@ -684,14 +645,16 @@ nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_DESTINATION_PORT] =
g_param_spec_uint(NM_SETTING_VXLAN_DESTINATION_PORT,
"",
"",
0,
G_MAXUINT16,
DST_PORT_DEFAULT,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_VXLAN_DESTINATION_PORT,
PROP_DESTINATION_PORT,
0,
G_MAXUINT16,
DST_PORT_DEFAULT,
NM_SETTING_PARAM_INFERRABLE,
NMSettingVxlanPrivate,
destination_port);
/**
* NMSettingVxlan:ageing:
@ -700,14 +663,16 @@ nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_AGEING] =
g_param_spec_uint(NM_SETTING_VXLAN_AGEING,
"",
"",
0,
G_MAXUINT32,
300,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_VXLAN_AGEING,
PROP_AGEING,
0,
G_MAXUINT32,
300,
NM_SETTING_PARAM_INFERRABLE,
NMSettingVxlanPrivate,
ageing);
/**
* NMSettingVxlan:limit:
@ -717,14 +682,16 @@ nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_LIMIT] =
g_param_spec_uint(NM_SETTING_VXLAN_LIMIT,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_VXLAN_LIMIT,
PROP_LIMIT,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_INFERRABLE,
NMSettingVxlanPrivate,
limit);
/**
* NMSettingVxlan:tos:
@ -733,14 +700,16 @@ nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_TOS] =
g_param_spec_uint(NM_SETTING_VXLAN_TOS,
"",
"",
0,
255,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_VXLAN_TOS,
PROP_TOS,
0,
255,
0,
NM_SETTING_PARAM_INFERRABLE,
NMSettingVxlanPrivate,
tos);
/**
* NMSettingVxlan:ttl:
@ -749,14 +718,16 @@ nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
*
* Since: 1.2
**/
obj_properties[PROP_TTL] =
g_param_spec_uint(NM_SETTING_VXLAN_TTL,
"",
"",
0,
255,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_VXLAN_TTL,
PROP_TTL,
0,
255,
0,
NM_SETTING_PARAM_INFERRABLE,
NMSettingVxlanPrivate,
ttl);
/**
* NMSettingVxlan:proxy:

View file

@ -53,20 +53,20 @@ typedef struct {
guint len;
guint n_alloc;
} s390_options;
GArray *mac_address_blacklist;
char **s390_subchannels;
char *port;
char *duplex;
char *device_mac_address;
char *cloned_mac_address;
char *generate_mac_address_mask;
char *s390_nettype;
char *wol_password;
int accept_all_mac_addresses;
NMSettingWiredWakeOnLan wol;
guint32 speed;
guint32 mtu;
bool auto_negotiate;
GArray *mac_address_blacklist;
char **s390_subchannels;
char *port;
char *duplex;
char *device_mac_address;
char *cloned_mac_address;
char *generate_mac_address_mask;
char *s390_nettype;
char *wol_password;
int accept_all_mac_addresses;
guint32 wake_on_lan;
guint32 speed;
guint32 mtu;
bool auto_negotiate;
} NMSettingWiredPrivate;
/**
@ -731,7 +731,7 @@ nm_setting_wired_get_wake_on_lan(NMSettingWired *setting)
{
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NM_SETTING_WIRED_WAKE_ON_LAN_NONE);
return NM_SETTING_WIRED_GET_PRIVATE(setting)->wol;
return NM_SETTING_WIRED_GET_PRIVATE(setting)->wake_on_lan;
}
/**
@ -919,8 +919,8 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
if (NM_FLAGS_ANY(priv->wol, NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS)
&& !nm_utils_is_power_of_two(priv->wol)) {
if (NM_FLAGS_ANY(priv->wake_on_lan, NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS)
&& !nm_utils_is_power_of_two(priv->wake_on_lan)) {
g_set_error_literal(error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
@ -932,7 +932,8 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
if (priv->wol_password && !NM_FLAGS_HAS(priv->wol, NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC)) {
if (priv->wol_password
&& !NM_FLAGS_HAS(priv->wake_on_lan, NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC)) {
g_set_error_literal(error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
@ -1005,9 +1006,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_PORT:
g_value_set_string(value, nm_setting_wired_get_port(setting));
break;
case PROP_SPEED:
g_value_set_uint(value, nm_setting_wired_get_speed(setting));
break;
case PROP_DUPLEX:
g_value_set_string(value, nm_setting_wired_get_duplex(setting));
break;
@ -1026,9 +1024,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_MAC_ADDRESS_BLACKLIST:
g_value_set_boxed(value, (char **) priv->mac_address_blacklist->data);
break;
case PROP_MTU:
g_value_set_uint(value, nm_setting_wired_get_mtu(setting));
break;
case PROP_S390_SUBCHANNELS:
g_value_set_boxed(value, priv->s390_subchannels);
break;
@ -1044,9 +1039,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
}
g_value_take_boxed(value, hash);
break;
case PROP_WAKE_ON_LAN:
g_value_set_uint(value, priv->wol);
break;
case PROP_WAKE_ON_LAN_PASSWORD:
g_value_set_string(value, priv->wol_password);
break;
@ -1068,9 +1060,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
g_free(priv->port);
priv->port = g_value_dup_string(value);
break;
case PROP_SPEED:
priv->speed = g_value_get_uint(value);
break;
case PROP_DUPLEX:
g_free(priv->duplex);
priv->duplex = g_value_dup_string(value);
@ -1104,9 +1093,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
}
}
break;
case PROP_MTU:
priv->mtu = g_value_get_uint(value);
break;
case PROP_S390_SUBCHANNELS:
if (priv->s390_subchannels)
g_strfreev(priv->s390_subchannels);
@ -1178,9 +1164,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
g_return_if_fail(!invalid_content);
}
} break;
case PROP_WAKE_ON_LAN:
priv->wol = g_value_get_uint(value);
break;
case PROP_WAKE_ON_LAN_PASSWORD:
g_free(priv->wol_password);
priv->wol_password = g_value_dup_string(value);
@ -1201,8 +1184,6 @@ nm_setting_wired_init(NMSettingWired *setting)
/* We use GArray rather than GPtrArray so it will automatically be NULL-terminated */
priv->mac_address_blacklist = g_array_new(TRUE, FALSE, sizeof(char *));
g_array_set_clear_func(priv->mac_address_blacklist, (GDestroyNotify) clear_blacklist_item);
priv->wol = NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT;
}
/**
@ -1295,13 +1276,16 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
* parameter in the ETHTOOL_OPTS variable.
* ---end---
*/
obj_properties[PROP_SPEED] = g_param_spec_uint(NM_SETTING_WIRED_SPEED,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIRED_SPEED,
PROP_SPEED,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_NONE,
NMSettingWiredPrivate,
speed);
/**
* NMSettingWired:duplex:
@ -1559,14 +1543,16 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
* description: MTU of the interface.
* ---end---
*/
obj_properties[PROP_MTU] = g_param_spec_uint(NM_SETTING_WIRED_MTU,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE
| G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIRED_MTU,
PROP_MTU,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_FUZZY_IGNORE,
NMSettingWiredPrivate,
mtu);
/**
* NMSettingWired:s390-subchannels:
@ -1667,14 +1653,16 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
* in the ethtool manual page.
* ---end---
*/
obj_properties[PROP_WAKE_ON_LAN] =
g_param_spec_uint(NM_SETTING_WIRED_WAKE_ON_LAN,
"",
"",
0,
G_MAXUINT32,
NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIRED_WAKE_ON_LAN,
PROP_WAKE_ON_LAN,
0,
G_MAXUINT32,
NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT,
NM_SETTING_PARAM_NONE,
NMSettingWiredPrivate,
wake_on_lan);
/**
* NMSettingWired:wake-on-lan-password:

View file

@ -901,7 +901,7 @@ typedef struct {
int ip6_auto_default_route;
guint32 fwmark;
guint32 mtu;
guint16 listen_port;
guint32 listen_port;
bool peer_routes;
bool private_key_valid : 1;
} NMSettingWireGuardPrivate;
@ -2265,15 +2265,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
NMSettingWireGuardPrivate *priv = NM_SETTING_WIREGUARD_GET_PRIVATE(setting);
switch (prop_id) {
case PROP_FWMARK:
g_value_set_uint(value, priv->fwmark);
break;
case PROP_LISTEN_PORT:
g_value_set_uint(value, priv->listen_port);
break;
case PROP_MTU:
g_value_set_uint(value, priv->mtu);
break;
case PROP_PEER_ROUTES:
g_value_set_boolean(value, priv->peer_routes);
break;
@ -2293,15 +2284,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
const char *str;
switch (prop_id) {
case PROP_FWMARK:
priv->fwmark = g_value_get_uint(value);
break;
case PROP_LISTEN_PORT:
priv->listen_port = g_value_get_uint(value);
break;
case PROP_MTU:
priv->mtu = g_value_get_uint(value);
break;
case PROP_PEER_ROUTES:
priv->peer_routes = g_value_get_boolean(value);
break;
@ -2428,14 +2410,16 @@ nm_setting_wireguard_class_init(NMSettingWireGuardClass *klass)
*
* Since: 1.16
**/
obj_properties[PROP_FWMARK] =
g_param_spec_uint(NM_SETTING_WIREGUARD_FWMARK,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIREGUARD_FWMARK,
PROP_FWMARK,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_INFERRABLE,
NMSettingWireGuardPrivate,
fwmark);
/**
* NMSettingWireGuard:listen-port:
@ -2445,14 +2429,16 @@ nm_setting_wireguard_class_init(NMSettingWireGuardClass *klass)
*
* Since: 1.16
**/
obj_properties[PROP_LISTEN_PORT] =
g_param_spec_uint(NM_SETTING_WIREGUARD_LISTEN_PORT,
"",
"",
0,
65535,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIREGUARD_LISTEN_PORT,
PROP_LISTEN_PORT,
0,
65535,
0,
NM_SETTING_PARAM_INFERRABLE,
NMSettingWireGuardPrivate,
listen_port);
/**
* NMSettingWireGuard:peer-routes:
@ -2492,14 +2478,16 @@ nm_setting_wireguard_class_init(NMSettingWireGuardClass *klass)
*
* Since: 1.16
**/
obj_properties[PROP_MTU] =
g_param_spec_uint(NM_SETTING_WIREGUARD_MTU,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIREGUARD_MTU,
PROP_MTU,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_INFERRABLE,
NMSettingWireGuardPrivate,
mtu);
/**
* NMSettingWireGuard:ip4-auto-default-route:

View file

@ -62,26 +62,26 @@ NM_GOBJECT_PROPERTIES_DEFINE(NMSettingWirelessSecurity,
PROP_FILS, );
typedef struct {
GSList *proto; /* GSList of strings */
GSList *pairwise; /* GSList of strings */
GSList *group; /* GSList of strings */
char *key_mgmt;
char *auth_alg;
char *leap_username;
char *leap_password;
char *wep_key0;
char *wep_key1;
char *wep_key2;
char *wep_key3;
char *psk;
guint leap_password_flags;
guint wep_key_flags;
guint psk_flags;
NMWepKeyType wep_key_type;
NMSettingWirelessSecurityWpsMethod wps_method;
gint32 pmf;
gint32 fils;
guint32 wep_tx_keyidx;
GSList *proto; /* GSList of strings */
GSList *pairwise; /* GSList of strings */
GSList *group; /* GSList of strings */
char *key_mgmt;
char *auth_alg;
char *leap_username;
char *leap_password;
char *wep_key0;
char *wep_key1;
char *wep_key2;
char *wep_key3;
char *psk;
guint leap_password_flags;
guint wep_key_flags;
guint psk_flags;
NMWepKeyType wep_key_type;
gint32 pmf;
gint32 fils;
guint32 wep_tx_keyidx;
guint32 wps_method;
} NMSettingWirelessSecurityPrivate;
/**
@ -1005,19 +1005,6 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
if (priv->wep_tx_keyidx > 3) {
g_set_error(error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("'%d' value is out of range <0-3>"),
priv->wep_tx_keyidx);
g_prefix_error(error,
"%s.%s: ",
NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX);
return FALSE;
}
if (priv->wep_key_type > NM_WEP_KEY_TYPE_LAST) {
g_set_error_literal(error,
NM_CONNECTION_ERROR,
@ -1317,9 +1304,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_KEY_MGMT:
g_value_set_string(value, priv->key_mgmt);
break;
case PROP_WEP_TX_KEYIDX:
g_value_set_uint(value, priv->wep_tx_keyidx);
break;
case PROP_AUTH_ALG:
g_value_set_string(value, priv->auth_alg);
break;
@ -1356,9 +1340,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_WEP_KEY_TYPE:
g_value_set_enum(value, priv->wep_key_type);
break;
case PROP_WPS_METHOD:
g_value_set_uint(value, priv->wps_method);
break;
default:
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
break;
@ -1378,9 +1359,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
str = g_value_get_string(value);
priv->key_mgmt = str ? g_ascii_strdown(str, -1) : NULL;
break;
case PROP_WEP_TX_KEYIDX:
priv->wep_tx_keyidx = g_value_get_uint(value);
break;
case PROP_AUTH_ALG:
g_free(priv->auth_alg);
str = g_value_get_string(value);
@ -1429,9 +1407,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
case PROP_WEP_KEY_TYPE:
priv->wep_key_type = g_value_get_enum(value);
break;
case PROP_WPS_METHOD:
priv->wps_method = g_value_get_uint(value);
break;
default:
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
break;
@ -1445,8 +1420,6 @@ nm_setting_wireless_security_init(NMSettingWirelessSecurity *self)
{
nm_assert(NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE(self)->wep_key_type
== NM_WEP_KEY_TYPE_UNKNOWN);
nm_assert(NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE(self)->wps_method
== NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DEFAULT);
}
/**
@ -1542,17 +1515,20 @@ nm_setting_wireless_security_class_init(NMSettingWirelessSecurityClass *klass)
* variable: DEFAULTKEY
* values: 1, 2, 3, 4
* default: 1
* description: Index of active WEP key.
* description: Index of active WEP key. Note that in ifcfg format the index starts counting
* at 1, while NetworkManager API otherwise is zero based.
* ---end---
*/
obj_properties[PROP_WEP_TX_KEYIDX] =
g_param_spec_uint(NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX,
"",
"",
0,
3,
0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX,
PROP_WEP_TX_KEYIDX,
0,
3,
0,
NM_SETTING_PARAM_NONE,
NMSettingWirelessSecurityPrivate,
wep_tx_keyidx);
/**
* NMSettingWirelessSecurity:auth-alg:
@ -1932,14 +1908,16 @@ nm_setting_wireless_security_class_init(NMSettingWirelessSecurityClass *klass)
* example: WPS_METHOD=disabled, WPS_METHOD="pin pbc"
* ---end---
*/
obj_properties[PROP_WPS_METHOD] = g_param_spec_uint(
NM_SETTING_WIRELESS_SECURITY_WPS_METHOD,
"",
"",
0,
G_MAXUINT32,
NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DEFAULT,
G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIRELESS_SECURITY_WPS_METHOD,
PROP_WPS_METHOD,
0,
G_MAXUINT32,
NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DEFAULT,
NM_SETTING_PARAM_FUZZY_IGNORE,
NMSettingWirelessSecurityPrivate,
wps_method);
/**
* NMSettingWirelessSecurity:fils:

View file

@ -46,24 +46,24 @@ NM_GOBJECT_PROPERTIES_DEFINE(NMSettingWireless,
PROP_AP_ISOLATION, );
typedef struct {
GBytes *ssid;
GArray *mac_address_blacklist;
GPtrArray *seen_bssids;
char *mode;
char *band;
char *bssid;
char *device_mac_address;
char *cloned_mac_address;
char *generate_mac_address_mask;
int ap_isolation;
NMSettingMacRandomization mac_address_randomization;
guint32 channel;
guint32 rate;
guint32 tx_power;
guint32 mtu;
guint32 powersave;
guint32 wowl;
bool hidden;
GBytes *ssid;
GArray *mac_address_blacklist;
GPtrArray *seen_bssids;
char *mode;
char *band;
char *bssid;
char *device_mac_address;
char *cloned_mac_address;
char *generate_mac_address_mask;
int ap_isolation;
guint32 mac_address_randomization;
guint32 channel;
guint32 rate;
guint32 tx_power;
guint32 mtu;
guint32 powersave;
guint32 wake_on_wlan;
bool hidden;
} NMSettingWirelessPrivate;
/**
@ -1035,8 +1035,8 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
if (NM_FLAGS_ANY(priv->wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_EXCLUSIVE_FLAGS)) {
if (!nm_utils_is_power_of_two(priv->wowl)) {
if (NM_FLAGS_ANY(priv->wake_on_wlan, NM_SETTING_WIRELESS_WAKE_ON_WLAN_EXCLUSIVE_FLAGS)) {
if (!nm_utils_is_power_of_two(priv->wake_on_wlan)) {
g_set_error_literal(error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
@ -1047,7 +1047,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
NM_SETTING_WIRELESS_WAKE_ON_WLAN);
return FALSE;
}
} else if (NM_FLAGS_ANY(priv->wowl, ~NM_SETTING_WIRELESS_WAKE_ON_WLAN_ALL)) {
} else if (NM_FLAGS_ANY(priv->wake_on_wlan, ~NM_SETTING_WIRELESS_WAKE_ON_WLAN_ALL)) {
g_set_error_literal(error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
@ -1148,7 +1148,7 @@ nm_setting_wireless_get_wake_on_wlan(NMSettingWireless *setting)
{
g_return_val_if_fail(NM_IS_SETTING_WIRELESS(setting), NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE);
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->wowl;
return NM_SETTING_WIRELESS_GET_PRIVATE(setting)->wake_on_wlan;
}
static void
@ -1172,15 +1172,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_BAND:
g_value_set_string(value, nm_setting_wireless_get_band(setting));
break;
case PROP_CHANNEL:
g_value_set_uint(value, nm_setting_wireless_get_channel(setting));
break;
case PROP_RATE:
g_value_set_uint(value, nm_setting_wireless_get_rate(setting));
break;
case PROP_TX_POWER:
g_value_set_uint(value, nm_setting_wireless_get_tx_power(setting));
break;
case PROP_CLONED_MAC_ADDRESS:
g_value_set_string(value, nm_setting_wireless_get_cloned_mac_address(setting));
break;
@ -1190,9 +1181,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_MAC_ADDRESS_BLACKLIST:
g_value_set_boxed(value, (char **) priv->mac_address_blacklist->data);
break;
case PROP_MTU:
g_value_set_uint(value, nm_setting_wireless_get_mtu(setting));
break;
case PROP_SEEN_BSSIDS:
g_value_take_boxed(
value,
@ -1200,15 +1188,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
? nm_strv_dup((char **) priv->seen_bssids->pdata, priv->seen_bssids->len, TRUE)
: NULL);
break;
case PROP_POWERSAVE:
g_value_set_uint(value, nm_setting_wireless_get_powersave(setting));
break;
case PROP_MAC_ADDRESS_RANDOMIZATION:
g_value_set_uint(value, nm_setting_wireless_get_mac_address_randomization(setting));
break;
case PROP_WAKE_ON_WLAN:
g_value_set_uint(value, nm_setting_wireless_get_wake_on_wlan(setting));
break;
default:
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
break;
@ -1232,15 +1211,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
g_free(priv->band);
priv->band = g_value_dup_string(value);
break;
case PROP_CHANNEL:
priv->channel = g_value_get_uint(value);
break;
case PROP_RATE:
priv->rate = g_value_get_uint(value);
break;
case PROP_TX_POWER:
priv->tx_power = g_value_get_uint(value);
break;
case PROP_CLONED_MAC_ADDRESS:
bool_val = !!priv->cloned_mac_address;
g_free(priv->cloned_mac_address);
@ -1271,9 +1241,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
}
}
break;
case PROP_MTU:
priv->mtu = g_value_get_uint(value);
break;
case PROP_SEEN_BSSIDS:
{
gs_unref_ptrarray GPtrArray *arr_old = NULL;
@ -1292,15 +1259,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
}
break;
}
case PROP_POWERSAVE:
priv->powersave = g_value_get_uint(value);
break;
case PROP_MAC_ADDRESS_RANDOMIZATION:
priv->mac_address_randomization = g_value_get_uint(value);
break;
case PROP_WAKE_ON_WLAN:
priv->wowl = g_value_get_uint(value);
break;
default:
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
break;
@ -1317,8 +1275,6 @@ nm_setting_wireless_init(NMSettingWireless *setting)
/* We use GArray rather than GPtrArray so it will automatically be NULL-terminated */
priv->mac_address_blacklist = g_array_new(TRUE, FALSE, sizeof(char *));
g_array_set_clear_func(priv->mac_address_blacklist, (GDestroyNotify) clear_blacklist_item);
priv->wowl = NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT;
}
/**
@ -1452,13 +1408,16 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
* example: CHANNEL=6
* ---end---
*/
obj_properties[PROP_CHANNEL] = g_param_spec_uint(NM_SETTING_WIRELESS_CHANNEL,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIRELESS_CHANNEL,
PROP_CHANNEL,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_NONE,
NMSettingWirelessPrivate,
channel);
/**
* NMSettingWireless:bssid:
@ -1498,14 +1457,16 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
* description: This property is not handled by ifcfg-rh plugin.
* ---end---
*/
obj_properties[PROP_RATE] = g_param_spec_uint(NM_SETTING_WIRELESS_RATE,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE
| G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIRELESS_RATE,
PROP_RATE,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_FUZZY_IGNORE,
NMSettingWirelessPrivate,
rate);
/**
* NMSettingWireless:tx-power:
@ -1520,14 +1481,16 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
* description: This property is not handled by ifcfg-rh plugin.
* ---end---
*/
obj_properties[PROP_TX_POWER] = g_param_spec_uint(
NM_SETTING_WIRELESS_TX_POWER,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIRELESS_TX_POWER,
PROP_TX_POWER,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_FUZZY_IGNORE,
NMSettingWirelessPrivate,
tx_power);
/**
* NMSettingWireless:mac-address:
@ -1750,14 +1713,16 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
* description: MTU of the wireless interface.
* ---end---
*/
obj_properties[PROP_MTU] = g_param_spec_uint(NM_SETTING_WIRELESS_MTU,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE
| G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIRELESS_MTU,
PROP_MTU,
0,
G_MAXUINT32,
0,
NM_SETTING_PARAM_FUZZY_IGNORE,
NMSettingWirelessPrivate,
mtu);
/**
* NMSettingWireless:hidden:
@ -1811,13 +1776,16 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
* example: POWERSAVE=enable
* ---end---
*/
obj_properties[PROP_POWERSAVE] = g_param_spec_uint(NM_SETTING_WIRELESS_POWERSAVE,
"",
"",
0,
G_MAXUINT32,
NM_SETTING_WIRELESS_POWERSAVE_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIRELESS_POWERSAVE,
PROP_POWERSAVE,
0,
G_MAXUINT32,
NM_SETTING_WIRELESS_POWERSAVE_DEFAULT,
NM_SETTING_PARAM_NONE,
NMSettingWirelessPrivate,
powersave);
/**
* NMSettingWireless:mac-address-randomization:
@ -1840,14 +1808,16 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
* example: MAC_ADDRESS_RANDOMIZATION=always
* ---end---
*/
obj_properties[PROP_MAC_ADDRESS_RANDOMIZATION] =
g_param_spec_uint(NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION,
"",
"",
0,
G_MAXUINT32,
NM_SETTING_MAC_RANDOMIZATION_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION,
PROP_MAC_ADDRESS_RANDOMIZATION,
0,
G_MAXUINT32,
NM_SETTING_MAC_RANDOMIZATION_DEFAULT,
NM_SETTING_PARAM_NONE,
NMSettingWirelessPrivate,
mac_address_randomization);
/* Compatibility for deprecated property */
/* ---ifcfg-rh---
@ -1888,14 +1858,16 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
*
* Since: 1.12
**/
obj_properties[PROP_WAKE_ON_WLAN] =
g_param_spec_uint(NM_SETTING_WIRELESS_WAKE_ON_WLAN,
"",
"",
0,
G_MAXUINT32,
NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
_nm_setting_property_define_direct_uint32(properties_override,
obj_properties,
NM_SETTING_WIRELESS_WAKE_ON_WLAN,
PROP_WAKE_ON_WLAN,
0,
G_MAXUINT32,
NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT,
NM_SETTING_PARAM_NONE,
NMSettingWirelessPrivate,
wake_on_wlan);
/**
* NMSettingWireless:ap-isolation

View file

@ -376,9 +376,7 @@ _nm_setting_class_commit(NMSettingClass *setting_class,
nm_assert(p->param_spec);
vtype = p->param_spec->value_type;
if (vtype == G_TYPE_UINT)
p->property_type = &nm_sett_info_propert_type_plain_u;
else if (vtype == G_TYPE_INT64)
if (vtype == G_TYPE_INT64)
p->property_type = NM_SETT_INFO_PROPERT_TYPE_GPROP(
G_VARIANT_TYPE_INT64,
.compare_fcn = _nm_setting_property_compare_fcn_default,
@ -3491,12 +3489,6 @@ const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_ignore_u =
/* No functions set. This property type is to silently ignore the value on D-Bus. */
.compare_fcn = _nm_setting_property_compare_fcn_ignore);
const NMSettInfoPropertType nm_sett_info_propert_type_plain_u =
NM_SETT_INFO_PROPERT_TYPE_GPROP_INIT(G_VARIANT_TYPE_UINT32,
.compare_fcn = _nm_setting_property_compare_fcn_default,
.from_dbus_fcn = _nm_setting_property_from_dbus_fcn_gprop,
.from_dbus_is_full = TRUE);
const NMSettInfoPropertType nm_sett_info_propert_type_direct_boolean =
NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(G_VARIANT_TYPE_BOOLEAN,
.direct_type = NM_VALUE_TYPE_BOOL,

View file

@ -4898,18 +4898,6 @@ check_done:;
!= 0)
continue;
if ((pt == &nm_sett_info_propert_type_plain_u
&& pt_2 == &nm_sett_info_propert_type_deprecated_ignore_u)
|| (pt_2 == &nm_sett_info_propert_type_plain_u
&& pt == &nm_sett_info_propert_type_deprecated_ignore_u)) {
/* These are known to be duplicated. This is the case for
* "gsm.allowed-bands" and plain properties like "802-11-olpc-mesh.channel" ("u" D-Bus type)
* While the content/behaviour of the property types are identical, their purpose
* is different. So allow them.
*/
continue;
}
/* the property-types with same content should all be shared. Here we have two that
* are the same content, but different instances. Bug. */
g_error("The identical property type for D-Bus type \"%s\" is used by: %s and %s. "