On Thu, Dec 2, 2021 at 1:35 AM Geert Stappers via Dnsmasq-discuss <dnsmasq-discuss@lists.thekelleys.org.uk> wrote: > > 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.
I hear pi v3 ignores next-server. for more details on what it does: it first does many ftp get /<filenam> and it isn't clear what files it needs from the boot partition.if t can't find the file in / then it tries /<serial>/<filename> so I could put all 41 files in /srv/tftp ... but that makes me grumpy. > > Is the serial number also visible in the DHCP request? > IRC #raspberypi clever: i believe it is, run wireshark and you should see it in a dhcp option good idea. if this works, then I don't need to worry about the ftp error. > > > id=7a6d27f6 > > Is that a MAC address? > > no, but.. also no: "there's a serial-number hard-coded into the SoC (you can see yours with "cat /proc/cpuinfo"), and the serial number determines the Ethernet MAC address " https://forums.raspberrypi.com/viewtopic.php?f=29&t=8985 algorithm is proprietary to the chip manufacturer. Which effectively means, "nobody knows if the serial number can be counted on to be truly unique". https://raspberrypi.stackexchange.com/questions/2086/how-do-i-get-the-serial-number > > 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 > > _______________________________________________ > Dnsmasq-discuss mailing list > Dnsmasq-discuss@lists.thekelleys.org.uk > https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss -- Carl K _______________________________________________ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss