net/icmpv6/icmpv6_input.c: fix undefined build error
When CONFIG_NETDB_RESOLVCONF is enabled, CONFIG_NETDB_DNSSERVER_NAMESERVERS will undefined, could cause net/icmpv6/icmpv6_input.c build error. just add one nameserver to avoid overwrite ipv4 nameserver. Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
parent
986ddc83ce
commit
ce0599f46c
@ -480,7 +480,6 @@ void icmpv6_input(FAR struct net_driver_s *dev, unsigned int iplen)
|
|||||||
struct sockaddr_in6 addr;
|
struct sockaddr_in6 addr;
|
||||||
int nservers;
|
int nservers;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (rdnss->optlen < 3)
|
if (rdnss->optlen < 3)
|
||||||
{
|
{
|
||||||
@ -497,15 +496,13 @@ void icmpv6_input(FAR struct net_driver_s *dev, unsigned int iplen)
|
|||||||
servers = (FAR struct in6_addr *)rdnss->servers;
|
servers = (FAR struct in6_addr *)rdnss->servers;
|
||||||
nservers = (rdnss->optlen - 1) / 2;
|
nservers = (rdnss->optlen - 1) / 2;
|
||||||
|
|
||||||
/* Set the IPv6 DNS server address */
|
if (nservers > 0)
|
||||||
|
|
||||||
memset(&addr, 0, sizeof(addr));
|
|
||||||
addr.sin6_family = AF_INET6;
|
|
||||||
|
|
||||||
for (i = 0; i < CONFIG_NETDB_DNSSERVER_NAMESERVERS &&
|
|
||||||
i < nservers; i++)
|
|
||||||
{
|
{
|
||||||
net_ipv6addr_copy(&addr.sin6_addr, servers + i);
|
/* Set the IPv6 DNS server address */
|
||||||
|
|
||||||
|
memset(&addr, 0, sizeof(addr));
|
||||||
|
addr.sin6_family = AF_INET6;
|
||||||
|
net_ipv6addr_copy(&addr.sin6_addr, servers);
|
||||||
ret = dns_add_nameserver(
|
ret = dns_add_nameserver(
|
||||||
(FAR const struct sockaddr *)&addr,
|
(FAR const struct sockaddr *)&addr,
|
||||||
sizeof(struct sockaddr_in6));
|
sizeof(struct sockaddr_in6));
|
||||||
|
Loading…
Reference in New Issue
Block a user