ndp: fix adding proxy neighbor entries
[project/odhcpd.git] / src / ndp.c
index e201ac9..49aea1c 100644 (file)
--- a/src/ndp.c
+++ b/src/ndp.c
@@ -33,9 +33,8 @@
 #include <netlink/socket.h>
 #include <netlink/attr.h>
 
-#include "router.h"
 #include "dhcpv6.h"
-#include "ndp.h"
+#include "odhcpd.h"
 
 struct event_socket {
        struct odhcpd_event ev;
@@ -363,8 +362,6 @@ static void check_addr_updates(struct interface *iface)
        qsort(addr, len, sizeof(*addr), prefixcmp);
 
        for (int i = 0; i < len; ++i) {
-               addr[i].addr.s6_addr32[3] = 0;
-
                if (addr[i].preferred < UINT32_MAX - now)
                        addr[i].preferred += now;
 
@@ -395,7 +392,7 @@ static void check_addr_updates(struct interface *iface)
        }
 }
 
-void setup_addr_for_relaying(struct in6_addr *addr, struct interface *iface, bool add)
+static void setup_addr_for_relaying(struct in6_addr *addr, struct interface *iface, bool add)
 {
        struct interface *c;
        char ipbuf[INET6_ADDRSTRLEN];
@@ -406,18 +403,18 @@ void setup_addr_for_relaying(struct in6_addr *addr, struct interface *iface, boo
                if (iface == c || (c->ndp != RELAYD_RELAY && !add))
                        continue;
 
-               add = (c->ndp == RELAYD_RELAY ? add : false);
+               bool neigh_add = (c->ndp == RELAYD_RELAY ? add : false);
 
-               if (odhcpd_setup_proxy_neigh(addr, c, add))
+               if (odhcpd_setup_proxy_neigh(addr, c, neigh_add))
                        syslog(LOG_DEBUG, "Failed to %s proxy neighbour entry %s%%%s",
-                               add ? "add" : "delete", ipbuf, iface->ifname);
+                               neigh_add ? "add" : "delete", ipbuf, c->ifname);
                else
                        syslog(LOG_DEBUG, "%s proxy neighbour entry %s%%%s",
-                               add ? "Added" : "Deleted", ipbuf, iface->ifname);
+                               neigh_add ? "Added" : "Deleted", ipbuf, c->ifname);
        }
 }
 
-void setup_ping6(struct in6_addr *addr, struct interface *iface)
+static void setup_ping6(struct in6_addr *addr, struct interface *iface)
 {
        struct interface *c;