summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2005-02-16 19:48:03 +0000
committerEric Andersen <andersen@codepoet.org>2005-02-16 19:48:03 +0000
commit9cc9476c35294e43a1e42bd9752d5fae30a76c19 (patch)
treef897ea20f25bc8882a45455fbf78dfca6ed2fa75
parent2506ab7fc35695c53e6d46eb360fde6491bea0ba (diff)
more dhcp updates
-rw-r--r--package/Makefile.in1
-rw-r--r--package/dhcp/default-relay12
-rw-r--r--package/dhcp/default-server7
-rw-r--r--package/dhcp/dhclient.conf50
-rw-r--r--package/dhcp/dhcp.mk20
-rw-r--r--package/dhcp/dhcp_xecute.patch452
-rw-r--r--package/dhcp/dhcpd.conf108
-rwxr-xr-xpackage/dhcp/init-relay44
-rwxr-xr-xpackage/dhcp/init-server44
9 files changed, 729 insertions, 9 deletions
diff --git a/package/Makefile.in b/package/Makefile.in
index 2fda89fc7..fd6200a6c 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -34,6 +34,7 @@ KERNEL_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
TARGET_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
TARGET_CC=$(TARGET_CROSS)gcc
STRIP=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note
+INSTALL=/usr/bin/install
HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
diff --git a/package/dhcp/default-relay b/package/dhcp/default-relay
new file mode 100644
index 000000000..59249db28
--- /dev/null
+++ b/package/dhcp/default-relay
@@ -0,0 +1,12 @@
+# Defaults for dhcp-relay initscript
+# sourced by /etc/init.d/dhcp-relay
+
+# What servers should the DHCP relay forward requests to?
+# e.g: SERVERS="192.168.0.1"
+SERVERS=""
+
+# On what interfaces should the DHCP relay (dhrelay) serve DHCP requests?
+INTERFACES=""
+
+# Additional options that are passed to the DHCP relay daemon?
+OPTIONS="" \ No newline at end of file
diff --git a/package/dhcp/default-server b/package/dhcp/default-server
new file mode 100644
index 000000000..0385d1699
--- /dev/null
+++ b/package/dhcp/default-server
@@ -0,0 +1,7 @@
+# Defaults for dhcp initscript
+# sourced by /etc/init.d/dhcp-server
+# installed at /etc/default/dhcp-server by the maintainer scripts
+
+# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
+# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
+INTERFACES=""
diff --git a/package/dhcp/dhclient.conf b/package/dhcp/dhclient.conf
new file mode 100644
index 000000000..0e6dcf96c
--- /dev/null
+++ b/package/dhcp/dhclient.conf
@@ -0,0 +1,50 @@
+# Configuration file for /sbin/dhclient, which is included in Debian's
+# dhcp3-client package.
+#
+# This is a sample configuration file for dhclient. See dhclient.conf's
+# man page for more information about the syntax of this file
+# and a more comprehensive list of the parameters understood by
+# dhclient.
+#
+# Normally, if the DHCP server provides reasonable information and does
+# not leave anything out (like the domain name, for example), then
+# few changes must be made to this file, if any.
+#
+
+#send host-name "andare.fugue.com";
+#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
+#send dhcp-lease-time 3600;
+#supersede domain-name "fugue.com home.vix.com";
+#prepend domain-name-servers 127.0.0.1;
+request subnet-mask, broadcast-address, time-offset, routers,
+ domain-name, domain-name-servers, host-name,
+ netbios-name-servers, netbios-scope;
+#require subnet-mask, domain-name-servers;
+#timeout 60;
+#retry 60;
+#reboot 10;
+#select-timeout 5;
+#initial-interval 2;
+#script "/etc/dhcp3/dhclient-script";
+#media "-link0 -link1 -link2", "link0 link1";
+#reject 192.33.137.209;
+
+#alias {
+# interface "eth0";
+# fixed-address 192.5.5.213;
+# option subnet-mask 255.255.255.255;
+#}
+
+#lease {
+# interface "eth0";
+# fixed-address 192.33.137.200;
+# medium "link0 link1";
+# option host-name "andare.swiftmedia.com";
+# option subnet-mask 255.255.255.0;
+# option broadcast-address 192.33.137.255;
+# option routers 192.33.137.250;
+# option domain-name-servers 127.0.0.1;
+# renew 2 2000/1/12 00:00:01;
+# rebind 2 2000/1/12 00:00:01;
+# expire 2 2000/1/12 00:00:01;
+#}
diff --git a/package/dhcp/dhcp.mk b/package/dhcp/dhcp.mk
index c99241313..20708edae 100644
--- a/package/dhcp/dhcp.mk
+++ b/package/dhcp/dhcp.mk
@@ -22,6 +22,7 @@ dhcp-source: $(DL_DIR)/$(DHCP)
$(DHCP_DIR)/.unpacked: $(DL_DIR)/$(DHCP)
$(DHCP_CAT) $(DL_DIR)/$(DHCP) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ toolchain/patch-kernel.sh $(DHCP_DIR) package/dhcp/ dhcp*.patch
touch $(DHCP_DIR)/.unpacked
$(DHCP_DIR)/.configured: $(DHCP_DIR)/.unpacked
@@ -29,29 +30,30 @@ $(DHCP_DIR)/.configured: $(DHCP_DIR)/.unpacked
touch $(DHCP_DIR)/.configured
$(DHCP_DIR)/$(DHCP_RELAY_BINARY): $(DHCP_DIR)/.configured
- $(MAKE) CC=$(TARGET_CC) $(BVARS) -C $(DHCP_DIR)
+ $(MAKE) $(TARGET_CONFIGURE_OPTS) $(BVARS) -C $(DHCP_DIR)
$(STRIP) $(DHCP_DIR)/$(DHCP_RELAY_BINARY)
$(TARGET_DIR)/$(DHCP_SERVER_TARGET_BINARY): $(DHCP_DIR)/$(DHCP_RELAY_BINARY)
(cd $(TARGET_DIR)/var/lib; ln -sf /tmp dhcp)
- install -m 0755 $(DHCP_DIR)/dhcpd $(TARGET_DIR)/$(DHCP_SERVER_TARGET_BINARY)
- install -m 0755 $(DHCP_DIR)/dhcp-server $(TARGET_DIR)/etc/init.d/dhcp-server
- install -m 0644 $(DHCP_DIR)/dhcpd.conf $(TARGET_DIR)/etc/dhcp/dhcpd.conf
+ $(INSTALL) -m 0755 -D $(DHCP_DIR)/dhcpd $(TARGET_DIR)/$(DHCP_SERVER_TARGET_BINARY)
+ $(INSTALL) -m 0755 -D package/dhcp/init-server $(TARGET_DIR)/etc/init.d/dhcp-server
+ $(INSTALL) -m 0644 -D package/dhcp/dhcpd.conf $(TARGET_DIR)/etc/dhcp/dhcpd.conf
+ $(INSTALL) -m 0644 -D package/dhcp/default-server $(TARGET_DIR)/etc/default/dhcp-server
rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
$(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
$(TARGET_DIR)/$(DHCP_RELAY_TARGET_BINARY): $(DHCP_DIR)/$(DHCP_RELAY_BINARY)
(cd $(TARGET_DIR)/var/lib; ln -sf /tmp dhcp)
- install -m 0755 $(DHCP_DIR)/work.linux-2.2/relay/dhcrelay $(TARGET_DIR)/$(DHCP_RELAY_TARGET_BINARY)
- install -m 0755 $(DHCP_DIR)/work.linux-2.2/relay/dhcp-relay $(TARGET_DIR)/etc/init.d/dhcp-relay
- install -m 0644 $(DHCP_DIR)/dhclient.conf $(TARGET_DIR)/etc/default/dhcp-relay
+ $(INSTALL) -m 0755 -D $(DHCP_DIR)/work.linux-2.2/relay/dhcrelay $(TARGET_DIR)/$(DHCP_RELAY_TARGET_BINARY)
+ $(INSTALL) -m 0755 -D package/dhcp/init-relay $(TARGET_DIR)/etc/init.d/dhcp-relay
+ $(INSTALL) -m 0644 -D package/dhcp/default-relay $(TARGET_DIR)/etc/default/dhcp-relay
rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
$(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
$(TARGET_DIR)/$(DHCP_CLIENT_TARGET_BINARY): $(DHCP_DIR)/$(DHCP_RELAY_BINARY)
(cd $(TARGET_DIR)/var/lib; ln -sf /tmp dhcp)
- install -m 0755 $(DHCP_DIR)/dhclient $(TARGET_DIR)/$(DHCP_CLIENT_TARGET_BINARY)
- install -m 0644 $(DHCP_DIR)/dhclient.conf $(TARGET_DIR)/etc/dhcp/dhclient.conf
+ $(INSTALL) -m 0755 -D $(DHCP_DIR)/dhclient $(TARGET_DIR)/$(DHCP_CLIENT_TARGET_BINARY)
+ $(INSTALL) -m 0644 -D $(DHCP_DIR)/dhclient.conf $(TARGET_DIR)/etc/dhcp/dhclient.conf
rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
$(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
diff --git a/package/dhcp/dhcp_xecute.patch b/package/dhcp/dhcp_xecute.patch
new file mode 100644
index 000000000..358af5ff9
--- /dev/null
+++ b/package/dhcp/dhcp_xecute.patch
@@ -0,0 +1,452 @@
+diff -urN dhcp-3.0.1.orig/common/conflex.c dhcp-3.0.1/common/conflex.c
+--- dhcp-3.0.1.orig/common/conflex.c 2004-06-10 11:59:14.000000000 -0600
++++ dhcp-3.0.1/common/conflex.c 2005-02-16 12:41:43.000000000 -0700
+@@ -676,6 +676,8 @@
+ return EVAL;
+ if (!strcasecmp (atom + 1, "ncapsulate"))
+ return ENCAPSULATE;
++ if (!strcasecmp (atom + 1, "xecute"))
++ return EXECUTE;
+ break;
+ case 'f':
+ if (!strcasecmp (atom + 1, "atal"))
+diff -urN dhcp-3.0.1.orig/common/dhcp-eval.5 dhcp-3.0.1/common/dhcp-eval.5
+--- dhcp-3.0.1.orig/common/dhcp-eval.5 2004-06-10 11:59:15.000000000 -0600
++++ dhcp-3.0.1/common/dhcp-eval.5 2005-02-16 12:41:43.000000000 -0700
+@@ -408,7 +408,32 @@
+ Rebind - DHCP client is in the REBINDING state - it has an IP address,
+ and is trying to contact any server to renew it. The next message to
+ be sent will be a DHCPREQUEST, which will be broadcast.
+-.RE
++.PP
++.B execute (\fIcommand-path\fB, \fIdata-expr1\fB ... \fIdata-exprN\fB)\fR
++.PP
++External command execution is possibly through execute expressions. Execute
++takes a variable number of arguments, where the first is the command
++name (full path or only the name of the executable) and following zero
++or more are data-expressions which values will be passed as external
++arguments. It returns the return code of the external command.
++.PP
++Execute is synchronous, and the program will block until the external
++command being run has finished. Please note that lengthy program
++execution (for example, in an "on commit" in the dhcpd) may result in
++bad performance and timed out clients. Try keeping the execution times
++short.
++.PP
++Passing user-supplied data might be dangerous. Check input buffers
++and make sure the external command handles all kinds of "unusual"
++characters (shell special characters in sh-scripts etc) correctly.
++.PP
++It is possible to use the execute expression in any context, not only
++on events. If you put it in a regular scope in the configuration file
++you will execute that command every time a scope is evaluated.
++.PP
++The execute expression is only available if you have defined ENABLE_EXECUTE
++in site.h before compilation.
++RE
+ .SH REFERENCE: LOGGING
+ Logging statements may be used to send information to the standard logging
+ channels. A logging statement includes an optional priority (\fBfatal\fR,
+diff -urN dhcp-3.0.1.orig/common/parse.c dhcp-3.0.1/common/parse.c
+--- dhcp-3.0.1.orig/common/parse.c 2004-06-17 14:54:38.000000000 -0600
++++ dhcp-3.0.1/common/parse.c 2005-02-16 12:41:43.000000000 -0700
+@@ -3636,7 +3636,56 @@
+ return 0;
+ }
+ break;
+-
++ #ifdef ENABLE_EXECUTE
++ case EXECUTE:
++ token = next_token (&val, (unsigned *)0, cfile);
++
++ if (!expression_allocate (expr, MDL))
++ log_fatal ("can't allocate expression.");
++
++ token = next_token (&val, (unsigned *)0, cfile);
++ if (token != LPAREN) {
++ parse_warn (cfile, "left parenthesis expected.");
++ skip_to_semi (cfile);
++ *lose = 1;
++ return 0;
++ }
++ token = next_token (&val, (unsigned *)0, cfile);
++ (*expr) -> data.funcall.name =
++ dmalloc (strlen (val) + 1, MDL);
++ if (!(*expr)->data.funcall.name)
++ log_fatal ("can't allocate command name");
++ strcpy ((*expr) -> data.funcall.name, val);
++ token = next_token (&val, (unsigned *)0, cfile);
++ ep = &((*expr) -> data.funcall.arglist);
++ while (token == COMMA) {
++ if (!expression_allocate (ep, MDL))
++ log_fatal ("can't allocate expression");
++ if (!parse_data_expression (&(*ep) -> data.arg.val,
++ cfile, lose)) {
++ skip_to_semi (cfile);
++ *lose = 1;
++ return 0;
++ }
++ ep = &((*ep) -> data.arg.next);
++ token = next_token (&val, (unsigned *)0, cfile);
++ }
++ (*expr) -> op = expr_execute;
++ if (token != RPAREN) {
++ parse_warn (cfile, "right parenthesis expected.");
++ skip_to_semi (cfile);
++ *lose = 1;
++ return 0;
++ }
++ break;
++ #else
++ case EXECUTE:
++ parse_warn (cfile, "define ENABLE_EXECUTE in site.h to enable execute expressions.");
++ skip_to_semi (cfile);
++ *lose = 1;
++ return 0;
++ break;
++ #endif
+ case ENCODE_INT:
+ token = next_token (&val, (unsigned *)0, cfile);
+ token = next_token (&val, (unsigned *)0, cfile);
+diff -urN dhcp-3.0.1.orig/common/print.c dhcp-3.0.1/common/print.c
+--- dhcp-3.0.1.orig/common/print.c 2004-06-17 14:54:39.000000000 -0600
++++ dhcp-3.0.1/common/print.c 2005-02-16 12:41:43.000000000 -0700
+@@ -459,6 +459,7 @@
+ {
+ unsigned rv, left;
+ const char *s;
++ struct expression* next_arg;
+
+ switch (expr -> op) {
+ case expr_none:
+@@ -483,7 +484,8 @@
+ return rv;
+ }
+ break;
+-
++
++
+ case expr_equal:
+ if (len > 6) {
+ rv = 4;
+@@ -1024,6 +1026,29 @@
+ buf [rv++] = 0;
+ return rv;
+ }
++ #ifdef ENABLE_EXECUTE
++ case expr_execute:
++ rv = 11 + strlen (expr -> data.funcall.name);
++ if (len > rv + 2) {
++ sprintf (buf,
++ "(execute \"%s\"",
++ expr -> data.funcall.name);
++ for(next_arg = expr -> data.funcall.arglist;
++ next_arg;
++ next_arg = next_arg -> data.arg.next) {
++ if (len > rv + 3)
++ buf [rv++] = ' ';
++ rv += print_subexpression (next_arg ->
++ data.arg.val,
++ buf + rv,
++ len - rv - 2);
++ }
++ buf [rv++] = ')';
++ buf [rv] = 0;
++ return rv;
++ }
++ break;
++ #endif
+ }
+ return 0;
+ }
+diff -urN dhcp-3.0.1.orig/common/tree.c dhcp-3.0.1/common/tree.c
+--- dhcp-3.0.1.orig/common/tree.c 2004-06-17 14:54:39.000000000 -0600
++++ dhcp-3.0.1/common/tree.c 2005-02-16 12:41:43.000000000 -0700
+@@ -50,6 +50,113 @@
+ int resolver_inited = 0;
+ #endif
+
++#ifdef ENABLE_EXECUTE
++static unsigned long execute (char** args)
++{
++pid_t p = fork();
++if (p > 0) {
++int status;
++waitpid (p, &status, 0);
++return WEXITSTATUS(status);
++}
++else if(p == 0) {
++execvp (args[0], args);
++log_error ("Unable to execute %s: %s", args[0],
++strerror(errno));
++_exit(127);
++} else {
++log_fatal ("unable to fork");
++}
++return 1; /* never reached */
++}
++
++#define CAPACITY_INCREMENT 8
++static void append_to_ary (char*** ary_ptr, int* ary_size, int* ary_capacity,
++char* new_element)
++{
++(*ary_size)++;
++if (*ary_size > *ary_capacity) {
++char** new_ary;
++int new_ary_capacity = *ary_capacity + CAPACITY_INCREMENT;
++new_ary = dmalloc(new_ary_capacity*sizeof(char *), MDL);
++if (!new_ary)
++log_fatal ("no memory for array.");
++if (*ary_ptr != NULL) {
++memcpy (new_ary, *ary_ptr,
++(*ary_capacity)*sizeof(char *));
++dfree (*ary_ptr, MDL);
++}
++*ary_ptr = new_ary;
++*ary_capacity = new_ary_capacity;
++}
++(*ary_ptr)[*ary_size-1] = new_element;
++}
++
++static char* data_string_to_char_string (struct data_string* d)
++{
++char* str = dmalloc (d->len+1, MDL);
++if (!str)
++log_fatal ("no memory for string.");
++/* FIXME: should one use d -> buffer -> data or d -> data? are
++they equivalent? */
++strncpy (str, d -> data, d -> len);
++str[d->len] = '\0';
++return str;
++}
++
++static int evaluate_execute (unsigned long* result, struct packet *packet,
++struct lease *lease,
++struct client_state *client_state,
++struct option_state *in_options,
++struct option_state *cfg_options,
++struct binding_scope **scope,
++struct expression* expr)
++{
++int status;
++int cmd_status;
++int i;
++struct data_string ds;
++struct expression* next_arg;
++char** arg_ary = NULL;
++int arg_ary_size = 0;
++int arg_ary_capacity = 0;
++append_to_ary (&arg_ary, &arg_ary_size, &arg_ary_capacity,
++ expr -> data.funcall.name);
++for(next_arg = expr -> data.funcall.arglist;
++next_arg;
++next_arg = next_arg -> data.arg.next) {
++memset (&ds, 0, sizeof ds);
++status = (evaluate_data_expression
++(&ds, packet,
++lease, client_state, in_options,
++cfg_options, scope,
++next_arg -> data.arg.val,
++MDL));
++if (!status) {
++if (arg_ary) {
++for (i=1; i<arg_ary_size; i++)
++dfree (arg_ary[i], MDL);
++dfree(arg_ary, MDL);
++}
++return 0;
++}
++append_to_ary (&arg_ary, &arg_ary_size, &arg_ary_capacity,
++ data_string_to_char_string(&ds));
++data_string_forget (&ds, MDL);
++}
++#if defined (DEBUG_EXPRESSIONS)
++log_debug ("exec: execute");
++#endif
++append_to_ary (&arg_ary, &arg_ary_size, &arg_ary_capacity, NULL);
++*result = execute (arg_ary);
++for (i=1; i<arg_ary_size-1; i++)
++dfree (arg_ary[i], MDL);
++dfree(arg_ary, MDL);
++return 1;
++}
++#endif
++
++
+ pair cons (car, cdr)
+ caddr_t car;
+ pair cdr;
+@@ -859,6 +966,9 @@
+ case expr_extract_int8:
+ case expr_extract_int16:
+ case expr_extract_int32:
++ #ifdef ENABLE_EXECUTE
++ case expr_execute:
++ #endif
+ case expr_const_int:
+ case expr_lease_time:
+ case expr_dns_transaction:
+@@ -1222,6 +1332,9 @@
+ case expr_extract_int8:
+ case expr_extract_int16:
+ case expr_extract_int32:
++ #ifdef ENABLE_EXECUTE
++ case expr_execute:
++ #endif
+ case expr_const_int:
+ case expr_lease_time:
+ case expr_dns_transaction:
+@@ -2084,6 +2197,9 @@
+ case expr_extract_int8:
+ case expr_extract_int16:
+ case expr_extract_int32:
++ #ifdef ENABLE_EXECUTE
++ case expr_execute:
++ #endif
+ case expr_const_int:
+ case expr_lease_time:
+ case expr_dns_transaction:
+@@ -2592,7 +2708,12 @@
+ #endif
+ return 0;
+ }
+-
++#ifdef ENABLE_EXECUTE
++ case expr_execute:
++ return evaluate_execute (result, packet, lease,
++ client_state, in_options,
++ cfg_options, scope, expr);
++#endif
+ case expr_ns_add:
+ case expr_ns_delete:
+ case expr_ns_exists:
+@@ -3005,6 +3126,9 @@
+ return (expr -> op == expr_extract_int8 ||
+ expr -> op == expr_extract_int16 ||
+ expr -> op == expr_extract_int32 ||
++ #ifdef ENABLE_EXECUTE
++ expr -> op == expr_execute ||
++ #endif
+ expr -> op == expr_const_int ||
+ expr -> op == expr_lease_time ||
+ expr -> op == expr_dns_transaction ||
+@@ -3040,6 +3164,9 @@
+ expr -> op == expr_extract_int8 ||
+ expr -> op == expr_extract_int16 ||
+ expr -> op == expr_extract_int32 ||
++ #ifdef ENABLE_EXECUTE
++ expr -> op == expr_execute ||
++ #endif
+ expr -> op == expr_dns_transaction);
+ }
+
+@@ -3066,6 +3193,9 @@
+ case expr_extract_int8:
+ case expr_extract_int16:
+ case expr_extract_int32:
++ #ifdef ENABLE_EXECUTE
++ case expr_execute:
++ #endif
+ case expr_encode_int8:
+ case expr_encode_int16:
+ case expr_encode_int32:
+@@ -3160,6 +3290,9 @@
+ case expr_extract_int8:
+ case expr_extract_int16:
+ case expr_extract_int32:
++ #ifdef ENABLE_EXECUTE
++ case expr_execute:
++ #endif
+ case expr_encode_int8:
+ case expr_encode_int16:
+ case expr_encode_int32:
+@@ -3220,6 +3353,8 @@
+ int firstp;
+ {
+ struct expression *e;
++ struct expression* next_arg;
++
+ const char *s;
+ char obuf [65];
+ int scol;
+@@ -3691,7 +3826,27 @@
+ expr -> data.variable);
+ col = token_print_indent (file, col, indent, "", "", ")");
+ break;
+-
++ #ifdef ENABLE_EXECUTE
++ case expr_execute:
++ col = token_print_indent (file, col, indent, "", "","execute");
++ col = token_print_indent (file, col, indent, " ", "","(");
++ scol = col;
++ /* FIXME: use token_print_indent_concat() here? */
++ col = token_print_indent (file, col, scol, "", "","\"");
++ col = token_print_indent (file, col, scol, "", "",expr -> data.funcall.name);
++ col = token_print_indent (file, col, scol, "", "","\"");
++ for(next_arg = expr -> data.funcall.arglist;
++ next_arg;
++ next_arg = next_arg -> data.arg.next) {
++ col = token_print_indent (file, col, scol, "", " ",",");
++ col = write_expression (file,
++ next_arg -> data.arg.val,
++ col, scol, 0);
++ }
++ col = token_print_indent (file, col, indent, "", "",")");
++
++ break;
++#endif
+ default:
+ log_fatal ("invalid expression type in print_expression: %d",
+ expr -> op);
+@@ -3910,6 +4065,9 @@
+ case expr_extract_int8:
+ case expr_extract_int16:
+ case expr_extract_int32:
++ #ifdef ENABLE_EXECUTE
++ case expr_execute:
++ #endif
+ case expr_encode_int8:
+ case expr_encode_int16:
+ case expr_encode_int32:
+diff -urN dhcp-3.0.1.orig/includes/dhctoken.h dhcp-3.0.1/includes/dhctoken.h
+--- dhcp-3.0.1.orig/includes/dhctoken.h 2004-06-10 11:59:30.000000000 -0600
++++ dhcp-3.0.1/includes/dhctoken.h 2005-02-16 12:41:43.000000000 -0700
+@@ -307,7 +307,8 @@
+ REMOVE = 611,
+ REFRESH = 612,
+ DOMAIN_NAME = 613,
+- DO_FORWARD_UPDATE = 614
++ DO_FORWARD_UPDATE = 614,
++ EXECUTE = 614
+ };
+
+ #define is_identifier(x) ((x) >= FIRST_TOKEN && \
+diff -urN dhcp-3.0.1.orig/includes/site.h dhcp-3.0.1/includes/site.h
+--- dhcp-3.0.1.orig/includes/site.h 2002-03-12 11:33:39.000000000 -0700
++++ dhcp-3.0.1/includes/site.h 2005-02-16 12:41:43.000000000 -0700
+@@ -167,6 +167,12 @@
+
+ /* #define DHCPD_LOG_FACILITY LOG_DAEMON */
+
++/* Define this if you want to be able to execute external commands
++ during conditional evaluation. */
++
++/* #define ENABLE_EXECUTE */
++
++
+ /* Define this if you aren't debugging and you want to save memory
+ (potentially a _lot_ of memory) by allocating leases in chunks rather
+ than one at a time. */
+diff -urN dhcp-3.0.1.orig/includes/tree.h dhcp-3.0.1/includes/tree.h
+--- dhcp-3.0.1.orig/includes/tree.h 2004-06-10 11:59:31.000000000 -0600
++++ dhcp-3.0.1/includes/tree.h 2005-02-16 12:41:43.000000000 -0700
+@@ -150,6 +150,9 @@
+ expr_hardware,
+ expr_packet,
+ expr_const_data,
++ #ifdef ENABLE_EXECUTE
++ expr_execute,
++ #endif
+ expr_extract_int8,
+ expr_extract_int16,
+ expr_extract_int32,
diff --git a/package/dhcp/dhcpd.conf b/package/dhcp/dhcpd.conf
new file mode 100644
index 000000000..0001c0f00
--- /dev/null
+++ b/package/dhcp/dhcpd.conf
@@ -0,0 +1,108 @@
+#
+# Sample configuration file for ISC dhcpd for Debian
+#
+# $Id: dhcpd.conf,v 1.1.1.1 2002/05/21 00:07:44 peloy Exp $
+#
+
+# The ddns-updates-style parameter controls whether or not the server will
+# attempt to do a DNS update when a lease is confirmed. We default to the
+# behavior of the version 2 packages ('none', since DHCP v2 didn't
+# have support for DDNS.)
+ddns-update-style none;
+
+# option definitions common to all supported networks...
+option domain-name "example.org";
+option domain-name-servers ns1.example.org, ns2.example.org;
+
+default-lease-time 600;
+max-lease-time 7200;
+
+# If this DHCP server is the official DHCP server for the local
+# network, the authoritative directive should be uncommented.
+#authoritative;
+
+# Use this to send dhcp log messages to a different log file (you also
+# have to hack syslog.conf to complete the redirection).
+log-facility local7;
+
+# No service will be given on this subnet, but declaring it helps the
+# DHCP server to understand the network topology.
+
+#subnet 10.152.187.0 netmask 255.255.255.0 {
+#}
+
+# This is a very basic subnet declaration.
+
+#subnet 10.254.239.0 netmask 255.255.255.224 {
+# range 10.254.239.10 10.254.239.20;
+# option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
+#}
+
+# This declaration allows BOOTP clients to get dynamic addresses,
+# which we don't really recommend.
+
+#subnet 10.254.239.32 netmask 255.255.255.224 {
+# range dynamic-bootp 10.254.239.40 10.254.239.60;
+# option broadcast-address 10.254.239.31;
+# option routers rtr-239-32-1.example.org;
+#}
+
+# A slightly different configuration for an internal subnet.
+#subnet 10.5.5.0 netmask 255.255.255.224 {
+# range 10.5.5.26 10.5.5.30;
+# option domain-name-servers ns1.internal.example.org;
+# option domain-name "internal.example.org";
+# option routers 10.5.5.1;
+# option broadcast-address 10.5.5.31;
+# default-lease-time 600;
+# max-lease-time 7200;
+#}
+
+# Hosts which require special configuration options can be listed in
+# host statements. If no address is specified, the address will be
+# allocated dynamically (if possible), but the host-specific information
+# will still come from the host declaration.
+
+#host passacaglia {
+# hardware ethernet 0:0:c0:5d:bd:95;
+# filename "vmunix.passacaglia";
+# server-name "toccata.fugue.com";
+#}
+
+# Fixed IP addresses can also be specified for hosts. These addresses
+# should not also be listed as being available for dynamic assignment.
+# Hosts for which fixed IP addresses have been specified can boot using
+# BOOTP or DHCP. Hosts for which no fixed address is specified can only
+# be booted with DHCP, unless there is an address range on the subnet
+# to which a BOOTP client is connected which has the dynamic-bootp flag
+# set.
+#host fantasia {
+# hardware ethernet 08:00:07:26:c0:a5;
+# fixed-address fantasia.fugue.com;
+#}
+
+# You can declare a class of clients and then do address allocation
+# based on that. The example below shows a case where all clients
+# in a certain class get addresses on the 10.17.224/24 subnet, and all
+# other clients get addresses on the 10.0.29/24 subnet.
+
+#class "foo" {
+# match if substring (option vendor-class-identifier, 0, 4) = "SUNW";
+#}
+
+#shared-network 224-29 {
+# subnet 10.17.224.0 netmask 255.255.255.0 {
+# option routers rtr-224.example.org;
+# }
+# subnet 10.0.29.0 netmask 255.255.255.0 {
+# option routers rtr-29.example.org;
+# }
+# pool {
+# allow members of "foo";
+# range 10.17.224.10 10.17.224.250;
+# }
+# pool {
+# deny members of "foo";
+# range 10.0.29.10 10.0.29.230;
+# }
+#}
diff --git a/package/dhcp/init-relay b/package/dhcp/init-relay
new file mode 100755
index 000000000..019a7e84c
--- /dev/null
+++ b/package/dhcp/init-relay
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# $Id: dhcp3-relay,v 1.1 2004/04/16 15:41:08 ml Exp $
+#
+
+# It is not safe to start if we don't have a default configuration...
+if [ ! -f /etc/default/dhcp-relay ]; then
+ echo "/etc/default/dhcp-relay does not exist! - Aborting..."
+ echo "create this file to fix the problem."
+ exit 1
+fi
+
+# Read init script configuration (interfaces the daemon should listen on
+# and the DHCP server we should forward requests to.)
+. /etc/default/dhcp-relay
+
+# Build command line for interfaces (will be passed to dhrelay below.)
+IFCMD=""
+if test "$INTERFACES" != ""; then
+ for I in $INTERFACES; do
+ IFCMD=${IFCMD}"-i "${I}" "
+ done
+fi
+
+DHCRELAYPID=/var/run/dhcrelay.pid
+
+case "$1" in
+ start)
+ start-stop-daemon -S -x /usr/sbin/dhcrelay -- -q $OPTIONS $IFCMD $SERVERS
+ ;;
+ stop)
+ start-stop-daemon -K -x /usr/sbin/dhcrelay
+ ;;
+ restart | force-reload)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "Usage: /etc/init.d/dhcp-relay {start|stop|restart|force-reload}"
+ exit 1
+esac
+
+exit 0
diff --git a/package/dhcp/init-server b/package/dhcp/init-server
new file mode 100755
index 000000000..34c20852b
--- /dev/null
+++ b/package/dhcp/init-server
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# $Id: dhcp3-server.init.d,v 1.4 2003/07/13 19:12:41 mdz Exp $
+#
+
+test -f /usr/sbin/dhcpd || exit 0
+
+# It is not safe to start if we don't have a default configuration...
+if [ ! -f /etc/default/dhcp-server ]; then
+ echo "/etc/default/dhcp-server does not exist! - Aborting..."
+ exit 0
+fi
+
+# Read init script configuration (so far only interfaces the daemon
+# should listen on.)
+. /etc/default/dhcp-server
+
+case "$1" in
+ start)
+ echo -n "Starting DHCP server: "
+ test -d /var/lib/dhcp/ || mkdir -p /var/lib/dhcp/
+ test -f /var/lib/dhcp/dhcpd.leases || touch /var/lib/dhcp/dhcpd.leases
+ start-stop-daemon -S -x /usr/sbin/dhcpd -- -q $INTERFACES
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping DHCP server: dhcpd3"
+ start-stop-daemon -K -x /usr/sbin/dhcpd
+ echo "."
+ ;;
+ restart | force-reload)
+ $0 stop
+ sleep 2
+ $0 start
+ if [ "$?" != "0" ]; then
+ exit 1
+ fi
+ ;;
+ *)
+ echo "Usage: /etc/init.d/dhcp-server {start|stop|restart|force-reload}"
+ exit 1
+esac
+
+exit 0