treewide: use RELAYD_MAX_ADDRS as address array size
authorHans Dedecker <dedeckeh@gmail.com>
Sat, 21 Jan 2017 15:27:17 +0000 (16:27 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Sat, 21 Jan 2017 15:27:17 +0000 (16:27 +0100)
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/ndp.c
src/odhcpd.h
src/router.c

index f9e04051c73c3018c3b9197a51e2ab2148f88b3c..7cabc5e69cbbc79b4cd262618062a459bb501610 100644 (file)
--- a/src/ndp.c
+++ b/src/ndp.c
@@ -291,9 +291,9 @@ static int prefixcmp(const void *va, const void *vb)
 // Check address update
 static void check_updates(struct interface *iface)
 {
-       struct odhcpd_ipaddr addr[8] = {{IN6ADDR_ANY_INIT, 0, 0, 0, 0}};
+       struct odhcpd_ipaddr addr[RELAYD_MAX_ADDRS] = {{IN6ADDR_ANY_INIT, 0, 0, 0, 0}};
        time_t now = odhcpd_time();
-       ssize_t len = odhcpd_get_interface_addresses(iface->ifindex, addr, 8);
+       ssize_t len = odhcpd_get_interface_addresses(iface->ifindex, addr, ARRAY_SIZE(addr));
 
        if (len < 0)
                return;
index 0e5868cd06dc6b14cb14e732aa1bbce837f84f33..cbeaaf82644f36c8ce6f51afa0a54d76d79514ac 100644 (file)
@@ -43,6 +43,7 @@
 
 #define RELAYD_BUFFER_SIZE 8192
 #define RELAYD_MAX_PREFIXES 8
+#define RELAYD_MAX_ADDRS 8
 
 #define INFINITE_VALID(x) ((x) == 0)
 
@@ -118,7 +119,7 @@ struct interface {
        // Runtime data
        struct uloop_timeout timer_rs;
        struct list_head ia_assignments;
-       struct odhcpd_ipaddr ia_addr[8];
+       struct odhcpd_ipaddr ia_addr[RELAYD_MAX_ADDRS];
        size_t ia_addr_len;
        bool ia_reconf;
 
index f964a82a813368a100eb2f888add88b6b40816fa..bc228295706c1f62e2db513c71aaccca70e1f57c 100644 (file)
@@ -247,7 +247,7 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add
        odhcpd_get_mac(iface, adv.lladdr.data);
 
        // If not currently shutting down
-       struct odhcpd_ipaddr addrs[8];
+       struct odhcpd_ipaddr addrs[RELAYD_MAX_ADDRS];
        ssize_t ipcnt = 0;
        int64_t minvalid = INT64_MAX;