[PATCH] libnetworking: Send the hostname if set in the network configuration.
Chris Johns
chrisj at rtems.org
Tue May 5 06:34:13 UTC 2015
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.
---
cpukit/libnetworking/rtems/rtems_dhcp.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/cpukit/libnetworking/rtems/rtems_dhcp.c b/cpukit/libnetworking/rtems/rtems_dhcp.c
index 957a30a..fa44302 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 at nortelnetworks.com>
* based on and uses subroutines from c/src/libnetworking/nfs/bootp_subr.c
@@ -544,6 +544,21 @@ 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)) {
+ printf("]] len = %d\n", len);
+ 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 +895,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.
--
2.2.2
More information about the devel
mailing list