Skip to content

feat(start-wrt): use USB Ethernet adapters as LAN ports - #4662

Merged
Dominion5254 merged 9 commits into
masterfrom
wrt/usb-ethernet-ports
Nov 11, 2026
Merged

Dominion5254 merged 9 commits into
masterfrom
wrt/usb-ethernet-ports

Conversation

@Dominion5254

@Dominion5254 Dominion5254 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

A USB Ethernet adapter in one of the router's USB-A ports becomes a LAN port with its own Security Profile.

What it does

  • One port per USB socket. The first time an Ethernet-type USB network device is plugged into a socket, the daemon records that socket in startwrt (config usb_port, keyed by controller and port chain on the socket's USB 2 side) and adds a usb_eth<N> port to the LAN bridge in the Admin profile. The profile belongs to the socket, not the adapter, and persists while the socket is empty. Each socket of a hub is a port of its own: the kernel reports removable and connect_type as unknown, so an onboard hub cannot be told from a plugged-in one, and no socket is treated as shared.
  • Dataplane. usb_eth<N> is a veth on br-lan carrying the port's VLAN; its peer joins br-usb_eth<N>, which the adapter joins. Plugging in needs no network reload. The watcher follows ip monitor link and re-attaches the veth peer whenever netifd resets it (netifd treats a veth's peer as its parent).
  • Socket identity. The socket is read from the hub's port node, not the USB device's port link: on a fresh enumeration the adapter's network device can register before that link exists, which left the adapter unused with no later event to retry on.
  • Packet steering. The watcher runs /etc/init.d/packet_steering reload when an adapter joins its port. Steering otherwise runs at boot and on network reloads, so a hot-plugged adapter kept all its packet work on one core.
  • LAN guard. 10-startwrt-lan-dhcp-guard.nft accepts frames entering a USB port's bridge from its usb_eth<N>-up link: they are the router's own or were checked on br-lan. Without it the guard dropped the router's own DHCP replies and RAs crossing a USB port's bridge. Frames a USB port sends into br-lan are checked there, which is where a VLAN-tagged frame from behind an adapter loses its tag.
  • Profile change. An r8152 adapter keeps link with its interface down, so the bounce de-authorizes and re-authorizes the adapter's USB device. Ethernet ports are bounced as before.
  • Removal. ethernet.remove-usb-port (trash button on the Ethernet page) forgets a port with no adapter plugged in. While an adapter is plugged in, the button is disabled and its hint says to unplug the adapter; the handler refuses as well, which covers a click before the page next polls. Removal reloads the network before it returns, because netifd would otherwise give a later port of the same name the removed port's VLAN; the reload runs as its own task, so it finishes when the caller disconnects. A new port takes the lowest unused number.
  • ethernet.get adds usb_ports (present, active); ethernet.set keeps a recorded USB port a stale request omits and refuses one as WAN. config.check reads usb_port sections for the Ethernet page.
  • Image. kmod-usb-net-{rtl8152,asix,asix-ax88179,cdc-ether,cdc-ncm,rndis}. kmod-usb-net-rtl8152 depends on kmod-crypto-sha256, whose module kernel 6.18 renamed; openwrt-patches/0010 follows the rename (same shape as 0003). Without it the image does not build.

Docs, help text, changelog fragment and translations are included.

Verification

The disabled trash button (e99516f) was checked and benched on e99516f. 93d792c is that commit with master 246876d merged; the merge conflicted only in the five dictionaries, where master had taken string ID 633, so this PR's strings moved to 634–638, and npm run check:i18n:wrt (599 keys) and npm run check:wrt passed on 93d792c.

Earlier checks ran on 1ee09422b; 59d2b43 is that commit rebased onto master ed6bc4b without conflicts, with the commit message rewritten. make start-wrt-test and make start-wrt-format-check ran again on 99fe1ee (review round 1).

  • make start-wrt-test: 911 + 37 passed
  • npm run check:wrt, npm run check:i18n:wrt (599 keys), make start-wrt-rpc-bindings-check, make start-wrt-format-check, prettier --check: clean
  • node scripts/changelog.mjs check-version projects/start-wrt: passes on 59d2b43

