diff options
author | Dan HorĂ¡k <dan@danny.cz> | 2019-10-22 11:18:09 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2019-11-04 15:44:58 +0100 |
commit | adcc52c3daafd71d5687a54cc1d9d62653ddd4b7 (patch) | |
tree | 8f9d45175e982b9b6003e5fc9f7ce5dcfd09498a | |
parent | 4e34807a8cfd4e6e6314ec75a6e34646b89fad3f (diff) | |
download | NetworkManager-adcc52c3daafd71d5687a54cc1d9d62653ddd4b7.tar.gz |
initrd: use proper interface when adding s390 specific details
The current solution for s390 specific details relies on an interface to
exist before adding the s390 details. It means the ip= option must precede
the rd.znet= option. Also only a single interface can be configured. With
this change the s390 details are put to the right interface and properly
named interface is created if it hasn't existed yet.
-rw-r--r-- | src/initrd/nmi-cmdline-reader.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/initrd/nmi-cmdline-reader.c b/src/initrd/nmi-cmdline-reader.c index b607c6da62..3a3227254a 100644 --- a/src/initrd/nmi-cmdline-reader.c +++ b/src/initrd/nmi-cmdline-reader.c @@ -688,16 +688,33 @@ parse_rd_znet (GHashTable *connections, char *argument) const char *nettype; const char *subchannels[4] = { 0, 0, 0, 0 }; const char *tmp; + const char *ifname, *prefix; + const char *bus_id; + size_t bus_id_len; + size_t bus_id_start; NMConnection *connection; NMSettingWired *s_wired; nettype = get_word (&argument, ','); subchannels[0] = get_word (&argument, ','); + + /* The following logic is taken from names_ccw() in systemd/src/udev/udev-builtin-net_id.c */ + bus_id = subchannels[0]; + bus_id_len = strlen (bus_id); + bus_id_start = strspn (bus_id, ".0"); + bus_id += bus_id_start < bus_id_len ? bus_id_start : bus_id_len - 1; + subchannels[1] = get_word (&argument, ','); - if (!nm_streq0 (nettype, "ctc")) + + if (nm_streq0 (nettype, "ctc")) { + prefix = "sl"; + } else { subchannels[2] = get_word (&argument, ','); + prefix = "en"; + } - connection = get_conn (connections, NULL, NM_SETTING_WIRED_SETTING_NAME); + ifname = g_strdup_printf ("%sc%s", prefix, bus_id); + connection = get_conn (connections, ifname, NM_SETTING_WIRED_SETTING_NAME); s_wired = nm_connection_get_setting_wired (connection); g_object_set (s_wired, NM_SETTING_WIRED_S390_NETTYPE, nettype, |