From 5d26158b5371a515977b0c54393397ab3476d669 Mon Sep 17 00:00:00 2001 From: cynfo3000 Date: Wed, 4 Mar 2026 00:04:32 +0100 Subject: [PATCH] WAN IP fix: IPv4 bevorzugen, PPPoE-Interfaces korrekt erkennen --- frontend/src/pages/Agents.jsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/Agents.jsx b/frontend/src/pages/Agents.jsx index 3efe9fe..ca8fcbb 100644 --- a/frontend/src/pages/Agents.jsx +++ b/frontend/src/pages/Agents.jsx @@ -136,12 +136,14 @@ export default function Agents() { : null const gateways = sys?.gateways || [] - // WAN IP: prefer gateway with WAN role, fallback to interface with WAN role, fallback to a.ip + // WAN IP: find interface with WAN role AND a valid IPv4 address const ifaces = sys?.network_interfaces || [] - const wanIface = ifaces.find(i => (i.role || '').toUpperCase() === 'WAN') - const lanIface = ifaces.find(i => (i.role || '').toUpperCase() === 'LAN') - const wanGw = gateways.find(g => (g.name || '').toUpperCase().includes('WAN')) - const wanIp = wanIface?.ip || wanGw?.address || a.ip || '' + const isIPv4 = (ip) => ip && /^\d+\.\d+\.\d+\.\d+/.test(ip) + const wanIface = ifaces.find(i => (i.role || '').toUpperCase() === 'WAN' && isIPv4(i.ip)) + || ifaces.find(i => (i.role || '').toUpperCase() === 'WAN' && i.ip) + const lanIface = ifaces.find(i => (i.role || '').toUpperCase() === 'LAN' && isIPv4(i.ip)) + || ifaces.find(i => (i.role || '').toUpperCase() === 'LAN' && i.ip) + const wanIp = wanIface?.ip || a.ip || '' const lanIp = lanIface?.ip || '' return {