Fix dhcp-hostsfile to explicitly set known tag for PXE clients
Bare MACs in dhcp-hostsfile were not auto-setting the known tag in proxy DHCP mode, causing dhcp-ignore=tag:!known to drop all requests. Explicitly write set:known per host entry. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -79,11 +79,11 @@ func (s *Supervisor) writeConfig(hosts []model.Host) error {
|
|||||||
confPath := filepath.Join(s.cfg.RuntimeDir, "dnsmasq.conf")
|
confPath := filepath.Join(s.cfg.RuntimeDir, "dnsmasq.conf")
|
||||||
hostsPath := filepath.Join(s.cfg.RuntimeDir, "dhcp-hostsfile")
|
hostsPath := filepath.Join(s.cfg.RuntimeDir, "dhcp-hostsfile")
|
||||||
|
|
||||||
var macs []string
|
var lines []string
|
||||||
for _, h := range hosts {
|
for _, h := range hosts {
|
||||||
macs = append(macs, h.MAC)
|
lines = append(lines, h.MAC+",set:known")
|
||||||
}
|
}
|
||||||
if err := os.WriteFile(hostsPath, []byte(strings.Join(macs, "\n")+"\n"), 0o644); err != nil {
|
if err := os.WriteFile(hostsPath, []byte(strings.Join(lines, "\n")+"\n"), 0o644); err != nil {
|
||||||
return fmt.Errorf("pxe: write dhcp-hostsfile: %w", err)
|
return fmt.Errorf("pxe: write dhcp-hostsfile: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user