[network-manager-iodine] Unbreak MTU parsing
- From: Guido Günther <guidog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-iodine] Unbreak MTU parsing
- Date: Sun, 5 Feb 2017 00:45:59 +0000 (UTC)
commit 1f97c01496dee53d6d27095529c781222a3b803d
Author: Guido Günther <agx sigxcpu org>
Date: Sun Feb 5 01:43:50 2017 +0100
Unbreak MTU parsing
by using g_variant_new_uint32 instead of addr4_to_gvariant
introduced by a9fad49eceb1928fb7dd5ff63f4b4b384f35c81a
src/nm-iodine-service.c | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/src/nm-iodine-service.c b/src/nm-iodine-service.c
index 0164133..705d4fe 100644
--- a/src/nm-iodine-service.c
+++ b/src/nm-iodine-service.c
@@ -250,6 +250,7 @@ iodine_parse_stderr_line (NMVpnServicePlugin *plugin,
NMIodinePluginPrivate *priv = NM_IODINE_PLUGIN_GET_PRIVATE (plugin);
gchar **split = NULL;
GVariant *val;
+ long int mtu;
gint len;
gint ret = 1;
@@ -321,15 +322,21 @@ iodine_parse_stderr_line (NMVpnServicePlugin *plugin,
return -1;
}
} else if (g_str_has_prefix(line, "Setting MTU of ")) {
- g_message("MTU: %s", split[len-1]);
- val = addr4_to_gvariant (split[len-1]);
- if (val) {
- g_variant_builder_add (&priv->ip4config, "{sv}",
- NM_VPN_PLUGIN_IP4_CONFIG_MTU,
- val);
+ errno = 0;
+ mtu = strtol (split[len-1], NULL, 10);
+ if (errno || mtu < 0 || mtu > 20000) {
+ g_warning("Ignoring invalid tunnel MTU '%s'", split[len-1]);
} else {
- g_warning("Could not set MTU");
- return -1;
+ g_message("MTU: %s", split[len-1]);
+ val = g_variant_new_uint32 ((guint32) mtu);
+ if (val) {
+ g_variant_builder_add (&priv->ip4config, "{sv}",
+ NM_VPN_PLUGIN_IP4_CONFIG_MTU,
+ val);
+ } else {
+ g_warning("Could not set MTU");
+ return -1;
+ }
}
} else if (g_str_has_prefix(line, "Opened dns")) {
g_message("Interface: %s", split[len-1]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]