I have a pic with several nics.
At the moment, 2 of them are connected
- one is connected to a 'real' network where it got an ip address 10.2.0.56 via dhcp
- one has a fixed ip 10.1.3.37, and the tftpd32 DHCP server is bound to this address. It has a pool of 10 addresses starting at 10.1.3.1, mask is set to 255.255.255.0, the default router to 10.1.3.37.
Now for some reason, the DHCP server sets the 'Next server IP address' in its DHCP reply packet to 10.2.0.56 instead of 10.1.3.37. The IP address given to the client is correct (10.1.3.1).
Looking at the code, I guess there is some problem in FindNearestServerAddress when
pNearest = FindNearestServerAddress (&pDhcpPkt->yiaddr, & sParamDHCP.dwMask, FALSE);
I assume this is called with parameters equivalent to :
FindNearestServerAddress ( 10.1.3.1, 255.255.255.0, FALSE );
So 10.1.3.37 should be nearer then 10.2.0.56.
Looking at the FindNearestServerAddress code, I do not immediately see the problem, but I can't say I fully grok the function either. But problem with the function is already that Ark is not assigned a value when the first if fails, so the last return can return something not really well defined (though it will always be either the first entry or the loopback).
I am using tftpd64 version 4.
EDIT: TFTP is also enabled, so it should execute
if (sSettings.uServices & TFTPD32_TFTP_SERVER)
pDhcpPkt->siaddr = *pNearest; // Next server (TFTP server is enabled)
Edited by beamer145, 13 February 2013 - 01:27 PM.