Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions systemd_units/RdkWanManager.service
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Environment="LOG4C_RCPATH=/etc"
EnvironmentFile=/etc/device.properties
WorkingDirectory=/usr/rdk/wanmanager
ExecStartPre=/bin/touch /tmp/OS_WANMANAGER_ENABLED
ExecStartPre=-/bin/sh -c '[ -x /usr/ccsp/dhcpmgr/DHCPMgrPSMValueCheck.sh ] && (/usr/ccsp/dhcpmgr/DHCPMgrPSMValueCheck.sh)'
ExecStartPre=/bin/sh -c '(/usr/ccsp/utopiaInitCheck.sh)'
ExecStart=/usr/rdk/wanmanager/wanmanager -subsys $Subsys
ExecStop=/bin/sh -c 'echo "`date`: Stopping/Restarting RdkWanManager" >> ${PROCESS_RESTART_LOG}'
Expand Down
65 changes: 65 additions & 0 deletions systemd_units/scripts/DHCPMgrPSMValueCheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/sh
##########################################################################
# If not stated otherwise in this file or this component's LICENSE
# file the following copyright and licenses apply:
#
# Copyright 2026 RDK Management.
#
# Licensed under the Apache License, Version 2.0 (the "License");

Check failure on line 8 in systemd_units/scripts/DHCPMgrPSMValueCheck.sh

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'GPL-2.0' license found in local file 'systemd_units/scripts/DHCPMgrPSMValueCheck.sh' (Match: unofficial-openjdk/openjdk/7-b24, 11 lines, url: https://github.com/unofficial-openjdk/openjdk/archive/refs/tags/jdk7-b24.tar.gz, file: jaxp/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Makefile.inc)
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##########################################################################

if [ -e /etc/log_timestamp.sh ]
then
. /etc/log_timestamp.sh
else
echo_t()
{
echo "$(date +"%y%m%d-%T.%6N") $1"
}
fi

LOG_FILE=/rdklogs/logs/Consolelog.txt.0

echo_t "[DHCP Manager PSM Check] Running the script to check psm records" >> $LOG_FILE

wanifcount=$(psmcli get dmsb.wanmanager.wan.interfacecount)
if ! echo "$wanifcount" | grep -qE "^[0-9]+$"; then
echo_t "[DHCP Manager PSM Check] Invalid interface count: '$wanifcount'" >> $LOG_FILE
exit 1
fi

echo_t "[DHCP Manager PSM Check] Number of wan interface is ${wanifcount}" >> $LOG_FILE

cnt=1
while [ "$cnt" -le "$wanifcount" ]
do
psmDHCPv4=$(psmcli get dmsb.wanmanager.if.${cnt}.VirtualInterface.1.IP.DHCPV4Interface)
psmDHCPv6=$(psmcli get dmsb.wanmanager.if.${cnt}.VirtualInterface.1.IP.DHCPV6Interface)

if [ -z "$psmDHCPv4" ]; then
psmcli set dmsb.wanmanager.if.${cnt}.VirtualInterface.1.IP.DHCPV4Interface Device.DHCPv4.Client.${cnt} 2> /dev/null
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I didn’t notice this the first time.
We shouldn’t assume that the DHCP client index is the same as the WAN index. Any DHCP client index can be mapped to any WAN interface. We already support different DHCP client indices depending on the enabled features.
We should read the default PSM configuration and update the current configuration if this issue is detected.

echo_t "[DHCP Manager PSM Check] PSM record \"dmsb.wanmanager.if.${cnt}.VirtualInterface.1.IP.DHCPV4Interface\" is set with \"Device.DHCPv4.Client.${cnt}\"" >> $LOG_FILE
else
echo_t "[DHCP Manager PSM Check] PSM record \"dmsb.wanmanager.if.${cnt}.VirtualInterface.1.IP.DHCPV4Interface\" already exists with value: \"${psmDHCPv4}\"" >> $LOG_FILE
fi

if [ -z "$psmDHCPv6" ]; then
psmcli set dmsb.wanmanager.if.${cnt}.VirtualInterface.1.IP.DHCPV6Interface Device.DHCPv6.Client.${cnt} 2> /dev/null
echo_t "[DHCP Manager PSM Check] PSM record \"dmsb.wanmanager.if.${cnt}.VirtualInterface.1.IP.DHCPV6Interface\" is set with \"Device.DHCPv6.Client.${cnt}\"" >> $LOG_FILE
else
echo_t "[DHCP Manager PSM Check] PSM record \"dmsb.wanmanager.if.${cnt}.VirtualInterface.1.IP.DHCPV6Interface\" already exists with value: \"${psmDHCPv6}\"" >> $LOG_FILE
fi
cnt=$((cnt + 1))
done
echo_t "[DHCP Manager PSM Check] End Of the Script" >> $LOG_FILE

Loading