How to get DNS address?

Hello,
I’m using Connect ME9210 with NET+OS.

Is there any way to read DNS address when DHCP is enabled? I use ‘customizeIamGetIfAddrInfo()’ which gives me current IP, subnet mask, gateway, but DNS is reported as 0.0.0.0.
Even if I disable the DHCP and it uses “APP_PRIMARY_DNS_ADDRESS” defined in “appconf.h”, the function still returns DNS as zero.

Many thanks for suggestions

are you running Netos 7.5.2 with all the patches?
are you able to run: C:
etos75\src\examples
adnsclnt\ example app? Works fine here

Hi,

yes I’m running NETOS 7.5.2. All patches installed.

The example works fine. Thanks for it. The function “DNSGetServers()” works fine for me. I can use it instead of “customizeIamGetIfAddrInfo()”.

Also, does the NETOS use DNS translation when it boots up? Meaning, can I configure for example SNTP server by its name instead of address?

#define APP_SNTP_PRIMARY “1.gb.pool.ntp.org

instead of

#define APP_SNTP_PRIMARY “71.252.219.43”

Thanks for answer

i beleive it has to be the IP, but you can easily change this. It is used in C:
etos75\src\bsp\common\C:
etos75\src\bsp\common\appconf_api.c

/ad

  • Returns the value of @link APP_SNTP_PRIMARY as defined in appconf.h
  • @external
  • @include “appconf_api.h”
  • @category SystemSWServices:ApplicationConfiguration
  • @since 6.0
  • @return IP-Address IP Address of primary SNTP server.
  • @return NULL APP_SNTP_PRIMARY is not defined.
    ad/
    char * NAGetAppSntpPrimary(void)
    {
    #ifdef APP_SNTP_PRIMARY
    return (APP_SNTP_PRIMARY);
    #else
    return (NULL);
    #endif
    }

chust change this function so it will accept hostname and resolve it.

Hello,

Thanks for suggestion.
I’ve tried to modify the function, but the problem is if you want to translate the host name using “getaddrinfo()” inside the function “NAGetAppSntpPrimary()” it does not work. It just get stuck. I guess the problem is that network connection is not established yet while calling the function “NAGetAppSntpPrimary()” and so it cannot access the DNS.

So it seems the only option is to use just an IP address.

Thank you