RDKB-63168: WAN Default Gateway Address (IPv4) is blank#111
RDKB-63168: WAN Default Gateway Address (IPv4) is blank#111GoutamD2905 merged 2 commits intodevelopfrom
Conversation
Reason for change: WAN Default Gateway Address (IPv4) in Network section is blank - GPON mode Test Procedure: Test for WAN Default Gateway Address (IPv4) in Network section - GPON mode Risks:low Priority: P1 Signed-off-by: pavankumarreddy_balireddy@comcast.com
There was a problem hiding this comment.
Pull request overview
Fixes cases where the WAN Default Gateway Address (IPv4) displays as blank in the Network section (notably in GPON mode) by ensuring the UI selects a valid DHCP client interface even when DHCP manager/WanManager interface data isn’t available yet.
Changes:
- Detects whether DHCP manager initialization has completed via
/tmp/dhcpmgr_initialized. - When not initialized, falls back to default TR-181 DHCP client objects (
Device.DHCPv4.Client.1/Device.DHCPv6.Client.1). - Retains existing logic to select DHCP interfaces from the active WanManager interface when available.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $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"; |
There was a problem hiding this comment.
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.
Reason for change: WAN Default Gateway Address (IPv4) in Network section is blank - GPON mode
Test Procedure: Test for WAN Default Gateway Address (IPv4) in Network section - GPON mode
Risks:low
Priority: P1
Signed-off-by: pavankumarreddy_balireddy@comcast.com