Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions source/Styles/xb3/jst/includes/utility.jst
Original file line number Diff line number Diff line change
Expand Up @@ -1262,18 +1262,24 @@ function current_operationalMode()
*/
function get_dhcp_client_interfaces()
{
$dhcpmgr_enabled = file_exists("/tmp/dhcpmgr_initialized");
var $dhcp_client_interfaces = { v4: "", v6: "" };
$ids = explode(",", getInstanceIds("Device.X_RDK_WanManager.Interface."));
wanInterfaceLoop: for($key in $ids) { $j = $ids[$key];
$status = getStr("Device.X_RDK_WanManager.Interface."+$j+".Status");
if($status == "true" || $status == "Up" || $status == "Active"){
$dhcp_client_interfaces.v4 = getStr("Device.X_RDK_WanManager.Interface."+$j+".VirtualInterface.1.IP.DHCPv4Interface");
$dhcp_client_interfaces.v6 = getStr("Device.X_RDK_WanManager.Interface."+$j+".VirtualInterface.1.IP.DHCPv6Interface");
break wanInterfaceLoop;
if($dhcpmgr_enabled) {
$ids = explode(",", getInstanceIds("Device.X_RDK_WanManager.Interface."));
wanInterfaceLoop: for($key in $ids) { $j = $ids[$key];
$status = getStr("Device.X_RDK_WanManager.Interface."+$j+".Status");
if($status == "true" || $status == "Up" || $status == "Active"){
$dhcp_client_interfaces.v4 = getStr("Device.X_RDK_WanManager.Interface."+$j+".VirtualInterface.1.IP.DHCPv4Interface");
$dhcp_client_interfaces.v6 = getStr("Device.X_RDK_WanManager.Interface."+$j+".VirtualInterface.1.IP.DHCPv6Interface");
break wanInterfaceLoop;
}
}
if($dhcp_client_interfaces.v4 == "") $dhcp_client_interfaces.v4 = "Device.DHCPv4.Client.1";
if($dhcp_client_interfaces.v6 == "") $dhcp_client_interfaces.v6 = "Device.DHCPv6.Client.1";
} else {
$dhcp_client_interfaces.v4 = "Device.DHCPv4.Client.1";
$dhcp_client_interfaces.v6 = "Device.DHCPv6.Client.1";
Comment on lines +1265 to +1281
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

The default DHCP client interface assignments are duplicated (set in the else branch and again inside the if ($dhcpmgr_enabled) branch when values remain empty). This can be simplified by setting defaults once before the conditional/loop and only overriding them when an active WAN interface provides specific DHCPv4/v6 interface paths, reducing duplicated logic and future drift.

Copilot uses AI. Check for mistakes.
}
if($dhcp_client_interfaces.v4 == "") $dhcp_client_interfaces.v4 = "Device.DHCPv4.Client.1";
if($dhcp_client_interfaces.v6 == "") $dhcp_client_interfaces.v6 = "Device.DHCPv6.Client.1";
return $dhcp_client_interfaces;
}

Expand Down
Loading