From d976d94e3d902c23a9ebbc3bc7afab61694280ac Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Tue, 22 Jul 2025 22:09:49 +0100 Subject: [PATCH] Implement RFC 6221 para 4. If the link address in a relayed DHCPv6 message is zero, don't use it for addresss selection. --- src/rfc3315.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rfc3315.c b/src/rfc3315.c index a502bb3..90b50ce 100644 --- a/src/rfc3315.c +++ b/src/rfc3315.c @@ -245,7 +245,11 @@ static int dhcp6_maybe_relay(struct state *state, unsigned char *inbuff, size_t struct in6_addr align; /* the packet data is unaligned, copy to aligned storage */ memcpy(&align, inbuff + 2, IN6ADDRSZ); - state->link_address = &align; + + + /* RFC6221 para 4 */ + if (!IN6_IS_ADDR_UNSPECIFIED(&align)) + state->link_address = &align; /* zero is_unicast since that is now known to refer to the relayed packet, not the original sent by the client */ if (!dhcp6_maybe_relay(state, opt6_ptr(opt, 0), opt6_len(opt), client_addr, 0, now))