[BusyBox-cvs] busybox/networking/udhcp Config.in,1.2,1.3 README.udhcpc,1.2,1.3 dhcpc.c,1.4,1.5 dumpleases.c,1.2,1.3 files.c,1.2,1.3 options.c,1.2,1.3 options.h,1.2,1.3 script.c,1.2,1.3 version.h,1.1,1.2

Russ Dill russ at busybox.net
Wed Dec 11 21:12:49 UTC 2002


Update of /var/cvs/busybox/networking/udhcp
In directory winder:/tmp/cvs-serv24590

Modified Files:
	Config.in README.udhcpc dhcpc.c dumpleases.c files.c options.c 
	options.h script.c version.h 
Log Message:
resync with udhcp cvs

Index: Config.in
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/Config.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Config.in	8 Dec 2002 22:17:54 -0000	1.2
+++ Config.in	11 Dec 2002 21:12:44 -0000	1.3
@@ -38,14 +38,5 @@
 	help
 	  Please submit a patch to add help text for this item.
 
-config CONFIG_FEATURE_UDHCPC_IP
-	bool "  Compile udhcpc with ip support"
-	default n
-	depends on CONFIG_UDHCPC
-	help
-	  Say yes if you are using the ip command instead of route and ifconfig
-	  in your scripts to bring up the interface.
-	  This is needed as ip wants the subnet as a bitprefix not an ip value.
-
 endmenu
 

Index: README.udhcpc
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/README.udhcpc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- README.udhcpc	19 Nov 2002 00:41:09 -0000	1.2
+++ README.udhcpc	11 Dec 2002 21:12:44 -0000	1.3
@@ -69,6 +69,7 @@
 	$1		- What action the script should perform
 	interface	- The interface this was obtained on
 	ip		- The obtained IP
+	mask		- The number of bits in the netmask (ie: 24)
 	siaddr		- The bootp next server option
 	sname		- The bootp server name option
 	boot_file	- The bootp boot file option

Index: dhcpc.c
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/dhcpc.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dhcpc.c	11 Dec 2002 07:46:30 -0000	1.4
+++ dhcpc.c	11 Dec 2002 21:12:45 -0000	1.5
@@ -248,7 +248,7 @@
 		switch (c) {
 		case 'c':
 			len = strlen(optarg) > 255 ? 255 : strlen(optarg);
-			free(client_config.clientid);
+			if (client_config.clientid) free(client_config.clientid);
 			client_config.clientid = xmalloc(len + 2);
 			client_config.clientid[OPT_CODE] = DHCP_CLIENT_ID;
 			client_config.clientid[OPT_LEN] = len;
@@ -264,7 +264,7 @@
 		case 'h':
 		case 'H':
 			len = strlen(optarg) > 255 ? 255 : strlen(optarg);
-			free(client_config.hostname);
+			if (client_config.hostname) free(client_config.hostname);
 			client_config.hostname = xmalloc(len + 2);
 			client_config.hostname[OPT_CODE] = DHCP_HOST_NAME;
 			client_config.hostname[OPT_LEN] = len;

Index: dumpleases.c
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/dumpleases.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dumpleases.c	6 Dec 2002 21:42:56 -0000	1.2
+++ dumpleases.c	11 Dec 2002 21:12:45 -0000	1.3
@@ -28,7 +28,7 @@
 	u_int32_t expires;
 };
 
-#ifdef COMBINED_BINARY	
+#ifdef BB_VER
 int dumpleases_main(int argc, char *argv[])
 #else
 int main(int argc, char *argv[])

Index: files.c
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/files.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- files.c	28 Nov 2002 11:27:29 -0000	1.2
+++ files.c	11 Dec 2002 21:12:45 -0000	1.3
@@ -38,7 +38,7 @@
 {
 	char **dest = arg;
 	
-	free(*dest);
+	if (*dest) free(*dest);
 	*dest = strdup(line);
 	
 	return 1;

Index: options.c
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/options.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- options.c	8 Dec 2002 22:17:54 -0000	1.2
+++ options.c	11 Dec 2002 21:12:45 -0000	1.3
@@ -13,16 +13,11 @@
 #include "options.h"
 #include "leases.h"
 
-#include "config.h"
 
 /* supported options are easily added here */
 struct dhcp_option options[] = {
 	/* name[10]	flags					code */
-#ifdef CONFIG_FEATURE_UDHCPC_IP
-	{"subnet",	OPTION_IP | OPTION_REQ | OPTION_PREFIX,	0x01},
-#else
- 	{"subnet",	OPTION_IP | OPTION_REQ,			0x01},
-#endif
+	{"subnet",	OPTION_IP | OPTION_REQ,			0x01},
 	{"timezone",	OPTION_S32,				0x02},
 	{"router",	OPTION_IP | OPTION_LIST | OPTION_REQ,	0x03},
 	{"timesvr",	OPTION_IP | OPTION_LIST,		0x04},

Index: options.h
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/options.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- options.h	8 Dec 2002 22:17:54 -0000	1.2
+++ options.h	11 Dec 2002 21:12:45 -0000	1.3
@@ -4,8 +4,6 @@
 
 #include "packet.h"
 
-#include "config.h"
-
 #define TYPE_MASK	0x0F
 
 enum {
@@ -22,7 +20,6 @@
 
 #define OPTION_REQ	0x10 /* have the client request this option */
 #define OPTION_LIST	0x20 /* There can be a list of 1 or more of these */
-#define OPTION_PREFIX	0x40 /* ip wants a prefix instead of a ip for subnet */
 
 struct dhcp_option {
 	char name[10];

Index: script.c
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/script.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- script.c	8 Dec 2002 22:17:54 -0000	1.2
+++ script.c	11 Dec 2002 21:12:45 -0000	1.3
@@ -37,8 +37,6 @@
 #include "options.h"
 #include "debug.h"
 
-#include "config.h"
-
 /* get a rough idea of how long an option will be (rounding up...) */
 static int max_option_length[] = {
 	[OPTION_IP] =		sizeof("255.255.255.255 "),
@@ -60,41 +58,22 @@
 }
 
[...138 lines suppressed...]
-			fill_options(envp[j], temp, &options[i]);
-			j++;
+	envp[j] = xmalloc(sizeof("ip=255.255.255.255"));
+	sprintip(envp[j++], "ip=", (unsigned char *) &packet->yiaddr);
+
+
+	for (i = 0; options[i].code; i++) {
+		if (!(temp = get_option(packet, options[i].code)))
+			continue;
+		envp[j] = xmalloc(upper_length(temp[OPT_LEN - 2], &options[i]) + strlen(options[i].name) + 2);
+		fill_options(envp[j++], temp, &options[i]);
+
+		/* Fill in a subnet bits option for things like /24 */
+		if (options[i].code == DHCP_SUBNET) {
+			envp[j] = xmalloc(sizeof("mask=32"));
+			memcpy(&subnet, temp, 4);
+			sprintf(envp[j++], "mask=%d", mton(&subnet));
 		}
 	}
 	if (packet->siaddr) {

Index: version.h
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/version.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- version.h	5 Nov 2002 20:10:21 -0000	1.1
+++ version.h	11 Dec 2002 21:12:45 -0000	1.2
@@ -1,6 +1,6 @@
 #ifndef _UDHCP_VERSION_H
 #define _UDHCP_VERSION_H
 
-#define VERSION "0.9.8"
+#define VERSION "0.9.9-pre"
 
 #endif




More information about the busybox-cvs mailing list