Other Parts Discussed in Thread: CC3120
Hi TI Team,
I'm looking for some clarity on setting the Secondary DNS server option when DHCP is enabled and some information on when that second DNS is being used.
Secondary DNS being overwritten
I'm running into an issue where the Secondary DNS server that is set by the application is overwritten. I've described the steps below that will replicate the condition.
Things happen in this order:
SL_NETAPP_EVENT_IPV4_ACQUIRED
received in SL App Event Handler- Instructs another task to change states and configures the Secondary DNS
- Execute the code in Block A below
- Another task check the Secondary DNS address (using
sl_NetCfgGet
) a bit of time later (to log the DHCP given data and the secondary DNS data as well) - Secondary DNS address matches the Primary DNS that was given from the DHCP server, and not the configured DNS (i.e.
192.168.1.254
in my case, versus1.1.1.1
)
Block A
// Here we also want to set the secondary DNS, as an IP acquisition has overridden the value // This is stated in SWRU455J - §5.3.3 DNS Addresses // Setup secondary DNS to CloudFlare's DNS server dns_opt.DnsSecondServerAddr = SL_IPV4_VAL(1, 1, 1, 1); int16_t sl_ret_val = 0; sl_ret_val = sl_NetCfgSet(SL_NETCFG_IPV4_DNS_CLIENT, 0, config_len, (uint8_t *)&dns_opt); assert(sl_ret_val == 0);
These are the observations that I have found from testing the functionality:
- Setting it too early, it appears the NWP will overwrite the secondary with the primary given from the DHCP server
- The IP Acquired event is received by the application, but setting the Secondary DNS in that callback or quickly after will cause it to be overwritten.
- Tried adjusting the DHCP process from "Opportunistic Renew Process" back to "Full Renew Process", but didn't seem to have an effect.
Repeated attempts to set the Secondary DNS server will eventually cause it to "stick". I'm assuming this is because after the DHCP process finishes fully, the DHCP process will have completed and the set Secondary DNS server IP will remain.
My biggest hang-up on this issue is, when trying to set the Secondary DNS server, I know I must wait until the DHCP process has completed, but there's no unique event to know when the Secondary DNS is safe to set.
Secondary DNS Usage
I ran some experiments with the Secondary DNS server set on my device, and created a scenario where the Primary DNS was no longer accessible. It seemed like calls to SlNetUtil_getHostByName
(the specific of which is in the SNTP lib) and calls to sl_NetAppDnsGetHostByName
(in the AWS libs) were failing. I tried adjusting the timeout/retry values, as is mentioned on this CC3120 MOD post on E2E, but it didn't seem to have any effect. It seems the name resolution doesn't fail over to the secondary DNS if the primary is unavailable.
Can you provide any guidance on either/both of these issues?
Thank you very much,
-Tom