[Dnsmasq-discuss] Bug in 2.31 and dhcp relay

Simon Kelley simon at thekelleys.org.uk
Mon Jun 26 14:11:21 BST 2006


Daniel Hamlin wrote:
> There appears to be a bug in 2.31 (and earlier), that mishandles requests 
> forwarded by a dhcp relay.  In this packet capture, 192.168.1.196 is the DHCP 
> server, and 192.168.0.1 is the router (Nortel Passport 8600).  Notice the 
> response is sent back to the wrong port on the relay.  According to "The DHCP 
> Handbook", the response to a relay should go back to port 67, not 68 as 
> dnsmasq is currently doing. 

Your analysis is spot on: this code was changed around 2.28 to honour 
the source port in the request from the relay, rather then always send 
to port 68. The aim was to allow use of non-standard ports by relays, 
but it breaks if the relay sets port 67 as the source for the relayed 
packets, as in this case. It's probably best just to revert this change, 
and always send to port 68.

	
Cheers,

Simon.



> It appears that the bug is in dhcp.c line 229:
> 
> if (mess->giaddr.s_addr)
> {
>   /* Send to BOOTP relay  */
>   if (!dest.sin_port)
> dest.sin_port = htons(DHCP_SERVER_PORT);
>   dest.sin_addr = mess->giaddr;
> }
> 
> when the "if (!dest.sin_port)" statement is commented out, the dhcp server 
> works correctly:
> 
> if (mess->giaddr.s_addr)
> {
>   /* Send to BOOTP relay  */
>   /*if (!dest.sin_port)*/
> dest.sin_port = htons(DHCP_SERVER_PORT);
>   dest.sin_addr = mess->giaddr;
> }
> 
> 
> Dan Hamlin
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 




More information about the Dnsmasq-discuss mailing list