ifcfg-rh: add support for gateway ping timeout

This commit is contained in:
Dan Williams 2013-07-12 22:32:06 -05:00
parent 7c2abb2c9f
commit d687492d49
2 changed files with 23 additions and 0 deletions

View file

@ -228,6 +228,21 @@ make_connection_setting (const char *file,
g_free (value);
}
value = svGetValue (ifcfg, "GATEWAY_PING_TIMEOUT", FALSE);
if (value) {
long int tmp;
guint32 timeout;
errno = 0;
tmp = strtol (value, NULL, 10);
if (errno == 0 && tmp >= 0 && tmp < G_MAXINT32) {
timeout = (guint32) tmp;
g_object_set (s_con, NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, timeout, NULL);
} else
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid GATEWAY_PING_TIMEOUT time");
g_free (value);
}
return NM_SETTING (s_con);
}

View file

@ -1430,6 +1430,7 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
guint32 n, i;
GString *str;
const char *master;
char *tmp;
svSetValue (ifcfg, "NAME", nm_setting_connection_get_id (s_con), FALSE);
svSetValue (ifcfg, "UUID", nm_setting_connection_get_uuid (s_con), FALSE);
@ -1491,6 +1492,13 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
svSetValue (ifcfg, "SECONDARY_UUIDS", str->str, FALSE);
g_string_free (str, TRUE);
}
svSetValue (ifcfg, "GATEWAY_PING_TIMEOUT", NULL, FALSE);
if (nm_setting_connection_get_gateway_ping_timeout (s_con)) {
tmp = g_strdup_printf ("%" G_GUINT32_FORMAT, nm_setting_connection_get_gateway_ping_timeout (s_con));
svSetValue (ifcfg, "GATEWAY_PING_TIMEOUT", tmp, FALSE);
g_free (tmp);
}
}
static gboolean