RDKCOM-5612: RDKBNETWOR-16 DNS Relay Feature - #377
Open
pradeeptakdas wants to merge 1 commit into
Open
Conversation
Reason for change: Implementation of DNS forward proxy Test Procedure: DNS Relay DM functionality and proxy functionality Risks: None. Change-Id: I930ffa57b58c2e2123f731d5b6cb74fd88cd594c Signed-off-by: Sherik Sensin A <sherik.a@t-systems.com>
|
📋 PR Format Reminder
Expected: |
Contributor
There was a problem hiding this comment.
Pull request overview
Implements a DNS relay / forward-proxy capability by introducing new syscfg/utopia keys and UTAPI accessors, and updating the dnsmasq (DHCP/DNS) service scripts to generate separate WAN/LAN dnsmasq configurations and run multiple dnsmasq instances when relay is enabled.
Changes:
- Added new Utopia/syscfg keys and enum values for
dns_relay_enableanddns_forward_count. - Introduced UTAPI DNS helpers (
utapi_dns.h/.c) for getting/setting DNS relay enable and reading DNS forward count. - Updated DHCP/DNS service scripts to generate split dnsmasq configs and start/monitor separate LAN/WAN dnsmasq processes; added LAN handler bridge bring-up logic.
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 | Adds syscfg token mappings for DNS relay enable and forward count. |
| source/utctx/lib/utctx_api.h | Adds new UtopiaValue_* enum entries for DNS relay feature (library header). |
| source/include/utctx/utctx_api.h | Adds matching new UtopiaValue_* enum entries for exported header. |
| source/utapi/lib/utapi.h | Extends DNS_Client_t with alias storage. |
| source/include/utapi/utapi.h | Mirrors the DNS_Client_t struct extension in exported header. |
| source/utapi/lib/utapi_dns.h | New header exposing DNS relay/forward-count UTAPI functions. |
| source/utapi/lib/utapi_dns.c | Adds DNS relay enable wrappers and forward-count accessor. |
| source/scripts/init/service.d/service_dhcp_server/dhcp_server_functions.sh | Generates split dnsmasq config and resolver file for relay mode. |
| source/scripts/init/service.d/service_dhcp_server.sh | Starts/monitors dnsmasq differently when relay is enabled (LAN+WAN instances). |
| source/scripts/init/service.d/lan_handler.sh | Adds physical-interface-to-bridge bring-up logic (RPi-specific block). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+149
to
+158
| static int g_Dns_ForwardCount = 0; | ||
|
|
||
| int Utopia_GetNumberOfDnsForwards(UtopiaContext *ctx) | ||
| { | ||
| if(g_Dns_ForwardCount == 0) | ||
| { | ||
| Utopia_GetInt(ctx, UtopiaValue_Dns_ForwardCount, &g_Dns_ForwardCount); | ||
| } | ||
| return g_Dns_ForwardCount; | ||
| } |
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 | ||
| } |
| then | ||
| echo "${PREFIX}interface=${IFNAME}" >> $LOCAL_DHCP_CONF | ||
| echo "${PREFIX}""dhcp-range=set:$i,${m_DHCP_START_ADDR},${m_DHCP_END_ADDR},$m_LAN_SUBNET,${m_DHCP_LEASE_TIME}" >> $LOCAL_DHCP_CONF | ||
| echo "${PREFIX}""interface="${IFNAME} >> $LOCAL_DHCP_CONF_LAN |
Comment on lines
+149
to
+166
| $SERVER -u nobody -P 4096 -C $DHCP_CONF_LAN | ||
| $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 | ||
|
|
||
| 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 |
Comment on lines
+304
to
+305
| if [ -n "$FOO" ] || [ -n "$FOO1"]; then | ||
| RESTART=1 |
| WAN_CONF_PID=`cat $WAN_PID_FILE` | ||
| fi | ||
|
|
||
| if [ -z "$LAN_PID_FILE" ] || [ -z "$WAN_PID_FILE" ] ; then |
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
+1090
to
+1097
| $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 |
Comment on lines
+323
to
+330
| 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
+689
to
+691
| get_static_dns_ips(){ | ||
| ind=1 | ||
|
|
| { | ||
| if(g_Dns_ForwardCount == 0) | ||
| { | ||
| Utopia_GetInt(ctx, UtopiaValue_Dns_ForwardCount, &g_Dns_ForwardCount); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason for change: Implementation of DNS forward proxy
Test Procedure: DNS Relay DM functionality and proxy functionality
Risks: None.
Signed-off-by: Sherik Sensin A sherik.a@t-systems.com
Change-Id: I930ffa57b58c2e2123f731d5b6cb74fd88cd594c