router: add syslog debug tracing for trouble shooting
[project/odhcpd.git] / src / dhcpv6.c
index c62a08f..81eae06 100644 (file)
@@ -18,6 +18,7 @@
 #include <stddef.h>
 #include <resolv.h>
 #include <sys/timerfd.h>
 #include <stddef.h>
 #include <resolv.h>
 #include <sys/timerfd.h>
+#include <arpa/inet.h>
 
 #include "odhcpd.h"
 #include "dhcpv6.h"
 
 #include "odhcpd.h"
 #include "dhcpv6.h"
@@ -228,7 +229,7 @@ static void handle_client_request(void *addr, void *data, size_t len,
        size_t dns_cnt = iface->dns_cnt;
 
        if ((dns_cnt == 0) &&
        size_t dns_cnt = iface->dns_cnt;
 
        if ((dns_cnt == 0) &&
-               odhcpd_get_preferred_interface_address(iface->ifindex, &dns_addr)) {
+               !odhcpd_get_linklocal_interface_address(iface->ifindex, &dns_addr)) {
                dns_addr_ptr = &dns_addr;
                dns_cnt = 1;
        }
                dns_addr_ptr = &dns_addr;
                dns_cnt = 1;
        }
@@ -460,7 +461,7 @@ static void relay_server_response(uint8_t *data, size_t len)
                size_t rewrite_cnt = iface->dns_cnt;
 
                if (rewrite_cnt == 0) {
                size_t rewrite_cnt = iface->dns_cnt;
 
                if (rewrite_cnt == 0) {
-                       if (odhcpd_get_preferred_interface_address(iface->ifindex, &addr) < 1)
+                       if (odhcpd_get_linklocal_interface_address(iface->ifindex, &addr))
                                return; // Unable to get interface address
 
                        rewrite = &addr;
                                return; // Unable to get interface address
 
                        rewrite = &addr;