Live bench (K1, RTL8153 adapters, a real wired client behind each):

  • Flashed image (built at 7c640b636, sysupgrade with settings kept): all six driver modules and usbnet loaded at boot, r8152 firmware present, guard rule shipped, an adapter plugged in at boot recorded as usb_eth0 with eth0/eth1 unchanged, client leased in Admin, followed a move to Guest in about 17 s, profile and lease survived a reboot, bench.sh smoke passed.
  • Second socket and hub (hot-plug on that image): a second adapter became usb_eth1; moved into a hub it became usb_eth2 at its own port chain; moving usb_eth2 to Guest moved its client while usb_eth0 stayed in Admin; removing the empty usb_eth1 left the others intact.
  • Binary on 1ee09422b: ports re-attached after a daemon restart; ethernet.get and config.check (no findings) through the UI's signed login; headless Chromium on the real UI showed the rows and the remove confirm on an empty port; smoke passed.
  • Also driven live on earlier commits of the branch: refusals (remove while plugged in, unknown port, USB port as WAN), network restart, removal then replug giving a fresh Admin port after the removed one had been in Guest, and a rogue DHCP server behind a USB port dropped by the guard (before the usb_eth rename of the rule).
  • Review round 1 (binary 99fe1ee, narrowed guard file copied onto the router):
    • Guard: a synthetic client on one USB port's bridge sent DHCP replies, DHCPv6 replies and router advertisements untagged, tagged with the port's VLAN ID, and priority-tagged (VID 0), three of each. A client on br-lan and a client on a second USB port's bridge counted what arrived. With the rule as first pushed (iifname "usb_eth*" accept) the untagged frames were dropped and all six tagged ones of each kind reached both clients. With the narrowed rule none arrived and the guard's drop counters rose, while a control datagram on other ports sent the same three ways arrived every time. Under the narrowed rule fw4 loaded its ruleset, the client on the second USB port's bridge leased from the router and took an address from its router advertisement, and a real wired client behind an RTL8153 adapter re-leased after the adapter was bounced.
    • Removal through startwrt-cli on 59d2b43 returned within a second and the Wi-Fi restart that ends the reload never ran; on 99fe1ee it returned after about 3 s with the whole reload logged. Through the daemon the call returned after the reload. An adapter plugged in after its port was removed came up as a fresh usb_eth0 in Admin and its client leased. bench.sh smoke passed.
  • Throughput and detection (binary c1577bd; bd1a927 is that commit with master 698c455 merged without conflicts): make start-wrt-test 911 + 37 passed on c1577bd.
    • Single TCP stream, 15 s, between a gigabit client behind an RTL8153 adapter and a host on the WAN side, flow offloading unset on the bench:

      Adapter state Upload Download
      Hot-plugged, f3d6997 (no steering: threaded 0, rps_cpus 00) 761–764 Mbps 491–496 Mbps
      Plugged in at boot 940–941 Mbps 804–805 Mbps
      Hot-plugged, c1577bd (four reconnects) 941 Mbps 795–799 Mbps
    • Download stays near 800 Mbps: one core runs at about 92% wherever the xHCI interrupt lands, and pinning that interrupt to other cores gave 751–814 Mbps.

    • A 986 Mbps UDP stream from the client on one adapter to a client on a second adapter left the second adapter at 984 Mbps. The same stream routed to the WAN forwarded 435 Mbps with flow offloading unset and 985 Mbps with it on (the shipped default).

    • Detection: a second adapter physically plugged in on f3d6997 logged no physical port and stayed unused. Disconnecting and reconnecting an adapter at its hub port (disable 1, then 0) showed the device's port link absent when its network device appeared in 4 of 6 cycles; on c1577bd the adapter joined its port in all 6, and in 16 further authorized cycles, with no warning logged. The authorized bounce does not recreate the race, since the USB device persists.

    • bench.sh smoke passed after a reboot. Before it, smoke reported one deadline has elapsed error logged at each daemon restart; whether master logs it too was not checked.

  • Disabled trash button (binary e99516f, npm run check:wrt and npm run check:i18n:wrt passed): headless Chromium on the real UI. Ports with an adapter plugged in showed a disabled button and the hint on hover; empty ports showed an enabled button and no hint. Clicking a disabled button opened nothing and sent no request. Disconnecting an adapter at its hub port enabled its button without a reload, and reconnecting it disabled the button again within about 7 s. A removal confirmed after the adapter was reconnected behind the open dialog was refused, the error toast named the port, and the port stayed recorded. In phone emulation a tap on a disabled button shows no hint, since a disabled button receives no click; the button is still greyed out. bench.sh smoke passed.
  • A USB 2 flash drive confirmed each socket's USB 2 and USB 3 sides are peered in sysfs, which the socket identity relies on.

