RDKCOM-5612: RDKBNETWOR-16 DNS Relay Feature#366
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 Refer to JIRA Risks: None. Change-Id: I930ffa57b58c2e2123f731d5b6cb74fd88cd594c Signed-off-by: Sherik Sensin A <sherik.a@t-systems.com>
Contributor
Contributor
There was a problem hiding this comment.
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_enableanddns_forward_count. - Introduced
utapi_dns.hand 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); |
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 Refer to JIRA
Risks: None.
Signed-off-by: Sherik Sensin A sherik.a@t-systems.com
Change-Id: I930ffa57b58c2e2123f731d5b6cb74fd88cd594c