Bridge VLAN table and port PVID tools for MikroTik MCP

1 hour ago

Before this pull request, an assistant using the MikroTik server could create VLAN sub-interfaces, but it couldn't touch the bridge VLAN table at all. That table says which ports carry each VLAN, tagged or untagged. Each bridge port also has a PVID for untagged traffic. Without both, you can't build a VLAN-filtering switch through the server. This closes issue 105.

Ask about this presentation

Chapters

  1. 0:00The gap
  2. 0:25Six new tools
  3. 0:52Safe writes
  4. 1:29What to check
Show transcript
  1. Before this pull request, an assistant using the MikroTik server could create VLAN sub-interfaces, but it couldn't touch the bridge VLAN table at all. That table says which ports carry each VLAN, tagged or untagged. Each bridge port also has a PVID for untagged traffic. Without both, you can't build a VLAN-filtering switch through the server. This closes issue 105.

    Slide text
    Pull request 127

    The MCP server could not manage VLANs on a bridge

    RouterOS keeps tagged and untagged ports per VLAN in the bridge VLAN table, and each port has its own PVID. Neither was reachable.

  2. The new bridge module adds six tools. Four manage the bridge VLAN table: list, add, update and remove. Two cover ports: one lists them with their PVIDs, and one updates the PVID, the accepted frame types and ingress filtering. Reads are marked read only, so read-only mode exposes just the two list tools. VLAN ids can be a single id, a comma list, or a range like 100 to 199.

    Slide text
    New bridge scope

    Six tools in one new module

    • list, add, update, remove bridge VLAN
    • list bridge ports, with each PVID
    • update bridge port: pvid, frame types, ingress filtering
  3. Two follow-up commits matter most. First, RouterOS prints nothing on success and stays silent when a set matches nothing, so the early code reported success for changes that never happened. Updates now count first and say not found, and any output from a write is treated as a refusal. Second, filter and name values were put into commands unescaped, so a crafted value could run a second command, even through a read-only tool. Everything now goes through the shared quoting helper, with fifteen tests that failed before. Dynamic entries created from PVIDs are never touched.

    Slide text
    Review follow-ups

    Writes are confirmed and input cannot escape its quotes

    • update of a missing entry now says not found
    • any output from a write is a refusal
    • values go through ros_quoted
    • dynamic entries are never modified
  4. A reviewer tested this on real hardware with a read-only account, and the refusals came back as failures with the device untouched. The unit suite has fifty bridge tests and about 750 overall. Two non-blocking gaps remain. VLAN ids aren't range checked, though RouterOS refuses bad ones. And removing an entry doesn't mention a dynamic entry with the same id that survives. If the API coverage manifest merges first, the six tools need to be declared there.

    Slide text
    For the reviewer

    Verified on hardware, with two small gaps left

    • read-only account on RouterOS 7.24: refusals surface
    • vlan_ids has no range check
    • removal does not mention a surviving dynamic twin

What happened in AI today, in your inbox

One short email each evening. Read it and you’re caught up.

Built with ❤️ in New York