Skip to content

Allow rspconfig to disable VLAN on IPMI BMCs#27

Closed
viniciusferrao wants to merge 2 commits into
masterfrom
fix/ipmi-vlan-disable
Closed

Allow rspconfig to disable VLAN on IPMI BMCs#27
viniciusferrao wants to merge 2 commits into
masterfrom
fix/ipmi-vlan-disable

Conversation

@viniciusferrao

@viniciusferrao viniciusferrao commented May 3, 2026

Copy link
Copy Markdown
Member

Summary

  • rspconfig vlan= only accepted values 1-4096 with no way to disable VLAN tagging
  • Users had to resort to raw IPMI commands to clear stale VLAN tags
  • Also fixes a pre-existing operator precedence bug in the alert handler

Changes:

  • Accept vlan=off, vlan=disable, vlan=disabled to clear VLAN tagging (standard IPMI parameter 0x14)
  • Fix valid VLAN range from 1-4096 to 1-4094 (IEEE 802.1Q)
  • Use strict digit matching (/^\d+$/) to reject malformed inputs like 123abc
  • Fix alert handler precedence: parenthesize or alternatives so they're scoped to $subcommand eq "alert"
  • Tighten alert input matching to exact tokens while preserving en/dis abbreviations used by snmpmon.pm

Test plan

Tested on Supermicro IPMI BMC (10.20.0.51):

# Before fix: vlan=0 rejected, no way to disable
$ rspconfig smcbmc vlan=0
Error: The input 0 is invalid, valid value [1-4096]

# After fix: set and disable VLAN
$ rspconfig smcbmc vlan=100
smcbmc: BMC VLAN ID enabled: 100
$ rspconfig smcbmc vlan=off
smcbmc: BMC VLAN disabled

# BMC accessible after all operations
$ rspconfig smcbmc ip
smcbmc: BMC IP: 10.20.0.51
$ rspconfig smcbmc vlan
smcbmc: BMC VLAN disabled

perlcritic: no new findings (all pre-existing in ipmi.pm)

Fixes xcat2#3725

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5488a6578

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread xCAT-server/lib/xcat/plugins/ipmi.pm
@viniciusferrao viniciusferrao force-pushed the fix/ipmi-vlan-disable branch 4 times, most recently from dc97354 to 1c9627b Compare May 3, 2026 14:59
Two pre-existing bugs in the alert on/off conditions:

1. Operator precedence: 'and' with 'or' without parens caused any
   subcommand with argument matching /^en/ or /^dis/ to silently
   trigger the alert handler.

2. Loose prefix matching: /^en/ and /^dis/ accepted typos like
   "enterprise" or "discover". Replace with exact token matching
   while preserving the "en"/"dis" abbreviations used by snmpmon.pm.
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 xcat2#3725
@viniciusferrao viniciusferrao force-pushed the fix/ipmi-vlan-disable branch from 1c9627b to 2fa7fca Compare May 3, 2026 15:04
@viniciusferrao viniciusferrao deleted the fix/ipmi-vlan-disable branch May 3, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rspconfig on OpenPower (IPMI) does not reset all attributes of the bmc to factory

1 participant