Repository navigation
Fix: dashboard connection interface detection with VPN/policy routing - #2170
Merged
Merged
Conversation
getConnectionInterface() read a fixed column of 'ip -o route get 1.1.1.1'. With a wg-quick full tunnel the output is "1.1.1.1 dev wg0 table 51820 src ...", so the dashboard looked up an interface named "51820" and showed no uplink IP, SSID or connection type. Routes without a gateway (e.g. ppp0) returned the source IP. Take the interface from the 'dev' field instead, and when it is a VPN interface (wg0, tun0, tailscale0) return the physical uplink from the main table's default route; the VPN is already shown separately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
billz
reviewed
Oct 20, 2026
Member
There was a problem hiding this comment.
@Acio thanks for the PR. parsing the dev field is the right fix for the $5 column assumption. a couple of observations:
- the VPN interface list now lives here and in
Sysinfo::getActiveVpnInterface(). Would you mind moving it to a shared constant or helper so the two don't drift? - Probably worth a note in the docblock that the first (lowest metric) default route is used when there are several?
Address review feedback on RaspAP#2170: - Move the VPN interface list to a Sysinfo::VPN_INTERFACES constant, used by both getActiveVpnInterface() and Dashboard::getConnectionInterface(), so the two can't drift. - Document that the first default route of the main table is used when there are several; ip lists them by ascending metric, so this is the route the kernel prefers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Hi Bill, Thanks for the review! Both points are addressed in 048defd:
Re-tested on a Pi 5 through I also will open a feature request for showing when multiple VPNs are connected, instead of just giving back one. I have multiple VPNs open for different routes when away, and just showing the lowest id while factually correct, is not the total picture :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2169
getConnectionInterface()read a fixed column ($5) ofip -o route get 1.1.1.1. The column layout of that output varies:$51.1.1.1 via 192.168.40.1 dev wlan0 src ...wlan0✔1.1.1.1 dev wg0 table 51820 src ...51820✘1.1.1.1 dev ppp0 src 10.64.1.2 ...10.64.1.2✘This change:
devfield instead of a fixed column;wg0,tun0,tailscale0, the same listSysinfo::getActiveVpnInterface()uses), returns the physical uplink from the main table's default route instead, so the dashboard keeps showing how the device is actually connected; the VPN is already shown separately by the VPN status item.Testing
On a Pi 5 with RaspAP 3.5.8:
wlan0/wireless/ IP and SSID shown, same as before.default dev wg0 table 51820,ip rule not fwmark 0xca6c table 51820,ip rule table main suppress_prefixlength 0):51820, typeother (51820), no IPwlan0, typewireless, IP192.168.40.213via/ no-via/tablevariants.