[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [BusyBox] bug#1271: udhcp busybox integration
From:       Russ Dill <Russ.Dill () asu ! edu>
Date:       2002-09-26 13:16:05
[Download RAW message or body]

Package: busybox
Version: CVS
Severity: wishlist


These patches and files allow for full integration of udhcp into busybox. 
Updating busybox to the latest version of udhcp is easy, just do a cp 
*.[ch] from the busybox directory. The only libbb function that is used
now is xmalloc, but other functions can be used to save additional space.

Also, it might be a good idea to make a busybox applet that serves as a
default script to udhcpc, that would be written in c, as many people
just want it to work, and don't care about how it does it.

udhcp.diff: apply against the busybox directory
config.in: goes in networking/udhcp
Makefile.in: goes in networking/udhcp

cp udhcp/*.[ch] networking/udhcp
cp udhcp/samples/sample.* udhcp/samples/simple.script
udhcp/samples/udhcpd.conf examples/udhcp
rm busybox/networking/udhcpc.c





["Makefile.in" (Makefile.in)]

# Makefile for busybox
#
# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#

UDHCP_AR:=udhcp.a
ifndef $(UDHCP_DIR)
UDHCP_DIR:=$(TOPDIR)networking/udhcp/
endif

#ok, so I forgot how to do an or, but this is a quick and dirty hack
ifeq ($(CONFIG_UDHCPC), y)
CONFIG_UDHCP_SHARED=y
else
ifeq ($(CONFIG_UDHCPD), y)
CONFIG_UDHCP_SHARED=y
else
CONFIG_UDHCP_SHARED=n
endif
endif

UDHCP-y:=
UDHCP-$(CONFIG_UDHCP_SHARED)	+= options.o socket.o packet.o pidfile.o
UDHCP-$(CONFIG_UDHCPC)		+= dhcpc.o clientpacket.o script.o
UDHCP-$(CONFIG_UDHCPD)		+= dhcpd.o arpping.o files.o leases.o serverpacket.o
UDHCP-$(CONFIG_DUMPLEASES)	+= dumpleases.o

libraries-y+=$(UDHCP_DIR)$(UDHCP_AR)

$(UDHCP_DIR)$(UDHCP_AR): $(patsubst %,$(UDHCP_DIR)%, $(UDHCP-y))
	$(AR) -ro $@ $(patsubst %,$(UDHCP_DIR)%, $(UDHCP-y))


["config.in" (config.in)]

#
# For a description of the syntax of this configuration file,
# see scripts/kbuild/config-language.txt.
#

mainmenu_option next_comment
comment 'udhcp Server/Client'

bool 'udhcp Server (udhcpd)'			CONFIG_UDHCPD
bool 'udhcp Client (udhcpc)'			CONFIG_UDHCPC
bool 'Lease display utility (dumpleases)'	CONFIG_DUMPLEASES
if [ "$CONFIG_UDHCPD" = "y" -o "$CONFIG_UDHCPC" = "y" ]; then
    bool '  Log udhcp messages to syslog (instead of stdout)' CONFIG_FEATURE_UDHCP_SYSLOG
    bool '  Compile udhcp with noisy debugging messages' CONFIG_FEATURE_UDHCP_DEBUG  
fi

endmenu


["udhcp.diff" (udhcp.diff)]

Index: Makefile
===================================================================
RCS file: /var/cvs/busybox/Makefile,v
retrieving revision 1.262
diff -u -r1.262 Makefile
--- Makefile	31 Jul 2002 03:45:05 -0000	1.262
+++ Makefile	20 Sep 2002 20:39:16 -0000
@@ -22,7 +22,7 @@
 include $(TOPDIR)Rules.mak
 SUBDIRS:=applets archival archival/libunarchive console-tools \
 	editors fileutils findutils init miscutils modutils networking \
-	procps loginutils shell shellutils sysklogd \
+	networking/udhcp procps loginutils shell shellutils sysklogd \
 	textutils util-linux libbb libpwdgrp
 
 all:    do-it-all
Index: include/applets.h
===================================================================
RCS file: /var/cvs/busybox/include/applets.h,v
retrieving revision 1.68
diff -u -r1.68 applets.h
--- include/applets.h	17 Sep 2002 22:14:58 -0000	1.68
+++ include/applets.h	20 Sep 2002 20:39:17 -0000
@@ -152,6 +152,9 @@
 #ifdef CONFIG_DUMPKMAP
 	APPLET(dumpkmap, dumpkmap_main, _BB_DIR_BIN, _BB_SUID_NEVER)
 #endif
+#ifdef CONFIG_DUMPLEASES
+        APPLET(dumpleases, dumpleases_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
+#endif
 #ifdef CONFIG_DUTMP
 	APPLET(dutmp, dutmp_main, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)
 #endif
@@ -492,7 +495,10 @@
 	APPLET(tty, tty_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
 #endif
 #ifdef CONFIG_UDHCPC
-	APPLET(udhcpc, udhcpc_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
+	APPLET(udhcpc, udhcpc_main, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)
+#endif
+#ifdef CONFIG_UDHCPD
+        APPLET(udhcpd, udhcpd_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
 #endif
 #ifdef CONFIG_UMOUNT
 	APPLET(umount, umount_main, _BB_DIR_BIN, _BB_SUID_NEVER)
Index: include/usage.h
===================================================================
RCS file: /var/cvs/busybox/include/usage.h,v
retrieving revision 1.108
diff -u -r1.108 usage.h
--- include/usage.h	17 Sep 2002 22:14:58 -0000	1.108
+++ include/usage.h	20 Sep 2002 20:39:19 -0000
@@ -385,6 +385,14 @@
 #define dumpkmap_example_usage \
 	"$ dumpkmap > keymap\n"
 
+#define dumpleases_trivial_usage \
+	"[-r|-a] [-f LEASEFILE]"
+#define dumpleases_full_usage \
+	"Usage: dumpleases -f <file> -[r|a]\n" \
+	"\t-f,\t--file=FILENAME\tLeases file to load\n" \
+	"\t-r,\t--remaining\tInterepret lease times as time remaing\n" \
+	"\t-a,\t--absolute\tInterepret lease times as expire time\n"
+
 #define dutmp_trivial_usage \
 	"[FILE]"
 #define dutmp_full_usage \
@@ -1937,12 +1945,14 @@
 	"/dev/tty2\n"
 
 #define udhcpc_trivial_usage \
-	"[-fqv] [-c CLIENTID] [-H HOSTNAME] [-i INTERFACE]\n[-p file] [-r IP] [-s script]"
+	"[-fbnqv] [-c CLIENTID] [-H HOSTNAME] [-i INTERFACE]\n[-p pidfile] [-r IP] [-s script]"
 #define udhcpc_full_usage \
-	"\tUsage: udhcpcd [OPTIONS]\n" \
+	"\tUsage: udhcpc [OPTIONS]\n" \
 	"\t-c,\t--clientid=CLIENTID\tClient identifier\n" \
 	"\t-H,\t--hostname=HOSTNAME\tClient hostname\n" \
+	"\t-h,\t                   \tAlias for -h\n" \
 	"\t-f,\t--foreground\tDo not fork after getting lease\n" \
+	"\t-b,\t--background\tFork to background if lease cannot be immediately negotiated.\n" \
 	"\t-i,\t--interface=INTERFACE\tInterface to use (default: eth0)\n" \
 	"\t-n,\t--now\tExit with failure if lease cannot be immediately negotiated.\n" \
 	"\t-p,\t--pidfile=file\tStore process ID of daemon in file\n" \
@@ -1950,6 +1960,12 @@
 	"\t-r,\t--request=IP\tIP address to request (default: none)\n" \
 	"\t-s,\t--script=file\tRun file at dhcp events (default: /usr/share/udhcpc/default.script)\n" \
 	"\t-v,\t--version\tDisplay version"
+
+#define udhcpd_trivial_usage \
+	"[configfile]\n" \
+
+#define udhcpd_full_usage \
+	"\tUsage: udhcpd [configfile]\n"
 
 #ifdef CONFIG_FEATURE_MOUNT_FORCE
   #define USAGE_MOUNT_FORCE(a) a
Index: networking/Makefile.in
===================================================================
RCS file: /var/cvs/busybox/networking/Makefile.in,v
retrieving revision 1.3
diff -u -r1.3 Makefile.in
--- networking/Makefile.in	21 Aug 2002 10:27:58 -0000	1.3
+++ networking/Makefile.in	20 Sep 2002 20:39:20 -0000
@@ -34,7 +34,6 @@
 NETWORKING-$(CONFIG_TELNET)		+= telnet.o
 NETWORKING-$(CONFIG_TFTP)		+= tftp.o
 NETWORKING-$(CONFIG_TRACEROUTE)		+= traceroute.o
-NETWORKING-$(CONFIG_UDHCPC)		+= udhcpc.o
 NETWORKING-$(CONFIG_WGET)		+= wget.o
 
 libraries-y+=$(NETWORKING_DIR)$(NETWORKING_AR)
Index: networking/config.in
===================================================================
RCS file: /var/cvs/busybox/networking/config.in,v
retrieving revision 1.7
diff -u -r1.7 config.in
--- networking/config.in	21 Aug 2002 10:27:58 -0000	1.7
+++ networking/config.in	20 Sep 2002 20:39:20 -0000
@@ -46,12 +46,13 @@
     bool '  Enable verbose output'			CONFIG_FEATURE_TRACEROUTE_VERBOSE
     bool '  Enable SO_DEBUG option'	CONFIG_FEATURE_TRACEROUTE_SO_DEBUG
 fi
-bool 'udhcpc'       CONFIG_UDHCPC
 bool 'wget'	    CONFIG_WGET
 if [ "$CONFIG_WGET" = "y" ]; then
     bool '  Enable a nifty process meter (+2k)'	CONFIG_FEATURE_WGET_STATUSBAR
 	bool '  Enable HTTP authentication'			CONFIG_FEATURE_WGET_AUTHENTICATION
 fi
+
+source networking/udhcp/config.in
 
 endmenu
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic