mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-09 13:30:20 +01:00
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.
This commit is contained in:
parent
a10775c928
commit
3d81c82e58
1 changed files with 4 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue