SETTING_FIELD (NM_SETTING_IP_TUNNEL_OUTPUT_KEY), /* 9 */
SETTING_FIELD (NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT), /* 10 */
SETTING_FIELD (NM_SETTING_IP_TUNNEL_FLOW_LABEL), /* 11 */
+ SETTING_FIELD (NM_SETTING_IP_TUNNEL_MTU), /* 12 */
{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
};
#define NMC_FIELDS_SETTING_IP_TUNNEL_ALL "name"","\
NM_SETTING_IP_TUNNEL_INPUT_KEY","\
NM_SETTING_IP_TUNNEL_OUTPUT_KEY","\
NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT","\
- NM_SETTING_IP_TUNNEL_FLOW_LABEL
+ NM_SETTING_IP_TUNNEL_FLOW_LABEL","\
+ NM_SETTING_IP_TUNNEL_MTU
#define NMC_FIELDS_SETTING_IP_TUNNEL_COMMON NMC_FIELDS_SETTING_IP_TUNNEL_ALL
/* Available fields for NM_SETTING_MACVLAN_SETTING_NAME */
DEFINE_GETTER (nmc_property_ip_tunnel_get_output_key, NM_SETTING_IP_TUNNEL_OUTPUT_KEY);
DEFINE_GETTER (nmc_property_ip_tunnel_get_encapsulation_limit, NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT);
DEFINE_GETTER (nmc_property_ip_tunnel_get_flow_label, NM_SETTING_IP_TUNNEL_FLOW_LABEL);
+DEFINE_GETTER (nmc_property_ip_tunnel_get_mtu, NM_SETTING_IP_TUNNEL_MTU);
static const char **
nmc_property_ip_tunnel_allowed_mode (NMSetting *setting, const char *prop)
NULL,
NULL,
NULL);
+ nmc_add_prop_funcs (GLUE (IP_TUNNEL, MTU),
+ nmc_property_ip_tunnel_get_mtu,
+ nmc_property_set_uint,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
/* Add editable properties for NM_SETTING_MACVLAN_SETTING_NAME */
nmc_add_prop_funcs (GLUE (MACVLAN, PARENT),
set_val_str (arr, 9, nmc_property_ip_tunnel_get_output_key (setting, NMC_PROPERTY_GET_PRETTY));
set_val_str (arr, 10, nmc_property_ip_tunnel_get_encapsulation_limit (setting, NMC_PROPERTY_GET_PRETTY));
set_val_str (arr, 11, nmc_property_ip_tunnel_get_flow_label (setting, NMC_PROPERTY_GET_PRETTY));
+ set_val_str (arr, 12, nmc_property_ip_tunnel_get_mtu (setting, NMC_PROPERTY_GET_PRETTY));
g_ptr_array_add (nmc->output_data, arr);
print_data (nmc); /* Print all data */
char *output_key;
guint encapsulation_limit;
guint flow_label;
+ guint mtu;
} NMSettingIPTunnelPrivate;
enum {
PROP_OUTPUT_KEY,
PROP_ENCAPSULATION_LIMIT,
PROP_FLOW_LABEL,
+ PROP_MTU,
LAST_PROP
};
return NM_SETTING_IP_TUNNEL_GET_PRIVATE (setting)->flow_label;
}
+/**
+ * nm_setting_ip_tunnel_get_mtu:
+ * @setting: the #NMSettingIPTunnel
+ *
+ * Returns the #NMSettingIPTunnel:mtu property of the setting.
+ *
+ * Returns: the MTU
+ *
+ * Since: 1.2
+ **/
+guint
+nm_setting_ip_tunnel_get_mtu (NMSettingIPTunnel *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_IP_TUNNEL (setting), 0);
+
+ return NM_SETTING_IP_TUNNEL_GET_PRIVATE (setting)->mtu;
+}
+
/*********************************************************************/
static gboolean
case PROP_FLOW_LABEL:
priv->flow_label = g_value_get_uint (value);
break;
+ case PROP_MTU:
+ priv->mtu = g_value_get_uint (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
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;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
G_PARAM_CONSTRUCT |
NM_SETTING_PARAM_INFERRABLE |
G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingIPTunel:mtu:
+ *
+ * If non-zero, only transmit packets of the specified size or smaller,
+ * breaking larger packets up into multiple fragments.
+ *
+ * Since: 1.2
+ **/
+ g_object_class_install_property
+ (object_class, PROP_MTU,
+ g_param_spec_uint (NM_SETTING_IP_TUNNEL_MTU, "", "",
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ NM_SETTING_PARAM_FUZZY_IGNORE |
+ G_PARAM_STATIC_STRINGS));
}
#define NM_SETTING_IP_TUNNEL_OUTPUT_KEY "output-key"
#define NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT "encapsulation-limit"
#define NM_SETTING_IP_TUNNEL_FLOW_LABEL "flow-label"
+#define NM_SETTING_IP_TUNNEL_MTU "mtu"
struct _NMSettingIPTunnel {
NMSetting parent;
guint nm_setting_ip_tunnel_get_encapsulation_limit (NMSettingIPTunnel *setting);
NM_AVAILABLE_IN_1_2
guint nm_setting_ip_tunnel_get_flow_label (NMSettingIPTunnel *setting);
+NM_AVAILABLE_IN_1_2
+guint nm_setting_ip_tunnel_get_mtu (NMSettingIPTunnel *setting);
G_END_DECLS
nm_setting_ip_tunnel_get_input_key;
nm_setting_ip_tunnel_get_local;
nm_setting_ip_tunnel_get_mode;
+ nm_setting_ip_tunnel_get_mtu;
nm_setting_ip_tunnel_get_output_key;
nm_setting_ip_tunnel_get_parent;
nm_setting_ip_tunnel_get_path_mtu_discovery;
#include "nm-core-internal.h"
#include "nm-connection-provider.h"
#include "nm-activation-request.h"
+#include "nm-ip4-config.h"
#include "nmdbus-device-ip-tunnel.h"
update_properties (device);
}
+static void
+ip4_config_pre_commit (NMDevice *device, NMIP4Config *config)
+{
+ NMConnection *connection;
+ NMSettingIPTunnel *s_ip_tunnel;
+ guint32 mtu;
+
+ connection = nm_device_get_applied_connection (device);
+ g_assert (connection);
+ s_ip_tunnel = nm_connection_get_setting_ip_tunnel (connection);
+ g_assert (s_ip_tunnel);
+
+ /* MTU override */
+ mtu = nm_setting_ip_tunnel_get_mtu (s_ip_tunnel);
+ if (mtu)
+ nm_ip4_config_set_mtu (config, mtu, NM_IP_CONFIG_SOURCE_USER);
+}
+
static void
unrealize (NMDevice *device, gboolean remove_resources)
{
device_class->update_connection = update_connection;
device_class->check_connection_compatible = check_connection_compatible;
device_class->create_and_realize = create_and_realize;
+ device_class->ip4_config_pre_commit = ip4_config_pre_commit;
device_class->realize = realize;
device_class->setup_start = setup_start;
device_class->unrealize = unrealize;