Not verified:

  • The image was built incrementally and before the rebase. CI skips the image job on this pull request, so openwrt-patches/0010 has had no clean-workspace build.
  • The removal reload outliving a caller that disconnects partway: the reload takes about 2 s and no attempt cut a client off inside it.
  • The guard check used the Admin VLAN (ID 1), the profile every USB port on the bench was in.
  • ASIX, CDC ECM/NCM and RNDIS adapters, and a USB 2 adapter: their modules load, no such hardware was tested.
  • Whether de-authorizing the USB device drops the cable link on chips other than the RTL8153.
  • Two downloads at once through two adapters: the second client could only receive.
  • Whether master also logs deadline has elapsed on a daemon restart.

A physical USB port becomes a LAN bridge port the first time an
Ethernet-type USB network device is plugged into it. The daemon follows
ip monitor link, records the port in startwrt (usb_port, keyed by the
controller and the port chain on its USB 2 side, so USB 2 and USB 3
adapters in one port match), and joins the device to the port's
br-usb_eth<N> bridge. A usb_eth<N> veth links that bridge to br-lan and
carries the port's profile, so the mapping and profile persist while the
port is empty, and plugging in needs no network reload. A hub's ports
are physical ports of their own: the kernel cannot tell an onboard hub
from a plugged-in one, so no port is treated as shared. A new port takes
the lowest unused number.

netifd takes a veth's peer for its parent and resets the peer (out of
its bridge, IPv6 back on) whenever it claims the veth: at boot, on a
network restart, and on reloads that touch the port. The watcher
re-attaches the peer and disables its IPv6 on every peer event.

The LAN guard drops DHCP replies and router advertisements forwarded
between the ports of every bridge, including the router's own replies
crossing a USB port's bridge from its veth. Frames entering from a
usb_eth* link are the router's own or were checked on the bridge they
left, so the guard accepts them.

An r8152 adapter keeps link with its interface down, so a profile change
de-authorizes and re-authorizes the adapter's USB device to make its
clients lose link; Ethernet ports are still taken down and up.

ethernet.get reports whether each USB port holds an adapter and has
link; ethernet.set keeps a recorded USB port that a stale request omits
and refuses one as WAN. ethernet.remove-usb-port forgets an empty port
and reloads the network, since netifd would otherwise give a later port
of the same name the removed port's VLAN. config.check reads usb_port
sections for the Ethernet page.

The image gains the Realtek, ASIX, CDC and RNDIS USB network drivers.
kmod-usb-net-rtl8152 depends on kmod-crypto-sha256, whose module kernel
6.18 renamed from sha256_generic to sha256; openwrt-patches/0010 follows
the rename.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Requesting changes on 59d2b43 for two correctness issues.

[P1] Keep USB adapter ingress subject to the LAN guard — backend/nftables/ruleset-pre/10-startwrt-lan-dhcp-guard.nft:18 (paths relative to projects/start-wrt). The wildcard exemption trusts both ends of each veth. A client behind a USB adapter can send a DHCP reply or RA tagged with its assigned profile's VID. br-usb_eth<N> has VLAN filtering disabled, so that frame retains its tag there and does not match the guard's ether type ip/ip6 conditions. On br-lan, VLAN filtering removes the tag for an untagged destination, but iifname "usb_eth*" accept now exempts the packet before the guard can inspect it. This bypasses the DHCP-server and RA restrictions for other clients in the profile. Linux 6.18 reconstructs the VLAN header for the EtherType match and applies egress VLAN handling before the forward hook. The proposal scopes the exemption to ingress on br-usb_eth*, preserving router replies arriving through the peer while re-checking adapter traffic on br-lan. It records that boundary beside the rule. The reported untagged rogue-DHCP check does not cover this tagged path; adopted changes need packet-path regression coverage for tagged replies/advertisements and legitimate router traffic.

