summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan HorĂ¡k <dan@danny.cz>2019-10-23 11:56:47 +0200
committerLubomir Rintel <lkundrak@v3.sk>2019-11-04 16:22:14 +0100
commit22e388d90e4ffbddbe44cfaef0c3e15782e5576a (patch)
tree47e8720b55c69b8212fef12ee6b28d6757fc4441
parentc7423dca894caa6083f0160c61eaa5e3fa724efd (diff)
downloadNetworkManager-22e388d90e4ffbddbe44cfaef0c3e15782e5576a.tar.gz
initrd: handle rd.znet with legacy interface names
Handle rd.znet with legacy interface names too, the index for eth or ctc corresponds to the position on the command line.
-rw-r--r--src/initrd/nmi-cmdline-reader.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/initrd/nmi-cmdline-reader.c b/src/initrd/nmi-cmdline-reader.c
index 76abb2bb77..a4f4687651 100644
--- a/src/initrd/nmi-cmdline-reader.c
+++ b/src/initrd/nmi-cmdline-reader.c
@@ -692,16 +692,29 @@ parse_rd_znet (GHashTable *connections, char *argument, gboolean net_ifnames)
const char *prefix;
NMConnection *connection;
NMSettingWired *s_wired;
+ static int count_ctc = 0;
+ static int count_eth = 0;
+ int index;
nettype = get_word (&argument, ',');
subchannels[0] = get_word (&argument, ',');
subchannels[1] = get_word (&argument, ',');
if (nm_streq0 (nettype, "ctc")) {
- prefix = "sl";
+ if (net_ifnames == TRUE) {
+ prefix = "sl";
+ } else {
+ prefix = "ctc";
+ index = count_ctc++;
+ }
} else {
subchannels[2] = get_word (&argument, ',');
- prefix = "en";
+ if (net_ifnames == TRUE) {
+ prefix = "en";
+ } else {
+ prefix = "eth";
+ index = count_eth++;
+ }
}
if (net_ifnames == TRUE) {
@@ -716,6 +729,8 @@ parse_rd_znet (GHashTable *connections, char *argument, gboolean net_ifnames)
bus_id += bus_id_start < bus_id_len ? bus_id_start : bus_id_len - 1;
ifname = g_strdup_printf ("%sc%s", prefix, bus_id);
+ } else {
+ ifname = g_strdup_printf ("%s%d", prefix, index);
}
connection = get_conn (connections, ifname, NM_SETTING_WIRED_SETTING_NAME);