Handle upper case MAC addresses in ifname option

While the documentation states that ifname MAC addresses must be
lower case, we silently accept upper case ones and fail later on
when udev doesn't rename the device.

Instead of adding sanity checking on the MAC address just convert
it to lower case and remove the requirement completely.
This commit is contained in:
Anton Blanchard 2011-12-27 09:08:27 +11:00 committed by Harald Hoyer
parent 2e7b661681
commit acfab3733f
2 changed files with 2 additions and 2 deletions

View File

@ -464,7 +464,6 @@ This parameter can be specified multiple times.</para>
<term><envar>ifname=</envar><replaceable>&lt;interface&gt;</replaceable>:<replaceable>&lt;MAC&gt;</replaceable></term>
<listitem>
<para>Assign network device name &lt;interface&gt; (ie eth0) to the NIC with MAC &lt;MAC&gt;.
Note letters in the MAC-address must be lowercase!
<remark>Note: If you use this option you <emphasis remap="B">must</emphasis> specify an ifname= argument for all interfaces used in ip= or fcoe= arguments.</remark>
This parameter can be specified multiple times.</para>
</listitem>

View File

@ -25,7 +25,8 @@ parse_ifname_opts() {
case $# in
7)
ifname_if=$1
ifname_mac=$2:$3:$4:$5:$6:$7
# udev requires MAC addresses to be lower case
ifname_mac=`echo $2:$3:$4:$5:$6:$7 | tr '[:upper:]' '[:lower:]'`
;;
*)
die "Invalid arguments for ifname="