mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 23:40:16 +01:00
ifcfg-rh: accept BOOTPROTO=static with missing IPv4 addresses
Dracut when faced with an ipv6 only setup during kickstart will generate a ifcfg file that sets the ipv4 address things to null but sets BOOTPROTO=static. This makes network manager screw up because it expects an ipv4 address to be set. Instead deal with this case by checking if we have any ipv4 addrs set, and if not just disable ipv4. This fixes our inability to kickstart in our ipv6 only clusters. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> https://mail.gnome.org/archives/networkmanager-list/2015-October/msg00015.html
This commit is contained in:
parent
90fb64024c
commit
68eb350ad8
3 changed files with 26 additions and 6 deletions
|
|
@ -956,7 +956,10 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
} else if (!g_ascii_strcasecmp (value, "bootp") || !g_ascii_strcasecmp (value, "dhcp")) {
|
||||
method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
|
||||
} else if (!g_ascii_strcasecmp (value, "static")) {
|
||||
method = NM_SETTING_IP4_CONFIG_METHOD_MANUAL;
|
||||
if (is_any_ip4_address_defined (ifcfg, NULL))
|
||||
method = NM_SETTING_IP4_CONFIG_METHOD_MANUAL;
|
||||
else
|
||||
method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
|
||||
} else if (!g_ascii_strcasecmp (value, "autoip")) {
|
||||
g_free (value);
|
||||
g_object_set (s_ip4,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
IPADDR=
|
||||
GATEWAY=
|
||||
NETMASK=
|
||||
BOOTPROTO=static
|
||||
TYPE=Ethernet
|
||||
DEVICE=eth2
|
||||
HWADDR=00:11:22:33:44:ee
|
||||
ONBOOT=yes
|
||||
USERCTL=yes
|
||||
NM_CONTROLLED=yes
|
||||
PEERDNS=yes
|
||||
DNS1=1:2:3:4::a
|
||||
DOMAIN="lorem.com ipsum.org dolor.edu"
|
||||
IPV6INIT=yes
|
||||
IPV6_AUTOCONF=no
|
||||
IPV6ADDR="1001:abba::1234/56"
|
||||
|
|
@ -1685,9 +1685,10 @@ test_read_wired_ipv6_manual (void)
|
|||
}
|
||||
|
||||
#define TEST_IFCFG_WIRED_IPV6_ONLY TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-ipv6-only"
|
||||
#define TEST_IFCFG_WIRED_IPV6_ONLY_1 TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-ipv6-only-1"
|
||||
|
||||
static void
|
||||
test_read_wired_ipv6_only (void)
|
||||
test_read_wired_ipv6_only (const char *file, const char *expected_id)
|
||||
{
|
||||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
|
|
@ -1697,17 +1698,16 @@ test_read_wired_ipv6_only (void)
|
|||
char *unmanaged = NULL;
|
||||
GError *error = NULL;
|
||||
const char *tmp;
|
||||
const char *expected_id = "System test-wired-ipv6-only";
|
||||
NMIPAddress *ip6_addr;
|
||||
const char *method;
|
||||
|
||||
connection = connection_from_file_test (TEST_IFCFG_WIRED_IPV6_ONLY,
|
||||
connection = connection_from_file_test (file,
|
||||
NULL,
|
||||
TYPE_ETHERNET,
|
||||
&unmanaged,
|
||||
&error);
|
||||
ASSERT (connection != NULL,
|
||||
"wired-ipv6-only-read", "failed to read %s: %s", TEST_IFCFG_WIRED_IPV6_ONLY, error->message);
|
||||
"wired-ipv6-only-read", "failed to read %s: %s", file, error->message);
|
||||
|
||||
ASSERT (nm_connection_verify (connection, &error),
|
||||
"wired-ipv6-only-verify", "failed to verify %s: %s", TEST_IFCFG_WIRED_IPV6_ONLY, error->message);
|
||||
|
|
@ -12914,7 +12914,8 @@ int main (int argc, char **argv)
|
|||
test_read_wired_ipv4_manual (TEST_IFCFG_WIRED_IPV4_MANUAL_3, "System test-wired-ipv4-manual-3");
|
||||
test_read_wired_ipv4_manual (TEST_IFCFG_WIRED_IPV4_MANUAL_4, "System test-wired-ipv4-manual-4");
|
||||
test_read_wired_ipv6_manual ();
|
||||
test_read_wired_ipv6_only ();
|
||||
test_read_wired_ipv6_only (TEST_IFCFG_WIRED_IPV6_ONLY, "System test-wired-ipv6-only");
|
||||
test_read_wired_ipv6_only (TEST_IFCFG_WIRED_IPV6_ONLY_1, "System test-wired-ipv6-only-1");
|
||||
test_read_wired_dhcp6_only ();
|
||||
test_read_onboot_no ();
|
||||
test_read_noip ();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue