Commit 91921525 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

When specifying the accesspoint, allow the MAC to be in either dotted

or undotted notation.
parent 3bb1cbeb
...@@ -195,20 +195,28 @@ sub os_ifconfig_line($$$$$$$;$$) ...@@ -195,20 +195,28 @@ sub os_ifconfig_line($$$$$$$;$$)
return undef; return undef;
} }
my $accesspoint = $settings->{"accesspoint"}; my $accesspoint = $settings->{"accesspoint"};
my $accesspointwdots;
# Allow either dotted or undotted notation!
if ($accesspoint =~ /^(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})$/) {
$accesspointwdots = "$1:$2:$3:$4:$5:$6";
}
elsif ($accesspoint =~
/^(\w{2}):(\w{2}):(\w{2}):(\w{2}):(\w{2}):(\w{2})$/) {
$accesspointwdots = $accesspoint;
$accesspoint = "${1}${2}${3}${4}${5}${6}";
}
else {
warn("*** WARNING: Improper format for MAC ($accesspoint) ".
"provided for $iface!\n");
return undef;
}
if (libsetup::findiface($accesspoint) eq $iface) { if (libsetup::findiface($accesspoint) eq $iface) {
$iwcmd .= " mode Master"; $iwcmd .= " mode Master";
} }
else { else {
if ($accesspoint =~ /^(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})$/) { $iwcmd .= " mode Managed ap $accesspointwdots";
$accesspoint = "$1:$2:$3:$4:$5:$6";
$iwcmd .= " mode Managed ap $accesspoint";
}
else {
warn("*** WARNING: Bad accesspoint provided for $iface!\n");
return undef;
}
} }
$uplines = sprintf($IFCONFIG, $iface, $inet, $mask) . "\n"; $uplines = sprintf($IFCONFIG, $iface, $inet, $mask) . "\n";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment