From de87029e6c0955eef792324c42156c9827d7317d Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Tue, 7 Oct 2025 10:44:18 +0200 Subject: [PATCH] luci-mod-network: add carrier info to interface page Currently the LuCI does not show whether a carrier is available on the interface or not. On ethernet devices the carrier indicates whether a cable is plugged in or not. This commit adds this functionality, which makes debugging easier. Signed-off-by: Florian Eckert --- .../htdocs/luci-static/resources/view/network/interfaces.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js index 4a7f62e8c6..548bc65fe4 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js @@ -70,9 +70,11 @@ function render_status(node, ifc, with_device) { const changecount = with_device ? 0 : count_changes(ifc.getName()); const maindev = ifc.getL3Device() ?? ifc.getDevice(); const macaddr = maindev ? maindev.getMAC() : null; + const carrier = maindev ? maindev.getCarrier(): null; const cond00 = !changecount && !ifc.isDynamic() && !ifc.isAlias(); const cond01 = cond00 && macaddr; const cond02 = cond00 && maindev; + const cond03 = cond00 && carrier; function addEntries(label, array) { return Array.isArray(array) ? array.flatMap((item) => [label, item]) : [label, null]; @@ -81,6 +83,7 @@ function render_status(node, ifc, with_device) { return L.itemlist(node, [ _('Protocol'), with_device ? null : (desc || '?'), _('Device'), with_device ? (maindev ? maindev.getShortName() : E('em', _('Not present'))) : null, + _('Carrier'), (cond03) ? _('Present') : _('Absent'), _('Uptime'), (!changecount && ifc.isUp()) ? '%t'.format(ifc.getUptime()) : null, _('MAC'), (cond01) ? macaddr : null, _('RX'), (cond02) ? '%.2mB (%d %s)'.format(maindev.getRXBytes(), maindev.getRXPackets(), _('Pkts.')) : null, -- 2.30.2