[P2] Finish the removal reload before the local CLI exits — backend/ctrl/src/ethernet.rs:162. remove-usb-port is registered as a local handler, without with_call_remote::<CliContext>(). Its spawned reload can therefore be cancelled when CliApp::run returns and drops the CLI context's runtime. The port has already been deleted from disk and the kernel, but netifd can retain the old VLAN for that name—the exact condition the reload is intended to prevent when the name is reused. The proposal awaits the reload, retaining configs-only behavior; the web caller already uses the restart/reconnect action flow.

Proposed changes: 59d2b43...proposal/4662

git merge-tree --write-tree origin/master <reviewed-head> was clean. Reviewed the USB lifecycle, VLAN/profile handling, guard, RPC/bindings, and Ethernet UI paths. No builds, tests, or VM runs were performed; the proposal is unverified and belongs to the author to verify. Available CI has no reported failure, but binary build, automated tests, formatting/lockfiles, and generated artifacts remain pending; the OpenWrt image job is skipped.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

…s dropped

The daemon drops a handler's future when its client disconnects, which a
bare await would let stop the reload between the network and Wi-Fi steps.
Awaiting a spawned task keeps the CLI process alive until the reload ends
and lets the daemon finish it regardless of the caller.
@Dominion5254

Copy link
Copy Markdown
Member Author

Both adopted in 59d2b43..99fe1ee.

  • P1: adopted as proposed (f980b9b). Reproduced on a K1 with the rule as pushed: DHCP replies, DHCPv6 replies and RAs sent from behind a USB port tagged with the port's VLAN ID, and priority-tagged, all reached a client on br-lan and a client behind a second USB port; untagged ones were dropped. With the narrowed rule none of the three arrived tagged or untagged, a control datagram sent the same ways still did, fw4 loaded its ruleset, a client on a USB port bridge leased and autoconfigured from the router's RA, and a real client behind an RTL8153 re-leased. The repo has no harness that can run nft bridge hooks, so this coverage is a bench run, recorded in the PR body.
  • P2: adopted with one change (99fe1ee): tokio::spawn(reload_bridge_ports()).await instead of a bare await. The daemon runs the handler inside the request future, which is dropped when the client disconnects; a bare await could then stop between the network reload and the Wi-Fi restart. Awaiting the spawned task gives the CLI the same guarantee your proposal does. On the old head the CLI returned in under a second without the Wi-Fi restart; now it returns after about 3 s with the whole sequence logged.

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved on f3d6997. Both findings are resolved. Spawning and awaiting the removal reload is better than my bare-await proposal: the CLI waits for completion, while dropping an HTTP request detaches rather than cancels the reload. The narrowed guard retains checks for USB adapter traffic entering the LAN bridge. Merge-tree against current master is clean.

Brief

USB Ethernet adapters add persistent, individually profiled LAN ports on the Ethernet page. The profile belongs to the physical USB socket, including each hub socket, rather than the adapter. Empty sockets remain listed as “Not connected”; removal requires unplugging the adapter and confirms the network disruption. Removing a socket forgets its profile, and reconnecting creates a fresh Admin port. USB ports cannot become WAN ports.

Policy to note: a previously unseen socket starts in Admin, granting its attached client Admin-profile network access. Moving a hub changes its downstream socket identities; the resulting new ports also start in Admin.

Implementation diff: +1100 / −105 lines in 21 files (excludes lockfiles, tests, docs, release notes, and changelog). Localized contextual-help text counts as documentation; generated binding implementation is included.

Approach and ownership. Stable virtual Ethernet ports reuse the existing bridge-VLAN profile assignments rather than making adapter interface names the persistent identity. The daemon owns discovery and adapter attachment to a per-socket bridge. Its link-event watcher also repairs the peer attachment that OpenWrt's network manager resets. Shared VLAN lookup and network/firewall/Wi-Fi reload sequencing replace duplicated logic. Profile changes reset USB authorization because bringing an RTL8153 interface down does not drop its cable link. The image adds six adapter-driver packages and a kernel-6.18-specific SHA256 module-name correction needed by the Realtek driver.

Data model and compatibility. New UciUsbPort sections store the physical socket's path, keyed by its virtual port name; existing configurations need no migration. EthernetInfo retains the existing flattened Ethernet response and adds the required usb_ports map, whose UsbPortStatus values report adapter presence and cable-link activity. RemoveUsbPortRequest supplies a port to the new removal endpoint, which returns null. The existing set-request shape stays unchanged, but omitted recorded USB ports retain their profiles and USB WAN assignments are rejected. Rust contracts, generated bindings, and live/mock UI clients ship together.

