mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-05-05 16:49:08 +00:00
Allow rspconfig to disable VLAN on IPMI BMCs
rspconfig vlan= only accepted values 1-4096 with no way to disable VLAN tagging. Users had to resort to raw IPMI commands to clear a stale VLAN after ip=dhcp. - Accept vlan=off/disable/disabled to clear VLAN tagging via standard IPMI parameter 0x14 with the enable bit unset - Fix valid range from 1-4096 to 1-4094 (IEEE 802.1Q) - Use strict digit matching to reject malformed inputs To clear VLAN after a DHCP reset: rspconfig <node> vlan=off Tested on Supermicro IPMI BMC (10.20.0.51). Partially addresses #3725
This commit is contained in:
@@ -450,7 +450,7 @@ OPTIONS
|
||||
|
||||
\ **vlan**\
|
||||
|
||||
Get or set vlan ID. For get vlan ID, if vlan is not enabled, 'BMC VLAN disabled' will be displayed. For set vlan ID, the valid value are [1-4096].
|
||||
Get or set VLAN ID. Valid VLAN IDs are 1-4094. On IPMI managed nodes, use \ **vlan=off**\ or \ **vlan=disable**\ to disable VLAN tagging.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -352,7 +352,7 @@ Get or set hostname on the service processor.
|
||||
|
||||
=item B<vlan>
|
||||
|
||||
Get or set vlan ID. For get vlan ID, if vlan is not enabled, 'BMC VLAN disabled' will be displayed. For set vlan ID, the valid value are [1-4096].
|
||||
Get or set VLAN ID. Valid VLAN IDs are 1-4094. On IPMI managed nodes, use B<vlan=off> or B<vlan=disable> to disable VLAN tagging.
|
||||
|
||||
=item B<ipsrc>
|
||||
|
||||
|
||||
@@ -946,18 +946,22 @@ sub setnetinfo {
|
||||
}
|
||||
@cmd = (0x01, $channel_number, 12, @mask);
|
||||
} elsif ($subcommand =~ m/vlan/) {
|
||||
unless ( int($argument) == $argument ) {
|
||||
$callback->({ errorcode => [1], error => ["The input $argument is invalid, please input an integer"] });
|
||||
return;
|
||||
if ($argument =~ /^(off|disable|disabled)$/i) {
|
||||
@cmd = (0x01, $channel_number, 0x14, 0x00, 0x00);
|
||||
} else {
|
||||
unless ( $argument =~ /^\d+$/ ) {
|
||||
$callback->({ errorcode => [1], error => ["The input $argument is invalid, please input an integer or 'off'"] });
|
||||
return;
|
||||
}
|
||||
unless (($argument>=1) && ($argument<=4094)) {
|
||||
$callback->({ errorcode => [1], error => ["The input $argument is invalid, valid value [1-4094] or 'off'"] });
|
||||
return;
|
||||
}
|
||||
my @vlanparam = ();
|
||||
$vlanparam[0] = ($argument & 0xff);
|
||||
$vlanparam[1] = 0x80 | (($argument & 0xf00) >> 8);
|
||||
@cmd = (0x01, $channel_number, 0x14, @vlanparam);
|
||||
}
|
||||
unless (($argument>=1) && ($argument<=4096)) {
|
||||
$callback->({ errorcode => [1], error => ["The input $argument is invalid, valid value [1-4096]"] });
|
||||
return;
|
||||
}
|
||||
my @vlanparam = ();
|
||||
$vlanparam[0] = ($argument & 0xff);
|
||||
$vlanparam[1] = 0x80 | (($argument & 0xf00) >> 8);
|
||||
@cmd = (0x01, $channel_number, 0x14, @vlanparam);
|
||||
} elsif ($subcommand =~ m/ip/ and $argument =~ m/dhcp/) {
|
||||
@cmd = (0x01, $channel_number, 0x4, 0x2);
|
||||
} elsif ($subcommand =~ m/ip/) {
|
||||
|
||||
Reference in New Issue
Block a user