mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-11 15:40:17 +01:00
libnm: fix handling "q" (uint16) property types in libnm
NMDeviceVxlan has some "q" type properties. They were not handled:
$ G_MESSAGES_DEBUG=all PAGER= LIBNM_GLIB_DEBUG=properties-changed nmcli 2>&1 | grep "couldn't be set from D-Bus type"
libnm-Message: 10:44:04.538: demarshal_generic: NMDeviceVxlan:dst-port (type guint) couldn't be set from D-Bus type q.
libnm-Message: 10:44:04.538: demarshal_generic: NMDeviceVxlan:src-port-max (type guint) couldn't be set from D-Bus type q.
libnm-Message: 10:44:04.538: demarshal_generic: NMDeviceVxlan:src-port-min (type guint) couldn't be set from D-Bus type q.
libnm-Message: 10:44:04.539: demarshal_generic: NMDeviceWireGuard:listen-port (type guint) couldn't be set from D-Bus type q.
(cherry picked from commit e2dac63de6)
This commit is contained in:
parent
c36da8b990
commit
9ef4137826
1 changed files with 18 additions and 6 deletions
|
|
@ -772,14 +772,24 @@ properties_changed (GDBusProxy *proxy,
|
|||
}
|
||||
}
|
||||
|
||||
#define HANDLE_TYPE(vtype, ctype, getter) \
|
||||
G_STMT_START { \
|
||||
#define HANDLE_TYPE_CHECK(vtype, ctype, getter) \
|
||||
({ \
|
||||
gboolean _success = FALSE; \
|
||||
\
|
||||
if (g_variant_is_of_type (value, vtype)) { \
|
||||
ctype *param = (ctype *) field; \
|
||||
ctype newval = getter (value); \
|
||||
different = *param != newval; \
|
||||
*param = newval; \
|
||||
} else { \
|
||||
_success = TRUE; \
|
||||
} \
|
||||
\
|
||||
_success; \
|
||||
})
|
||||
|
||||
#define HANDLE_TYPE(vtype, ctype, getter) \
|
||||
G_STMT_START { \
|
||||
if (!HANDLE_TYPE_CHECK (vtype, ctype, getter)) {\
|
||||
success = FALSE; \
|
||||
goto done; \
|
||||
} \
|
||||
|
|
@ -891,9 +901,11 @@ demarshal_generic (NMObject *object,
|
|||
NM_PRAGMA_WARNING_REENABLE
|
||||
} else if (pspec->value_type == G_TYPE_INT)
|
||||
HANDLE_TYPE (G_VARIANT_TYPE_INT32, int, g_variant_get_int32);
|
||||
else if (pspec->value_type == G_TYPE_UINT)
|
||||
HANDLE_TYPE (G_VARIANT_TYPE_UINT32, guint, g_variant_get_uint32);
|
||||
else if (pspec->value_type == G_TYPE_INT64)
|
||||
else if (pspec->value_type == G_TYPE_UINT) {
|
||||
if ( !HANDLE_TYPE_CHECK (G_VARIANT_TYPE_UINT32, guint, g_variant_get_uint32)
|
||||
&& !HANDLE_TYPE_CHECK (G_VARIANT_TYPE_UINT16, guint, g_variant_get_uint16))
|
||||
success = FALSE;
|
||||
} else if (pspec->value_type == G_TYPE_INT64)
|
||||
HANDLE_TYPE (G_VARIANT_TYPE_INT64, gint64, g_variant_get_int64);
|
||||
else if (pspec->value_type == G_TYPE_UINT64)
|
||||
HANDLE_TYPE (G_VARIANT_TYPE_UINT64, guint64, g_variant_get_uint64);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue