[Dnsmasq-discuss] tftp hook for "not found"

Geert Stappers stappers at stappers.nl
Thu Dec 2 09:04:45 UTC 2021


On Wed, Dec 01, 2021 at 08:36:47PM -0800, Carl Karsten wrote:
> Subject: Re: [Dnsmasq-discuss] tftp hook for "not found"
> or some way to create a symlink when needed.
> 
> when a pi net boots, it injects its serial number into the path that
> it requests:
> dnsmasq-tftp[678]: file /srv/tftp/7a6d27f6/autoboot.txt not found
> 
> When thathappens, I need to create a symlink:
> id=7a6d27f6
>  ln -s  /srv/tftp/boot /srv/tftp/${id}
> 
> and ideally catch that before it decides to error.  otherwise I'll
> just power cycle the pi and the 2nd time it should work.
> 
> if I understand the docs the hook only gets called on "sent" -
> 
> "The "tftp" action is invoked when a TFTP file transfer completes: the
> arguments are the file size in bytes, the address to which the file
> was sent, and the complete pathname of the file. "
> https://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html
> 
> I only expect to have 20 - 40 pi's, so it isn't a huge problem if I
> have to boot from SD card to harvest the serial number.  but it would
> be nice if we didn't need to do that.

It would be nice if the clients did not mengle next filename request.

Is the serial number also visible in the DHCP request?


> id=7a6d27f6

Is that a MAC address?



Anyway, this if is from the manual page of dnsmasq

  --dhcp-script=<path>
       Whenever  a  new  DHCP lease is created, or an old one destroyed,
       or a TFTP file transfer completes, the executable specified by
       this  option  is  run.
       The arguments to the process are "add", "old" or "del", the
       MAC address of the  host  (or DUID  for IPv6) , the IP address,
       and the hostname, if known.



Groeten
Geert Stappers
-- 
Silence is hard to parse



More information about the Dnsmasq-discuss mailing list