[En-Nut-Discussion] DHCP hostname

Damian Slee damian at commtech.com.au
Thu Apr 15 05:49:19 CEST 2004


This may also have to be added to the header
#define DHCPOPT_HOSTNAME     12 


-----Original Message-----
From: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] On Behalf Of Damian Slee
Sent: Thursday, April 15, 2004 11:44 AM
To: Ethernut User Chat (English)
Subject: [En-Nut-Discussion] DHCP hostname

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); }
_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion





More information about the En-Nut-Discussion mailing list