From 6dcb1569fc782a8f8a5e8855faee5aadcc769554 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Sat, 13 Sep 2025 12:45:50 +0100 Subject: [PATCH] ND Route Information Option prefix is optional As the length could be zero and is RFC compliant. Fixes #527. --- src/dhcpcd-definitions-small.conf | 2 +- src/dhcpcd-definitions.conf | 2 +- src/if-options.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dhcpcd-definitions-small.conf b/src/dhcpcd-definitions-small.conf index 2f231286..0c874ae1 100644 --- a/src/dhcpcd-definitions-small.conf +++ b/src/dhcpcd-definitions-small.conf @@ -74,7 +74,7 @@ embed byte length # bits 4 and 5 are route preference embed bitflags=00011 prf embed uint32 lifetime -embed truncated ip6address prefix +embed optional truncated ip6address prefix # ND6 options, RFC6101 definend 25 index embed rdnss diff --git a/src/dhcpcd-definitions.conf b/src/dhcpcd-definitions.conf index 5c9230de..e350aa9f 100644 --- a/src/dhcpcd-definitions.conf +++ b/src/dhcpcd-definitions.conf @@ -417,7 +417,7 @@ embed byte length # bits 4 and 5 are route preference embed bitflags=00011 prf embed uint32 lifetime -embed truncated ip6address prefix +embed optional truncated ip6address prefix # ND6 options, RFC6101 definend 25 index embed rdnss diff --git a/src/if-options.c b/src/if-options.c index 3cb89f35..2819113d 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -2093,7 +2093,7 @@ err_sla: t |= OT_RESERVED; } } - if (t & OT_TRUNCATED && t != (OT_ADDRIPV6 | OT_TRUNCATED)) { + if (t & OT_TRUNCATED && !(t & OT_ADDRIPV6)) { logerrx("truncated only works for ip6address"); return -1; } -- 2.47.3