From 6bb689210cc20aa6ab47d249f50b6e141cf76488 Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 5 Jun 2024 10:25:07 +0000 Subject: [PATCH] Do not request a prefix with length zero. If we got a prefix delegation for some IA but not others use the prefix lenght from the configuration for the ones we did not get a prefix delegation. --- sbin/dhcp6leased/frontend.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sbin/dhcp6leased/frontend.c b/sbin/dhcp6leased/frontend.c index 6dc1abe5203..c5cb4467f83 100644 --- a/sbin/dhcp6leased/frontend.c +++ b/sbin/dhcp6leased/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.9 2024/06/04 15:48:47 florian Exp $ */ +/* $OpenBSD: frontend.c,v 1.10 2024/06/05 10:25:07 florian Exp $ */ /* * Copyright (c) 2017, 2021, 2024 Florian Obser @@ -874,9 +874,12 @@ build_packet(uint8_t message_type, struct iface *iface, char *if_name) case DHCPRENEW: case DHCPREBIND: pd = &iface->pds[ia_conf->id]; - iaprefix.prefix_len = pd->prefix_len; - memcpy(&iaprefix.prefix, &pd->prefix, - sizeof(struct in6_addr)); + if (pd->prefix_len > 0) { + iaprefix.prefix_len = pd->prefix_len; + memcpy(&iaprefix.prefix, &pd->prefix, + sizeof(struct in6_addr)); + } else + iaprefix.prefix_len = ia_conf->prefix_len; break; default: fatalx("%s: %s not implemented", __func__, -- 2.20.1