forked from Imagelibrary/rtems
libnetworking: Send the hostname if set in the network configuration.
This allows a suitably configured DHCP server with DDNS to enter the name into the DNS table making it addressiable via it's host name.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* DCHP client for RTEMS
|
* DCHP client for RTEMS
|
||||||
* Andrew Bythell, <abythell@nortelnetworks.com>
|
* Andrew Bythell, <abythell@nortelnetworks.com>
|
||||||
* based on and uses subroutines from c/src/libnetworking/nfs/bootp_subr.c
|
* based on and uses subroutines from c/src/libnetworking/nfs/bootp_subr.c
|
||||||
@@ -543,6 +543,20 @@ dhcp_discover_req (struct dhcp_packet* call,
|
|||||||
call->vend[len++] = 1;
|
call->vend[len++] = 1;
|
||||||
call->vend[len++] = DHCP_DISCOVER;
|
call->vend[len++] = DHCP_DISCOVER;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a host name is set add it to the request.
|
||||||
|
*/
|
||||||
|
if (rtems_bsdnet_config.hostname && \
|
||||||
|
(strlen (rtems_bsdnet_config.hostname) > 1) &&
|
||||||
|
(strlen (rtems_bsdnet_config.hostname) < 32)) {
|
||||||
|
call->vend[len++] = DHCP_HOST;
|
||||||
|
call->vend[len++] = strlen (rtems_bsdnet_config.hostname);
|
||||||
|
memcpy (&call->vend[len],
|
||||||
|
rtems_bsdnet_config.hostname,
|
||||||
|
strlen (rtems_bsdnet_config.hostname));
|
||||||
|
len += strlen (rtems_bsdnet_config.hostname);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DHCP Parameter request list
|
* DHCP Parameter request list
|
||||||
*/
|
*/
|
||||||
@@ -880,7 +894,7 @@ dhcp_init (int update_files)
|
|||||||
struct proc *procp = NULL;
|
struct proc *procp = NULL;
|
||||||
|
|
||||||
clean_dns_entries();
|
clean_dns_entries();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we are to update the files create the root
|
* If we are to update the files create the root
|
||||||
* file structure.
|
* file structure.
|
||||||
|
|||||||
Reference in New Issue
Block a user