From f620b7afe2133f8ddf564b65de24ef2f13e030ac Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Thu, 13 Jun 2024 15:41:48 -0600 Subject: [PATCH] Restore previous behavior of static dhcp - Disable dynamic pool when using static dhcp - Populate configuration of non-primary interfaces for static dhcp Signed-off-by: Jonathon Anderson --- CHANGELOG.md | 1 + overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0259720..20b50301 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix a regression in overlay autobuild. #1216 - Fix wwclient not reading asset-tag. #1110 - Fix dhcp not passing asset tag or uuid to iPXE. #1110 +- Restored previous static dhcp behavior. #1263 ## v4.5.4, 2024-06-12 diff --git a/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww b/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww index 78f715dd..4489c748 100644 --- a/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww +++ b/overlays/host/rootfs/etc/dhcp/dhcpd.conf.ww @@ -51,8 +51,10 @@ if exists user-class and option user-class = "iPXE" { subnet {{$.Network}} netmask {{$.Netmask}} { max-lease-time 120; +{{- if ne .Dhcp.Template "static" }} range {{$.Dhcp.RangeStart}} {{$.Dhcp.RangeEnd}}; next-server {{.Ipaddr}}; +{{- end }} } {{- if eq .Dhcp.Template "static" }} @@ -60,20 +62,19 @@ subnet {{$.Network}} netmask {{$.Netmask}} { {{- range $netname, $netdevs := $nodes.NetDevs}} host {{$nodes.Id.Get}}-{{$netname}} { - {{- if $netdevs.Primary.GetB}} {{- if $netdevs.Hwaddr.Defined}} hardware ethernet {{$netdevs.Hwaddr.Get}}; {{- end }} {{- if $netdevs.Ipaddr.Defined}} fixed-address {{$netdevs.Ipaddr.Get}}; {{- end }} + {{- if $netdevs.Primary.GetB}} option host-name "{{$nodes.Id.Get}}"; {{- end }} } {{end -}}{{/* range NetDevs */}} {{end -}}{{/* range AllNodes */}} {{end -}}{{/* if static */}} - {{- else}} {{abort}} {{- end}}{{/* dhcp enabled */}}