rpms/dhcp/devel dhcp-3.0.3-dhclient_ibmzSeries_-I_option.patch, NONE, 1.1

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Mar 2 22:52:27 UTC 2006


Author: jvdias

Update of /cvs/dist/rpms/dhcp/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv24418

Added Files:
	dhcp-3.0.3-dhclient_ibmzSeries_-I_option.patch 
Log Message:
fix bug 181908: fix dhclient IBM zSeries linux guest operation - add -I <dhcp-client-identifier> option

dhcp-3.0.3-dhclient_ibmzSeries_-I_option.patch:
 dhclient.8 |   19 ++++++++++++++++++-
 dhclient.c |   48 ++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 64 insertions(+), 3 deletions(-)

--- NEW FILE dhcp-3.0.3-dhclient_ibmzSeries_-I_option.patch ---
--- dhcp-3.0.3/client/dhclient.8.dhclient_ibmzSeries_-I_option	2006-03-02 17:29:07.000000000 -0500
+++ dhcp-3.0.3/client/dhclient.8	2006-03-02 17:37:11.000000000 -0500
@@ -81,6 +81,10 @@
 .B -x
 ]
 [
+.B -I
+.I dhcp-client-identifier
+]
+[
 .B -B
 ]
 [
@@ -261,7 +265,20 @@
 .PP
 The -x argument enables eXtended option information to be created in the
 -s dhclient-script environment, which would allow applications running 
-in that environment to handle options they do not know about in advance.
+in that environment to handle options they do not know about in advance -
+this is a Red Hat extension to support dhcdbd and NetworkManager.
+.PP
+The -I <id> argument allow you to specify the dhcp-client-identifier string, <id>,
+to be sent to the dhcp server on the command line. It is equivalent to the
+top level dhclient.conf statement:
+.br
+ \fBsend dhcp-client-identifier "<id>";\fR
+The -I <id> command line option will override any top level dhclient.conf 
+'send dhcp-client-identifier' statement, but more specific per-interface
+'interface "X" { send dhcp-client-identifier...; }' statements in dhclient.conf
+will override the -I <id> command line option for interface "X".
+This option is provided as a Red Hat extension to enable dhclient to work
+on IBM zSeries z/OS Linux guests .
 .PP
 The -B option instructs dhclient to set the bootp broadcast flag in request
 packets, so that servers will always broadcast replies . This is equivalent
--- dhcp-3.0.3/client/dhclient.c.dhclient_ibmzSeries_-I_option	2006-03-02 17:29:07.000000000 -0500
+++ dhcp-3.0.3/client/dhclient.c	2006-03-02 17:36:02.000000000 -0500
@@ -107,6 +107,7 @@
 	int no_dhclient_pid = 0;
 	int no_dhclient_script = 0;
 	char *s;
+	char *dhcp_client_identifier_arg = 0L;
 
 	/* Make sure we have stdin, stdout and stderr. */
 	i = open ("/dev/null", O_RDWR);
@@ -216,6 +217,17 @@
 			extended_option_environment = 1;
 			new_option_info_tree = GENERATE_NEW_OPTION_INFO;
 #endif
+		} else if (!strcmp (argv [i], "-I")) {
+			if ((++i == argc) || (argv[i] == 0L) || (*(argv[i])=='\0'))
+				usage ();
+			if (strlen(argv[i]) >= DHCP_OPTION_LEN)
+			{
+				log_error("-I option dhcp-client-identifier string \"%s\" is too long -"
+					  "maximum length is: %d",  argv[i], DHCP_OPTION_LEN-1);
+				exit(1);
+			}
+			dhcp_client_identifier_arg = argv[i];
+
 		} else if (!strcmp (argv [i], "-B")) {
 			bootp_broadcast_always = 1;
  		} else if (argv [i][0] == '-') {
@@ -440,6 +452,38 @@
 	/* Parse the dhclient.conf file. */
 	read_client_conf ();
 
+	if ( (dhcp_client_identifier_arg != 0L) && (*dhcp_client_identifier_arg != '\0') )
+	{ 
+	   /* parse the dhcp client identifier option  
+	    * as a 'send' statement at top level scope:
+            */
+	      	struct parse *cfile = (struct parse *)0;
+		char send_dhcid_stmt[ DHCP_OPTION_LEN + 40 ];
+		const char *val=0L;
+		int  token, send_dhcid_stmt_len = 
+			 sprintf (send_dhcid_stmt, "send dhcp-client-identifier \"%s\";",
+				  dhcp_client_identifier_arg
+			         );
+		
+		status = new_parse (&cfile, -1, send_dhcid_stmt, send_dhcid_stmt_len,
+				    "dhcp-client-identifier option", 0);
+
+		if (status != ISC_R_SUCCESS)
+			log_fatal ("Cannot parse dhcp-client-identifier send statement!");
+
+		do {
+			token = peek_token (&val, (unsigned *)0, cfile);
+			if (token == END_OF_FILE)
+				break;
+
+			parse_client_statement (cfile,
+						(struct interface_info *)0,
+						&top_level_config);
+
+		} while (1);
+		end_parse (&cfile);
+	}
+		
 	/* Parse the lease database. */
 	read_client_leases ();
 
@@ -584,9 +628,9 @@
 	log_info (url);
 
 #ifdef EXTENDED_NEW_OPTION_INFO
-	log_error ("Usage: dhclient [-1dqr] [-nwx] [-p <port>] [-B] %s",
+	log_error ("Usage: dhclient [-1dqr] [-nwx] [-p <port>] [-I <id>] [-B] %s",
 #else
-	log_error ("Usage: dhclient [-1dqr] [-nw] [-p <port>] [-B] %s",
+	log_error ("Usage: dhclient [-1dqr] [-nw] [-p <port>] [-I <id>] [-B] %s",
 #endif
 		   "[-s server]");
 	log_error ("                [-cf config-file] [-lf lease-file]%s",




More information about the fedora-cvs-commits mailing list