On Mon, Apr 25, 2022 at 08:29:18PM +0200, Florian Obser wrote: > On 2022-04-24 20:01 +02, Ibrahim Khalifa <i...@trukonsult.se> wrote: > > Hi, > > > > I ran into an issue with dhcpleased when trying to do pxeboot and automatic > > installation when using DHCP Relay on Cisco ASA. > > > > The problem is when dhcpleased starts for the first time after bsd.rd > > is loaded there is no hostname set for the server yet. Dhcpleased will > > set option 12 in it’s discover request but set the length to 0. As per > > the RFC the minimum length for the host name is 1. The assumption here > > is that sending option 12 with a zero length would be treated the same > > as it not being set. However Cisco ASA will block such package with > > error ”option 12 is malformed.”. > > > > It can be argued on which view on this is the most correct, but as it > > is now at least Cisco ASA blocks it as malformed. The attached patch > > will not set option 12 if the host name is empty. It works for me, > > both in the above scenario but also when host name is set. Someone > > with better insight in the depth of dhcpleased might know if this > > could be done in a more elegant way. > > > > Best regards, > > > > //Ibo > > > > > > very good catch. > > There is no need for strlen(3), we just want to know if hostname is the > empty string, i.e. starts with '\0'. > > Btw. fun thing, I tested this by moving /etc/myname out of the way and > the dhcp server on my CPE just echos the empty hostname back. dhcpleased > refuses the lease because the hostname option is invalid :D > > OK?
ok