Skip to content

RDKCOM-5612: RDKBNETWOR-16 DNS Relay Feature#366

Open
pradeeptakdas wants to merge 1 commit into
rdkcentral:developfrom
pradeeptakdas:RDKBNETWOR-16
Open

RDKCOM-5612: RDKBNETWOR-16 DNS Relay Feature#366
pradeeptakdas wants to merge 1 commit into
rdkcentral:developfrom
pradeeptakdas:RDKBNETWOR-16

Conversation

@pradeeptakdas

Copy link
Copy Markdown

Reason for change: Implementation of DNS forward proxy Test Procedure:
DNS Relay DM functionality and proxy functionality Refer to JIRA

Risks: None.
Signed-off-by: Sherik Sensin A sherik.a@t-systems.com
Change-Id: I930ffa57b58c2e2123f731d5b6cb74fd88cd594c

Reason for change: Implementation of DNS forward proxy
Test Procedure:
DNS Relay DM functionality and proxy functionality
Refer to JIRA

Risks: None.

Change-Id: I930ffa57b58c2e2123f731d5b6cb74fd88cd594c
Signed-off-by: Sherik Sensin A <sherik.a@t-systems.com>
Copilot AI review requested due to automatic review settings July 10, 2026 16:01
@pradeeptakdas pradeeptakdas requested review from a team as code owners July 10, 2026 16:01
@rdkcmf-jenkins

Copy link
Copy Markdown
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 1 file pending identification.

  • Protex Server Path: /home/blackduck/github/utopia/366/rdkb/components/opensource/ccsp/Utopia

  • Commit: 40cef8b

Report detail: gist'

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Implements DNS Relay / DNS forward proxy support by adding new Utopia config keys + UTAPI helpers, and updating dnsmasq service scripts to optionally run separate LAN/WAN dnsmasq instances with a generated LAN-side resolv file.

