libnm: merge branch 'th/libnm-iptunnel-fwmark'

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1797
This commit is contained in:
Thomas Haller 2023-11-30 15:35:09 +01:00
commit 80839291f8
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
4 changed files with 47 additions and 0 deletions

View file

@ -1947,6 +1947,7 @@ global:
libnm_1_46_0 {
global:
nm_access_point_get_bandwidth;
nm_device_ip_tunnel_get_fwmark;
nm_ethtool_optname_is_channels;
nm_ethtool_optname_is_eee;
} libnm_1_44_0;

View file

@ -26,6 +26,7 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_MODE,
PROP_OUTPUT_KEY,
PROP_ENCAPSULATION_LIMIT,
PROP_FLOW_LABEL,
PROP_FWMARK,
PROP_FLAGS, );
typedef struct {
@ -37,6 +38,7 @@ typedef struct {
guint32 mode;
guint32 flow_label;
guint32 flags;
guint32 fwmark;
guint8 ttl;
guint8 tos;
guint8 encapsulation_limit;
@ -236,6 +238,23 @@ nm_device_ip_tunnel_get_flow_label(NMDeviceIPTunnel *device)
return NM_DEVICE_IP_TUNNEL_GET_PRIVATE(device)->flow_label;
}
/**
* nm_device_ip_tunnel_get_fwmark:
* @device: a #NMDeviceIPTunnel
*
* Returns: the fwmark assigned to tunnel packets. This property applies only
* to VTI tunnels.
*
* Since: 1.46
**/
guint32
nm_device_ip_tunnel_get_fwmark(NMDeviceIPTunnel *device)
{
g_return_val_if_fail(NM_IS_DEVICE_IP_TUNNEL(device), 0);
return NM_DEVICE_IP_TUNNEL_GET_PRIVATE(device)->fwmark;
}
/**
* nm_device_ip_tunnel_get_flags:
* @device: a #NMDeviceIPTunnel
@ -334,6 +353,9 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
case PROP_FLOW_LABEL:
g_value_set_uint(value, nm_device_ip_tunnel_get_flow_label(device));
break;
case PROP_FWMARK:
g_value_set_uint(value, nm_device_ip_tunnel_get_fwmark(device));
break;
case PROP_FLAGS:
g_value_set_uint(value, nm_device_ip_tunnel_get_flags(device));
break;
@ -357,6 +379,7 @@ const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_iptunnel = NML_DBUS_META_I
PROP_FLOW_LABEL,
NMDeviceIPTunnel,
_priv.flow_label),
NML_DBUS_META_PROPERTY_INIT_U("FwMark", PROP_FWMARK, NMDeviceIPTunnel, _priv.fwmark),
NML_DBUS_META_PROPERTY_INIT_S("InputKey",
PROP_INPUT_KEY,
NMDeviceIPTunnel,
@ -558,6 +581,22 @@ nm_device_ip_tunnel_class_init(NMDeviceIPTunnelClass *klass)
0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* NMDeviceIPTunnel:fwmark:
*
* The fwmark value to assign to tunnel packets. This property applies only
* to VTI tunnels.
*
* Since: 1.46
**/
obj_properties[PROP_FWMARK] = g_param_spec_uint(NM_DEVICE_IP_TUNNEL_FWMARK,
"",
"",
0,
G_MAXUINT32,
0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* NMDeviceIPTunnel:flags:
*

View file

@ -3188,6 +3188,10 @@ check_dbus_properties:
&& nm_streq(pspec->name, NM_DEVICE_WIREGUARD_FWMARK)) {
g_assert_cmpstr(obj_property_name, ==, "fw-mark");
expected_property_name = NM_DEVICE_WIREGUARD_FWMARK;
} else if (mif == &_nml_dbus_meta_iface_nm_device_iptunnel
&& nm_streq(pspec->name, NM_DEVICE_IP_TUNNEL_FWMARK)) {
g_assert_cmpstr(obj_property_name, ==, "fw-mark");
expected_property_name = NM_DEVICE_IP_TUNNEL_FWMARK;
} else if (NM_IN_SET(mif,
&_nml_dbus_meta_iface_nm_ip4config,
&_nml_dbus_meta_iface_nm_ip6config)

View file

@ -37,6 +37,7 @@ G_BEGIN_DECLS
#define NM_DEVICE_IP_TUNNEL_OUTPUT_KEY "output-key"
#define NM_DEVICE_IP_TUNNEL_ENCAPSULATION_LIMIT "encapsulation-limit"
#define NM_DEVICE_IP_TUNNEL_FLOW_LABEL "flow-label"
#define NM_DEVICE_IP_TUNNEL_FWMARK "fwmark"
#define NM_DEVICE_IP_TUNNEL_FLAGS "flags"
/**
@ -72,6 +73,8 @@ NM_AVAILABLE_IN_1_2
guint8 nm_device_ip_tunnel_get_encapsulation_limit(NMDeviceIPTunnel *device);
NM_AVAILABLE_IN_1_2
guint nm_device_ip_tunnel_get_flow_label(NMDeviceIPTunnel *device);
NM_AVAILABLE_IN_1_46
guint32 nm_device_ip_tunnel_get_fwmark(NMDeviceIPTunnel *device);
NM_AVAILABLE_IN_1_12
NMIPTunnelFlags nm_device_ip_tunnel_get_flags(NMDeviceIPTunnel *device);