summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2015-05-20 15:21:53 +1000
committerChris Johns <chrisj@rtems.org>2015-07-14 08:15:52 +1000
commit083e6d6b4bfddedd917af9ab9a68c149a81ed63a (patch)
treeabe19aed9db2ecdbdfcca118d1f1c81de08562dd /cpukit
parentscore: Simplify _Thread_Lock_set() (diff)
downloadrtems-083e6d6b4bfddedd917af9ab9a68c149a81ed63a.tar.bz2
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.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libnetworking/rtems/rtems_dhcp.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/cpukit/libnetworking/rtems/rtems_dhcp.c b/cpukit/libnetworking/rtems/rtems_dhcp.c
index 957a30a822..c938ee028f 100644
--- a/cpukit/libnetworking/rtems/rtems_dhcp.c
+++ b/cpukit/libnetworking/rtems/rtems_dhcp.c
@@ -1,4 +1,4 @@
-/*
+/*
* DCHP client for RTEMS
* Andrew Bythell, <abythell@nortelnetworks.com>
* based on and uses subroutines from c/src/libnetworking/nfs/bootp_subr.c
@@ -544,6 +544,20 @@ dhcp_discover_req (struct dhcp_packet* call,
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
*/
call->vend[len++] = DHCP_PARAMETERS;
@@ -880,7 +894,7 @@ dhcp_init (int update_files)
struct proc *procp = NULL;
clean_dns_entries();
-
+
/*
* If we are to update the files create the root
* file structure.