Verification evidence. The author reports 911 + 37 Rust tests passing, plus web/i18n, bindings and formatting checks. Rust tests and formatting were rerun on 99fe1ee; the final merge adds only SDK documentation. Recorded K1/RTL8153 bench evidence covers discovery, separate sockets and hubs, profile changes, persistence across reboot, removal/name reuse, and signed UI calls. The review regression run reproduced tagged and priority-tagged DHCP/DHCPv6/RA leakage before the guard fix and blocked it afterward, while preserving control traffic, router DHCP replies and router advertisements. CLI removal now completes the whole reload sequence before returning.

I ran no tests or router operations. For the required screenshots only, I built the final-head mock UI and captured its Ethernet list and both removal dialogs; images follow in a screenshot-only comment. That build succeeded with bundle-size and CommonJS warnings.

Remaining evidence limits. Current binary-build, automated-test, formatting/lockfile and generated-artifact CI jobs are pending. The image job is skipped: the SHA256 packaging patch has not had a clean-workspace image build. Non-Realtek and USB 2 adapters, link loss on other chipsets, and a deliberately interrupted removal request remain unverified; the guard regression used Admin's VLAN. The author also records an unreproduced attachment miss during driverless-adapter experimentation.

The independent managed-switch PR, #4628, overlaps the Ethernet/VLAN implementation and UI; this approval covers this head against master, not a combined USB/trunk implementation.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

…dapter

Packet steering ran at boot and on network reloads, so an adapter plugged
in afterwards kept its packet work on one core until the next reload.
…link

The kernel registers the adapter's network device before it creates the
USB device's port link, so an adapter could be seen with no port and
left unused. The hub's port node exists beforehand.

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved on bd1a927. I re-reviewed everything since my last approval (f3d6997): two usb_ports.rs fixes and a master merge that adds only a StartOS docs edit. A test merge against current master (00be0f5) is clean.

  • Port identity without the port link (c1577bd). port_node now builds the hub's port path from the device name: <bus>-0:1.0/usb<bus>-port<n> under a root hub, <hub>:1.0/<hub>-port<n> under an external hub. That node already exists when the adapter's network device appears, so identity no longer depends on the device's port symlink, which the kernel creates later. The SuperSpeed peer lookup reads the same node, so USB 2 and USB 3 sides still map to one socket. The test fixture stops creating the port symlink, so the existing socket and hub tests now cover the path derivation instead of the link.
  • Packet steering on hot-plug (239b0fb). The packet_steering reload runs only after an adapter is newly attached to its port bridge; already-attached adapters return earlier, so repeated link events don't re-trigger it. A failure is logged and doesn't block attachment.

Brief

USB Ethernet adapters add persistent, individually profiled LAN ports on the Ethernet page. The profile belongs to the physical USB socket, including each hub socket, rather than the adapter. Empty sockets stay listed as "Not connected". Removal requires unplugging the adapter and confirms the network disruption. Removing a socket forgets its profile, and reconnecting creates a fresh Admin port. USB ports cannot become WAN ports.

Policy to note: a previously unseen socket starts in Admin, which gives its client Admin-profile network access. Moving a hub changes its downstream socket identities, so those new ports also start in Admin.

Approach and ownership. Stable virtual Ethernet ports reuse the existing bridge-VLAN profile assignments; adapter interface names are not the persistent identity. The daemon handles discovery and attaches each adapter to a per-socket bridge. Its link-event watcher repairs the peer attachment that OpenWrt's netifd resets, and reruns packet steering when a hot-plugged adapter is attached. Socket identity comes from the hub port node, which exists before the adapter's network device appears. The shared VLAN lookup and network/firewall/Wi-Fi reload sequence replace duplicated logic. Profile changes reset USB authorization, because bringing an RTL8153 interface down doesn't drop its cable link. The image adds six adapter-driver packages and a kernel-6.18 SHA256 module-name correction that the Realtek driver needs.

Data model and compatibility. New UciUsbPort sections store the physical socket's path, keyed by virtual port name. Existing configurations need no migration. EthernetInfo keeps the flattened Ethernet response and adds a required usb_ports map; each UsbPortStatus reports adapter presence and cable link. RemoveUsbPortRequest names a port for the new removal endpoint, which returns null. The set-request shape is unchanged, but recorded USB ports left out of a set request keep their profiles, and USB WAN assignments are rejected. Rust contracts, generated bindings and the live and mock UI clients ship together.

