Skip to content

port_forwarding: fix open-range TCP+UDP merge updating the wrong table#35

Merged
ispyisail merged 1 commit into
masterfrom
fix/port-forwarding-openrange-merge-wrong-table
Jul 6, 2026
Merged

port_forwarding: fix open-range TCP+UDP merge updating the wrong table#35
ispyisail merged 1 commit into
masterfrom
fix/port-forwarding-openrange-merge-wrong-table

Conversation

@ispyisail

Copy link
Copy Markdown
Owner

Summary

Found while adding the WAN-zone selector (#34): addPortoRangeRule()'s TCP+UDP merge-display code referenced portfRangeTable -- the forward-range table's variable, left behind as an implicit global (no var) by addPortfRangeRule() -- instead of portoRangeTable, the open-range table it's actually supposed to update.

In a real session this only manifests once a user has opened the Port Range Forwarding "Add" modal at some point earlier (making portfRangeTable a defined, live table reference) -- from then on, merging two open-range rules of opposite protocol (e.g. adding a UDP rule that matches an existing TCP one on the same port/IP) silently rewrites the forward-range table's row content ("Both", or the row's description) instead of the open-range table's own row.

Fix

One-line fix: portfRangeTable.rows[...]portoRangeTable.rows[...] on the line that sets the merged row's protocol label to "Both".

Test plan

  • node --check passes
  • New tests/known-devices/port-forwarding-open-range-merge.test.js (companion gargoyle-tools commit) -- confirmed the test fails against the pre-fix code (asserts the open-range row shows "TCP" instead of merging to "Both", and that the forward-range table's unrelated row was left alone) and passes with the fix
  • Full tests/known-devices/*.test.js suite -- 51/62 pass, same 8 pre-existing unrelated failures with/without this change
  • Deployed to a real vnet router and confirmed via grep that the fix landed (portoRangeTable.rows now appears in place of the old portfRangeTable.rows reference)

https://claude.ai/code/session_012xm1pavEAaQbR8Z5YoG8KX

addPortoRangeRule()'s merge-display code referenced portfRangeTable
(the forward-range table's module-global, left behind without var by
addPortfRangeRule()) instead of portoRangeTable, the open-range table
it's actually meant to update. Once a user had opened the forward-range
modal at any point in the session, merging two open-range rules of
opposite protocol silently rewrote the forward-range table's row
content instead of the open-range table's own row.
@ispyisail ispyisail merged commit 17c2905 into master Jul 6, 2026
@ispyisail ispyisail deleted the fix/port-forwarding-openrange-merge-wrong-table branch July 6, 2026 21:07
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.

1 participant