Skip to content

Commit ce0599f

Browse files
zhhyu7xiaoxiang781216
authored andcommitted
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 <[email protected]>
1 parent 986ddc8 commit ce0599f

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

net/icmpv6/icmpv6_input.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,6 @@ void icmpv6_input(FAR struct net_driver_s *dev, unsigned int iplen)
480480
struct sockaddr_in6 addr;
481481
int nservers;
482482
int ret;
483-
int i;
484483

485484
if (rdnss->optlen < 3)
486485
{
@@ -497,15 +496,13 @@ void icmpv6_input(FAR struct net_driver_s *dev, unsigned int iplen)
497496
servers = (FAR struct in6_addr *)rdnss->servers;
498497
nservers = (rdnss->optlen - 1) / 2;
499498

500-
/* Set the IPv6 DNS server address */
501-
502-
memset(&addr, 0, sizeof(addr));
503-
addr.sin6_family = AF_INET6;
504-
505-
for (i = 0; i < CONFIG_NETDB_DNSSERVER_NAMESERVERS &&
506-
i < nservers; i++)
499+
if (nservers > 0)
507500
{
508-
net_ipv6addr_copy(&addr.sin6_addr, servers + i);
501+
/* Set the IPv6 DNS server address */
502+
503+
memset(&addr, 0, sizeof(addr));
504+
addr.sin6_family = AF_INET6;
505+
net_ipv6addr_copy(&addr.sin6_addr, servers);
509506
ret = dns_add_nameserver(
510507
(FAR const struct sockaddr *)&addr,
511508
sizeof(struct sockaddr_in6));

0 commit comments

Comments
 (0)