Browse Source

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

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>
Alin Nastac 3 years ago
parent
commit
f5728e40ff
2 changed files with 3 additions and 3 deletions
  1. 2 2
      src/dhcpv6.c
  2. 1 1
      src/odhcp6c.h

+ 2 - 2
src/dhcpv6.c

@@ -1229,8 +1229,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;
 

+ 1 - 1
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;