[network-manager-sstp/set-mtu] Adding in settings for controlling the MRU/MTU
- From: Eivind Næss <eivnaes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-sstp/set-mtu] Adding in settings for controlling the MRU/MTU
- Date: Sun, 18 Sep 2022 20:03:50 +0000 (UTC)
commit 1ae9d5975aa29c14a0cffd8a4812dc37674b4839
Author: Eivind Naess <eivnaes yahoo com>
Date: Fri Sep 16 10:02:49 2022 -0700
Adding in settings for controlling the MRU/MTU
Signed-off-by: Eivind Naess <eivnaes yahoo com>
properties/advanced-dialog.c | 35 +++++++++++++++++++++++
properties/nm-sstp-dialog.ui | 68 ++++++++++++++++++++++++++++++++++++++++++--
shared/nm-service-defines.h | 1 +
src/nm-sstp-service.c | 12 ++++++++
4 files changed, 113 insertions(+), 3 deletions(-)
---
diff --git a/properties/advanced-dialog.c b/properties/advanced-dialog.c
index 81a2165..0fb9451 100644
--- a/properties/advanced-dialog.c
+++ b/properties/advanced-dialog.c
@@ -68,6 +68,7 @@ static const char *advanced_keys[] = {
NM_SSTP_KEY_LCP_ECHO_FAILURE,
NM_SSTP_KEY_LCP_ECHO_INTERVAL,
NM_SSTP_KEY_UNIT_NUM,
+ NM_SSTP_KEY_MTU,
NM_SSTP_KEY_PROXY_SERVER,
NM_SSTP_KEY_PROXY_PORT,
NM_SSTP_KEY_PROXY_USER,
@@ -800,6 +801,30 @@ advanced_dialog_new (GHashTable *hash, gboolean is_tls, gchar *subject)
gtk_widget_set_sensitive (widget, FALSE);
}
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mtu_checkbutton"));
+ spin = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mtu_spinbutton"));
+ g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (checkbox_toggled_update_widget_cb), spin);
+
+ value = g_hash_table_lookup (hash, NM_SSTP_KEY_MTU);
+ if (value && *value) {
+ long int tmp;
+
+ errno = 0;
+ tmp = strtol (value, NULL, 10);
+ if (errno == 0 && tmp >= 0 && tmp <= 1500) {
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), TRUE);
+
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mtu_spinbutton"));
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), (gdouble) tmp);
+ gtk_widget_set_sensitive (widget, TRUE);
+ }
+ } else {
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), FALSE);
+
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mtu_spinbutton"));
+ gtk_widget_set_sensitive (widget, FALSE);
+ }
+
return dialog;
}
@@ -945,6 +970,16 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error)
g_strdup_printf ("%d", unit_num));
}
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mtu_checkbutton"));
+ if (gtk_check_button_get_active (GTK_CHECK_BUTTON (widget))) {
+ int mtu;
+
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mtu_spinbutton"));
+ mtu = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
+ g_hash_table_insert (hash, g_strdup (NM_SSTP_KEY_MTU),
+ g_strdup_printf ("%d", mtu));
+ }
+
/* TLS Authentication */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "tls_identity"));
value = gtk_editable_get_text (GTK_EDITABLE (widget));
diff --git a/properties/nm-sstp-dialog.ui b/properties/nm-sstp-dialog.ui
index b5601b8..399e644 100644
--- a/properties/nm-sstp-dialog.ui
+++ b/properties/nm-sstp-dialog.ui
@@ -12,6 +12,12 @@
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
+ <object class="GtkAdjustment" id="adjustment3">
+ <property name="upper">1500</property>
+ <property name="value">1400</property>
+ <property name="step-increment">1</property>
+ <property name="page-increment">10</property>
+ </object>
<object class="GtkSizeGroup" id="labels_group_3"/>
<object class="GtkListStore" id="model1">
<columns>
@@ -1086,15 +1092,14 @@ config: unit <n></property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">Enable custom index for
ppp<n> device name.
config: unit <n></property>
- <property name="margin-top">7</property>
<property name="adjustment">adjustment1</property>
<property name="climb-rate">1</property>
<property name="numeric">True</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
@@ -1104,6 +1109,51 @@ config: unit <n></property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="ppp_mtu_checkbutton">
+ <property name="label" translatable="yes">Set maximum transmission unit
(MTU):</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="tooltip-text" translatable="yes">Specify the maximum size of the
network packets that can be transmitted by this ppp<n> device. The default for Microsoft servers is
1400.</property>
+ <property name="halign">start</property>
+ <property name="hexpand">False</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="ppp_mtu_spinbutton">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="tooltip-text" translatable="yes">Specify the maximum size of the
network packets that can be transmitted by this ppp<n> device. The default for Microsoft servers is
1400.</property>
+ <property name="numeric">True</property>
+ <property name="adjustment">adjustment3</property>
+ <property name="climb-rate">1</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -1733,4 +1783,16 @@ or just the Common Name (CN field).
<widget name="proxy_password_label"/>
</widgets>
</object>
+ <object class="GtkSizeGroup" id="labels_group_6">
+ <widgets>
+ <widget name="ppp_mtu_checkbutton"/>
+ <widget name="ppp_unit_checkbutton"/>
+ </widgets>
+ </object>
+ <object class="GtkSizeGroup" id="spinbutton_group_7">
+ <widgets>
+ <widget name="ppp_mtu_spinbutton"/>
+ <widget name="ppp_unit_spinbutton"/>
+ </widgets>
+ </object>
</interface>
diff --git a/shared/nm-service-defines.h b/shared/nm-service-defines.h
index 40c4569..98e5950 100644
--- a/shared/nm-service-defines.h
+++ b/shared/nm-service-defines.h
@@ -59,6 +59,7 @@
#define NM_SSTP_KEY_LCP_ECHO_FAILURE "lcp-echo-failure"
#define NM_SSTP_KEY_LCP_ECHO_INTERVAL "lcp-echo-interval"
#define NM_SSTP_KEY_UNIT_NUM "unit"
+#define NM_SSTP_KEY_MTU "mtu"
#define NM_SSTP_KEY_PROXY_SERVER "proxy-server"
#define NM_SSTP_KEY_PROXY_PORT "proxy-port"
#define NM_SSTP_KEY_PROXY_USER "proxy-user"
diff --git a/src/nm-sstp-service.c b/src/nm-sstp-service.c
index 9ff17af..61b3b96 100644
--- a/src/nm-sstp-service.c
+++ b/src/nm-sstp-service.c
@@ -74,6 +74,7 @@ typedef struct {
#define NM_SSTP_PPPD_PLUGIN PLUGINDIR "/nm-sstp-pppd-plugin.so"
#define NM_SSTP_WAIT_PPPD 10000 /* 10 seconds */
+#define NM_SSTP_MTU_DEFAULT "1400"
#define SSTP_SERVICE_SECRET_TRIES "sstp-service-secret-tries"
/*****************************************************************************/
@@ -115,6 +116,7 @@ static const ValidProperty valid_properties[] = {
{ NM_SSTP_KEY_CA_CERT, G_TYPE_STRING, FALSE },
{ NM_SSTP_KEY_IGN_CERT_WARN, G_TYPE_BOOLEAN, FALSE },
{ NM_SSTP_KEY_TLS_EXT_ENABLE, G_TYPE_BOOLEAN, FALSE },
+ { NM_SSTP_KEY_MTU, G_TYPE_UINT, FALSE },
{ NM_SSTP_KEY_REFUSE_EAP, G_TYPE_BOOLEAN, FALSE },
{ NM_SSTP_KEY_REFUSE_PAP, G_TYPE_BOOLEAN, FALSE },
{ NM_SSTP_KEY_REFUSE_CHAP, G_TYPE_BOOLEAN, FALSE },
@@ -780,6 +782,16 @@ construct_pppd_args (NMSstpPlugin *plugin,
g_ptr_array_add (args, (gpointer) g_strdup ("need-peer-eap"));
}
+ value = nm_setting_vpn_get_data_item (s_vpn, NM_SSTP_KEY_MTU) ? : NM_SSTP_MTU_DEFAULT;
+ if (value && *value) {
+ long int tmp_int;
+ if (str_to_int (value, &tmp_int)) {
+ g_ptr_array_add (args, (gpointer) g_strdup ("mtu"));
+ g_ptr_array_add (args, (gpointer) g_strdup_printf("%ld", tmp_int));
+ } else
+ _LOGW ("failed to convert mtu value “%s”", value);
+ }
+
/* Allow EAP */
value = nm_setting_vpn_get_data_item (s_vpn, NM_SSTP_KEY_REFUSE_EAP);
if (value && !strcmp (value, "yes"))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]