tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: dhcpcd glue for rc.d/network and sysinst
On Mon, May 26, 2008 at 10:15:57PM +0200, Joerg Sonnenberger wrote:
> Hi all,
> the attached patch implements two functions:
> (1) It makes ifconfig_bge0=dhcp start/stop dhcpcd, same for single lines
> in /etc/ifconfig_bge0. I'm not sure where this should be documented.
> Timeouts etc can be set via dhcpcd_flags.
>
> (2) It adds the glue to use dhcpcd on the initial ramdisk. This is very
> bare-bone, e.g. it doesn't set the hostname (no /bin/hostname :-)).
> This needs changes for all architectures that bundle dhclient, but it
> should be straight to convert the rest.
This is the collectively patch to conver all architectures (build tested
only, thanks Greg) + the man page changes. This should free 100KB or so
for more useful things on the install images.
Joerg
Index: distrib/amd64/ramdisks/common/Makefile.ramdisk
===================================================================
RCS file: /data/repo/netbsd/src/distrib/amd64/ramdisks/common/Makefile.ramdisk,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile.ramdisk
--- distrib/amd64/ramdisks/common/Makefile.ramdisk 1 Feb 2008 13:43:12
-0000 1.3
+++ distrib/amd64/ramdisks/common/Makefile.ramdisk 26 May 2008 03:59:33
-0000
@@ -39,6 +39,7 @@ HACKSRC= ${DISTRIBDIR}/utils/libhack
${CRUNCHBIN}: libhack.o
.include "${DISTRIBDIR}/common/Makefile.crunch"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
.include "${DISTRIBDIR}/common/Makefile.makedev"
.include "${DISTRIBDIR}/common/Makefile.image"
Index: distrib/amd64/ramdisks/ramdisk/Makefile
===================================================================
RCS file: /data/repo/netbsd/src/distrib/amd64/ramdisks/ramdisk/Makefile,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile
--- distrib/amd64/ramdisks/ramdisk/Makefile 2 Jun 2006 22:11:52 -0000
1.1
+++ distrib/amd64/ramdisks/ramdisk/Makefile 26 May 2008 03:59:46 -0000
@@ -2,8 +2,7 @@
IMAGE= ramdisk.fs
IMAGESIZE= 5000k
-IMAGEDEPENDS= disktab.preinstall \
- ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
+IMAGEDEPENDS= disktab.preinstall
USE_SYSINST= yes
SMALLPROG_INET6=1
Index: distrib/amd64/ramdisks/ramdisk/list
===================================================================
RCS file: /data/repo/netbsd/src/distrib/amd64/ramdisks/ramdisk/list,v
retrieving revision 1.6
diff -u -p -r1.6 list
--- distrib/amd64/ramdisks/ramdisk/list 6 May 2008 15:32:06 -0000 1.6
+++ distrib/amd64/ramdisks/ramdisk/list 26 May 2008 04:00:01 -0000
@@ -24,7 +24,6 @@ PROG bin/sync
PROG libexec/lfs_cleanerd
-PROG sbin/dhclient
PROG sbin/disklabel
PROG sbin/fdisk
PROG sbin/fsck
@@ -65,15 +64,11 @@ PROG usr/sbin/chown usr/bin/chgrp
PROG usr/sbin/chroot
PROG usr/sbin/wiconfig
-SPECIAL dhclient srcdir distrib/utils/x_dhclient
SPECIAL ifconfig srcdir distrib/utils/x_ifconfig
SPECIAL ping srcdir distrib/utils/x_ping
SPECIAL route srcdir distrib/utils/x_route
LIBS libhack.o -lbz2 -ledit -lutil -lcurses -ltermcap -lrmt -lcrypt -ll -lm
-lz -lprop
-# various files that we need in /etc for the install
-COPY ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
sbin/dhclient-script 555
-
# the disktab explanation file
COPY ${CURDIR}/disktab.preinstall etc/disktab.preinstall
Index: distrib/cats/ramdisk/Makefile
===================================================================
RCS file: /data/repo/netbsd/src/distrib/cats/ramdisk/Makefile,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile
--- distrib/cats/ramdisk/Makefile 1 Feb 2008 17:18:07 -0000 1.9
+++ distrib/cats/ramdisk/Makefile 27 May 2008 00:01:58 -0000
@@ -31,6 +31,7 @@ HACKSRC= ${DISTRIBDIR}/utils/libhack
${CRUNCHBIN}: libhack.o
.include "${DISTRIBDIR}/common/Makefile.crunch"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
.include "${DISTRIBDIR}/common/Makefile.makedev"
.include "${DISTRIBDIR}/common/Makefile.image"
Index: distrib/cats/ramdisk/list
===================================================================
RCS file: /data/repo/netbsd/src/distrib/cats/ramdisk/list,v
retrieving revision 1.9
diff -u -p -r1.9 list
--- distrib/cats/ramdisk/list 6 May 2008 15:32:06 -0000 1.9
+++ distrib/cats/ramdisk/list 27 May 2008 00:01:46 -0000
@@ -22,7 +22,6 @@ PROG bin/sh
PROG bin/stty
PROG bin/sync
-PROG sbin/dhclient
PROG sbin/disklabel
PROG sbin/fsck
PROG sbin/fsck_ffs
@@ -59,7 +58,6 @@ PROG usr/sbin/chroot
# init invokes the shell as -sh
ARGVLN sh -sh
-SPECIAL dhclient srcdir distrib/utils/x_dhclient
SPECIAL ifconfig srcdir distrib/utils/x_ifconfig
SPECIAL ping srcdir distrib/utils/x_ping
SPECIAL route srcdir distrib/utils/x_route
@@ -67,10 +65,6 @@ SPECIAL route srcdir distrib/utils/x_ro
LIBS libhack.o -lbz2 -ledit -lutil -lcurses -ltermcap -lrmt -lcrypt -ll -lm
-lz -lprop
# various files that we need in /etc for the install
-COPY ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
sbin/dhclient-script 555
-
-
-# various files that we need in /etc for the install
COPY ${NETBSDSRCDIR}/etc/group etc/group
COPY ${NETBSDSRCDIR}/etc/master.passwd etc/master.passwd
COPY ${NETBSDSRCDIR}/etc/netconfig etc/netconfig
Index: distrib/common/10-resolv.conf
===================================================================
RCS file: distrib/common/10-resolv.conf
diff -N distrib/common/10-resolv.conf
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ distrib/common/10-resolv.conf 26 May 2008 16:11:50 -0000
@@ -0,0 +1,24 @@
+# Minimal version using shell builtins.
+
+make_resolv_conf()
+{
+ if [ -z "${new_domain_name_servers}" -a \
+ -z "${new_domain_name}" -a \
+ -z "${new_domain_search}" ]; then
+ return 0
+ fi
+ local o=/etc/resolv.conf
+ echo "${signature}" > $o
+ if [ -n "${new_domain_search}" ]; then
+ echo "search ${new_domain_search}" >> $o
+ elif [ -n "${new_domain_name}" ]; then
+ echo "search ${new_domain_name}" >> $o
+ fi
+ for x in ${new_domain_name_servers}; do
+ echo "nameserver ${x}" >> $o
+ done
+}
+
+case "${reason}" in
+BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT) make_resolv_conf;;
+esac
Index: distrib/common/99-print-sysinst
===================================================================
RCS file: distrib/common/99-print-sysinst
diff -N distrib/common/99-print-sysinst
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ distrib/common/99-print-sysinst 26 May 2008 16:18:05 -0000
@@ -0,0 +1,11 @@
+# $NetBSD$
+
+case "${reason}" in
+BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT)
+ cat > /tmp/dhcpcd-lease << EOF
+host-name=${new_host_name}
+domain-name=${new_domain_name}
+EOF
+ set > /tmp/dhcpcd-lease-all
+ ;;
+esac
Index: distrib/common/Makefile.dhcpcd
===================================================================
RCS file: distrib/common/Makefile.dhcpcd
diff -N distrib/common/Makefile.dhcpcd
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ distrib/common/Makefile.dhcpcd 26 May 2008 13:21:00 -0000
@@ -0,0 +1,9 @@
+# $NetBSD$
+
+IMAGEDEPENDS+= \
+ ${DESTDIR}/etc/dhcpcd.conf \
+ ${DESTDIR}/libexec/dhcpcd-run-hooks \
+ ${DESTDIR}/libexec/dhcpcd-hooks/10-resolv.conf \
+ ${DESTDIR}/libexec/dhcpcd-hooks/15-hostname
+
+LISTS+= ${DISTRIBDIR}/common/list.dhcpcd
Index: distrib/common/list.dhcpcd
===================================================================
RCS file: distrib/common/list.dhcpcd
diff -N distrib/common/list.dhcpcd
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ distrib/common/list.dhcpcd 26 May 2008 16:18:59 -0000
@@ -0,0 +1,12 @@
+# $NetBSD$
+#
+# list file (c.f. parselist.awk) for DHCP-enabled install media.
+#
+
+PROG sbin/dhcpcd
+
+COPY ${DESTDIR}/etc/dhcpcd.conf etc/dhcpcd.conf
+COPY ${DESTDIR}/libexec/dhcpcd-run-hooks libexec/dhcpcd-run-hooks 555
+
+COPY ${NETBSDSRCDIR}/distrib/common/10-resolv.conf
libexec/dhcpcd-hooks/10-resolv.conf
+COPY ${NETBSDSRCDIR}/distrib/common/99-print-sysinst
libexec/dhcpcd-hooks/99-print-sysinst
Index: distrib/common/mtree.common
===================================================================
RCS file: /data/repo/netbsd/src/distrib/common/mtree.common,v
retrieving revision 1.8
diff -u -p -r1.8 mtree.common
--- distrib/common/mtree.common 24 Aug 2007 17:11:58 -0000 1.8
+++ distrib/common/mtree.common 26 May 2008 13:33:10 -0000
@@ -7,6 +7,7 @@
./dev
./etc
./libexec
+./libexec/dhcpcd-hooks
./mnt
./mnt2
./kern
Index: distrib/evbarm/instkernel/ramdisk/Makefile
===================================================================
RCS file: /data/repo/netbsd/src/distrib/evbarm/instkernel/ramdisk/Makefile,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile
--- distrib/evbarm/instkernel/ramdisk/Makefile 10 May 2007 23:22:29 -0000
1.4
+++ distrib/evbarm/instkernel/ramdisk/Makefile 27 May 2008 00:01:39 -0000
@@ -28,6 +28,7 @@ HACKSRC= ${DISTRIBDIR}/utils/libhack
${CRUNCHBIN}: libhack.o
.include "${DISTRIBDIR}/common/Makefile.crunch"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
.include "${DISTRIBDIR}/common/Makefile.makedev"
.include "${DISTRIBDIR}/common/Makefile.image"
Index: distrib/evbarm/instkernel/ramdisk/list
===================================================================
RCS file: /data/repo/netbsd/src/distrib/evbarm/instkernel/ramdisk/list,v
retrieving revision 1.7
diff -u -p -r1.7 list
--- distrib/evbarm/instkernel/ramdisk/list 21 May 2008 18:05:29 -0000
1.7
+++ distrib/evbarm/instkernel/ramdisk/list 27 May 2008 00:01:30 -0000
@@ -20,7 +20,6 @@ PROG bin/sh
PROG bin/stty
PROG bin/sync
-PROG sbin/dhclient
PROG sbin/disklabel
PROG sbin/fsck
PROG sbin/fsck_ffs
@@ -53,7 +52,6 @@ PROG usr/bin/tset
PROG usr/sbin/chown usr/bin/chgrp
PROG usr/sbin/chroot
-SPECIAL dhclient srcdir distrib/utils/x_dhclient
SPECIAL ed srcdir distrib/utils/x_ed
SPECIAL ping srcdir distrib/utils/x_ping
SPECIAL ifconfig srcdir distrib/utils/x_ifconfig
@@ -69,7 +67,6 @@ ARGVLN sh -sh
#COPY ${DESTDIR}/usr/mdec/ofwboot usr/mdec/ofwboot
# various files that we need in /etc for the install
-COPY ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
sbin/dhclient-script 555
COPY ${NETBSDSRCDIR}/etc/group etc/group
COPY ${NETBSDSRCDIR}/etc/master.passwd etc/master.passwd
COPY ${NETBSDSRCDIR}/etc/netconfig etc/netconfig
Index: distrib/hpcarm/miniroot/Makefile.inc
===================================================================
RCS file: /data/repo/netbsd/src/distrib/hpcarm/miniroot/Makefile.inc,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile.inc
--- distrib/hpcarm/miniroot/Makefile.inc 30 Dec 2005 11:47:19 -0000
1.1
+++ distrib/hpcarm/miniroot/Makefile.inc 27 May 2008 00:01:20 -0000
@@ -11,3 +11,5 @@ MTREECONF+= ${.CURDIR}/mtree.usr.install
IMAGEDEPENDS+= ${ARCHDIR}/dot.profile ${ARCHDIR}/termcap.vt100 \
${DESTDIR}/.profile ${DESTDIR}/etc/disktab
SMALLPROG_INET6=1
+
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
Index: distrib/hpcarm/miniroot/list
===================================================================
RCS file: /data/repo/netbsd/src/distrib/hpcarm/miniroot/list,v
retrieving revision 1.1
diff -u -p -r1.1 list
--- distrib/hpcarm/miniroot/list 30 Dec 2005 11:47:19 -0000 1.1
+++ distrib/hpcarm/miniroot/list 27 May 2008 00:01:10 -0000
@@ -7,7 +7,6 @@ PROG bin/rcp
PROG bin/rcmd
# extras in sbin
-PROG sbin/dhclient
PROG sbin/disklabel
PROG sbin/fdisk
PROG sbin/mount_ext2fs
@@ -22,7 +21,6 @@ PROG usr/bin/tset usr/bin/reset
PROG usr/bin/vi
# crunchgen source directory specials: progs built in nonstandard places
-SPECIAL dhclient srcdir distrib/utils/x_dhclient
SPECIAL vi srcdir usr.bin/vi/build
# Minimize use of MFS
@@ -39,6 +37,3 @@ COPY ${ARCHDIR}/dot.profile .profile
# and a spare .profile
COPY ${DESTDIR}/.profile tmp/.hdprofile
-
-# various files that we need in /etc for the install
-COPY ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
sbin/dhclient-script 555
Index: distrib/hpcmips/miniroot/Makefile.inc
===================================================================
RCS file: /data/repo/netbsd/src/distrib/hpcmips/miniroot/Makefile.inc,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile.inc
--- distrib/hpcmips/miniroot/Makefile.inc 10 Apr 2003 15:01:52 -0000
1.14
+++ distrib/hpcmips/miniroot/Makefile.inc 27 May 2008 00:00:58 -0000
@@ -11,3 +11,5 @@ MTREECONF+= ${.CURDIR}/mtree.usr.install
IMAGEDEPENDS+= ${ARCHDIR}/dot.profile ${ARCHDIR}/termcap.vt100 \
${DESTDIR}/.profile ${DESTDIR}/etc/disktab
SMALLPROG_INET6=1
+
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
Index: distrib/hpcmips/miniroot/list
===================================================================
RCS file: /data/repo/netbsd/src/distrib/hpcmips/miniroot/list,v
retrieving revision 1.9
diff -u -p -r1.9 list
--- distrib/hpcmips/miniroot/list 10 Feb 2003 07:17:58 -0000 1.9
+++ distrib/hpcmips/miniroot/list 27 May 2008 00:00:47 -0000
@@ -7,7 +7,6 @@ PROG bin/rcp
PROG bin/rcmd
# extras in sbin
-PROG sbin/dhclient
PROG sbin/disklabel
PROG sbin/fdisk
PROG sbin/mount_ext2fs
@@ -22,7 +21,6 @@ PROG usr/bin/tset usr/bin/reset
PROG usr/bin/vi
# crunchgen source directory specials: progs built in nonstandard places
-SPECIAL dhclient srcdir distrib/utils/x_dhclient
SPECIAL vi srcdir usr.bin/vi/build
# Minimize use of MFS
@@ -39,6 +37,3 @@ COPY ${ARCHDIR}/dot.profile .profile
# and a spare .profile
COPY ${DESTDIR}/.profile tmp/.hdprofile
-
-# various files that we need in /etc for the install
-COPY ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
sbin/dhclient-script 555
Index: distrib/i386/ramdisks/ramdisk-big/Makefile
===================================================================
RCS file: /data/repo/netbsd/src/distrib/i386/ramdisks/ramdisk-big/Makefile,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile
--- distrib/i386/ramdisks/ramdisk-big/Makefile 2 Jun 2006 22:11:07 -0000
1.1
+++ distrib/i386/ramdisks/ramdisk-big/Makefile 27 May 2008 00:00:29 -0000
@@ -3,12 +3,12 @@
BOOTMODEL= big
IMAGE= ramdisk-${BOOTMODEL}.fs
IMAGESIZE= 5000k
-IMAGEDEPENDS= disktab.preinstall \
- ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
+IMAGEDEPENDS= disktab.preinstall
USE_SYSINST= yes
SMALLPROG_INET6=1
.include "${.CURDIR}/../common/Makefile.ramdisk"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
.if ${USE_INET6} != "no"
LISTS+= ${.CURDIR}/list.inet6
Index: distrib/i386/ramdisks/ramdisk-big/list
===================================================================
RCS file: /data/repo/netbsd/src/distrib/i386/ramdisks/ramdisk-big/list,v
retrieving revision 1.2
diff -u -p -r1.2 list
--- distrib/i386/ramdisks/ramdisk-big/list 18 Nov 2006 16:09:57 -0000
1.2
+++ distrib/i386/ramdisks/ramdisk-big/list 27 May 2008 00:00:37 -0000
@@ -9,7 +9,6 @@ PROG bin/mt
PROG bin/rcmd
PROG bin/sync
-PROG sbin/dhclient
PROG sbin/fdisk
PROG sbin/mount_ext2fs
PROG sbin/mount_ntfs
@@ -27,10 +26,5 @@ PROG usr/sbin/installboot
PROG usr/sbin/wiconfig
-SPECIAL dhclient srcdir distrib/utils/x_dhclient
-
-# various files that we need in /etc for the install
-COPY ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
sbin/dhclient-script 555
-
# the disktab explanation file
COPY ${CURDIR}/disktab.preinstall etc/disktab.preinstall
Index: distrib/landisk/ramdisk/Makefile
===================================================================
RCS file: /data/repo/netbsd/src/distrib/landisk/ramdisk/Makefile,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile
--- distrib/landisk/ramdisk/Makefile 14 Apr 2008 17:24:56 -0000 1.1
+++ distrib/landisk/ramdisk/Makefile 26 May 2008 23:59:43 -0000
@@ -30,6 +30,7 @@ HACKSRC= ${DISTRIBDIR}/utils/libhack
${CRUNCHBIN}: libhack.o
.include "${DISTRIBDIR}/common/Makefile.crunch"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
.include "${DISTRIBDIR}/common/Makefile.makedev"
.include "${DISTRIBDIR}/common/Makefile.image"
Index: distrib/landisk/ramdisk/list
===================================================================
RCS file: /data/repo/netbsd/src/distrib/landisk/ramdisk/list,v
retrieving revision 1.1
diff -u -p -r1.1 list
--- distrib/landisk/ramdisk/list 14 Apr 2008 17:24:56 -0000 1.1
+++ distrib/landisk/ramdisk/list 26 May 2008 23:59:53 -0000
@@ -19,7 +19,6 @@ PROG bin/sh
PROG bin/stty
PROG bin/sync
-PROG sbin/dhclient
PROG sbin/disklabel
PROG sbin/fdisk
PROG sbin/fsck
@@ -47,7 +46,6 @@ PROG usr/sbin/chown usr/bin/chgrp
PROG usr/sbin/chroot
PROG usr/sbin/installboot
-SPECIAL dhclient srcdir distrib/utils/x_dhclient
SPECIAL ed srcdir distrib/utils/x_ed
SPECIAL ifconfig srcdir distrib/utils/x_ifconfig
SPECIAL ping srcdir distrib/utils/x_ping
@@ -60,7 +58,6 @@ LIBS libhack.o -lbz2 -lutil -lcurses -lt
ARGVLN sh -sh
# various files that we need in /etc for the install
-COPY ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
sbin/dhclient-script 555
COPY ${NETBSDSRCDIR}/etc/group etc/group
COPY ${NETBSDSRCDIR}/etc/master.passwd etc/master.passwd
COPY ${NETBSDSRCDIR}/etc/protocols etc/protocols
Index: distrib/mac68k/instkernel/ramdisk/Makefile
===================================================================
RCS file: /data/repo/netbsd/src/distrib/mac68k/instkernel/ramdisk/Makefile,v
retrieving revision 1.28
diff -u -p -r1.28 Makefile
--- distrib/mac68k/instkernel/ramdisk/Makefile 10 May 2007 23:22:30 -0000
1.28
+++ distrib/mac68k/instkernel/ramdisk/Makefile 26 May 2008 23:59:29 -0000
@@ -34,6 +34,7 @@ HACKSRC= ${DISTRIBDIR}/utils/libhack
${CRUNCHBIN}: libhack.o
.include "${DISTRIBDIR}/common/Makefile.crunch"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
.include "${DISTRIBDIR}/common/Makefile.makedev"
.include "${DISTRIBDIR}/common/Makefile.image"
Index: distrib/mac68k/instkernel/ramdisk/list
===================================================================
RCS file: /data/repo/netbsd/src/distrib/mac68k/instkernel/ramdisk/list,v
retrieving revision 1.19
diff -u -p -r1.19 list
--- distrib/mac68k/instkernel/ramdisk/list 6 May 2008 15:32:06 -0000
1.19
+++ distrib/mac68k/instkernel/ramdisk/list 26 May 2008 23:59:13 -0000
@@ -21,7 +21,6 @@ PROG bin/sh
PROG bin/stty
PROG bin/sync
-PROG sbin/dhclient
PROG sbin/disklabel
PROG sbin/fsck
PROG sbin/fsck_ffs
@@ -58,7 +57,6 @@ PROG usr/sbin/chroot
# init invokes the shell as -sh
ARGVLN sh -sh
-SPECIAL dhclient srcdir distrib/utils/x_dhclient
SPECIAL ed srcdir distrib/utils/x_ed
SPECIAL gzip srcdir distrib/utils/x_gzip
SPECIAL ifconfig srcdir distrib/utils/x_ifconfig
@@ -76,8 +74,6 @@ COPY ${NETBSDSRCDIR}/etc/protocols etc/
COPY ${NETBSDSRCDIR}/etc/netconfig etc/netconfig
COPY ${NETBSDSRCDIR}/distrib/common/services etc/services
-COPY ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
sbin/dhclient-script 555
-
# and the common installation tools
COPY ${DISTRIBDIR}/mac68k/miniroot/termcap usr/share/misc/termcap
Index: distrib/ofppc/ramdisks/common/Makefile.ramdisk
===================================================================
RCS file: /data/repo/netbsd/src/distrib/ofppc/ramdisks/common/Makefile.ramdisk,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile.ramdisk
--- distrib/ofppc/ramdisks/common/Makefile.ramdisk 2 Jan 2008 11:39:02
-0000 1.1
+++ distrib/ofppc/ramdisks/common/Makefile.ramdisk 26 May 2008 23:57:55
-0000
@@ -36,6 +36,7 @@ HACKSRC= ${DISTRIBDIR}/utils/libhack
${CRUNCHBIN}: libhack.o
.include "${DISTRIBDIR}/common/Makefile.crunch"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
.include "${DISTRIBDIR}/common/Makefile.makedev"
.include "${DISTRIBDIR}/common/Makefile.image"
Index: distrib/ofppc/ramdisks/ramdisk/Makefile
===================================================================
RCS file: /data/repo/netbsd/src/distrib/ofppc/ramdisks/ramdisk/Makefile,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile
--- distrib/ofppc/ramdisks/ramdisk/Makefile 2 Jan 2008 11:39:04 -0000
1.1
+++ distrib/ofppc/ramdisks/ramdisk/Makefile 26 May 2008 23:58:05 -0000
@@ -2,7 +2,6 @@
IMAGE= ramdisk.fs
IMAGESIZE= 5000k
-IMAGEDEPENDS= ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
USE_SYSINST= yes
SMALLPROG_INET6=1
Index: distrib/ofppc/ramdisks/ramdisk/list
===================================================================
RCS file: /data/repo/netbsd/src/distrib/ofppc/ramdisks/ramdisk/list,v
retrieving revision 1.2
diff -u -p -r1.2 list
--- distrib/ofppc/ramdisks/ramdisk/list 6 May 2008 15:32:06 -0000 1.2
+++ distrib/ofppc/ramdisks/ramdisk/list 26 May 2008 23:58:21 -0000
@@ -24,7 +24,6 @@ PROG bin/sync
PROG libexec/lfs_cleanerd
-PROG sbin/dhclient
PROG sbin/disklabel
PROG sbin/fdisk
PROG sbin/fsck
@@ -66,13 +65,9 @@ PROG usr/sbin/chown usr/bin/chgrp
PROG usr/sbin/chroot
PROG usr/sbin/wiconfig
-SPECIAL dhclient srcdir distrib/utils/x_dhclient
SPECIAL ifconfig srcdir distrib/utils/x_ifconfig
SPECIAL ping srcdir distrib/utils/x_ping
SPECIAL route srcdir distrib/utils/x_route
SPECIAL vi srcdir usr.bin/vi/build
LIBS libhack.o -lbz2 -ledit -lutil -lcurses -ltermcap -lrmt -lcrypt -ll -lm
-lz -lprop
-
-# various files that we need in /etc for the install
-COPY ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
sbin/dhclient-script 555
Index: distrib/sgimips/ramdisk/Makefile
===================================================================
RCS file: /data/repo/netbsd/src/distrib/sgimips/ramdisk/Makefile,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile
--- distrib/sgimips/ramdisk/Makefile 10 May 2007 23:22:32 -0000 1.10
+++ distrib/sgimips/ramdisk/Makefile 26 May 2008 23:57:19 -0000
@@ -33,6 +33,7 @@ HACKSRC= ${DISTRIBDIR}/utils/libhack
${CRUNCHBIN}: libhack.o
.include "${DISTRIBDIR}/common/Makefile.crunch"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
.include "${DISTRIBDIR}/common/Makefile.makedev"
.include "${DISTRIBDIR}/common/Makefile.image"
Index: distrib/sgimips/ramdisk/list
===================================================================
RCS file: /data/repo/netbsd/src/distrib/sgimips/ramdisk/list,v
retrieving revision 1.8
diff -u -p -r1.8 list
--- distrib/sgimips/ramdisk/list 6 May 2008 15:32:07 -0000 1.8
+++ distrib/sgimips/ramdisk/list 26 May 2008 23:57:32 -0000
@@ -19,7 +19,6 @@ PROG bin/sh
PROG bin/stty
PROG bin/sync
-PROG sbin/dhclient
PROG sbin/disklabel
PROG sbin/fsck
PROG sbin/fsck_ffs
@@ -47,7 +46,6 @@ PROG usr/mdec/sgivol
PROG usr/sbin/chown usr/bin/chgrp
PROG usr/sbin/chroot
-SPECIAL dhclient srcdir distrib/utils/x_dhclient
SPECIAL ed srcdir distrib/utils/x_ed
SPECIAL ifconfig srcdir distrib/utils/x_ifconfig
SPECIAL ping srcdir distrib/utils/x_ping
@@ -66,7 +64,6 @@ COPY ${DESTDIR}/usr/mdec/ip2xboot usr/m
COPY ${DESTDIR}/usr/mdec/ip3xboot usr/mdec/ip3xboot
# various files that we need in /etc for the install
-COPY ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
sbin/dhclient-script 555
COPY ${NETBSDSRCDIR}/etc/group etc/group
COPY ${NETBSDSRCDIR}/etc/master.passwd etc/master.passwd
COPY ${NETBSDSRCDIR}/etc/protocols etc/protocols
Index: distrib/shark/instkernel/ramdisk/Makefile
===================================================================
RCS file: /data/repo/netbsd/src/distrib/shark/instkernel/ramdisk/Makefile,v
retrieving revision 1.13
diff -u -p -r1.13 Makefile
--- distrib/shark/instkernel/ramdisk/Makefile 30 Jul 2007 14:03:17 -0000
1.13
+++ distrib/shark/instkernel/ramdisk/Makefile 26 May 2008 23:56:51 -0000
@@ -20,8 +20,7 @@ IMAGEDEPENDS= ${CRUNCHBIN} \
${DESTDIR}/usr/share/misc/termcap \
${NETBSDSRCDIR}/etc/group ${NETBSDSRCDIR}/etc/master.passwd \
${NETBSDSRCDIR}/etc/netconfig ${NETBSDSRCDIR}/etc/protocols \
- ${NETBSDSRCDIR}/distrib/common/services \
- ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
+ ${NETBSDSRCDIR}/distrib/common/services
# Use stubs to eliminate some large stuff from libc
HACKSRC= ${DISTRIBDIR}/utils/libhack
@@ -29,6 +28,7 @@ HACKSRC= ${DISTRIBDIR}/utils/libhack
${CRUNCHBIN}: libhack.o
.include "${DISTRIBDIR}/common/Makefile.crunch"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
.include "${DISTRIBDIR}/common/Makefile.makedev"
.include "${DISTRIBDIR}/common/Makefile.image"
Index: distrib/shark/instkernel/ramdisk/list
===================================================================
RCS file: /data/repo/netbsd/src/distrib/shark/instkernel/ramdisk/list,v
retrieving revision 1.10
diff -u -p -r1.10 list
--- distrib/shark/instkernel/ramdisk/list 6 May 2008 15:32:07 -0000
1.10
+++ distrib/shark/instkernel/ramdisk/list 26 May 2008 23:57:01 -0000
@@ -20,7 +20,6 @@ PROG bin/stty
PROG bin/sync
PROG sbin/disklabel
-PROG sbin/dhclient
PROG sbin/fsck
PROG sbin/fsck_ffs
PROG sbin/ifconfig
@@ -56,7 +55,6 @@ PROG usr/sbin/dev_mkdb
# init invokes the shell as -sh
ARGVLN sh -sh
-SPECIAL dhclient srcdir distrib/utils/x_dhclient
SPECIAL ping srcdir distrib/utils/x_ping
LIBS libhack.o -lbz2 -ledit -lutil -lcurses -ltermcap -lrmt -lcrypt -ll -lm
-lz -lprop
@@ -70,7 +68,6 @@ COPY ${NETBSDSRCDIR}/etc/master.passwd e
COPY ${NETBSDSRCDIR}/etc/netconfig etc/netconfig
COPY ${NETBSDSRCDIR}/etc/protocols etc/protocols
COPY ${NETBSDSRCDIR}/distrib/common/services etc/services
-COPY ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
sbin/dhclient-script 555
# and the common installation tools
COPY ${DESTDIR}/usr/share/misc/termcap usr/share/misc/termcap
Index: distrib/sparc64/instfs/Makefile
===================================================================
RCS file: /data/repo/netbsd/src/distrib/sparc64/instfs/Makefile,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile
--- distrib/sparc64/instfs/Makefile 22 Nov 2006 20:54:16 -0000 1.12
+++ distrib/sparc64/instfs/Makefile 26 May 2008 23:56:25 -0000
@@ -21,6 +21,7 @@ HACKSRC= ${DISTRIBDIR}/utils/libhack
${CRUNCHBIN}: libhack.o
.include "${DISTRIBDIR}/common/Makefile.crunch"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
.include "${DISTRIBDIR}/common/Makefile.makedev"
.include "${DISTRIBDIR}/common/Makefile.image"
.include "${DISTRIBDIR}/common/Makefile.mdset"
Index: distrib/sparc64/instfs/list
===================================================================
RCS file: /data/repo/netbsd/src/distrib/sparc64/instfs/list,v
retrieving revision 1.8
diff -u -p -r1.8 list
--- distrib/sparc64/instfs/list 6 May 2008 15:32:07 -0000 1.8
+++ distrib/sparc64/instfs/list 26 May 2008 23:56:14 -0000
@@ -22,7 +22,6 @@ PROG bin/sh
PROG bin/stty
PROG bin/sync
-PROG sbin/dhclient
PROG sbin/disklabel
PROG sbin/fsck
PROG sbin/fsck_ffs
@@ -70,7 +69,6 @@ PROG usr/sbin/pppd
ARGVLN sh -sh
SPECIAL chat srcdir usr.sbin/pppd/chat
-SPECIAL dhclient srcdir distrib/utils/x_dhclient
SPECIAL ifconfig srcdir distrib/utils/x_ifconfig
SPECIAL ping srcdir distrib/utils/x_ping
SPECIAL pppd srcdir usr.sbin/pppd/pppd
@@ -86,8 +84,6 @@ COPY ${NETBSDSRCDIR}/etc/netconfig etc/
COPY ${NETBSDSRCDIR}/etc/protocols etc/protocols
COPY ${NETBSDSRCDIR}/distrib/common/services etc/services
-COPY ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
sbin/dhclient-script 555
-
# we need the boot block in /usr/mdec + the arch specific extras
COPY ${DESTDIR}/usr/mdec/binstall usr/mdec/binstall 555
COPY ${DESTDIR}/usr/mdec/bootblk usr/mdec/bootblk
Index: distrib/utils/sysinst/net.c
===================================================================
RCS file: /data/repo/netbsd/src/distrib/utils/sysinst/net.c,v
retrieving revision 1.117
diff -u -p -r1.117 net.c
--- distrib/utils/sysinst/net.c 29 Mar 2008 15:19:53 -0000 1.117
+++ distrib/utils/sysinst/net.c 26 May 2008 15:36:14 -0000
@@ -38,6 +38,7 @@
/* net.c -- routines to fetch files off the network. */
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -99,7 +100,7 @@ static char *url_encode (char *dst, cons
static void write_etc_hosts(FILE *f);
-#define DHCLIENT_EX "/sbin/dhclient"
+#define DHCPCD "/sbin/dhcpcd"
#include <signal.h>
static int config_dhcp(char *);
static void get_dhcp_value(char *, size_t, const char *);
@@ -1091,8 +1092,7 @@ mnt_net_config(void)
add_rc_conf("defaultroute=\"%s\"\n", net_defroute);
} else {
- add_rc_conf("dhclient=YES\n");
- add_rc_conf("dhclient_flags=\"%s\"\n", net_dev);
+ add_rc_conf("ifconfig_%s=dhcp\n", net_dev);
}
#ifdef INET6
@@ -1117,73 +1117,55 @@ int
config_dhcp(char *inter)
{
int dhcpautoconf;
- int result;
- char *textbuf;
- int pid;
- /* check if dhclient is running, if so, kill it */
- result = collect(T_FILE, &textbuf, "/tmp/dhclient.pid");
- if (result >= 0) {
- pid = atoi(textbuf);
- if (pid > 0) {
- kill(pid, 15);
- sleep(1);
- kill(pid, 9);
- }
- }
- free(textbuf);
+ /*
+ * Don't bother checking for an existing instance of dhcpcd, just
+ * ask it to renew the lease. It will fork and daemonize if there
+ * wasn't already an instance.
+ */
- if (!file_mode_match(DHCLIENT_EX, S_IFREG))
+ if (!file_mode_match(DHCPCD, S_IFREG))
return 0;
process_menu(MENU_yesno, deconst(MSG_Perform_DHCP_autoconfiguration));
if (yesno) {
- /* spawn off dhclient and wait for parent to exit */
+ /* spawn off dhcpcd and wait for parent to exit */
dhcpautoconf = run_program(RUN_DISPLAY | RUN_PROGRESS,
- "%s -q -pf /tmp/dhclnt.pid -lf /tmp/dhclient.leases %s",
- DHCLIENT_EX, inter);
+ "%s -d -n %s", DHCPCD, inter);
return dhcpautoconf ? 0 : 1;
}
return 0;
}
static void
-get_dhcp_value(char *targ, size_t l, const char *line)
+get_dhcp_value(char *targ, size_t l, const char *var)
{
- int textsize;
- char *textbuf;
- char *t;
- char *walkp;
-
- textsize = collect(T_FILE, &textbuf, "/tmp/dhclient.leases");
- if (textsize < 0) {
- if (logging)
- (void)fprintf(logfp,
- "Could not open file /tmp/dhclient.leases.\n");
- (void)fprintf(stderr, "Could not open /tmp/dhclient.leases\n");
- /* not fatal, just assume value not found */
+ static const char *lease_data = "/tmp/dhcpcd-lease";
+ FILE *fp;
+ char *line;
+ size_t len, var_len;
+
+ if ((fp = fopen(lease_data, "r")) == NULL) {
+ warn("Could not open %s", lease_data);
+ *targ = '\0';
+ return;
}
- if (textsize >= 0) {
- (void)strtok(textbuf, " \t\n"); /* jump past 'lease' */
- while ((t = strtok(NULL, " \t\n")) != NULL) {
- if (strcmp(t, line) == 0) {
- t = strtok(NULL, " \t\n");
- /* found the tag, extract the value */
- /* last char should be a ';' */
- walkp = strrchr(t, ';');
- if (walkp != NULL) {
- *walkp = '\0';
- }
- /* strip any " from the string */
- walkp = strrchr(t, '"');
- if (walkp != NULL) {
- *walkp = '\0';
- t++;
- }
- strlcpy(targ, t, l);
- break;
- }
- }
+
+ var_len = strlen(var);
+
+ while ((line = fgetln(fp, &len)) != NULL) {
+ if (line[len - 1] == '\n')
+ --len;
+ if (len <= var_len)
+ continue;
+ if (memcmp(line, var, var_len))
+ continue;
+ if (line[var_len] != '=')
+ continue;
+ line += var_len + 1;
+ len -= var_len + 1;
+ strlcpy(targ, line, l > len ? len + 1: l);
+ break;
}
- free(textbuf);
- return;
+
+ fclose(fp);
}
Index: distrib/zaurus/ramdisk/Makefile
===================================================================
RCS file: /data/repo/netbsd/src/distrib/zaurus/ramdisk/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- distrib/zaurus/ramdisk/Makefile 10 Apr 2008 15:45:29 -0000 1.2
+++ distrib/zaurus/ramdisk/Makefile 26 May 2008 23:55:14 -0000
@@ -31,6 +31,7 @@ HACKSRC= ${DISTRIBDIR}/utils/libhack
${CRUNCHBIN}: libhack.o
.include "${DISTRIBDIR}/common/Makefile.crunch"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
.include "${DISTRIBDIR}/common/Makefile.makedev"
.include "${DISTRIBDIR}/common/Makefile.image"
Index: distrib/zaurus/ramdisk/list
===================================================================
RCS file: /data/repo/netbsd/src/distrib/zaurus/ramdisk/list,v
retrieving revision 1.3
diff -u -p -r1.3 list
--- distrib/zaurus/ramdisk/list 6 May 2008 15:32:07 -0000 1.3
+++ distrib/zaurus/ramdisk/list 26 May 2008 23:54:34 -0000
@@ -22,7 +22,6 @@ PROG bin/sh
PROG bin/stty
PROG bin/sync
-PROG sbin/dhclient
PROG sbin/disklabel
PROG sbin/fdisk
PROG sbin/fsck
@@ -60,7 +59,6 @@ PROG usr/sbin/chroot
# init invokes the shell as -sh
ARGVLN sh -sh
-SPECIAL dhclient srcdir distrib/utils/x_dhclient
SPECIAL ifconfig srcdir distrib/utils/x_ifconfig
SPECIAL ping srcdir distrib/utils/x_ping
SPECIAL route srcdir distrib/utils/x_route
@@ -68,10 +66,6 @@ SPECIAL route srcdir distrib/utils/x_ro
LIBS libhack.o -lbz2 -ledit -lutil -lcurses -ltermcap -lrmt -lcrypt -ll -lm
-lz -lprop
# various files that we need in /etc for the install
-COPY ${NETBSDSRCDIR}/usr.sbin/dhcp/clientscript/dhclient-script
sbin/dhclient-script 555
-
-
-# various files that we need in /etc for the install
COPY ${NETBSDSRCDIR}/etc/group etc/group
COPY ${NETBSDSRCDIR}/etc/master.passwd etc/master.passwd
COPY ${NETBSDSRCDIR}/etc/netconfig etc/netconfig
Index: etc/defaults/rc.conf
===================================================================
RCS file: /data/repo/netbsd/src/etc/defaults/rc.conf,v
retrieving revision 1.92
diff -u -p -r1.92 rc.conf
--- etc/defaults/rc.conf 15 Apr 2008 11:17:47 -0000 1.92
+++ etc/defaults/rc.conf 26 May 2008 20:11:36 -0000
@@ -152,6 +152,7 @@ racoon=NO # IKE daemon
auto_ifconfig=YES # config all avail. interfaces
net_interfaces="" # used only if above is NO
flushroutes=YES # flush routes in
netstart
+dhcpcd_flags="" # For ifconfig_XXX=dhcp.
dhclient=NO # behave as a DHCP client
dhclient_flags="" # blank: config all interfaces
ntpdate=NO ntpdate_flags="-b -s" # May need '-u' thru firewall
Index: etc/rc.d/network
===================================================================
RCS file: /data/repo/netbsd/src/etc/rc.d/network,v
retrieving revision 1.51
diff -u -p -r1.51 network
--- etc/rc.d/network 10 Feb 2007 19:40:58 -0000 1.51
+++ etc/rc.d/network 26 May 2008 20:12:23 -0000
@@ -200,7 +200,10 @@ network_start()
ipf -y >/dev/null
fi
fi
- if [ -n "$args" ]; then
+ if [ "$args" = "dhcp" ]; then
+ echo -n " $int"
+ dhcpcd -n ${dhcpcd_flags} $int
+ elif [ -n "$args" ]; then
echo -n " $int"
ifconfig $int $args
elif [ -f /etc/ifconfig.$int ]; then
@@ -213,6 +216,10 @@ network_start()
"!"*)
eval ${args#*!}
;;
+ dhcp)
+ dhcpcd -n ${dhcpcd_flags} \
+ $int
+ ;;
*)
eval ifconfig $int $args
;;
@@ -385,6 +392,7 @@ network_stop()
eval args=\$ifconfig_$int
if [ -n "$args" ] || [ -f /etc/ifconfig.$int ]; then
echo -n " $int"
+ dhcpcd -k $int 2> /dev/null
ifconfig $int down
if ifconfig $int destroy 2>/dev/null && \
checkyesno ipfilter; then
Index: share/man/man5/ifconfig.if.5
===================================================================
RCS file: /data/repo/netbsd/src/share/man/man5/ifconfig.if.5,v
retrieving revision 1.8
diff -u -p -r1.8 ifconfig.if.5
--- share/man/man5/ifconfig.if.5 24 Nov 2005 17:28:46 -0000 1.8
+++ share/man/man5/ifconfig.if.5 27 May 2008 13:41:44 -0000
@@ -26,7 +26,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd November 24, 2005
+.Dd May 27, 2008
.Dt IFCONFIG.IF 5
.Os
.Sh NAME
@@ -51,6 +51,11 @@ Normally, a line will be evaluated as co
.Dq Li ifconfig if
will be prepended on evaluation.
.Pp
+If the line is equal to
+.Dq dhcp ,
+.Xr dhcpcd 8
+will be started for the interface.
+.Pp
If a line is empty, or starts with
.Sq # ,
the line will be ignored as comment.
Index: share/man/man5/rc.conf.5
===================================================================
RCS file: /data/repo/netbsd/src/share/man/man5/rc.conf.5,v
retrieving revision 1.115
diff -u -p -r1.115 rc.conf.5
--- share/man/man5/rc.conf.5 15 Apr 2008 11:17:48 -0000 1.115
+++ share/man/man5/rc.conf.5 27 May 2008 13:41:26 -0000
@@ -32,7 +32,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd May 15, 2007
+.Dd May 27, 2008
.Dt RC.CONF 5
.Os
.Sh NAME
@@ -450,7 +450,10 @@ or
Set to
.Sq YES
to configure some or all network interfaces using
-the DHCP client.
+the ISC DHCP client.
+See the
+.Sy ifconfig_xxN
+variable for an alternative way to start use DHCP.
If you set
.Sy dhclient
to
@@ -654,7 +657,11 @@ parameters in
.Pa /etc/ifconfig.xxN
and then in the variable
.Sy ifconfig_xxN .
-The contents of the file or the variable are handed to ifconfig
+If this variable is equal to
+.Dq dhcp ,
+.Xr dhcpcd 8
+is started for the interface.
+Otherwise the contents of the file or the variable are handed to ifconfig
after the interface name.
If
.Sy auto_ifconfig
Home |
Main Index |
Thread Index |
Old Index