Skip to content

Commit

Permalink
dhcp: do not clobber $range_to / $range_from with the legacy test merge
Browse files Browse the repository at this point in the history
#7046

The merge is used as a test if a prefix is set at all (the legacy input
required a "prefix" but it was actually a suffix and verified as such)
but now that we prevent merging without a leading "::" the final compress
moves the compressed format from the front to the end because that sequence
is longer but the next merge doesn't like that.  Do the test merge without
storing the result as we do not need it anyway.
  • Loading branch information
fichtner committed Dec 19, 2023
1 parent 5cf738f commit dd92fe4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/etc/inc/plugins.inc.d/dhcpd.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1369,15 +1369,15 @@ function dhcpd_dhcp6_configure($verbose = false, $blacklist = [])
/* XXX $pdlen is never validated against prefixlenght setting, but must be smaller or equal */
$pdlen = 64 - calculate_ipv6_delegation_length($config['interfaces'][$ifname]['track6-interface']);

$range_from = merge_ipv6_address($dhcpdv6cfg[$ifname]['prefixrange']['from'], '::');
if ($range_from == '::') {
$range_from = $dhcpdv6cfg[$ifname]['prefixrange']['from'];
if (merge_ipv6_address($range_from, '::') == '::') {
log_msg("'{$dhcpdv6cfg[$ifname]['prefixrange']['from']}' is not a valid prefix range value", LOG_WARNING);
/* XXX previously it was suggested to use suffix but it was actually infix so shift 64 bits if possible */
$range_from = $dhcpdv6cfg[$ifname]['prefixrange']['from'] . ':0:0:0:0';
}

$range_to = merge_ipv6_address($dhcpdv6cfg[$ifname]['prefixrange']['to'], '::');
if ($range_to == '::') {
$range_to = $dhcpdv6cfg[$ifname]['prefixrange']['to'];
if (merge_ipv6_address($range_to, '::') == '::') {
log_msg("'{$dhcpdv6cfg[$ifname]['prefixrange']['to']}' is not a valid prefix range value", LOG_WARNING);
/* XXX previously it was suggested to use suffix but it was actually infix so shift 64 bits if possible */
$range_to = $dhcpdv6cfg[$ifname]['prefixrange']['to'] . ':0:0:0:0';
Expand Down

0 comments on commit dd92fe4

Please sign in to comment.