Verification evidence. The author reports make start-wrt-test (911 + 37 passed) on c1577bd; the final head is that commit with master merged, no conflicts. Earlier rounds also covered web/i18n, bindings and formatting checks. Recorded K1/RTL8153 bench evidence covers:

  • discovery, separate sockets and hubs, profile changes, persistence across reboot, removal and name reuse, and signed UI calls;
  • the DHCP/DHCPv6/RA guard regression from review round 1;
  • CLI removal completing the full reload before returning;
  • a second adapter that stayed unused on f3d6997 (no physical port found) and now joins its port: 6 of 6 hub-port reconnects plus 16 authorized cycles with no warning, where the port link was missing in 4 of 6 before the fix;
  • hot-plugged single-stream TCP rising from 761–764 / 491–496 Mbps to 941 / 795–799 Mbps up/down, matching an adapter plugged in at boot.

I ran no tests or router operations. The earlier mock-UI screenshots still show the final UI, since these commits change only daemon code.

Remaining evidence limits. On this head the riscv64 binary build, Changelog and Prettier CI jobs are pending. The image job is skipped, so the SHA256 packaging patch hasn't had a clean-workspace image build. Untested: non-Realtek and USB 2 adapters, link loss on other chipsets, a deliberately interrupted removal request, and a hub whose port interface isn't :1.0 (standard for hubs). The author also records a deadline has elapsed error at each daemon restart that wasn't compared against master.

The independent managed-switch PR, #4628, overlaps the Ethernet/VLAN implementation and UI. This approval covers this head against master, not a combined USB/trunk implementation.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5

@helix-white

Copy link
Copy Markdown
Member

@Dominion5254 #4662 now conflicts with master (bee51e17c). The conflict is an i18n ID collision in all five start-wrt dictionaries (en, de, es, fr, pl). Master took ID 633 for 'This device asked to open port(s) {ports} to the internet. The router refused because automatic port forwarding is off.', and this PR also starts at 633.

To resolve: merge origin/master, keep master's 633 entry, and move this PR's six strings to 634–639 ('Remove USB port?' … 'Adapter plugged in'). Shift the matching IDs in the four translated dictionaries the same way. API_CONTRACT.md, lib.rs, bindings.schemas.ts and mock-api.service.ts merge without conflicts.

I'm this PR's cross-reviewer, so I haven't pushed to your branch. My approval was for bd1a927, which no longer merges cleanly. Please re-request my review after the merge.

…d in

The trash icon on a USB port row was always clickable and answered a
click on an in-use port with an "Adapter plugged in" dialog. It is now
disabled while an adapter is in the port, with a hint saying to unplug
it, so an enabled icon means the port can actually be removed. The
dialog and the fresh ethernet.get behind it are gone; a click in the
few seconds before the page's next poll is refused by the backend as
before and shows its error toast.
# Conflicts:
#	projects/start-wrt/web/src/app/i18n/dictionaries/de.ts
#	projects/start-wrt/web/src/app/i18n/dictionaries/en.ts
#	projects/start-wrt/web/src/app/i18n/dictionaries/es.ts
#	projects/start-wrt/web/src/app/i18n/dictionaries/fr.ts
#	projects/start-wrt/web/src/app/i18n/dictionaries/pl.ts

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved on 93d792c. Since my last approval (bd1a927) there is one implementation commit and a master merge. A test merge against current master (246876d31) is clean.

  • Disabled removal button (e99516f). The trash button is disabled while usb_ports[port].present is true, and its hint says to unplug the adapter. This matches the disabled-button-with-hint pattern used elsewhere in the StartWRT UI (profiles, outbound VPNs). The pre-click ethernet.get, the "Adapter plugged in" dialog and their strings are gone. The backend still refuses removal of an occupied port, so a click made before the next poll gets an error toast. No leftover imports or strings remain; TUI_CONFIRM, fill and dialogs are still used by the confirm and WAN-move dialogs. The docs page was updated to match.
  • Merge resolution (93d792c). Master's string keeps ID 633. This PR's five remaining strings are 634–638, consistently across en, de, es, fr and pl, with no gaps or duplicates.

