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.
This commit is contained in:

committed by
Lubomir Rintel

parent
c7423dca89
commit
22e388d90e
@@ -692,16 +692,29 @@ parse_rd_znet (GHashTable *connections, char *argument, gboolean net_ifnames)
|
|||||||
const char *prefix;
|
const char *prefix;
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
NMSettingWired *s_wired;
|
NMSettingWired *s_wired;
|
||||||
|
static int count_ctc = 0;
|
||||||
|
static int count_eth = 0;
|
||||||
|
int index;
|
||||||
|
|
||||||
nettype = get_word (&argument, ',');
|
nettype = get_word (&argument, ',');
|
||||||
subchannels[0] = get_word (&argument, ',');
|
subchannels[0] = get_word (&argument, ',');
|
||||||
subchannels[1] = get_word (&argument, ',');
|
subchannels[1] = get_word (&argument, ',');
|
||||||
|
|
||||||
if (nm_streq0 (nettype, "ctc")) {
|
if (nm_streq0 (nettype, "ctc")) {
|
||||||
prefix = "sl";
|
if (net_ifnames == TRUE) {
|
||||||
|
prefix = "sl";
|
||||||
|
} else {
|
||||||
|
prefix = "ctc";
|
||||||
|
index = count_ctc++;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
subchannels[2] = get_word (&argument, ',');
|
subchannels[2] = get_word (&argument, ',');
|
||||||
prefix = "en";
|
if (net_ifnames == TRUE) {
|
||||||
|
prefix = "en";
|
||||||
|
} else {
|
||||||
|
prefix = "eth";
|
||||||
|
index = count_eth++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (net_ifnames == TRUE) {
|
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;
|
bus_id += bus_id_start < bus_id_len ? bus_id_start : bus_id_len - 1;
|
||||||
|
|
||||||
ifname = g_strdup_printf ("%sc%s", prefix, bus_id);
|
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);
|
connection = get_conn (connections, ifname, NM_SETTING_WIRED_SETTING_NAME);
|
||||||
|
Reference in New Issue
Block a user