diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-04-11 20:20:41 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-04-11 20:20:41 +0200 |
commit | a89bee73739384c02c9d2caa82a0f780e3c25345 (patch) | |
tree | 5ccb887927523210932ae502254770d65f840cac | |
parent | d9bf5d074dccde7bc66d6c19565da9e5aeb5c7c5 (diff) | |
download | plan9front-a89bee73739384c02c9d2caa82a0f780e3c25345.tar.xz |
ip/dhcpd: work around raspberry pi pxe firmware by providing dhcp option 66
The raspberry pi 4 PXE firmware insists on finding the tftp
server address by parsing dhcp option 66 as an ip address
string.
-rw-r--r-- | sys/src/cmd/ip/dhcpd/dhcpd.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/src/cmd/ip/dhcpd/dhcpd.c b/sys/src/cmd/ip/dhcpd/dhcpd.c index 7ca52a049..f6323f535 100644 --- a/sys/src/cmd/ip/dhcpd/dhcpd.c +++ b/sys/src/cmd/ip/dhcpd/dhcpd.c @@ -1136,8 +1136,7 @@ miscoptions(Req *rp, uchar *ip) uchar *addrs[8]; uchar *op, *omax; uchar x[nelem(addrs)*IPaddrlen], vopts[Maxoptlen]; - char *p; - char *attr[100], **a; + char ip4str[16], *p, *attr[100], **a; Ndbtuple *t; Iplifc *lifc; @@ -1279,6 +1278,21 @@ miscoptions(Req *rp, uchar *ip) case OBttl: byteopt(rp, OBttl, 255); break; + + case ODtftpserver: + /* + * This option actually should contain a hostname, BUT: + * It appears that Rpi4 PXE firmware ignores the siaddr + * and instead insists on this (DHCP option 66) to contain + * the IP address string of the TFTP server. + */ + snprint(ip4str, sizeof(ip4str), "%V", rp->bp->siaddr); + stringopt(rp, ODtftpserver, ip4str); + break; + case ODbootfile: + if(*rp->bp->file) + stringopt(rp, ODbootfile, rp->bp->file); + break; } if (*rp->vendorclass != '\0') { |