diff options
| author | Michael Biebl <biebl@debian.org> | 2023-02-10 11:50:34 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2023-02-10 11:50:34 +0100 |
| commit | 1372848511cb896b80b51ed1a3e9606bd9816631 (patch) | |
| tree | 674792b9385bdef935988894b45f06b2af39f88c /src/libnm-core-impl/nm-setting-ip-tunnel.c | |
| parent | 40ec077ea305994c1fc2130add6787ca0c73e2c6 (diff) | |
New upstream version 1.42.0 upstream/1.42.0
Diffstat (limited to 'src/libnm-core-impl/nm-setting-ip-tunnel.c')
| -rw-r--r-- | src/libnm-core-impl/nm-setting-ip-tunnel.c | 65 |
1 files changed, 59 insertions, 6 deletions
diff --git a/src/libnm-core-impl/nm-setting-ip-tunnel.c b/src/libnm-core-impl/nm-setting-ip-tunnel.c index 73416813..7fb8b017 100644 --- a/src/libnm-core-impl/nm-setting-ip-tunnel.c +++ b/src/libnm-core-impl/nm-setting-ip-tunnel.c @@ -28,6 +28,7 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_PARENT, PROP_OUTPUT_KEY, PROP_ENCAPSULATION_LIMIT, PROP_FLOW_LABEL, + PROP_FWMARK, PROP_MTU, PROP_FLAGS, ); @@ -41,6 +42,7 @@ typedef struct { guint32 tos; guint32 encapsulation_limit; guint32 flow_label; + guint32 fwmark; guint32 mode; guint32 mtu; guint32 flags; @@ -240,7 +242,7 @@ nm_setting_ip_tunnel_get_output_key(NMSettingIPTunnel *setting) * * Returns: the encapsulation limit value * - * Since: 1.42, 1.40.4 + * Since: 1.42 **/ guint nm_setting_ip_tunnel_get_encapsulation_limit(NMSettingIPTunnel *setting) @@ -258,7 +260,7 @@ nm_setting_ip_tunnel_get_encapsulation_limit(NMSettingIPTunnel *setting) * * Returns: the flow label value * - * Since: 1.42, 1.40.4 + * Since: 1.42 **/ guint nm_setting_ip_tunnel_get_flow_label(NMSettingIPTunnel *setting) @@ -269,6 +271,24 @@ nm_setting_ip_tunnel_get_flow_label(NMSettingIPTunnel *setting) } /** + * nm_setting_ip_tunnel_get_fwmark: + * @setting: the #NMSettingIPTunnel + * + * Returns the #NMSettingIPTunnel:fwmark property of the setting. + * + * Returns: the fwmark value + * + * Since: 1.42 + **/ +guint32 +nm_setting_ip_tunnel_get_fwmark(NMSettingIPTunnel *setting) +{ + g_return_val_if_fail(NM_IS_SETTING_IP_TUNNEL(setting), 0); + + return NM_SETTING_IP_TUNNEL_GET_PRIVATE(setting)->fwmark; +} + +/** * nm_setting_ip_tunnel_get_mtu: * @setting: the #NMSettingIPTunnel * @@ -366,7 +386,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error) return FALSE; } - if (priv->local && !nm_utils_ipaddr_is_valid(family, priv->local)) { + if (priv->local && !nm_inet_is_valid(family, priv->local)) { g_set_error(error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, @@ -392,7 +412,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error) return FALSE; } - if (!nm_utils_ipaddr_is_valid(family, priv->remote)) { + if (!nm_inet_is_valid(family, priv->remote)) { g_set_error(error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, @@ -411,11 +431,13 @@ verify(NMSetting *setting, NMConnection *connection, GError **error) NM_IP_TUNNEL_MODE_GRE, NM_IP_TUNNEL_MODE_GRETAP, NM_IP_TUNNEL_MODE_IP6GRE, - NM_IP_TUNNEL_MODE_IP6GRETAP)) { + NM_IP_TUNNEL_MODE_IP6GRETAP, + NM_IP_TUNNEL_MODE_VTI, + NM_IP_TUNNEL_MODE_VTI6)) { g_set_error_literal(error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("tunnel keys can only be specified for GRE tunnels")); + _("tunnel keys can only be specified for GRE and VTI tunnels")); return FALSE; } } @@ -484,6 +506,18 @@ verify(NMSetting *setting, NMConnection *connection, GError **error) return FALSE; } + if (priv->fwmark && !NM_IN_SET(priv->mode, NM_IP_TUNNEL_MODE_VTI, NM_IP_TUNNEL_MODE_VTI6)) { + g_set_error_literal(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("can be set only on VTI tunnels")); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP_TUNNEL_SETTING_NAME, + NM_SETTING_IP_TUNNEL_FWMARK); + return FALSE; + } + if (nm_connection_get_setting_wired(connection) && !_nm_ip_tunnel_mode_is_layer2(priv->mode)) { g_set_error(error, NM_CONNECTION_ERROR, @@ -728,6 +762,25 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass) flow_label); /** + * NMSettingIPTunnel:fwmark: + * + * The fwmark value to assign to tunnel packets. This property can be set + * to a non zero value only on VTI and VTI6 tunnels. + * + * Since: 1.42 + **/ + _nm_setting_property_define_direct_uint32(properties_override, + obj_properties, + NM_SETTING_IP_TUNNEL_FWMARK, + PROP_FWMARK, + 0, + G_MAXUINT32, + 0, + NM_SETTING_PARAM_INFERRABLE, + NMSettingIPTunnelPrivate, + fwmark); + + /** * NMSettingIPTunnel:mtu: * * If non-zero, only transmit packets of the specified size or smaller, |