summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2017-01-21 16:27:17 +0100
committerHans Dedecker <dedeckeh@gmail.com>2017-01-21 16:27:17 +0100
commitdf023adafeee1bf48fa1e0cce31e7130f8043dae (patch)
treec3c99a5ec23ce0faa4ab86e5229d53b595725daf /src
parentc8ac572154981ca833dad92d7ee7aa62b88087cc (diff)
treewide: use RELAYD_MAX_ADDRS as address array size
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/ndp.c4
-rw-r--r--src/odhcpd.h3
-rw-r--r--src/router.c2
3 files changed, 5 insertions, 4 deletions
diff --git a/src/ndp.c b/src/ndp.c
index f9e0405..7cabc5e 100644
--- 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;
diff --git a/src/odhcpd.h b/src/odhcpd.h
index 0e5868c..cbeaaf8 100644
--- a/src/odhcpd.h
+++ b/src/odhcpd.h
@@ -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;
diff --git a/src/router.c b/src/router.c
index f964a82..bc22829 100644
--- a/src/router.c
+++ b/src/router.c
@@ -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;