AW: [En-Nut-Discussion] DHCP hostname

Oliver Schulz Oliver.Schulz at bong.de
Thu Apr 15 08:56:05 CEST 2004


Hi Damain,

in the latest version of pro/dhcpc.c (v 1.12, HEAD branch) the support for the hostname fiels is already added in the function NutDHCPRequest. It's works fine on my machine incl. dynamic DNS registration.

But the hostname option field was not included in NutDHCPDiscover, so I added it to this function a well.

These changes are NOT in branch nut-3_4_2-release, because it's an additional feature, thus must be implemented in the HEAD.

Cheers,
Oliver.

> -----Ursprüngliche Nachricht-----
> Von: en-nut-discussion-bounces at egnite.de
> [mailto:en-nut-discussion-bounces at egnite.de]Im Auftrag von Damian Slee
> Gesendet: Donnerstag, 15. April 2004 05:49
> An: Ethernut User Chat (English)
> Betreff: RE: [En-Nut-Discussion] DHCP hostname
> 
> 
> 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
> 
> 
> _______________________________________________
> 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