Jump to content

- - - - -

DHCP replies with incorrect next server ip address

dhcp server ip address

  • Please log in to reply
No replies to this topic

#1 beamer145

  • Members
  • 6 posts

Posted 13 February 2013 - 01:22 PM



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 via dhcp

- one has a fixed ip, and the tftpd32 DHCP server is bound to this address. It has a pool of 10 addresses starting at, mask is set to, the default router to


Now for some reason, the DHCP server sets the 'Next server IP address' in its DHCP reply packet to instead of The IP address given to the client is correct (


Looking at the code, I guess there is some problem in FindNearestServerAddress when

pNearest = FindNearestServerAddress (&pDhcpPkt->yiaddr, & sParamDHCP.dwMask, FALSE);

is called.

I assume this is called with parameters equivalent to :

FindNearestServerAddress (,, FALSE );

So should be nearer then


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.

Also tagged with one or more of these keywords: dhcp, server ip address

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users