diff mbox series

[odhcp6c] odhcp6c_find_entry: exclude priority from the list of fields that must match

Message ID 1602774735-8141-1-git-send-email-alin.nastac@gmail.com
State Accepted
Headers show
Series [odhcp6c] odhcp6c_find_entry: exclude priority from the list of fields that must match | expand

Commit Message

Alin Nastac Oct. 15, 2020, 3:12 p.m. UTC
Priority of an entry can vary from one RA to another, but the entry
identity should be the same regardless of the priority declared in the
RA message handled in ra_process() at a time.

CDRouter for instance tests compliance of the device  to requirement
G-5 of RFC 7084 by provisioning initially the CPE with a valid default
route that has a medium preference after which it sends a low preference
RA with lifetime 0 to check that CPE will start sending RAs with
lifetime 0 on the LAN side. Because odhcp6c didn't matched the low
precedence default router entry with the odhcp6c_entry that was
previously stored with medium precedence, it will fail to remove the
existing STATE_RA_ROUTE default route, hence preventing odhcpd from
advertising RAs with lifetime 0 to LAN.

Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
---
 src/dhcpv6.c  | 4 ++--
 src/odhcp6c.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/src/dhcpv6.c b/src/dhcpv6.c
index 4cd1abc..65cc4e1 100644
--- a/src/dhcpv6.c
+++ b/src/dhcpv6.c
@@ -1233,8 +1233,8 @@  static unsigned int dhcpv6_parse_ia(void *opt, void *end)
 
 	// Update address IA
 	dhcpv6_for_each_option(&ia_hdr[1], end, otype, olen, odata) {
-		struct odhcp6c_entry entry = {IN6ADDR_ANY_INIT, 0, 0, 0,
-				IN6ADDR_ANY_INIT, 0, 0, 0, 0, 0};
+		struct odhcp6c_entry entry = {IN6ADDR_ANY_INIT, 0, 0,
+				IN6ADDR_ANY_INIT, 0, 0, 0, 0, 0, 0};
 
 		entry.iaid = ia_hdr->iaid;
 
diff --git a/src/odhcp6c.h b/src/odhcp6c.h
index 40ce098..14d0017 100644
--- a/src/odhcp6c.h
+++ b/src/odhcp6c.h
@@ -348,8 +348,8 @@  struct odhcp6c_entry {
 	struct in6_addr router;
 	uint8_t auxlen;
 	uint8_t length;
-	int16_t priority;
 	struct in6_addr target;
+	int16_t priority;
 	uint32_t valid;
 	uint32_t preferred;
 	uint32_t t1;