Changes:

  • Added Utopia config keys and enum values for dns_relay_enable and dns_forward_count.
  • Introduced utapi_dns.h and added UTAPI helpers for DNS relay enable + forward count.
  • Updated DHCP/DNS service scripts to generate separate dnsmasq configs for LAN/WAN and manage multiple dnsmasq instances (plus an RPi-specific LAN bridge update).

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
source/utctx/lib/utctx.c Registers new syscfg-backed config keys for DNS relay enable / forward count.
source/utctx/lib/utctx_api.h Adds new UtopiaValue_* enum entries for DNS relay feature.
source/include/utctx/utctx_api.h Mirrors the new enum entries in the exported include header.
source/utapi/lib/utapi.h Extends DNS_Client_t with per-nameserver alias storage.
source/include/utapi/utapi.h Mirrors the DNS_Client_t struct extension in exported include header.
source/utapi/lib/utapi_dns.h New UTAPI header for DNS relay/forward proxy accessors.
source/utapi/lib/utapi_dns.c Implements UTAPI getters/setters and cached forward-count accessor.
source/scripts/init/service.d/service_dhcp_server/dhcp_server_functions.sh Adds LAN/WAN dnsmasq config generation and DNS proxy resolv generation.
source/scripts/init/service.d/service_dhcp_server.sh Adds multi-dnsmasq start/restart/PMON logic for relay mode.
source/scripts/init/service.d/lan_handler.sh Adds RPi-specific physical interface bring-up / bridge membership changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +322 to +330
PHY_BRIDGE_IFNAME=`syscfg get lan_ifname`
PHY_ETH_IFNAMES=`syscfg get lan_ethernet_physical_ifnames`
IFS=' ' read -r -a PHY_ETH_IFNAME_ARRAY <<< "$PHY_ETH_IFNAMES"
for PHY_ETH_IFNAME in "${PHY_ETH_IFNAME_ARRAY[@]}"
do
echo "LAN HANDLER : PHY_ETH_IFNAME = $PHY_ETH_IFNAME"
ifconfig $PHY_ETH_IFNAME up
brctl addif $PHY_BRIDGE_IFNAME $PHY_ETH_IFNAME
done
Comment on lines 50 to 54
if [ "$BOX_TYPE" = "HUB4" ] || [ "$BOX_TYPE" = "SR300" ] || [ "$BOX_TYPE" = "SE501" ] || [ "$BOX_TYPE" = "SR213" ] || [ "$SelfHealSupport" = "true" ]; then
LOCAL_DHCP_CONF=/tmp/dnsmasq.conf
LOCAL_DHCP_STATIC_HOSTS_FILE=/tmp/dhcp_static_hosts
LOCAL_DHCP_OPTIONS_FILE=/tmp/dhcp_options
else
Comment on lines +689 to +699
get_static_dns_ips(){
ind=1

if [ "$1" == "ipv6" ] ; then
STATIC_DNS_IPv6=""
delim=":"
else
STATIC_DNS_IPv4=""
delim="\."
fi

Comment on lines +724 to +736
prepare_dns_proxy_conf()
{
get_static_dns_ips ipv6
get_static_dns_ips ipv4
ind=0
for ip in $STATIC_DNS_IPv4;
do
((ind++))
echo "nameserver $ip" >> $DNS_PROXY_RESOLV_CONF_TMP
done
cat $DNS_PROXY_RESOLV_CONF_TMP > $DNS_PROXY_RESOLV_CONF
rm $DNS_PROXY_RESOLV_CONF_TMP
}
Comment on lines +149 to +151
$SERVER -u nobody -P 4096 -C $DHCP_CONF_LAN
$SERVER -u nobody -P 4096 -C $DHCP_CONF_WAN

Comment on lines +304 to +306
if [ -n "$FOO" ] || [ -n "$FOO1"]; then
RESTART=1
fi
Comment on lines +318 to +335
if [ -z "$LAN_PID_FILE" ] || [ -z "$WAN_PID_FILE" ] ; then
RESTART=1
else
RUNNING_PIDS=`pidof dnsmasq`
if [ -z "$RUNNING_PIDS" ] ; then
RESTART=1
else
FOO=`echo $RUNNING_PIDS | grep $LAN_CONF_PID`
FOO1=`echo $RUNNING_PIDS | grep $WAN_CONF_PID`
if [ -z "$FOO" ] || [ -z "$FOO1" ] ; then
RESTART=1
fi

#Check for the case where dnsmasq is running without config file
FOO=`cat /proc/${LAN_CONF_PID}/cmdline | grep "$DHCP_LAN_CONF"`
FOO1=`cat /proc/${WAN_CONF_PID}/cmdline | grep "$DHCP_WAN_CONF"`
if [ -z "$FOO" ] || [ -z "$FOO1" ]; then
RESTART=1
Comment on lines +647 to +649
if [ -z "$LAN_PID_FILE" ] || [ -z "$WAN_PID_FILE" ] ; then
RESTART=1
else
Comment on lines +1077 to +1084
$SERVER -u nobody -P 4096 -C $DHCP_CONF_WAN
WANPID=`ps -ef | grep dnsmasq_wan | head -n 1| cut -d" " -f1`
if [ -z "$WANPID" ] ; then
WANPID=`ps -ef | grep dnsmasq_wan | head -n 1| cut -d" " -f2`
echo $WANPID > $WAN_PID_FILE
else
echo $WANPID > $WAN_PID_FILE
fi
Comment on lines +1089 to +1097
echo_t "dns proxy lan restart called by pmon"
$SERVER -u nobody -P 4096 -C $DHCP_CONF_LAN
LANPID=`ps -ef | grep dnsmasq_lan | head -n 1| cut -d" " -f1`
if [ -z "$LANPID" ] ; then
LANPID=`ps -ef | grep dnsmasq_lan | head -n 1| cut -d" " -f2`
echo $LANPID > $LAN_PID_FILE
else
echo $LANPID > $LAN_PID_FILE
fi
{
if(g_Dns_ForwardCount == 0)
{
Utopia_GetInt(ctx, UtopiaValue_Dns_ForwardCount, &g_Dns_ForwardCount);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants