summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Dedecker2019-01-02 18:23:11 +0000
committerHans Dedecker2019-01-04 17:56:25 +0000
commit96694abe8093b06daf5d503d19e7cdcd62de03a5 (patch)
tree300573a77dca34e7274b45c994bc36f02b9fed5f
parentd404c7e50bd487f9d8d3b13e5ff1c7fa878c7973 (diff)
downloadodhcpd-96694abe8093b06daf5d503d19e7cdcd62de03a5.tar.gz
router: filter route information option
Commit 750e457e3000187b85906814a2529ede24775325 added the capability to filter out prefixes in RAs; however routes were not filtered out based on the prefixes. This commit fixes this by taking into account the prefix_filter when constructing the RA route info option Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r--src/router.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/router.c b/src/router.c
index 70f9462..eb99145 100644
--- a/src/router.c
+++ b/src/router.c
@@ -588,7 +588,12 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add
for (ssize_t i = 0; i < ipcnt; ++i) {
struct odhcpd_ipaddr *addr = &addrs[i];
if (addr->dprefix > 64 || addr->dprefix == 0 || addr->valid <= (uint32_t)now)
- continue; // Address not suitable
+ continue; /* Address not suitable */
+
+ if (odhcpd_bmemcmp(&addr->addr, &iface->pio_filter_addr,
+ iface->pio_filter_length) != 0 ||
+ addr->prefix < iface->pio_filter_length)
+ continue; /* RIO filtered out of this RA */
if (addr->dprefix > 32) {
addr->addr.in6.s6_addr32[1] &= htonl(~((1U << (64 - addr->dprefix)) - 1));