Skip to content

Fix off-by-one when setting number of ports#68

Merged
rd235 merged 2 commits intomasterfrom
port_numport_fix
Mar 23, 2026
Merged

Fix off-by-one when setting number of ports#68
rd235 merged 2 commits intomasterfrom
port_numport_fix

Conversation

@danielinux
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 23, 2026 08:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses an off-by-one mismatch between the user-configured “number of ports” and the internal port table sizing by treating the configured value as the external port count and reserving an internal extra slot (port 0).

Changes:

  • Initialize port/FSTP subsystems with numports + 1 to account for the internal reserved port.
  • Update port/setnumports resizing logic to allocate/resize using val + 1 internally while keeping external reporting consistent.
  • Adjust port/showinfo output to report the external port count.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/vde_switch/vde_switch.c Initializes switch subsystems with an internal port count of numports + 1.
src/vde_switch/port.c Introduces external-vs-internal port count handling and resizes internal tables accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/vde_switch/vde_switch.c
Comment thread src/vde_switch/port.c Outdated
@rd235 rd235 merged commit 6ad51c2 into master Mar 23, 2026
2 checks passed
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.

3 participants