Networking_IpConfig_EnableCustomDns Function

Header: #include <applibs/networking.h>

Uses custom DNS server addresses for a Networking_IpConfig struct. Up to three addresses may be specified. Any existing DNS server configured via DHCP will be overridden.

void Networking_IpConfig_EnableCustomDns(Networking_IpConfig *ipConfig, const struct in_addr *dnsServerAddresses,
                                        size_t serverCount);

Parameters

  • ipConfig A pointer to the Networking_IpConfig struct to update.

  • dnsServerAddresses A pointer to an array of DNS server addresses.

  • serverCount The number of DNS server addresses in the dnsServerAddresses array.

Errors

Returns -1 if an error is encountered and sets errno to the error value.

  • EFAULT: the ipConfig or dnsServerAddresses parameter is NULL.

  • EINVAL: more than three IP addresses were provided, or an address in dnsServerAddresses equals INADDR_ANY.

Any other errno may also be specified; such errors aren't deterministic, and there's no guarantee that the same behavior will be retained through system updates.

Return value

Returns 0 for success, or -1 for failure, in which case errno is set to the error value.

Concepts and samples

Azure Sphere can run an external device on the network.