On 25/02/2024 23:24, Carl Karsten wrote:
Either dhcp-script isn't doing what it is expected, or I'd like it to do more. I am netbooting raspberry pi. so some dhcp client in the pi firmware get's an IP and netboot params, then tftp client gets files. the dhcp traffic happens and is shown in the logs, but not dhcp-script: sudo journalctl --follow -u dnsmasq.service Feb 25 16:49:44 base dnsmasq-dhcp[47924]: DHCPDISCOVER(eth-local) b8:27:eb:2f:5d:08 Feb 25 16:49:44 base dnsmasq-dhcp[47924]: DHCPOFFER(eth-local) 10.21.0.102 b8:27:eb:2f:5d:08 Feb 25 16:49:50 base dnsmasq-tftp[47924]: file /srv/tftp/bootsig.bin not found for 10.21.0.102 Feb 25 16:49:50 base dnsmasq-tftp[47924]: sent /srv/tftp/bootcode.bin to 10.21.0.102 Feb 25 16:49:50 base dnsmasq-dhcp[47924]: DHCPDISCOVER(eth-local) b8:27:eb:2f:5d:08 Feb 25 16:49:50 base dnsmasq-dhcp[47924]: DHCPOFFER(eth-local) 10.21.0.102 b8:27:eb:2f:5d:08 Feb 25 16:49:50 base dnsmasq-tftp[47924]: error 0 Early terminate received from 10.21.0.102 Feb 25 16:49:50 base dnsmasq-tftp[47924]: failed sending /srv/tftp/042f5d08/start.elf to 10.21.0.102 Feb 25 16:49:50 base dnsmasq-tftp[47924]: file /srv/tftp/042f5d08/autoboot.txt not found for 10.21.0.102 Feb 25 16:49:50 base dnsmasq-tftp[47924]: error 0 Early terminate received from 10.21.0.102 Feb 25 16:49:50 base dnsmasq-tftp[47924]: failed sending /srv/tftp/042f5d08/start.elf to 10.21.0.102 Feb 25 16:49:50 base dnsmasq-tftp[47924]: sent /srv/tftp/042f5d08/config.txt to 10.21.0.102 log from https://github.com/CarlFK/pici/blob/main/ansible/roles/site/files/pib/pistat/scripts/send_stat.py#L83 Namespace(action='tftp', mac='52476', ip='10.21.0.102', hostname='/srv/tftp/bootcode.bin') dsh='(none)' Namespace(action='tftp', mac='2545', ip='10.21.0.102', hostname='/srv/tftp/042f5d08/config.txt') dsh='(none)' Namespace(action='tftp', mac='2979264', ip='10.21.0.102', hostname='/srv/tftp/042f5d08/start.elf') dsh='(none)' I suspect the problem is with the client not DHCPREQUEST and so the server doesn't ACK and thus I guess an IP hasn't actually be allocated, thus no "add" event has happened which calls the script. if this is the case, can we add an "offer" action?
You're right that the script actions are triggered by changes in the DHCP lease database, and DISCOVER/OFFER doesn't change the database so there's no action. Because of the link with the lease database and the lack of a lease at OFFER stage, adding a new action there is severely non trivial.
I'd suggest that the the Pi netboot code is pretty buggy: a client shouldn't use IP address until it gets a lease, and it doesn't get the lease until it gets a DHCPACK message. It's perfectly possible to have a two-message interaction: just set the rapid-commit option in the DISCOVER packet and the server will go straight to DHCPACK and committing a lease. Buggy netboot code is far from uncommon, in my experience.
Simon. _______________________________________________ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss