[En-Nut-Discussion] DHCP hostname

Damian Slee damian at commtech.com.au
Thu Apr 15 05:44:01 CEST 2004


Hi,
I've noticed the hostname registration didn't make it in.  I've change
it here to use the new confos.hostname field.  Is this initialised to 0
length anywhere?



static int DhcpDiscover(UDPSOCKET * sock, struct bootp *bp, u_long xid,
u_short secs)
{
...
	/* Pass host name if specified in confos structure.  */
	/* Win2k DHCP server can register this as dynamic DNS entry.
Also viewing DHCP lease table shows something sensible */
	len = strlen(confos.hostname);
	if (len > 0)  {
		optlen += DhcpAddOptionFromRAM(op + optlen,
DHCPOPT_HOSTNAME, confos.hostname, len);
	}

	    /* Request a maximum message size. */
	    optlen += DhcpAddShortOption(op + optlen,
DHCPOPT_MAXMSGSIZE, htons(MAX_DHCP_MSGSIZE));

	    return DhcpSendMessage(sock, INADDR_BROADCAST, bp, optlen);
}



static int DhcpRequest(UDPSOCKET * sock, u_long daddr, struct bootp *bp,
u_long xid, u_long caddr, u_long raddr, u_long sid,
                       u_short secs)
{
...
	/* Pass host name if specified in confos structure.  */
	/* viewing DHCP lease table shows something sensible. */
	len = strlen(confos.hostname);
	if (len > 0)  {
		optlen += DhcpAddOptionFromRAM(op + optlen,
DHCPOPT_HOSTNAME, confos.hostname, len);
	}

    return DhcpSendMessage(sock, daddr, bp, optlen);
}



More information about the En-Nut-Discussion mailing list