This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: DHCP Options Enhancements


Andrew Lunn wrote:
> This requires that all applications that are linked with an eCos
> library with this option enabled have a function called
> cyg_get_dhcp_hostname(). Think about all the test cases etc. They
> don't have this function so they will not link.
I did it this way intentionally.  The new option is disabled by default, so
no existing
applications or test cases would have any linking problems.  If you enabled
the option,
then you would need to provide the host name via the cyg_get_dhcp_hostname()
function.
The linking error would remind you if you forgot.  It is an error to enable
this option
and not provide the host name, since there is no default host name.

I have attached a new patch with the suggested change.  I called the
function dhcp_set_hostname(), rather than cyg_dhcp_set_hostname() to be
consistent with the other dhcp_xxx() functions.  This can be changed if you
prefer the cyg_ prefix.

As with the previous method, there is no default host name associated with
this option.
Now, if you enable this option, but don't define a host name (by calling
dhcp_set_hostname()), the option is effectively disabled (at run-time).

Jay

-----Original Message-----
From: Andrew Lunn [mailto:andrew@lunn.ch]
Sent: Sunday, October 12, 2003 3:44 AM
To: Jay Foster
Cc: 'ecos-patches@sources.redhat.com'
Subject: Re: DHCP Options Enhancements


On Tue, Sep 30, 2003 at 05:53:01PM -0700, Jay Foster wrote:
> Attached is a patch for the DHCP options.  The patch includes the patch
> submitted previously that adds the host name and MAC address client ID to
> the DHCP request.  The patch also includes the CDL interface to configure
> the CYGOPT_NET_DHCP_PARM_REQ_LIST_REPLACE and
> CYGOPT_NET_DHCP_PARM_REQ_LIST_ADDITIONAL options.  These two options have
> been in the source code for some time, but there was no CDL interface to
> configure them.

Hi Jay.

The new CDL for CYGOPT_NET_DHCP_PARM_REQ_LIST_REPLACE and
CYGOPT_NET_DHCP_PARM_REQ_LIST_ADDITIONAL is fine. I've committed that
part of the patch, with a few minor modifications. 

I don't like this bit of code:
+#ifdef CYGOPT_NET_DHCP_OPTION_HOST_NAME
+{
+    extern char *cyg_get_dhcp_hostname(void);
+    char *hostname = cyg_get_dhcp_hostname();
+    if (hostname != NULL)
+    	set_variable_tag( xmit, TAG_HOST_NAME, hostname, (strlen(hostname) +
1));
+}

This requires that all applications that are linked with an eCos
library with this option enabled have a function called
cyg_get_dhcp_hostname(). Think about all the test cases etc. They
don't have this function so they will not link.

Please can you change this so that the application can call a function
cyg_dhcp_set_hostname() before calling init_all_network_interfaces()
to set the hostname. 

   Thanks
        Andrew

Index: net/common/current//ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/ChangeLog,v
retrieving revision 1.43
diff -u -r1.43 ChangeLog
--- net/common/current//ChangeLog	9 Oct 2003 16:08:31 -0000	1.43
+++ net/common/current//ChangeLog	12 Oct 2003 10:43:31 -0000
@@ -1,3 +1,9 @@
+2003-10-12  Jay Foster  <jay@systech.com>
+ 
+ 	* cdl/net.cdl: Added configuration interface for
+	CYGOPT_NET_DHCP_PARM_REQ_LIST_REPLACE and
+	CYGOPT_NET_DHCP_PARM_REQ_LIST_ADDITIONAL.
+
 2003-10-09  Eric Doenges <Eric.Doenges@DynaPel.com>
 
         * src/tftp_client.c: Changed the code so that if the last packet
Index: net/common/current//cdl/net.cdl
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/cdl/net.cdl,v
retrieving revision 1.8
diff -u -r1.8 net.cdl
--- net/common/current//cdl/net.cdl	31 Jul 2003 08:56:27 -0000	1.8
+++ net/common/current//cdl/net.cdl	12 Oct 2003 10:43:33 -0000
@@ -246,6 +246,28 @@
             when necessary, but it does not need to be as high as the
             network thread itself."
         }
+
+        cdl_option CYGOPT_NET_DHCP_PARM_REQ_LIST_REPLACE {
+            display "Replace DHCP request options"
+            flavor  booldata
+            default_value 0
+            active_if CYGOPT_NET_DHCP_DHCP_THREAD
+            description "
+                This option replaces the default list of requested
+                options in the DHCP/BOOTP request list.  These are a
+                comma separated list of TAG_xxx values."
+        }
+
+        cdl_option CYGOPT_NET_DHCP_PARM_REQ_LIST_ADDITIONAL {
+            display "Additional DHCP request options"
+            flavor  booldata
+            default_value 0
+            active_if CYGOPT_NET_DHCP_DHCP_THREAD
+            description " 
+                This option adds additional options to the list of
+                requested options in the DHCP/BOOTP request list.
+                These are a comma separated list of TAG_xxx values."
+        }
     }
 
     cdl_component CYGPKG_NET_IPV6_ROUTING {

Attachment: dhcp_ids3.pat
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]