From 3d81c82e58f61da463a6bd945cd5ef2cddbd8a3a Mon Sep 17 00:00:00 2001 From: Chuck Anderson Date: Thu, 8 Jan 2009 12:51:13 -0500 Subject: [PATCH] ifcfg-rh: fix IP4 address fallbacks Previous code forgot to clear a temporary variable when reading IPv4 addresses from ifcfg files, and when the value being read wasn't in the ifcfg file, it could set wrong values in the connection for that variable even though it didn't exist. --- system-settings/plugins/ifcfg-rh/reader.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/system-settings/plugins/ifcfg-rh/reader.c b/system-settings/plugins/ifcfg-rh/reader.c index 931e0911aa..4d65915274 100644 --- a/system-settings/plugins/ifcfg-rh/reader.c +++ b/system-settings/plugins/ifcfg-rh/reader.c @@ -222,11 +222,13 @@ make_ip4_setting (shvarFile *ifcfg, GError **error) if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) { addr = nm_ip4_address_new (); + tmp = 0; get_one_ip4_addr (ifcfg, "IPADDR", &tmp, error); if (*error) goto error; nm_ip4_address_set_address (addr, tmp); + tmp = 0; get_one_ip4_addr (ifcfg, "GATEWAY", &tmp, error); if (*error) goto error; @@ -236,6 +238,7 @@ make_ip4_setting (shvarFile *ifcfg, GError **error) if (!nm_ip4_address_get_gateway (addr)) { network_ifcfg = svNewFile (SYSCONFDIR "/sysconfig/network"); if (network_ifcfg) { + tmp = 0; get_one_ip4_addr (network_ifcfg, "GATEWAY", &tmp, error); svCloseFile (network_ifcfg); if (*error) @@ -262,6 +265,7 @@ make_ip4_setting (shvarFile *ifcfg, GError **error) /* Fall back to NETMASK if no PREFIX was specified */ if (!nm_ip4_address_get_prefix (addr)) { + netmask = 0; get_one_ip4_addr (ifcfg, "NETMASK", &netmask, error); if (*error) goto error;