Brief

USB Ethernet adapters add persistent, individually profiled LAN ports on the Ethernet page. The profile belongs to the physical USB socket, including each hub socket, rather than to the adapter. Empty sockets stay listed as "Not connected". The removal button is disabled while an adapter is plugged in, and removing an empty socket asks for confirmation of a brief network restart. Removing a socket forgets its profile, and reconnecting creates a fresh Admin port. USB ports cannot become WAN ports.

Policy to note: a previously unseen socket starts in Admin, which gives its client Admin-profile network access. Moving a hub changes its downstream socket identities, so those new ports also start in Admin.

Approach and ownership. Stable virtual Ethernet ports reuse the existing bridge-VLAN profile assignments; adapter interface names are not the persistent identity. The daemon handles discovery and attaches each adapter to a per-socket bridge. Its link-event watcher repairs the peer attachment that OpenWrt's netifd resets, and reruns packet steering when a hot-plugged adapter is attached. Socket identity comes from the hub port node, which exists before the adapter's network device appears. The shared VLAN lookup and network/firewall/Wi-Fi reload sequence replace duplicated logic. Profile changes reset USB authorization, because bringing an RTL8153 interface down doesn't drop its cable link. The image adds six adapter-driver packages and a kernel-6.18 SHA256 module-name correction that the Realtek driver needs.

Data model and compatibility. New UciUsbPort sections store the physical socket's path, keyed by virtual port name. Existing configurations need no migration. EthernetInfo keeps the flattened Ethernet response and adds a required usb_ports map; each UsbPortStatus reports adapter presence and cable link. RemoveUsbPortRequest names a port for the new removal endpoint, which returns null and refuses a port with an adapter present. The set-request shape is unchanged, but recorded USB ports left out of a set request keep their profiles, and USB WAN assignments are rejected. Rust contracts, generated bindings and the live and mock UI clients ship together.

Verification evidence. The author reports make start-wrt-test (911 + 37 passed) on c1577bd. On 93d792c (the final head), npm run check:wrt and npm run check:i18n:wrt (599 keys) passed. Recorded K1/RTL8153 bench evidence covers:

  • discovery, separate sockets and hubs, profile changes, persistence across reboot, removal and name reuse, and signed UI calls;
  • the DHCP/DHCPv6/RA guard regression from review round 1, and CLI removal completing the full reload before returning;
  • adapters joining their port on every reconnect after the port-identity fix, and hot-plugged throughput matching boot-time after the packet-steering fix;
  • in headless Chromium against the real UI on e99516f: occupied ports showed a disabled button with the hint, empty ports an enabled one. Disabled clicks sent no request, and the button followed unplug/replug within about 7 s. A removal confirmed after reconnecting behind the open dialog was refused with a toast naming the port.

I ran no tests or router operations. For the screenshots only, I built the final-head demo UI (npm run build:wrt:demo) and captured the Ethernet list, the disabled button's hint, and the removal confirmation. They follow in a screenshot-only comment and replace my earlier set, which showed the removed "Adapter plugged in" dialog.

Remaining evidence limits. On a phone a disabled button shows no hint, since it receives no tap; it is still greyed out. The image job is skipped, so the SHA256 packaging patch hasn't had a clean-workspace image build. Untested: non-Realtek and USB 2 adapters, link loss on other chipsets, a deliberately interrupted removal request, and a hub whose port interface isn't :1.0 (standard for hubs). The author also records a deadline has elapsed error at each daemon restart that wasn't compared against master. CI on this head was not complete when I reviewed.

The independent managed-switch PR, #4628, overlaps the Ethernet/VLAN implementation and UI. This approval covers this head against master, not a combined USB/trunk implementation.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5

@helix-white

Copy link
Copy Markdown
Member

Final-head (93d792c) mock UI screenshots (sample data, not a live router). These replace my earlier set.

USB Ethernet ports keep their profiles while disconnected; the occupied port's trash button is greyed out.

Hovering the disabled trash button on an occupied USB port explains how to remove it.

Removing an empty USB port confirms the network restart and fresh Admin profile on reconnection.

@Dominion5254
Dominion5254 merged commit 4812945 into master Nov 11, 2026
19 of 21 checks passed
@Dominion5254
Dominion5254 deleted the wrt/usb-ethernet-ports branch November 11, 2026 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants