[BusyBox-cvs] busybox/networking/udhcp Config.in,1.1,1.2 options.c,1.1,1.2 options.h,1.1,1.2 script.c,1.1,1.2
Glenn McGrath
bug1 at busybox.net
Sun Dec 8 22:17:58 UTC 2002
- Previous message: [BusyBox-cvs] busybox/debian busybox-cvs-static.dirs,1.1,1.2 config-deb,1.2,1.3 config-static,1.3,1.4 config-udeb,1.4,1.5 control,1.13,1.14 copyright,1.2,1.3 rules,1.19,1.20
- Next message: [BusyBox-cvs] busybox/shell Config.in,1.2,1.3 ash.c,1.63,1.64 cmdedit.c,1.74,1.75 cmdedit.h,1.13,1.14
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/cvs/busybox/networking/udhcp
In directory winder:/tmp/cvs-serv850/networking/udhcp
Modified Files:
Config.in options.c options.h script.c
Log Message:
Support using ip in udhcpc scripts.
Slightly modified version of patch by Bastian Blank
Index: Config.in
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/Config.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Config.in 5 Dec 2002 08:40:56 -0000 1.1
+++ Config.in 8 Dec 2002 22:17:54 -0000 1.2
@@ -38,5 +38,14 @@
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: options.c
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/options.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- options.c 14 Oct 2002 21:41:27 -0000 1.1
+++ options.c 8 Dec 2002 22:17:54 -0000 1.2
@@ -13,11 +13,16 @@
#include "options.h"
#include "leases.h"
+#include "config.h"
/* supported options are easily added here */
struct dhcp_option options[] = {
/* name[10] flags code */
- {"subnet", OPTION_IP | OPTION_REQ, 0x01},
+#ifdef CONFIG_FEATURE_UDHCPC_IP
+ {"subnet", OPTION_IP | OPTION_REQ | OPTION_PREFIX, 0x01},
+#else
+ {"subnet", OPTION_IP | OPTION_REQ, 0x01},
+#endif
{"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.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- options.h 14 Oct 2002 21:41:27 -0000 1.1
+++ options.h 8 Dec 2002 22:17:54 -0000 1.2
@@ -4,6 +4,8 @@
#include "packet.h"
+#include "config.h"
+
#define TYPE_MASK 0x0F
enum {
@@ -20,6 +22,7 @@
#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.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- script.c 14 Oct 2002 21:41:27 -0000 1.1
+++ script.c 8 Dec 2002 22:17:54 -0000 1.2
@@ -37,6 +37,8 @@
#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 "),
@@ -62,6 +64,37 @@
return sprintf(dest, "%s%d.%d.%d.%d ", pre, ip[0], ip[1], ip[2], ip[3]);
}
[...36 lines suppressed...]
*(dest++) = '/';
option += 4;
optlen = 4;
+#ifndef CONFIG_FEATURE_UDHCPC_IP
case OPTION_IP: /* Works regardless of host byte order. */
+#endif
dest += sprintip(dest, "", option);
break;
+#ifdef CONFIG_FEATURE_UDHCPC_IP
+ case OPTION_IP: /* Works regardless of host byte order. */
+ if (type_p->flags & OPTION_PREFIX) {
+ dest += sprintprefix(dest, "", option);
+ } else {
+ dest += sprintip(dest, "", option);
+ }
+ break;
+#endif
case OPTION_BOOLEAN:
dest += sprintf(dest, *option ? "yes " : "no ");
break;
- Previous message: [BusyBox-cvs] busybox/debian busybox-cvs-static.dirs,1.1,1.2 config-deb,1.2,1.3 config-static,1.3,1.4 config-udeb,1.4,1.5 control,1.13,1.14 copyright,1.2,1.3 rules,1.19,1.20
- Next message: [BusyBox-cvs] busybox/shell Config.in,1.2,1.3 ash.c,1.63,1.64 cmdedit.c,1.74,1.75 cmdedit.h,1.13,1.14
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the busybox-cvs
mailing list