Index: head/contrib/isc-dhcp/Makefile.conf =================================================================== --- head/contrib/isc-dhcp/Makefile.conf (nonexistent) +++ head/contrib/isc-dhcp/Makefile.conf (revision 62105) @@ -0,0 +1,332 @@ +# Makefile.conf +# +# Copyright (c) 1996, 1997, 1998, 1999 The Internet Software Consortium. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of The Internet Software Consortium nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND +# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. +# + +## Defaults... +SCRIPT = none +BINDIR = /usr/sbin +CLIENTBINDIR=/sbin +ADMMANEXT = .0 +FFMANEXT = .0 +ADMMANDIR = /usr/share/man/cat8 +FFMANDIR = /usr/share/man/cat5 +INSTALL = install -c +MANINSTALL = install -c -m 444 +CHMOD = chmod +CATMANPAGES = +MANCAT = cat +ETC = /etc +VARRUN = /var/run +VARDB = /var/db + +# Major version number (if applicable) +##--majver-- +MAJORVERSION=MajorVersion +##--majver-- + +# Minor version number (if applicable) +##--minver-- +MINORVERSION=MinorVersion +##--minver-- + +## Porting:: +# +# For each supported operating system, there is a block of text below +# beginning with #--os-name-- and ending with #--os-name--. Between +# these delimiters are assignments, commented out, which define the +# Makefile variables required for that operating system. +# +# The configure shell script figures out what operating system it's +# being run on and then runs Makefile.dist through a sed script which +# removes the comment characters from the appropriate set of +# assignments, and writes the output to Makefile. + +## AIX 4.1.5.0 +##--aix-- +#CF = cf/aix.h +#CC=cc -Daix +#INSTALL=/usr/ucb/install +#MANINSTALL=/usr/ucb/install +#ADMMANEXT = .8 +#FFMANEXT = .5 +#VARRUN = /etc +#VARDB = /etc +##--aix-- + +## NEXTSTEP 3.x,4.x +##--nextstep-- +#LIBS = +#CF = cf/nextstep.h +#CC=cc +#COPTS = -Wall +#BINDIR=/usr/etc +#ADMMANDIR = /usr/local/man/cat8 +#FFMANDIR = /usr/local/man/cat5 +#ADMMANEXT = .8 +#FFMANEXT = .5 +#VARRUN = /etc +#VARDB = /etc +##--nextstep-- + +## SunOS 4.1 +##--sunos4-- +#LIBS = -lresolv +#CF = cf/sunos4.h +#BINDIR=/usr/etc +#CLIENTBINDIR=/etc +#ADMMANEXT = .8 +#FFMANEXT = .5 +#VARRUN = /etc +#VARDB = /etc +##--sunos4-- + +## Solaris 2.5 (with gcc) +##--sunos5-gcc-- +#INSTALL=/usr/ucb/install +#MANINSTALL=/usr/ucb/install +#LIBS = -lresolv -lsocket -lnsl -lgen +#CC=gcc +#COPTS = -Wall -Wno-unused -Wno-implicit -Wno-comment \ +# -Wno-uninitialized -Wno-char-subscripts -Werror +#CF = cf/sunos5-5.h +#ADMMANDIR = /usr/share/man/cat1m +#ADMMANEXT = .1m +#FFMANDIR = /usr/share/man/cat4 +#FFMANEXT = .4 +#VARRUN = /etc +#VARDB = /etc +#SCRIPT=solaris +##--sunos5-gcc-- + +## Solaris 2.5 (with Sun cc) +##--sunos5-cc-- +#INSTALL=/usr/ucb/install +#MANINSTALL=/usr/ucb/install +#LIBS = -lresolv -lsocket -lnsl -lgen +#CC=cc +#COPTS = -D__svr4__ +#CF = cf/sunos5-5.h +#ADMMANDIR = /usr/share/man/cat1m +#ADMMANEXT = .1m +#FFMANDIR = /usr/share/man/cat4 +#FFMANEXT = .4 +#VARRUN = /etc +#VARDB = /etc +#SCRIPT=solaris +##--sunos5-cc-- + +## DEC Alpha/OSF1 +##--alphaosf-- +#CC=cc -std0 +#INSTALL=/usr/ucb/installbsd +#MANINSTALL=/usr/ucb/installbsd +#LIBS= +#CF = cf/alphaosf.h +#ADMMANEXT = .8 +#FFMANEXT = .5 +#VARDB = /etc +##--alphaosf-- + +## BSD/OS 2.1 +##--bsdos-- +#LIBS= -lresolv +#CC=gcc2 +#CF = cf/bsdos.h +##--bsdos-- + +## FreeBSD +##--freebsd-- +#CF = cf/freebsd.h +#SCRIPT=freebsd +##--freebsd-- + +## Rhapsody +##--rhapsody-- +#CF = cf/rhapsody.h +#COPTS = -Wall -Wno-unused -Wno-implicit -Wno-comment \ +# -Wno-uninitialized -Werror -pipe +#SCRIPT=rhapsody +##--rhapsody-- + +## NetBSD +##--netbsd-- +#CF = cf/netbsd.h +#COPTS = -Wall -Wstrict-prototypes -Wno-unused -Wno-implicit -Wno-comment \ +# -Wno-uninitialized -Werror -pipe +#SCRIPT=netbsd +##--netbsd-- + +## Ultrix +##--ultrix-- +#BINDIR = /usr/etc +#CLIENTBINDIR=/etc +#VARRUN = /etc +#VARDB = /etc +#CF = cf/ultrix.h +#ADMMANDIR = /usr/man/man8 +#ADMMANEXT = .8 +#FFMANDIR = /usr/man/man5 +#FFMANEXT = .5 +##--ultrix-- + +## Linux 1.x +##--linux-1-- +#COPTS = -DLINUX_MAJOR=$(MAJORVERSION) -DLINUX_MINOR=$(MINORVERSION) +#CF = cf/linux.h +#ADMMANDIR = /usr/man/man8 +#ADMMANEXT = .8 +#FFMANDIR = /usr/man/man5 +#FFMANEXT = .5 +#MANCAT = man +#VARRUN = /var/run +#VARDB = /var/state/dhcp # see rationale in includes/cf/linux.h +#SCRIPT=linux +##--linux-1-- + +## Linux 2.0 +##--linux-2.0-- +#COPTS = -DLINUX_MAJOR=$(MAJORVERSION) -DLINUX_MINOR=$(MINORVERSION) +#CF = cf/linux.h +#ADMMANDIR = /usr/man/man8 +#ADMMANEXT = .8 +#FFMANDIR = /usr/man/man5 +#FFMANEXT = .5 +#MANCAT = man +#VARRUN = /var/run +#VARDB = /var/state/dhcp # see rationale in includes/cf/linux.h +#SCRIPT=linux +##--linux-2.0-- + +## Linux 2.1 +##--linux-2.1-- +#COPTS = -DLINUX_MAJOR=$(MAJORVERSION) -DLINUX_MINOR=$(MINORVERSION) +#CF = cf/linux.h +#ADMMANDIR = /usr/man/man8 +#ADMMANEXT = .8 +#FFMANDIR = /usr/share/man/man5 +#FFMANEXT = .5 +#MANCAT = man +#VARRUN = /var/run +#VARDB = /var/state/dhcp # see rationale in includes/cf/linux.h +#SCRIPT=linux +##--linux-2.1-- + +## Linux 2.2 +##--linux-2.2-- +#COPTS = -DLINUX_MAJOR=$(MAJORVERSION) -DLINUX_MINOR=$(MINORVERSION) +#CF = cf/linux.h +#ADMMANDIR = /usr/man/man8 +#ADMMANEXT = .8 +#FFMANDIR = /usr/share/man/man5 +#FFMANEXT = .5 +#MANCAT = man +#VARRUN = /var/run +#VARDB = /var/state/dhcp # see rationale in includes/cf/linux.h +#SCRIPT=linux +##--linux-2.2-- + +## SCO +##--sco-- +#CF = cf/sco.h +#PREDEFINES=-DSCO -DBROKEN_ANSI +#BINDIR = /usr/etc +#CLIENTBINDIR=/etc +#ADMMANDIR = /usr/man/cat.ADMN +#ADMMANEXT = .ADMN.Z +#FFMANDIR = /usr/man/cat.SFF +#FFMANEXT = .SFF.Z +#INSTALL = cp +#MANFROM = < +#MANINSTALL = compress +#MANTO = > +#VARRUN = /etc +#VARDB = /etc +#CATMANPAGES= +##--sco-- + +## QNX +##--qnx-- +#CF = cf/qnx.h +#ADMMANDIR = /usr/man/man8 +#ADMMANEXT = .8 +#FFMANDIR = /usr/man/man5 +#FFMANEXT = .5 +#MANCAT = man +#VARRUN = /etc +#COPTS=-w3 -Dlint +#LFLAGS=$(DEBUG) "-Wl,op symfile" -l socket +#MANINSTALL = /bin/true +#INSTALL = cp +#BINDIR = /etc +#CLIENTBINDIR = /etc +##--qnx-- + +## CygWin32 +##--cygwin32-- +#CF = cf/cygwin32.h +#ADMMANDIR = /usr/man/man8 +#ADMMANEXT = .8 +#FFMANDIR = /usr/man/man5 +#FFMANEXT = .5 +#VARRUN = /etc +#MANINSTALL = /bin/true +#INSTALL = cp +#BINDIR = /etc +#CLIENTBINDIR = /etc +#CC=/usr/local/i386-unknown-cygwin32/bin/gcc +#AR=/usr/local/i386-unknown-cygwin32/bin/ar +#AS=/usr/local/i386-unknown-cygwin32/bin/as +#LD=/usr/local/i386-unknown-cygwin32/bin/ld +#NM=/usr/local/i386-unknown-cygwin32/bin/nm +#RANLIB=/usr/local/i386-unknown-cygwin32/bin/ranlib +#STRIP=/usr/local/i386-unknown-cygwin32/bin/strip +##--cygwin32-- + +## IRIX 6.x +##--irix-- +#LIBS = -lbind +#LFLAGS=$(DEBUG) -L/usr/local/lib -Wl,-woff,84 -Wl,-woff,85 -Wl,-woff,134 +#CC=gcc +#COPTS = -I/usr/local/include +#CF = cf/irix.h +#BINDIR = /usr/local/etc +#ADMMANDIR = /usr/local/man/man8 +#ADMMANEXT = .8 +#FFMANDIR = /usr/local/man/man5 +#FFMANEXT = .5 +#MANCAT = man +#INSTALL = install +#MANINSTALL = install +#CHMOD = chmod +#ETC = /etc +#VARRUN = /etc +#VARDB = /usr/local/etc/dhcp +##--irix-- Property changes on: head/contrib/isc-dhcp/Makefile.conf ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: head/contrib/isc-dhcp/Makefile.dist =================================================================== --- head/contrib/isc-dhcp/Makefile.dist (nonexistent) +++ head/contrib/isc-dhcp/Makefile.dist (revision 62105) @@ -0,0 +1,94 @@ +# Makefile.dist +# +# Copyright (c) 1996, 1997 The Internet Software Consortium. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of The Internet Software Consortium nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND +# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. +# + +SUBDIRS= common server client relay + +all: + @for dir in ${SUBDIRS}; do \ + echo "Making all in $$dir"; \ + (cd $$dir; $(MAKE) all) || exit 1; \ + done + @if [ `uname` = Linux ]; then \ + echo; \ + echo " !!!! WARNING !!!!"; \ + echo ; \ + echo "The default location for the dhcpd.leases file has \ +changed!!!"; \ + echo; \ + echo "It is now in /var/state/dhcp. If you are not"; \ + echo "installing this for the first time, please move your"; \ + echo "lease database to the new location before using this"; \ + echo "software."; \ + echo; \ + echo " !!!! WARNING !!!!"; \ + echo; \ + fi + +install: + @for dir in ${SUBDIRS}; do \ + echo "Installing in $$dir"; \ + (cd $$dir; $(MAKE) install) || exit 1; \ + done + @if [ `uname` = Linux ]; then \ + echo; \ + echo " !!!! WARNING !!!!"; \ + echo ; \ + echo "The default location for the dhcpd.leases file has \ +changed!!!"; \ + echo; \ + echo "It is now in /var/state/dhcp. If you are not"; \ + echo "installing this for the first time, please move your"; \ + echo "lease database to the new location before using this"; \ + echo "software."; \ + echo; \ + echo " !!!! WARNING !!!!"; \ + echo; \ + fi + +clean: + @for dir in ${SUBDIRS}; do \ + echo "Cleaning in $$dir"; \ + (cd $$dir; $(MAKE) clean) || exit 1; \ + done + +realclean: + @for dir in ${SUBDIRS}; do \ + echo "Really cleaning in $$dir"; \ + (cd $$dir; $(MAKE) realclean) || exit 1; \ + done + +distclean: + @for dir in ${SUBDIRS}; do \ + echo "Really, really cleaning in $$dir"; \ + (cd $$dir; $(MAKE) distclean) || exit 1; \ + done + @rm -f Makefile Property changes on: head/contrib/isc-dhcp/Makefile.dist ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: head/contrib/isc-dhcp/README =================================================================== --- head/contrib/isc-dhcp/README (revision 62104) +++ head/contrib/isc-dhcp/README (revision 62105) @@ -1,484 +1,535 @@ - Internet Software Consortium - Dynamic Host Configuration Protocol Distribution - Version 2 - June 22, 1999 +

Internet Software Consortium

+

Dynamic Host Configuration Protocol Distribution

+

Version 2 Patchlevel 1

+

June 24, 2000

- README FILE +

README FILE

-You should read this file carefully before trying to install or use -the ISC DHCP Distribution. +

You should read this file carefully before trying to install or use +the ISC DHCP Distribution.

- TABLE OF CONTENTS +
    +TABLE OF CONTENTS +
    +
    WHERE TO FIND DOCUMENTATION +
    RELEASE STATUS +
    BUILDING THE DHCP DISTRIBUTION +
    INSTALLING THE DHCP DISTRIBUTION +
    USING THE DHCP DISTRIBUTION +
    +
    LINUX +
    +
    SO_ATTACH_FILTER UNDECLARED +
    PROTOCOL NOT CONFIGURED +
    BROADCAST +
    FIREWALL RULES +
    IP BOOTP AGENT +
    MULTIPLE INTERFACES +
    +
    SCO +
    HP-UX +
    ULTRIX +
    FreeBSD +
    NeXTSTEP +
    SOLARIS +
    +
    SUPPORT +
    +
    HOW TO REPORT BUGS +
    +
    KNOWN BUGS - 1 WHERE TO FIND DOCUMENTATION - 2 RELEASE STATUS - 3 BUILDING THE DHCP DISTRIBUTION - 4 INSTALLING THE DHCP DISTRIBUTION - 5 USING THE DHCP DISTRIBUTION - 5.1 LINUX - 5.1.1 SO_ATTACH_FILTER UNDECLARED - 5.1.2 PROTOCOL NOT CONFIGURED - 5.1.3 BROADCAST - 5.1.4 FIREWALL RULES - 5.1.5 IP BOOTP AGENT - 5.1.6 MULTIPLE INTERFACES - 5.2 SCO - 5.3 HP-UX - 5.4 ULTRIX - 5.5 FreeBSD - 5.6 NeXTSTEP - 5.7 SOLARIS - 6 SUPPORT - 6.1 HOW TO REPORT BUGS - 7 KNOWN BUGS +

    Where to find documentation

    - WHERE TO FIND DOCUMENTATION - -Documentation for this software includes this README file, the +

    Documentation for this software includes this README file, the RELNOTES file, and the manual pages, which are in the server, common, client and relay subdirectories. Internet standards relating to the DHCP protocol are stored in the doc subdirectory. You will have the best luck reading the manual pages if you build this software and then install it, although you can read them directly out of the -distribution if you need to. +distribution if you need to.

    -DHCP server documentation is in the dhcpd man page. Information about +

    DHCP server documentation is in the dhcpd man page. Information about the DHCP server lease database is in the dhcpd.leases man page. Server configuration documentation is in the dhcpd.conf man page as well as the dhcp-options man page. A sample DHCP server configuration is in the file server/dhcpd.conf. The source for the dhcpd, dhcpd.leases and dhcpd.conf man pages is in the server/ sub- directory in the distribution. The source for the dhcp-options.5 -man page is in the common/ subdirectory. +man page is in the common/ subdirectory.

    -DHCP Client documentation is in the dhclient man page. DHCP client +

    DHCP Client documentation is in the dhclient man page. DHCP client configuration documentation is in the dhclient.conf man page and the dhcp-options man page. The DHCP client configuration script is documented in the dhclient-script man page. The format of the DHCP client lease database is documented in the dhclient.leases man page. The source for all these man pages is in the client/ subdirectory in the distribution. In addition, the dhcp-options man page should be -referred to for information about DHCP options. +referred to for information about DHCP options.

    -DHCP relay agent documentation is in the dhcrelay man page, the source -for which is distributed in the relay/ subdirectory. +

    DHCP relay agent documentation is in the dhcrelay man page, the source +for which is distributed in the relay/ subdirectory.

    -To read installed manual pages, use the man command. Type "man page" +

    To read installed manual pages, use the man command. Type "man page" where page is the name of the manual page. This will only work if you have installed the ISC DHCP distribution using the ``make install'' -command (described later). +command (described later).

    -If you want to read manual pages that aren't installed, you can type +

    If you want to read manual pages that aren't installed, you can type ``nroff -man page |more'' where page is the filename of the unformatted manual page. The filename of an unformatted manual page is the name of the manual page, followed by '.', followed by some number - 5 for documentation about files, and 8 for documentation about programs. For example, to read the dhcp-options man page, you would type ``nroff -man common/dhcp-options.5 |more'', assuming your current working directory is the top level directory of the ISC -DHCP Distribution. +DHCP Distribution.

    -If you do not have the nroff command, you can type ``more catpage'' +

    If you do not have the nroff command, you can type ``more catpage'' where catpage is the filename of the catted man page. Catted man pages names are the name of the manual page followed by ".cat" -followed by 5 or 8, as with unformatted manual pages. +followed by 5 or 8, as with unformatted manual pages.

    -Please note that until you install the manual pages, the pathnames of +

    Please note that until you install the manual pages, the pathnames of files to which they refer will not be correct for your operating -system. +system.

    - RELEASE STATUS +

    Release status

    -This is the final release of Version 2 of the Internet Software +

    This is the final release of Version 2 of the Internet Software Consortium DHCP Distribution. In version 2.0, this distribution includes a DHCP server, a DHCP client, and a BOOTP/DHCP relay agent. -This release is stable. +This release is stable.

    -In this release, the server and relay agent currently work well on +

    In this release, the server and relay agent currently work well on NetBSD, Linux after kernel version 2.0.30, FreeBSD, BSD/OS, Ultrix, Digital Alpha OSF/1, Solaris and SunOS 4.1.4. On AIX, HPUX, IRIX and Linux 2.0.30, only a single broadcast network interface is supported. They also runs on QNX as long as only one broadcast network interface is configured and a host route is added from that interface to the -255.255.255.255 broadcast address. +255.255.255.255 broadcast address.

    -The DHCP client currently only knows how to configure the network on +

    The DHCP client currently only knows how to configure the network on NetBSD, FreeBSD, BSD/os, Linux, Solaris and NextStep. The client depends on a system-dependent shell script to do network configuration - support for other operating systems is simply a matter -of porting this shell script to the new platform. +of porting this shell script to the new platform.

    -If you wish to run the DHCP Distribution on Linux, please see the +

    If you wish to run the DHCP Distribution on Linux, please see the Linux-specific notes later in this document. If you wish to run on an SCO release, please see the SCO-specific notes later in this document. You particularly need to read these notes if you intend to support Windows 95 clients. If you are running a version of FreeBSD prior to 2.2, please read the note on FreeBSD. If you are running HP-UX or Ultrix, please read the notes for those operating systems below. -If you are running NeXTSTEP, please see the notes on NeXTSTEP below. +If you are running NeXTSTEP, please see the notes on NeXTSTEP below.

    -If you start dhcpd and get a message, "no free bpf", that means you +

    If you start dhcpd and get a message, "no free bpf", that means you need to configure the Berkeley Packet Filter into your operating system kernel. On NetBSD, FreeBSD and BSD/os, type ``man bpf'' for -information. On Digital Unix, type ``man pfilt''. +information. On Digital Unix, type ``man pfilt''.

    +

    Building the DHCP Distribution

    - BUILDING THE DHCP DISTRIBUTION +

    To build the DHCP Distribution, unpack the compressed tar file using +the tar utility and the gzip command - type something like:

    -To build the DHCP Distribution, unpack the compressed tar file using -the tar utility and the gzip command - type something like: +
    + zcat dhcp-2.0pl1.tar.gz |tar xvf - +
    - zcat dhcp-2.0b1pl29.tar.gz |tar xvf - +

    On BSD/OS, you have to type gzcat, not zcat, and you may run into +similar problems on other operating systems.

    -On BSD/OS, you have to type gzcat, not zcat, and you may run into -similar problems on other operating systems. +

    Now, cd to the dhcp-2.0pl1 subdirectory that you've just created and +configure the source tree by typing:

    -Now, cd to the dhcp-2.0b1pl29 subdirectory that you've just created and -configure the source tree by typing: - +
    ./configure +
    -If the configure utility can figure out what sort of system you're +

    If the configure utility can figure out what sort of system you're running on, it will create a custom Makefile for you for that system; otherwise, it will complain. If it can't figure out what system you are using, that system is not supported - you are on -your own. +your own.

    -Once you've run configure, just type ``make'', and after a while +

    Once you've run configure, just type ``make'', and after a while you should have a dhcp server. If you get compile errors on one of the supported systems mentioned earlier, please let us know. If you get warnings, it's not likely to be a problem - the DHCP server compiles completely warning-free on as many architectures as we can manage, but there are a few for which this is difficult. If you get errors on a system not mentioned above, you will need to do some programming or debugging on your own to get the DHCP -Distribution working. +Distribution working.

    - INSTALLING THE DHCP DISTRIBUTION +

    Installing the dhcp distribution

    -Once you have successfully gotten the DHCP Distribution to build, you +

    Once you have successfully gotten the DHCP Distribution to build, you can install it by typing ``make install''. If you already have an old version of the DHCP Distribution installed, you may want to save it -before typing ``make install''. +before typing ``make install''.

    - USING THE DHCP DISTRIBUTION +

    Using the dhcp distribution

    - LINUX +

    Linux

    -There are three big LINUX issues: the all-ones broadcast address, +

    There are three big LINUX issues: the all-ones broadcast address, Linux 2.1 ip_bootp_agent enabling, and operations with more than one network interface. There are also two potential compilation/runtime problems for Linux 2.1/2.2: the "SO_ATTACH_FILTER undeclared" problem -and the "protocol not configured" problem. +and the "protocol not configured" problem.

    - LINUX: SO_ATTACH_FILTER UNDECLARED +

    So_attach_filter undeclared

    -In addition, there is a minor issue that we will mention here because +

    In addition, there is a minor issue that we will mention here because this release is so close on the heels of the Linux 2.2 release: there is a symlink in /usr/include that points at the linux asm headers. It appears to be not uncommon that this link won't be updated correctly, -in which case you'll get the following error when you try to build: +in which case you'll get the following error when you try to build:

    +
    lpf.c: In function `if_register_receive': lpf.c:152: `SO_ATTACH_FILTER' undeclared (first use this function) lpf.c:152: (Each undeclared identifier is reported only once lpf.c:152: for each function it appears in.) +
    -The line numbers may be different, of course. If you see this +

    The line numbers may be different, of course. If you see this header, your linux asm header link is probably bad, and you should -make sure it's pointing to correct linux source directory. +make sure it's pointing to correct linux source directory.

    - LINUX: PROTOCOL NOT CONFIGURED +

    Protocol not configured

    -One additional Linux 2.1/2.2 issue: if you get the following message, +

    One additional Linux 2.1/2.2 issue: if you get the following message, it's because your kernel doesn't have the linux packetfilter or raw -packet socket configured: +packet socket configured:

    - Set CONFIG_PACKET=y and CONFIG_FILTER=y in your kernel configuration +
    + Make sure CONFIG_PACKET (Packet socket) and CONFIG_FILTER (Socket + Filtering) are enabled in your kernel configuration +
    -If this happens, you need to edit your linux kernel .config file, set -CONFIG_FILTER=y and CONFIG_PACKET=y, and rebuild your kernel. If the -preceding sentence made no sense to you, ask your Linux vendor/guru -for help - please don't ask us. +

    If this happens, you need to configure your Linux kernel to support +Socket Filtering and the Packet socket. You can do this by typing +``make config'', ``make menuconfig'' or ``make xconfig'', and then +enabling the Packet socket and Socket Filtering options that you'll +see displayed on the menu or in the questionnaire. You can also edit +your linux kernel .config file directly: set CONFIG_FILTER=y and +CONFIG_PACKET=y. If you do this, make sure you run ``make oldconfig'' +afterwards, so that the changes you've made are propogated to the +kernel header files. After you've reconfigured, you need to type +``make'' to build a new Linux kernel, and then install it in the +appropriate place (probably /linux). Make sure to save a copy of your +old /linux.

    -If you set CONFIG_PACKET=m or CONFIG_FILTER=m, then you must tell the +

    If the preceding paragraph made no sense to you, ask your Linux +vendor/guru for help - please don't ask us.

    + +

    If you set CONFIG_PACKET=m or CONFIG_FILTER=m, then you must tell the kernel module loader to load the appropriate modules. If this doesn't make sense to you, don't use CONFIG_whatever=m - use CONFIG_whatever=y. Don't ask for help with this on the DHCP mailing list - it's a Linux -kernel issue. +kernel issue. This is probably not a problem with the most recent +Linux 2.2.x kernels.

    - LINUX: BROADCAST +

    Broadcast

    -In order for dhcpd to work correctly with picky DHCP clients (e.g., +

    In order for dhcpd to work correctly with picky DHCP clients (e.g., Windows 95), it must be able to send packets with an IP destination -address of 255.255.255.255. Unfortunately, Linux insists on changing -255.255.255.255 into the local subnet broadcast address (here, that's -192.5.5.223). This results in a DHCP protocol violation, and while -many DHCP clients don't notice the problem, some (e.g., all Microsoft -DHCP clients) do. Clients that have this problem will appear not to -see DHCPOFFER messages from the server. +address of 255.255.255.255. Unfortunately, Linux changes an IP +destination of 255.255.255.255 into the local subnet broadcast address +(here, that's 192.5.5.223). This isn't a problem on Linux 2.2 and +later kernels, since we completely bypass the Linux IP stack, but on +old versions of Linux 2.1 and all versions of Linux prior to 2.1, it +is a problem - pickier DHCP clients connected to the same network as +the ISC DHCP server or ISC relay agent will not see messages from the +DHCP server.

    -It is possible to work around this problem on some versions of Linux +

    It is possible to work around this problem on some versions of Linux by creating a host route from your network interface address to 255.255.255.255. The command you need to use to do this on Linux -varies from version to version. The easiest version is: +varies from version to version. The easiest version is:

    +
    route add -host 255.255.255.255 dev eth0 +
    -On some older Linux systems, you will get an error if you try to do +

    On some older Linux systems, you will get an error if you try to do this. On those systems, try adding the following entry to your -/etc/hosts file: +/etc/hosts file:

    +
    255.255.255.255 all-ones +
    -Then, try: +

    Then, try:

    +
    route add -host all-ones dev eth0 +
    -Another route that has worked for some users is: +

    Another route that has worked for some users is:

    +
    route add -net 255.255.255.0 dev eth0 +
    -If you are not using eth0 as your network interface, you should -specify the network interface you *are* using in your route command. +

    If you are not using eth0 as your network interface, you should +specify the network interface you *are* using in your route command.

    - LINUX: FIREWALL RULES +

    Firewall rules

    -If you are running the DHCP server or client on a Linux system that's +

    If you are running the DHCP server or client on a Linux system that's also acting as a firewall, you must be sure to allow DHCP packets through the firewall - Linux firewalls make filtering decisions before they make the forwarding decision, so they will filter packets that are intended for the firewall itself, as well as packets intended to be forwarded. In particular, your firewall rules _must_ allow packets from IP address 0.0.0.0 to IP address 255.255.255.255 from UDP port 68 to UDP port 67 through. They must also allow packets from your local firewall's IP address and UDP port 67 through to any address your DHCP server might serve on UDP port 68. Finally, packets from relay agents on port 67 to the DHCP server on port 67, -and vice versa, must be permitted. +and vice versa, must be permitted.

    - LINUX: IP BOOTP AGENT +

    IP BOOTP agent

    -Some versions of the Linux 2.1 kernel apparently prevent dhcpd from -working unless you enable it by doing the following: +

    Some versions of the Linux 2.1 kernel apparently prevent dhcpd from +working unless you enable it by doing the following:

    +
    echo 1 >/proc/sys/net/ipv4/ip_bootp_agent +
    +

    Multiple interfaces

    - LINUX: MULTIPLE INTERFACES - -Very old versions of the Linux kernel do not provide a networking API +

    Very old versions of the Linux kernel do not provide a networking API that allows dhcpd to operate correctly if the system has more than one broadcast network interface. However, Linux 2.0 kernels with version numbers greater than or equal to 2.0.31 add an API feature: the SO_BINDTODEVICE socket option. If SO_BINDTODEVICE is present, it is possible for dhcpd to operate on Linux with more than one network interface. In order to take advantage of this, you must be running a 2.0.31 or greater kernel, and you must have 2.0.31 or later system -headers installed *before* you build the DHCP Distribution. +headers installed *before* you build the DHCP Distribution.

    -We have heard reports that you must still add routes to 255.255.255.255 +

    We have heard reports that you must still add routes to 255.255.255.255 in order for the all-ones broadcast to work, even on 2.0.31 kernels. In fact, you now need to add a route for each interface. Hopefully -the Linux kernel gurus will get this straight eventually. +the Linux kernel gurus will get this straight eventually.

    -Linux 2.1 and later kernels do not use SO_BINDTODEVICE or require the +

    Linux 2.1 and later kernels do not use SO_BINDTODEVICE or require the broadcast address hack, but do support multiple interfaces, using the -Linux Packet Filter. +Linux Packet Filter.

    - SCO +

    SCO

    -SCO has the same problem as Linux (described earlier). The thing is, +

    SCO has the same problem as Linux (described earlier). The thing is, SCO *really* doesn't want to let you add a host route to the all-ones broadcast address. One technique that has been successful on some -versions of SCO is the very bizarre command: +versions of SCO is the very bizarre command:

    +
    ifconfig net0 alias 10.1.1.1 netmask 8.0.0.0 +
    -Apparently this works because of an interaction between SCO's support +

    Apparently this works because of an interaction between SCO's support for network classes and the weird netmask. The 10.* network is just a dummy that can generally be assumed to be safe. Don't ask why this works. Just try it. If it works for you, great. If not, SCO is supposedly adding hooks to support real DHCP service in a future release - I have this on good authority from the people at SCO who do -*their* DHCP server and client. +*their* DHCP server and client.

    - HP-UX +

    HP-UX

    -HP-UX has the same problem with the all-ones broadcast address that +

    HP-UX has the same problem with the all-ones broadcast address that SCO and Linux have. One user reported that adding the following to /etc/rc.config.d/netconf helped (you may have to modify this to suit -your local configuration): +your local configuration):

    +
    INTERFACE_NAME[0]=lan0 IP_ADDRESS[0]=1.1.1.1 SUBNET_MASK[0]=255.255.255.0 BROADCAST_ADDRESS[0]="255.255.255.255" LANCONFIG_ARGS[0]="ether" DHCP_ENABLE[0]=0 +
    - ULTRIX +

    Ultrix

    -Now that we have Ultrix packet filter support, the DHCP Distribution +

    Now that we have Ultrix packet filter support, the DHCP Distribution on Ultrix should be pretty trouble-free. However, one thing you do need to be aware of is that it now requires that the pfilt device be configured into your kernel and present in /dev. If you type ``man packetfilter'', you will get some information on how to configure your kernel for the packet filter (if it isn't already) and how to make an -entry for it in /dev. +entry for it in /dev.

    - FreeBSD +

    FreeBSD

    -Versions of FreeBSD prior to 2.2 have a bug in BPF support in that the +

    Versions of FreeBSD prior to 2.2 have a bug in BPF support in that the ethernet driver swaps the ethertype field in the ethernet header downstream from BPF, which corrupts the output packet. If you are running a version of FreeBSD prior to 2.2, and you find that dhcpd can't communicate with its clients, you should #define BROKEN_FREEBSD_BPF -in site.h and recompile. +in site.h and recompile.

    - NeXTSTEP +

    NeXTStep

    -The NeXTSTEP support uses the NeXTSTEP Berkeley Packet Filter +

    The NeXTSTEP support uses the NeXTSTEP Berkeley Packet Filter extension, which is not included in the base NextStep system. You -must install this extension in order to get dhcpd or dhclient to work. +must install this extension in order to get dhcpd or dhclient to work.

    - SOLARIS +

    Solaris

    -One problem which has been observed and is not fixed in this +

    One problem which has been observed and is not fixed in this patchlevel has to do with using DLPI on Solaris machines. The symptom of this problem is that the DHCP server never receives any requests. If you are using Solaris 2.6, and you encounter this symptom, and you are running the DHCP server on a machine with a single broadcast network interface, you may wish to edit the includes/site.h file and uncomment the #define USE_SOCKETS line. Then type ``make clean; -make''. +make''.

    -The DHCP client on Solaris will only work with DLPI. If you run it +

    The DHCP client on Solaris will only work with DLPI. If you run it and it just keeps saying it's sending DHCPREQUEST packets, but never gets a response, you may be having DLPI trouble as described above. If so, you are SOL. Also, because Solaris requires you to "plumb" an interface before it can be detected by the DHCP client, you must either specify the name(s) of the interface(s) you want to configure on the command line, or must plumb the interfaces prior to invoking the DHCP client. This can be done with ``ifconfig iface plumb'', where iface is the name of the interface (e.g., ``ifconfig hme0 -plumb''). +plumb'').

    -It should be noted that Solaris versions from 2.6 onward include a +

    It should be noted that Solaris versions from 2.6 onward include a DHCP client that you can run with ``/sbin/ifconfig iface dhcp start'' rather than using the ISC DHCP client. The feature set of the Solaris client is different (not necessarily better or worse) than that of the ISC client, but in most cases it will be a lot easier for you to just use that. Please do not ask for help in using the Solaris DHCP client on Internet Software Consortium mailing lists - that's why you're paying Sun the big bucks. If you're having a problem with the Solaris client interoperating with the ISC dhcp server, that's another -matter, but please check with Sun first. +matter, but please check with Sun first.

    - SUPPORT +

    Support

    -The Internet Software Consortium DHCP server is not a commercial +

    The Internet Software Consortium DHCP server is not a commercial product, and is not supported in that sense. However, it has attracted a fairly sizable following on the Internet, which means that there are a lot of knowledgable users who may be able to help you if you get stuck. These people generally read the dhcp-server@fugue.com -mailing list. +mailing list.

    -If you are going to use dhcpd, you should probably subscribe to the +

    If you are going to use dhcpd, you should probably subscribe to the dhcp-server and dhcp-announce mailing lists. If you will be using -dhclient, you should subscribe to the dhcp-client mailing list. +dhclient, you should subscribe to the dhcp-client mailing list.

    -If you need help, you should ask on the dhcp-server or dhcp-client +

    If you need help, you should ask on the dhcp-server or dhcp-client mailing list (or both) - whichever is appropriate to your application. This includes reporting bugs. Please do not report bugs in old software releases - fetch the latest release and see if the bug is still in that copy of the software, and if it's not, _then_ report it. It's okay to report bugs in the latest patchlevel of a major version that's not the most recent major version, though - for example, if you're running 2.0, you don't have to upgrade to 3.0 -before you can report bugs. +before you can report bugs.

    -PLEASE READ THIS README FILE CAREFULLY BEFORE REPORTING BUGS! +

    Please read this readme file carefully before reporting bugs!

    +

    How to report bugs

    - HOW TO REPORT BUGS - -When you report bugs, please provide us complete information. A list +

    When you report bugs, please provide us complete information. A list of information we need follows. Please read it carefully, and put all the information you can into your initial bug report, so that we don't have to ask you any questions in order to figure out your -problem. +problem.

    - - The specific operating system name and version of the - machine on which the DHCP server or client is running. - - The specific operating system name and version of the - machine on which the client is running, if you are having - trouble getting a client working with the server. - - If you're running Linux, the version number we care about is - the kernel version and maybe the library version, not the - distribution version - e.g., while we don't mind knowing - that you're running Redhat version mumble.foo, we must know - what kernel version you're running, and it helps if you can - tell us what version of the C library you're running, - although if you don't know that off the top of your head it - may be hard for you to figure it out, so don't go crazy - trying. - - The specific version of the DHCP distribution you're - running, for example 2.0b1pl19, not 2.0. - - Please explain the problem carefully, thinking through what - you're saying to ensure that you don't assume we know - something about your situation that we don't know. - - Include your dhcpd.conf and dhcpd.leases file if they're not - huge (if they are huge, we may need them anyway, but don't - send them until you're asked). - - Include a log of your server or client running until it - encounters the problem - for example, if you are having - trouble getting some client to get an address, restart the - server with the -d flag and then restart the client, and - send us what the server prints. Likewise, with the client, - include the output of the client as it fails to get an - address or otherwise does the wrong thing. Do not leave - out parts of the output that you think aren't interesting. - - If the client or server is dumping core, please run the - debugger and get a stack trace, and include that in your - bug report. For example, if your debugger is gdb, do the - following: +
      +
    • The specific operating system name and version of the +machine on which the DHCP server or client is running. +
    • The specific operating system name and version of the +machine on which the client is running, if you are having +trouble getting a client working with the server. +
    • If you're running Linux, the version number we care about is +the kernel version and maybe the library version, not the +distribution version - e.g., while we don't mind knowing +that you're running Redhat version mumble.foo, we must know +what kernel version you're running, and it helps if you can +tell us what version of the C library you're running, +although if you don't know that off the top of your head it +may be hard for you to figure it out, so don't go crazy +trying. +
    • The specific version of the DHCP distribution you're +running, for example 2.0b1pl19, not 2.0. +
    • Please explain the problem carefully, thinking through what +you're saying to ensure that you don't assume we know +something about your situation that we don't know. +
    • Include your dhcpd.conf and dhcpd.leases file if they're not +huge (if they are huge, we may need them anyway, but don't +send them until you're asked). +
    • Include a log of your server or client running until it +encounters the problem - for example, if you are having +trouble getting some client to get an address, restart the +server with the -d flag and then restart the client, and +send us what the server prints. Likewise, with the client, +include the output of the client as it fails to get an +address or otherwise does the wrong thing. Do not leave +out parts of the output that you think aren't interesting. +
    • If the client or server is dumping core, please run the +debugger and get a stack trace, and include that in your +bug report. For example, if your debugger is gdb, do the +following: +
      gdb dhcpd dhcpd.core (gdb) where [...] (gdb) quit +
      - This assumes that it's the dhcp server you're debugging, and - that the core file is in dhcpd.core. +

      This assumes that it's the dhcp server you're debugging, and +that the core file is in dhcpd.core.

      +
    -PLEASE DO NOT send queries about non-isc clients to the dhcp-client -mailing list. If you're asking about them on an ISC mailing list, -it's probably because you're using the ISC DHCP server, so ask there. -If you are having problems with a client whose executable is called -dhcpcd, this is _not_ the ISC DHCP client, and we probably can't help -you with it. +

    Please, do not send queries about non-isc clients +to the dhcp-client mailing list. If you're asking about them on an +ISC mailing list, it's probably because you're using the ISC DHCP +server, so ask there. If you are having problems with a client whose +executable is called dhcpcd, this is not the ISC DHCP client, +and we probably can't help you with it.

    -Please see http://www.fugue.com/dhcp/lists for details on how to -subscribe. If you don't have WorldWide Web access, you can send mail -to dhcp-request@fugue.com and tell me which lists you want to -subscribe to, but please use the web interface if you can, since I -have to handle the -request mailing list manually, and I will give you -the third degree if you make me do your subscription manually. +

    Please see +http://www.fugue.com/dhcp/lists for details on how to subscribe. +If you don't have WorldWide Web access, you can send mail to +dhcp-request@fugue.com and tell me which lists you want to subscribe +to, but please use the web interface if you can, since I have to +handle the -request mailing list manually, and I will give you the +third degree if you make me do your subscription manually.

    -PLEASE DO NOT SEND REQUESTS FOR SUPPORT DIRECTLY TO ME! The number of -people using the DHCP Distribution is sufficiently large that if I -take an interrupt every time any one of those people runs into -trouble, I will never get any more coding done. +

    Please do not send requests for help directly to the author! +The number of people using the DHCP Distribution is sufficiently large +that if we take an interrupt every time any one of those people runs into +trouble, we will never get any more coding done.

    -PLEASE DO NOT CALL ME ON THE PHONE FOR SUPPORT! Answering the phone -takes a lot more of my time and attention than answering email. If you -do call me on the phone, I will tell you to send email to the mailing -list, and I won't answer your question, so there's no point in doing -it. +

    Please do not call the author on the phone for support! +Answering the phone takes a lot more time and attention than answering +email. If you do call on the phone, you will be told to send email to +the mailing list, so there's no point in doing it.

    - KNOWN BUGS +

    Exception: if you are a support customer, you already know +how to get in touch with us. To become a support customer, see our +Support web +page. -This release of the DHCP Distribution does not yet contain support for +

    Known bugs

    + +

    This release of the DHCP Distribution does not yet contain support for DHCPINFORM. The Vendor Specific Data option is not supported. Site- specific options are not supported. All of these are supported in the -3.0 release of the DHCP distribution, which is now in beta testing. +3.0 release of the DHCP distribution, which is now in beta testing.

    + Index: head/contrib/isc-dhcp/RELNOTES =================================================================== --- head/contrib/isc-dhcp/RELNOTES (revision 62104) +++ head/contrib/isc-dhcp/RELNOTES (revision 62105) @@ -1,716 +1,742 @@ Internet Software Consortium Dynamic Host Configuration Protocol Distribution - Version 2 - June 22, 1999 + Version 2 Patchlevel 1 + June 24, 2000 Release Notes Version 2 of the ISC DHCP Distribution includes the ISC DHCP server, DHCP Client and DHCP/BOOTP Relay Agent. This version has been in a near feature freeze since January of 1998, was in Beta test from that time to June of 1999, and has now been released in its final form. It has a number of important features, and is the release that we would expect most sites to run. For information on how to install, configure and run this software, as well as how to find documentation and report bugs, please consult the README file. CHANGELOG This log describes the changes that have been made in version 2.0 since June of 1997. + + CHANGES FROM VERSION 2.0 + +- Clean up DHCPRELEASE support. + +- Don't use the broadcast flag when doing BOOTP unless we need to. + +- Clean up the fallback mess. + +- Quote all shell special characters in the client script. + +- Fix ethernet header alignment on arm32. + +- Clarify the "no subnet declaration" message. + +- Correctly store the tftp server name in the lease file and the + client script file. + +- Avoid a potential spin loop in client when script file creation + fails for reasons other than the presence of an existing file of the + same name. + +- Add support for Linux kernel versions greater than 2.2. + +- Fix a problem in raw.c on Irix. Thanks to Don Badrak for the + patch. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 29 - Define BYTE_ORDER in includes/cf/hpux.h so that ip.h will compile correctly on HP-UX. - Fix a long-standing but minor bug in the way the program name for syslog was derived. - Fix a long-standing bug that prevented the DHCP server from broadcasting responses to BOOTP clients that requested a broadcast response. - In dhcprequest(), check to make sure that there's a lease before trying to acknowledge it to the client. This fixes a potential core dump that a few people observed. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 28 - Fix some pastos I introduced when merging Andrew Chittenden's token ring support. - Apply a patch to the token ring support from Andrew Chittenden. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 27 - Add dependencies to makefiles. - Don't use ping -w 1 in freebsd client script. - Token ring support for LPF, contributed by Andrew Chittenden. - Fix a subtle bug that would cause the server to respond incorrectly in some cases when the client sent duplicate DHCPREQUEST packets. - Fix option pretty printing for 'X' format. - Add some special cases to deal with DHCPREQUEST packets from RFC1541 clients. - Fix an obscure bug in nested subnet mask handling. - Fix a bug in abandoned lease reclamation. - Allow maximum message size to be set in configuration file. - Allow parameter request list to be supplied in configuration file. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 26 - Fix UDP/IP checksum code - Fix UDP payload length computation to prevent logging of spurious errors. - Support compilation on MacOS X - Add support for some options that were added in RFC2132. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 25 - Use the udp header's length rather than computing the length based on the number of bytes received, because some broken relay agents send packets with ip lengths that are longer than then sum of the ip header size and the udp length. - Do path keyword substitution on unformatted manual pages before installing them. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 24 - D'oh! Fix a really stupid mistake in hash.c. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 23 - Support an always-reply-rfc1048 flag, which says to reply with an RFC1048-style vendor extensions buffer even if the client didn't send an RFC1048-style magic number. - Fix a null pointer dereference. - Use netmask from subnet if no netmask option specified. - IRIX support (thanks to Don Badrak). - Install unformatted manual pages on Linux. - Add note in README about zcat vs. gzcat on BSD/os. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 22 - Test for lease before dereferencing it in dhcprequest. - Free the client parameter request list in dhcpnak if there is one. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 21 - Fix a pasto in options.c that will cause a core dump whenever a client sends in a request without a parameter request list. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 20 - Actually do the client fix mentioned below - Patchlevel 20 only contained half of the fix. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 19 - Removed arp table clearing code from solaris client script. - Document Linux "protocol not configured" error more thoroughly. - Clean up some unused variables. - Add entry and exit hooks to all dhcp client scripts, along with a make_resolv_conf function that can be redefined in the entry hooks. Document this new feature set. - Fix client to take advantage of network APIs that allow it to receive a unicast instead of requesting that the DHCP server broadcast its response. - Add -pf flag to all daemons allowing user to specify PID file name on command line. - Undo a previous change that attempted to be clever about testing interface flags but wound up being stupid instead. - Enforce access control on DHCPREQUEST messages as well as DHCPDISCOVER messages. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 18 - Support added for AIX 4.1.5.0 (and hopefully other versions). - Use /var/run instead of /etc on Digital Unix. - Change DHCP client exponential backoff code to back off more slowly, so that it is more robust in lossy environments, at the expense of being a bit less polite to the server. - Don't request a specific lease interval in the client unless the user says to do so. - Don't print DHCPXXX in wrong xxx messages unless DEBUG is defined. - Fix handling of secs field. - Fix handling of append statement. - Fix documentation for append and prepend statements. - Fix server support for parameter request list and maximum message size. - Parameterize more hardware types in discover_interfaces. Check for IFF_BROADCAST instead of !IFF_POINTOPOINT - Print kernel configuration warning message if we get EINVAL when opening or configuring the Linux packet filter. - Fix a bug in UDP checksum code (thanks to John Nemeth for figuring this out) and re-enable UDP checksumming. This allows the client to work with some buggy DHCP servers that can't handle zero checksums in the UDP header - in particular, the one John's cable modem ISP is using. - Don't report packet header checksum errors unless we see a lot of them. It's perfectly normal for some number of checksum errors to occur. - Refer to the dhcpd.leases man page when printing an error message prior to exiting because there's no lease database. - Add information to the README telling the reader how to get to the manual pages. - Fix the server packet transmission code to unicast when it can. - Fix a typo in the dhcpd.conf manual page. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 17 - Fix a bug in the relay agent where messages to the client would be unicast in the IP header but broadcast in the link header. The Microsoft DHCP client would reject such packets, preventing it from being configured. This was only a problem on non-socket-API platforms. - Do not attempt to reclaim requested abandoned leases in response to DHCPDISCOVER messages. - Allow the maximum lease time parameter in a host declaration to override the maximum lease time parameter in a subnet declaration. - Better document the -p flag for dhclient, dhcrelay and dhcpd. - Apply John Wehle's patch to fix the endianness bug in the dlpi packet filter on Solaris. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 16 - Fix linux man page install location. - Fix some confusion in the dhclient-script man page. - Fix error in includes/cf/linux.h that would have made network API selections in site.h work incorrectly. - Fix some major stupidity in the code that figures out where or not a client owns a particular lease. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 15 - Fix Makefile.conf on Linux to refer to /var/state/dhcp instead of /var/state/dhcpd. - Eliminate redundant #defines in includes/cf/linux.h (for neatness). - Fix an obscure case where dhcpd is started by the /etc/rc system with exactly the same pid each time, dhcpd.pid is not erased on reboot, and therefore dhcpd would detect a server (itself) with the pid in dhcpd.pid and decide that another server was running and exit. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 14 - Install the dhcp databases in /var/state/dhcp instead of /etc or /var/dhcpd, as suggested in the Linux Filesystem Hierarchy Standard. - Fix an endianness bug in dlpi.c. As a consequence, make the Solaris/i386 use dlpi again. - Fix a bunch of bugs in the Solaris client script. - Add some more information about Solaris to the README file. - Adjust startup message in interface probe so that the relay agent and client's unattached status will not trigger questions. - Update some error messages to provide more help to new users for some common mistakes. - Create an interface alias on Solaris when setting up IP aliases, rather than trying to do things the *BSD way. - Fix a null pointer dereference bug (this time I went through the whole function and audited it for more null pointer dereferences, and I didn't find any, for what that's worth). - Don't ever release leases in response to a DHCPDISCOVER (I think this was unlikely anyway, but why not be correct?). - Remove the shared-network example from the sample dhcpd.conf file. - Make ``make install'' make all first. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 13 - Support DESTDIR on installs. - Fix a bug in dhcp.c where a store through a null pointer would be made under some reasonably common circumstances. - Add test for ARPHRD_TUNNEL so that client and server do not fail on versions of Linux running IPsec implementations or the like. - Move tests for constants defined in O.S. headers into osdep.h - test for HAVE_whatever in .c files. Define relevant HAVE_whatevers in linux.h, so that versions of linux that define these constants as enums will still work. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 12 - Initialize the "quiet" variable in dhclient.c to zero (it was used without first having been initialized). - Fix the parser code for the authoritative keyword. - Adjust lease discovery code to NAK more aggressively for addresses the server knows it owns. - Add several new messages for DHCPNAK. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 11 - Use DLPI only on sparcs running Solaris, since it seems not to work on i386 boxes running Solaris for reasons yet to be determined. - In the client, close standard I/O descriptors when forking a daemon. - Don't let large lease lengths wrap lease expiry times - just use what fits into a TIME value. - Fix a bug in the SIOCGIFCONF interface scanning code. - Fix a core dump in the interface scanner that crops up on Linux when an interface is specified on the command line. - Don't use %D in strftime because egcs complains about it. - Print the error message if SO_BINDTODEVICE fails. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 10 - Update top-level Makefile so that it exits correctly on errors in submakes under bash/gnu make (dunno which is the culprit, and don't really care). - Print a more helpful message if no free BPF devices are found. - Add support for specifying that the server is or is not authoritative for a particular network segment. - Fix two stupid typos in lpf.c. - Print a more helpful message if we can't create an LPF socket or can't attach a filter to it. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 9 - Correct the hopelessly outdated information about Linux at the top of the README - many apologies to the Linux people who have had to read that nonsense for the past couple of snapshots and have been confused or annoyed by it. I simply hadn't read it recently, and didn't realize how out-of-date it was. - Print a message if the client finds no broadcast interfaces to configure. - Add support for use-lease-addr-for-default-route flag in server, so that Windows machines can be made to ARP for all addresses. - Update README file to mention new Linux gotchas. - After finally understanding Brian Murrel's code (my fault, not his) to get interface names from /proc/net/dev on Linux, fix what I broke of his code and document it. - Use sendto rather than send for SOCK_PACKET sockets, because they can't be connected, only bound. :'( - Fix up SOCK_PACKET creation so that the kernel doesn't complain about it. - Fix incorrect tests in linux client script: [ $relmajor == 2 ] -> [ $relmajor -eq 2 ] - Make typedefs for u8, u16 and u32 types. These are Linux kernel internal data types which are unfortunately exposed in the linux packetfilter header file. - Don't include in lpf.c - it defines things we're already correctly defining elsewhere, and doesn't define any useful new stuff. - Finally fix client PREINIT bug that causes interfaces not specified on the command line to be preinitialized. If no interfaces are specified on the command line, all interfaces are still preinitialized. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 8 - Fix socket API fallback setup code, which was causing Linux servers and clients to loop endlessly on select when run as daemons. - Add support for Linux 2.2 version number (treated the same as Linux 2.1, for now). - Correct apparent error in DHCPREQUEST destination address handling when in INIT-REBOOT state. - Do not set BROADCAST flag if we have a valid IP address. - Remove hard-coded filenames and use system-specific manifest constants. - Add entry and exit hooks to Linux dhclient-script (should be added to all operating systems once tested). - Test for linux major and minor version so as to correctly invoke network configuration programs. - Add support for Linux's gratuitous name change of bpf_insn structure (can't pollute precious Linux sources with the "Berkeley" word, I guess. - Correct USE_BPF_{SEND,RECEIVE} ifdefs for if_reinitialize_* functions. - Ensure that we have ifreq structure before initializing interface - if an interface was specified on the command line on Linux, this was not the case. - Get rid of references to enstamp structure in lpf.c. Correctly declare and initialize sock_fprog structure (aka bpf_filter structure on non-Linux machines). - Define ssize_t on Ultrix. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 7 - Generalize FDDI support. - Fix potential core dump in interface discovery code. - Put explicit release versions on startup messages. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 6 - Add support for Linux Packet Filter (thanks to Brian Murrell, Interlinx). - Add support for FDDI hardware type. - Fix a long-standing bug in DLPI support where the ethertype was being set incorrectly (thanks to Gong Wei, CCENet). - Don't use DLPI RAW mode on Solaris. - In the client, when a lease expires, the interface to which that lease is attached is unconfigured. On systems that use the socket API, the interface needs to then be reconfigured with the 0.0.0.0 address so that it can be used to get a new address. - Add fallback support for Linux. This fixes a problem with the relay agent when relaying over non-broadcast links, and may also fix some obscure problems with unicasting DHCPACKs in both the server and relay agent. - When allocating leases, if the oldest lease is abandoned, try to find a younger-but-still-expired lease rather than reclaiming the abandoned lease. - Add more documentation to README. - The absence of the /etc/dhclient.conf file is no longer considered an error. - The dhcp client's lease file name can be specified on the command line. - The DHCP client should no longer zap interfaces that it has not been directed to configure. - If a client starts up in the init-reboot state, the xid will be a "random" number rather than always being zero, as was previously the case. - In addition to comparing transaction IDs, compare hardware addresses in response packets to verify that they are ours. - Rewrite the client lease database after 20 leases have been written. - Fix the exponential backoff code. - Add a Y2k comment to indicate that something suspicious-looking is in fact _not_ a problem. - Use mkstemp if possible. - Add missing fi in various client scripts. - Use "search" instead of "domain" in linux resolv.conf files. - Specify a hop count in all route command on solaris. - If an allocation fails, don't try to zero out the allocation buffer we didn't get. - Support subnets that are subsets of other subnets - that is, for example, 10.0.1.0/24 and 10.0.0.0/16. This is useful in fairly obscure circumstances. - Don't set the lease end time if it's already expired. - Don't define INADDR_LOOPBACK on FreeBSD if it's already defined in a system header. - Use the broadcast address in the relay agent if we are using the BSD socket API. - Allow host declarations without names. - Allow the server identifier option to be specified. - Don't dump hostnames into the lease file if they contain non-printable characters. - Copy the entire client hardware address buffer that the client sends to the output packet, not just the portion of it that's supposedly significant according to the hardware address length field. This is done for the benefit of certain Microsoft clients. - Don't send a second ICMP echo request if we receive two DHCPDISCOVER messages in quick succession. This prevents a rather annoying timing race in configuring some Win95 clients. - Fix up dhcp-options man page to make it more readable. Note that netbios-name-server is the same thing as WINS. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 5 - Define some extra DLPI support flags that make DLPI work much better on Solaris. - Fix inet_aton prototype/declaration to match Internet Software Consortium BIND distribution. - Document new server-identifier functionality. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 4 - Do not use -Wstrict-prototypes on Solaris with gcc - if the Internet Software Consortium BIND distribution is not installed, this produces errors. - Actually use the new DLPI support on Solaris - although the code was added in Patchlevel 2, it wasn't enabled (blush). - Fix a prototype bug that's exposed when DLPI support is enabled on Solaris. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 3 - Fix a makefile botch that prevents the DHCP Distribution from from compiling on Solaris with gcc. Sigh. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 2 - Allow server-identifier in any scope. Use in-scope server identifier option rather than the default, if one exists. - Delete newlines from abandoned lease reclaimation warning. - Only release other applicable leases held by a client when the client sends a DHCPREQUEST. - Fix core dump when find_lease didn't find a lease. - Update dhcpd.leases man page. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 1 - Use -Wno-char-subscript on Solaris to prevent bogus warnings from gcc on Solaris 2.6. - Add support for Apple's new Rhapsody operating system. - Use DLPI on Solaris instead of using the BSD Sockets API. - Fix two network input buffer overflow problems which could allow an attacker to pervert the stack. - Fix an ancient typo that could theoretically cause memory corruption. - Sort abandoned leases in at current time rather than end of time. This allows abandoned leases to be reclaimed if there are no available free leases. - If a client explicitly requests a lease that's been abandoned, it's probably the system that was answering pings on that address, so let it have the lease. - Fix a bunch of type conversion errors that are flagged by the Solaris C compiler. CHANGES FROM VERSION 2.0 BETA 1 PATCHLEVEL 0 - Fix two potential buffer overflow problems. - Differentiate between versions of Linux for better success in compiling. - Fix bug in linux client script regarding routing setup. - Clarify socket API error message on multiple interfaces. - Fix broken comparison that was setting IP source address to zero. - Reclaim abandoned leases if we run out of free leases. CHANGES FROM THE DECEMBER 2, 1997 SNAPSHOT - Use %ld to print pid_t and cast pid_t values to long to avoid inconsistent declarations between different POSIX flavours. - Add support for ARPHRD_IEEE802 (token ring) hardware type. - If we own an address and a client requests it, but we can't assign it to that client, we now NAK it so that the client doesn't try to reuse it. CHANGES FROM THE JUNE SNAPSHOT - Support for NeXTstep 3.x and 4.x - Added man pages for dhcpd.leases, dhclient-script, dhclient.leases and dhclient.conf. Move general documentation of DHCP options into a seperate man page which is referred to by the dhclient.conf and dhcpd.conf man pages. - Updated README to answer some frequently asked questions. - Fixed a bug in command-line interface specification in dhclient - it was formerly not possible to specify that only certain interfaces be configured. - Do not leave client scripts lying around in /tmp after they've been used unless the -D flag is specified. - Add a new, non-standard, not-guaranteed-to-stay-the-same system configuration status message server which can be used to trigger the client to recheck its address, e.g., after a laptop has been put to sleep and then awakened (this has yet to be documented). - Fix handling of media selection in the REBOOT phase - previously the media type would not be remembered, which could cause severe delays in reacquiring an address if the default media type was wrong. - Allocate space for a NUL terminator on the end of client options - this was previously overlooked, and could cause garbage characters to be written to the temporary client script files. - Use mkstemp if it's available. - Supply network number and broadcast address to the client script so that on systems that need these values, they don't need to be computed with an awk script. - Keep a PID file for the client and the relay agent, and have the relay agent background itself by default. - Add client script for bsd/os, fix many niggling bugs in existing client scripts and add support for static routing tables to all bsd scripts. - Add a -q option to the client, server and relay agent so that they can be started from /etc/rc scripts without spewing a bunch of garbage on the console. By default, all three daemons still print startup messages, since these are helpful in bug reporting. - Don't print anything to stderr or stdout after going into background. - Fix bug where hostname keyword was not being recognized in dhcpd.leases file, resulting in the loss of lease database entries. - Fix problem on some operating systems where zero-length ifreq structures were being offset incorrectly when scanning the interface list on startup. - Unless a BOOTP client requests it, never send more than 64 bytes of options. - Don't ping static leases, since we don't have a lease structure on the heap to work with later. - Fixed a compile problem on Solaris 2.6. - Support interface aliases on Solaris. - Print day and month with leading zero in lease files if less than ten, for easier parsing by perl/sed/awk scripts. - Never make the lease database world writable, even if dhcpd is invoked with a bogus umask. - Fix DHCPRELEASE handling (before, addressed would never be released.) - If there is more than one lease for a particular client on a particular network, find the lease the client is asking for so as to avoid a cycle of NAKs. - If a BOOTP request is received from a particular client and that client has previously received a DHCP address, make sure that we still find a valid BOOTP lease so that we don't cycle through addresses. - Remove server-identifier option from documentation, other than to document that it has been deprecated. - Don't give up if we get an EINTR or EAGAIN while polling or selecting - these return statuses can occur spuriously without indicating a fatal problem. - Do not select for exceptions, since we don't handle them. This was causing massive CPU consumption on some systems. - When a DHCP client has been assigned a fixed address but had previously had a lease, it will request the old leased address. In such an event, send a DHCPNAK so that it will discover its new static binding. Index: head/contrib/isc-dhcp/client/Makefile.dist =================================================================== --- head/contrib/isc-dhcp/client/Makefile.dist (nonexistent) +++ head/contrib/isc-dhcp/client/Makefile.dist (revision 62105) @@ -0,0 +1,136 @@ +# Makefile.dist +# +# Copyright (c) 1996, 1997, 1999 The Internet Software Consortium. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of The Internet Software Consortium nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND +# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. +# + +CATMANPAGES = dhclient.cat8 dhclient.conf.cat5 dhclient-script.cat8 \ + dhclient.leases.cat5 +SEDMANPAGES = dhclient.man8 dhclient.conf.man5 dhclient-script.man8 \ + dhclient.leases.man5 +SRCS = dhclient.c clparse.c +OBJS = dhclient.o clparse.o +PROG = dhclient +MAN = dhclient.8 dhclient.conf.5 dhclient-script.8 dhclient.leases.5 + +DEBUG = -g +INCLUDES = -I.. -I../includes +DHCPLIB = ../common/libdhcp.a +CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS) + +all: $(PROG) $(CATMANPAGES) + +install: all + for dir in $(CLIENTBINDIR) $(ETC) $(FFMANDIR) $(ADMMANDIR) $(VARDB); \ + do \ + foo=""; \ + for bar in `echo $(DESTDIR)$${dir} |tr / ' '`; do \ + foo=$${foo}/$$bar; \ + if [ ! -d $$foo ]; then \ + mkdir $$foo; \ + chmod 755 $$foo; \ + fi; \ + done; \ + done + $(INSTALL) dhclient $(DESTDIR)$(CLIENTBINDIR) + $(CHMOD) 755 $(DESTDIR)$(CLIENTBINDIR)/dhclient + if [ x$(SCRIPT) = xnone ]; then \ + echo "No client script available."; \ + else \ + $(INSTALL) scripts/$(SCRIPT) $(DESTDIR)$(ETC)/dhclient-script; \ + $(CHMOD) 700 $(DESTDIR)$(ETC)/dhclient-script; \ + fi + $(MANINSTALL) $(MANFROM) dhclient.$(MANCAT)8 $(MANTO) \ + $(DESTDIR)$(ADMMANDIR)/dhclient$(ADMMANEXT) + $(MANINSTALL) $(MANFROM) dhclient-script.$(MANCAT)8 $(MANTO) \ + $(DESTDIR)$(ADMMANDIR)/dhclient-script$(ADMMANEXT) + $(MANINSTALL) $(MANFROM) dhclient.conf.$(MANCAT)5 $(MANTO) \ + $(DESTDIR)$(FFMANDIR)/dhclient.conf$(FFMANEXT) + $(MANINSTALL) $(MANFROM) dhclient.leases.$(MANCAT)5 $(MANTO) \ + $(DESTDIR)$(FFMANDIR)/dhclient.leases$(FFMANEXT) + +clean: + -rm -f $(OBJS) + +realclean: clean + -rm -f $(PROG) $(CATMANPAGES) $(SEDMANPAGES) *~ #* + +distclean: realclean + -rm -f Makefile + +# These should only be done on 4.4 BSD-based systems, since the mandoc +# macros aren't available on older unices. Catted man pages are +# provided in the distribution so that this doesn't become a problem. + +dhclient.cat8: dhclient.man8 + nroff -man dhclient.man8 >dhclient.cat8 + +dhclient.man8: dhclient.8 + sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \ + -e "s#RUNDIR#$(VARRUN)#g" < dhclient.8 >dhclient.man8 + +dhclient-script.cat8: dhclient-script.man8 + nroff -man dhclient-script.man8 >dhclient-script.cat8 + +dhclient-script.man8: dhclient-script.8 + sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \ + -e "s#RUNDIR#$(VARRUN)#g" < dhclient-script.8 \ + >dhclient-script.man8 + +dhclient.conf.man5: dhclient.conf.5 + sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \ + -e "s#RUNDIR#$(VARRUN)#g" < dhclient.conf.5 \ + >dhclient.conf.man5 + +dhclient.conf.cat5: dhclient.conf.man5 + nroff -man dhclient.conf.man5 >dhclient.conf.cat5 + +dhclient.leases.man5: dhclient.leases.5 + sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \ + -e "s#RUNDIR#$(VARRUN)#g" < dhclient.leases.5 \ + >dhclient.leases.man5 + +dhclient.leases.cat5: dhclient.leases.man5 + nroff -man dhclient.leases.man5 >dhclient.leases.cat5 + +dhclient: $(OBJS) $(DHCPLIB) + $(CC) $(LFLAGS) -o $(PROG) $(OBJS) $(DHCPLIB) $(LIBS) + +# Dependencies (semi-automatically-generated) + +dhclient.o: dhclient.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h ../includes/version.h +clparse.o: clparse.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h ../includes/dhctoken.h Property changes on: head/contrib/isc-dhcp/client/Makefile.dist ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: head/contrib/isc-dhcp/common/Makefile.dist =================================================================== --- head/contrib/isc-dhcp/common/Makefile.dist (nonexistent) +++ head/contrib/isc-dhcp/common/Makefile.dist (revision 62105) @@ -0,0 +1,206 @@ +# Makefile.dist +# +# Copyright (c) 1996, 1999 The Internet Software Consortium. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of The Internet Software Consortium nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND +# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. +# + +CATMANPAGES = dhcp-options.cat5 +SEDMANPAGES = dhcp-options.man5 +SRC = raw.c parse.c nit.c icmp.c dispatch.c conflex.c upf.c bpf.c socket.c \ + lpf.c packet.c memory.c print.c options.c inet.c convert.c \ + tree.c tables.c hash.c alloc.c errwarn.c inet_addr.c dlpi.c \ + tr.c ethernet.c +OBJ = raw.o parse.o nit.o icmp.o dispatch.o conflex.o upf.o bpf.o socket.o \ + lpf.o packet.o memory.o print.o options.o inet.o convert.o \ + tree.o tables.o hash.o alloc.o errwarn.o inet_addr.o dlpi.o \ + tr.o ethernet.o +MAN = dhcp-options.5 + +DEBUG = -g +INCLUDES = -I.. -I../includes +CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS) + +all: libdhcp.a $(CATMANPAGES) + +libdhcp.a: $(OBJ) + rm -f libdhcp.a + ar cruv libdhcp.a $(OBJ) + ranlib libdhcp.a + +install: all + for dir in $(FFMANDIR); do \ + foo=""; \ + for bar in `echo $(DESTDIR)$${dir} |tr / ' '`; do \ + foo=$${foo}/$$bar; \ + if [ ! -d $$foo ]; then \ + mkdir $$foo; \ + chmod 755 $$foo; \ + fi; \ + done; \ + done + $(MANINSTALL) $(MANFROM) dhcp-options.$(MANCAT)5 $(MANTO) \ + $(DESTDIR)$(FFMANDIR)/dhcp-options$(FFMANEXT) + + +clean: + -rm -f $(OBJ) + +realclean: clean + -rm -f libdhcp.a *~ #* $(CATMANPAGES) $(SEDMANPAGES) + +distclean: realclean + -rm -f Makefile + +dhcp-options.cat5: dhcp-options.man5 + nroff -man dhcp-options.man5 >dhcp-options.cat5 + +dhcp-options.man5: dhcp-options.5 + sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \ + -e "s#RUNDIR#$(VARRUN)#g" < dhcp-options.5 >dhcp-options.man5 + +# Dependencies (semi-automatically-generated) + +raw.o: raw.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +parse.o: parse.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h \ + ../includes/dhcp.h ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h ../includes/dhctoken.h +nit.o: nit.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +icmp.o: icmp.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h ../includes/netinet/ip.h \ + ../includes/netinet/ip_icmp.h +dispatch.o: dispatch.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h \ + conflex.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h ../includes/dhctoken.h +upf.o: upf.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +bpf.o: bpf.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h ../includes/netinet/ip.h ../includes/netinet/udp.h \ + ../includes/netinet/if_ether.h +socket.o: socket.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +lpf.o: lpf.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +packet.o: packet.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h ../includes/netinet/ip.h \ + ../includes/netinet/udp.h ../includes/netinet/if_ether.h +memory.o: memory.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +print.o: print.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +options.o: options.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +inet.o: inet.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +convert.o: convert.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +tree.o: tree.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +tables.o: tables.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +hash.o: hash.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +alloc.o: alloc.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +errwarn.o: errwarn.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +inet_addr.o: inet_addr.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h +dlpi.o: dlpi.c ../includes/dhcpd.h \ + ../includes/cdefs.h ../includes/osdep.h ../includes/site.h \ + ../includes/cf/netbsd.h ../includes/dhcp.h \ + ../includes/tree.h ../includes/hash.h ../includes/inet.h \ + ../includes/sysconf.h Property changes on: head/contrib/isc-dhcp/common/Makefile.dist ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: head/contrib/isc-dhcp/common/dispatch.c =================================================================== --- head/contrib/isc-dhcp/common/dispatch.c (revision 62104) +++ head/contrib/isc-dhcp/common/dispatch.c (revision 62105) @@ -1,867 +1,868 @@ /* dispatch.c Network input dispatcher... */ /* * Copyright (c) 1995, 1996, 1997, 1998, 1999 * The Internet Software Consortium. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of The Internet Software Consortium nor the names * of its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This software has been written for the Internet Software Consortium * by Ted Lemon in cooperation with Vixie * Enterprises. To learn more about the Internet Software Consortium, * see ``http://www.vix.com/isc''. To learn more about Vixie * Enterprises, see ``http://www.vix.com''. */ #ifndef lint static char copyright[] = -"$Id: dispatch.c,v 1.47.2.14 1999/03/29 22:16:36 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dispatch.c,v 1.47.2.15 1999/07/13 12:51:55 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" #include struct interface_info *interfaces, *dummy_interfaces, *fallback_interface; struct protocol *protocols; struct timeout *timeouts; static struct timeout *free_timeouts; static int interfaces_invalidated; void (*bootp_packet_handler) PROTO ((struct interface_info *, struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *)); int quiet_interface_discovery; /* Use the SIOCGIFCONF ioctl to get a list of all the attached interfaces. For each interface that's of type INET and not the loopback interface, register that interface with the network I/O software, figure out what subnet it's on, and add it to the list of interfaces. */ void discover_interfaces (state) int state; { struct interface_info *tmp; struct interface_info *last, *next; char buf [8192]; struct ifconf ic; struct ifreq ifr; int i; int sock; struct subnet *subnet; struct shared_network *share; struct sockaddr_in foo; int ir; struct ifreq *tif; #ifdef ALIAS_NAMES_PERMUTED char *s; #endif /* Create an unbound datagram socket to do the SIOCGIFADDR ioctl on. */ if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) error ("Can't create addrlist socket"); /* Get the interface configuration information... */ ic.ifc_len = sizeof buf; ic.ifc_ifcu.ifcu_buf = (caddr_t)buf; i = ioctl(sock, SIOCGIFCONF, &ic); if (i < 0) error ("ioctl: SIOCGIFCONF: %m"); /* If we already have a list of interfaces, and we're running as a DHCP server, the interfaces were requested. */ if (interfaces && (state == DISCOVER_SERVER || state == DISCOVER_RELAY || state == DISCOVER_REQUESTED)) ir = 0; else if (state == DISCOVER_UNCONFIGURED) ir = INTERFACE_REQUESTED | INTERFACE_AUTOMATIC; else ir = INTERFACE_REQUESTED; /* Cycle through the list of interfaces looking for IP addresses. */ for (i = 0; i < ic.ifc_len;) { struct ifreq *ifp = (struct ifreq *)((caddr_t)ic.ifc_req + i); #ifdef HAVE_SA_LEN if (ifp -> ifr_addr.sa_len > sizeof (struct sockaddr)) i += (sizeof ifp -> ifr_name) + ifp -> ifr_addr.sa_len; else #endif i += sizeof *ifp; #ifdef ALIAS_NAMES_PERMUTED if ((s = strrchr (ifp -> ifr_name, ':'))) { *s = 0; } #endif #ifdef SKIP_DUMMY_INTERFACES if (!strncmp (ifp -> ifr_name, "dummy", 5)) continue; #endif /* See if this is the sort of interface we want to deal with. */ strcpy (ifr.ifr_name, ifp -> ifr_name); if (ioctl (sock, SIOCGIFFLAGS, &ifr) < 0) error ("Can't get interface flags for %s: %m", ifr.ifr_name); /* Skip loopback, point-to-point and down interfaces, except don't skip down interfaces if we're trying to get a list of configurable interfaces. */ if ((ifr.ifr_flags & IFF_LOOPBACK) || #ifdef HAVE_IFF_POINTOPOINT (ifr.ifr_flags & IFF_POINTOPOINT) || #endif (!(ifr.ifr_flags & IFF_UP) && state != DISCOVER_UNCONFIGURED)) continue; /* See if we've seen an interface that matches this one. */ for (tmp = interfaces; tmp; tmp = tmp -> next) if (!strcmp (tmp -> name, ifp -> ifr_name)) break; /* If there isn't already an interface by this name, allocate one. */ if (!tmp) { tmp = ((struct interface_info *) dmalloc (sizeof *tmp, "discover_interfaces")); if (!tmp) error ("Insufficient memory to %s %s", "record interface", ifp -> ifr_name); strcpy (tmp -> name, ifp -> ifr_name); tmp -> next = interfaces; tmp -> flags = ir; interfaces = tmp; } /* If we have the capability, extract link information and record it in a linked list. */ #ifdef HAVE_AF_LINK if (ifp -> ifr_addr.sa_family == AF_LINK) { struct sockaddr_dl *foo = ((struct sockaddr_dl *) (&ifp -> ifr_addr)); tmp -> hw_address.hlen = foo -> sdl_alen; tmp -> hw_address.htype = HTYPE_ETHER; /* XXX */ memcpy (tmp -> hw_address.haddr, LLADDR (foo), foo -> sdl_alen); } else #endif /* AF_LINK */ if (ifp -> ifr_addr.sa_family == AF_INET) { struct iaddr addr; /* Get a pointer to the address... */ memcpy (&foo, &ifp -> ifr_addr, sizeof ifp -> ifr_addr); /* We don't want the loopback interface. */ if (foo.sin_addr.s_addr == htonl (INADDR_LOOPBACK)) continue; /* If this is the first real IP address we've found, keep a pointer to ifreq structure in which we found it. */ if (!tmp -> ifp) { #ifdef HAVE_SA_LEN int len = ((sizeof ifp -> ifr_name) + ifp -> ifr_addr.sa_len); #else int len = sizeof *ifp; #endif tif = (struct ifreq *)malloc (len); if (!tif) error ("no space to remember ifp."); memcpy (tif, ifp, len); tmp -> ifp = tif; tmp -> primary_address = foo.sin_addr; } /* Grab the address... */ addr.len = 4; memcpy (addr.iabuf, &foo.sin_addr.s_addr, addr.len); /* If there's a registered subnet for this address, connect it together... */ if ((subnet = find_subnet (addr))) { /* If this interface has multiple aliases on the same subnet, ignore all but the first we encounter. */ if (!subnet -> interface) { subnet -> interface = tmp; subnet -> interface_address = addr; } else if (subnet -> interface != tmp) { warn ("Multiple %s %s: %s %s", "interfaces match the", "same subnet", subnet -> interface -> name, tmp -> name); } share = subnet -> shared_network; if (tmp -> shared_network && tmp -> shared_network != share) { warn ("Interface %s matches %s", tmp -> name, "multiple shared networks"); } else { tmp -> shared_network = share; } if (!share -> interface) { share -> interface = tmp; } else if (share -> interface != tmp) { warn ("Multiple %s %s: %s %s", "interfaces match the", "same shared network", share -> interface -> name, tmp -> name); } } } } #if defined (LINUX_SLASHPROC_DISCOVERY) /* On Linux, interfaces that don't have IP addresses don't show up in the SIOCGIFCONF syscall. We got away with this prior to Linux 2.1 because we would give each interface an IP address of 0.0.0.0 before trying to boot, but that doesn't work after 2.1 because we're using LPF, because we can't configure interfaces with IP addresses of 0.0.0.0 anymore (grumble). This only matters for the DHCP client, of course - the relay agent and server should only care about interfaces that are configured with IP addresses anyway. The PROCDEV_DEVICE (/proc/net/dev) is a kernel-supplied file that, when read, prints a human readable network status. We extract the names of the network devices by skipping the first two lines (which are header) and then parsing off everything up to the colon in each subsequent line - these lines start with the interface name, then a colon, then a bunch of statistics. Yes, Virgina, this is a kludge, but you work with what you have. */ if (state == DISCOVER_UNCONFIGURED) { FILE *proc_dev; char buffer [256]; int skip = 2; proc_dev = fopen (PROCDEV_DEVICE, "r"); if (!proc_dev) error ("%s: %m", PROCDEV_DEVICE); while (fgets (buffer, sizeof buffer, proc_dev)) { char *name = buffer; char *sep; /* Skip the first two blocks, which are header lines. */ if (skip) { --skip; continue; } sep = strrchr (buffer, ':'); if (sep) *sep = '\0'; while (*name == ' ') name++; /* See if we've seen an interface that matches this one. */ for (tmp = interfaces; tmp; tmp = tmp -> next) if (!strcmp (tmp -> name, name)) break; /* If we found one, nothing more to do.. */ if (tmp) continue; /* Otherwise, allocate one. */ tmp = ((struct interface_info *) dmalloc (sizeof *tmp, "discover_interfaces")); if (!tmp) error ("Insufficient memory to %s %s", "record interface", name); memset (tmp, 0, sizeof *tmp); strcpy (tmp -> name, name); tmp -> flags = ir; tmp -> next = interfaces; interfaces = tmp; } fclose (proc_dev); } #endif /* Now cycle through all the interfaces we found, looking for hardware addresses. */ #if defined (HAVE_SIOCGIFHWADDR) && !defined (HAVE_AF_LINK) for (tmp = interfaces; tmp; tmp = tmp -> next) { struct ifreq ifr; struct sockaddr sa; int b, sk; if (!tmp -> ifp) { /* Make up an ifreq structure. */ tif = (struct ifreq *)malloc (sizeof (struct ifreq)); if (!tif) error ("no space to remember ifp."); memset (tif, 0, sizeof (struct ifreq)); strcpy (tif -> ifr_name, tmp -> name); tmp -> ifp = tif; } /* Read the hardware address from this interface. */ ifr = *tmp -> ifp; if (ioctl (sock, SIOCGIFHWADDR, &ifr) < 0) continue; sa = *(struct sockaddr *)&ifr.ifr_hwaddr; switch (sa.sa_family) { #ifdef HAVE_ARPHRD_TUNNEL case ARPHRD_TUNNEL: /* ignore tunnel interfaces. */ #endif #ifdef HAVE_ARPHRD_ROSE case ARPHRD_ROSE: #endif #ifdef HAVE_ARPHRD_LOOPBACK case ARPHRD_LOOPBACK: /* ignore loopback interface */ break; #endif case ARPHRD_ETHER: tmp -> hw_address.hlen = 6; tmp -> hw_address.htype = ARPHRD_ETHER; memcpy (tmp -> hw_address.haddr, sa.sa_data, 6); break; #ifndef HAVE_ARPHRD_IEEE802 # define ARPHRD_IEEE802 HTYPE_IEEE802 #endif case ARPHRD_IEEE802: tmp -> hw_address.hlen = 6; tmp -> hw_address.htype = ARPHRD_IEEE802; memcpy (tmp -> hw_address.haddr, sa.sa_data, 6); break; #ifndef HAVE_ARPHRD_FDDI # define ARPHRD_FDDI HTYPE_FDDI #endif case ARPHRD_FDDI: tmp -> hw_address.hlen = 16; tmp -> hw_address.htype = HTYPE_FDDI; /* XXX */ memcpy (tmp -> hw_address.haddr, sa.sa_data, 16); break; #ifdef HAVE_ARPHRD_METRICOM case ARPHRD_METRICOM: tmp -> hw_address.hlen = 6; tmp -> hw_address.htype = ARPHRD_METRICOM; memcpy (tmp -> hw_address.haddr, sa.sa_data, 6); break; #endif #ifdef HAVE_ARPHRD_AX25 case ARPHRD_AX25: tmp -> hw_address.hlen = 6; tmp -> hw_address.htype = ARPHRD_AX25; memcpy (tmp -> hw_address.haddr, sa.sa_data, 6); break; #endif #ifdef HAVE_ARPHRD_NETROM case ARPHRD_NETROM: tmp -> hw_address.hlen = 6; tmp -> hw_address.htype = ARPHRD_NETROM; memcpy (tmp -> hw_address.haddr, sa.sa_data, 6); break; #endif default: warn ("%s: unknown hardware address type %d", ifr.ifr_name, sa.sa_family); break; } } #endif /* defined (HAVE_SIOCGIFHWADDR) && !defined (HAVE_AF_LINK) */ /* If we're just trying to get a list of interfaces that we might be able to configure, we can quit now. */ if (state == DISCOVER_UNCONFIGURED) return; /* Weed out the interfaces that did not have IP addresses. */ last = (struct interface_info *)0; for (tmp = interfaces; tmp; tmp = next) { next = tmp -> next; if ((tmp -> flags & INTERFACE_AUTOMATIC) && state == DISCOVER_REQUESTED) tmp -> flags &= ~(INTERFACE_AUTOMATIC | INTERFACE_REQUESTED); if (!tmp -> ifp || !(tmp -> flags & INTERFACE_REQUESTED)) { if ((tmp -> flags & INTERFACE_REQUESTED) != ir) error ("%s: not found", tmp -> name); if (!last) interfaces = interfaces -> next; else last -> next = tmp -> next; /* Remember the interface in case we need to know about it later. */ tmp -> next = dummy_interfaces; dummy_interfaces = tmp; continue; } last = tmp; memcpy (&foo, &tmp -> ifp -> ifr_addr, sizeof tmp -> ifp -> ifr_addr); /* We must have a subnet declaration for each interface. */ if (!tmp -> shared_network && (state == DISCOVER_SERVER)) { warn ("No subnet declaration for %s (%s).", tmp -> name, inet_ntoa (foo.sin_addr)); - warn ("Please write a subnet declaration for the %s", - "network segment to"); - error ("which interface %s is attached.", tmp -> name); + warn ("Please write a subnet declaration in your %s", + "dhcpd.conf file for the"); + error ("network segment to which interface %s %s", + tmp -> name, "is attached."); } /* Find subnets that don't have valid interface addresses... */ for (subnet = (tmp -> shared_network ? tmp -> shared_network -> subnets : (struct subnet *)0); subnet; subnet = subnet -> next_sibling) { if (!subnet -> interface_address.len) { /* Set the interface address for this subnet to the first address we found. */ subnet -> interface_address.len = 4; memcpy (subnet -> interface_address.iabuf, &foo.sin_addr.s_addr, 4); } } /* Register the interface... */ if_register_receive (tmp); if_register_send (tmp); } /* Now register all the remaining interfaces as protocols. */ for (tmp = interfaces; tmp; tmp = tmp -> next) add_protocol (tmp -> name, tmp -> rfdesc, got_one, tmp); close (sock); maybe_setup_fallback (); } struct interface_info *setup_fallback () { fallback_interface = ((struct interface_info *) dmalloc (sizeof *fallback_interface, "discover_interfaces")); if (!fallback_interface) error ("Insufficient memory to record fallback interface."); memset (fallback_interface, 0, sizeof *fallback_interface); strcpy (fallback_interface -> name, "fallback"); fallback_interface -> shared_network = new_shared_network ("parse_statement"); if (!fallback_interface -> shared_network) error ("No memory for shared subnet"); memset (fallback_interface -> shared_network, 0, sizeof (struct shared_network)); fallback_interface -> shared_network -> name = "fallback-net"; return fallback_interface; } void reinitialize_interfaces () { struct interface_info *ip; for (ip = interfaces; ip; ip = ip -> next) { if_reinitialize_receive (ip); if_reinitialize_send (ip); } if (fallback_interface) if_reinitialize_send (fallback_interface); interfaces_invalidated = 1; } #ifdef USE_POLL /* Wait for packets to come in using poll(). When a packet comes in, call receive_packet to receive the packet and possibly strip hardware addressing information from it, and then call through the bootp_packet_handler hook to try to do something with it. */ void dispatch () { struct protocol *l; int nfds = 0; struct pollfd *fds; int count; int i; int to_msec; nfds = 0; for (l = protocols; l; l = l -> next) { ++nfds; } fds = (struct pollfd *)malloc ((nfds) * sizeof (struct pollfd)); if (!fds) error ("Can't allocate poll structures."); do { /* Call any expired timeouts, and then if there's still a timeout registered, time out the select call then. */ another: if (timeouts) { struct timeout *t; if (timeouts -> when <= cur_time) { t = timeouts; timeouts = timeouts -> next; (*(t -> func)) (t -> what); t -> next = free_timeouts; free_timeouts = t; goto another; } /* Figure timeout in milliseconds, and check for potential overflow. We assume that integers are 32 bits, which is harmless if they're 64 bits - we'll just get extra timeouts in that case. Lease times would have to be quite long in order for a 32-bit integer to overflow, anyway. */ to_msec = timeouts -> when - cur_time; if (to_msec > 2147483) to_msec = 2147483; to_msec *= 1000; } else to_msec = -1; /* Set up the descriptors to be polled. */ i = 0; for (l = protocols; l; l = l -> next) { fds [i].fd = l -> fd; fds [i].events = POLLIN; fds [i].revents = 0; ++i; } /* Wait for a packet or a timeout... XXX */ count = poll (fds, nfds, to_msec); /* Get the current time... */ GET_TIME (&cur_time); /* Not likely to be transitory... */ if (count < 0) { if (errno == EAGAIN || errno == EINTR) continue; else error ("poll: %m"); } i = 0; for (l = protocols; l; l = l -> next) { if ((fds [i].revents & POLLIN)) { fds [i].revents = 0; if (l -> handler) (*(l -> handler)) (l); if (interfaces_invalidated) break; } ++i; } interfaces_invalidated = 0; } while (1); } #else /* Wait for packets to come in using select(). When one does, call receive_packet to receive the packet and possibly strip hardware addressing information from it, and then call through the bootp_packet_handler hook to try to do something with it. */ void dispatch () { fd_set r, w, x; struct protocol *l; int max = 0; int count; struct timeval tv, *tvp; FD_ZERO (&w); FD_ZERO (&x); do { /* Call any expired timeouts, and then if there's still a timeout registered, time out the select call then. */ another: if (timeouts) { struct timeout *t; if (timeouts -> when <= cur_time) { t = timeouts; timeouts = timeouts -> next; (*(t -> func)) (t -> what); t -> next = free_timeouts; free_timeouts = t; goto another; } tv.tv_sec = timeouts -> when - cur_time; tv.tv_usec = 0; tvp = &tv; } else tvp = (struct timeval *)0; /* Set up the read mask. */ FD_ZERO (&r); for (l = protocols; l; l = l -> next) { FD_SET (l -> fd, &r); if (l -> fd > max) max = l -> fd; } /* Wait for a packet or a timeout... XXX */ count = select (max + 1, &r, &w, &x, tvp); /* Get the current time... */ GET_TIME (&cur_time); /* Not likely to be transitory... */ if (count < 0) error ("select: %m"); for (l = protocols; l; l = l -> next) { if (!FD_ISSET (l -> fd, &r)) continue; if (l -> handler) (*(l -> handler)) (l); if (interfaces_invalidated) break; } interfaces_invalidated = 0; } while (1); } #endif /* USE_POLL */ void got_one (l) struct protocol *l; { struct sockaddr_in from; struct hardware hfrom; struct iaddr ifrom; int result; union { unsigned char packbuf [4095]; /* Packet input buffer. Must be as large as largest possible MTU. */ struct dhcp_packet packet; } u; struct interface_info *ip = l -> local; if ((result = receive_packet (ip, u.packbuf, sizeof u, &from, &hfrom)) < 0) { warn ("receive_packet failed on %s: %m", ip -> name); return; } if (result == 0) return; if (bootp_packet_handler) { ifrom.len = 4; memcpy (ifrom.iabuf, &from.sin_addr, ifrom.len); (*bootp_packet_handler) (ip, &u.packet, result, from.sin_port, ifrom, &hfrom); } } int locate_network (packet) struct packet *packet; { struct iaddr ia; /* If this came through a gateway, find the corresponding subnet... */ if (packet -> raw -> giaddr.s_addr) { struct subnet *subnet; ia.len = 4; memcpy (ia.iabuf, &packet -> raw -> giaddr, 4); subnet = find_subnet (ia); if (subnet) packet -> shared_network = subnet -> shared_network; else packet -> shared_network = (struct shared_network *)0; } else { packet -> shared_network = packet -> interface -> shared_network; } if (packet -> shared_network) return 1; return 0; } void add_timeout (when, where, what) TIME when; void (*where) PROTO ((void *)); void *what; { struct timeout *t, *q; /* See if this timeout supersedes an existing timeout. */ t = (struct timeout *)0; for (q = timeouts; q; q = q -> next) { if (q -> func == where && q -> what == what) { if (t) t -> next = q -> next; else timeouts = q -> next; break; } t = q; } /* If we didn't supersede a timeout, allocate a timeout structure now. */ if (!q) { if (free_timeouts) { q = free_timeouts; free_timeouts = q -> next; q -> func = where; q -> what = what; } else { q = (struct timeout *)malloc (sizeof (struct timeout)); if (!q) error ("Can't allocate timeout structure!"); q -> func = where; q -> what = what; } } q -> when = when; /* Now sort this timeout into the timeout list. */ /* Beginning of list? */ if (!timeouts || timeouts -> when > q -> when) { q -> next = timeouts; timeouts = q; return; } /* Middle of list? */ for (t = timeouts; t -> next; t = t -> next) { if (t -> next -> when > q -> when) { q -> next = t -> next; t -> next = q; return; } } /* End of list. */ t -> next = q; q -> next = (struct timeout *)0; } void cancel_timeout (where, what) void (*where) PROTO ((void *)); void *what; { struct timeout *t, *q; /* Look for this timeout on the list, and unlink it if we find it. */ t = (struct timeout *)0; for (q = timeouts; q; q = q -> next) { if (q -> func == where && q -> what == what) { if (t) t -> next = q -> next; else timeouts = q -> next; break; } t = q; } /* If we found the timeout, put it on the free list. */ if (q) { q -> next = free_timeouts; free_timeouts = q; } } /* Add a protocol to the list of protocols... */ void add_protocol (name, fd, handler, local) char *name; int fd; void (*handler) PROTO ((struct protocol *)); void *local; { struct protocol *p; p = (struct protocol *)malloc (sizeof *p); if (!p) error ("can't allocate protocol struct for %s", name); p -> fd = fd; p -> handler = handler; p -> local = local; p -> next = protocols; protocols = p; } void remove_protocol (proto) struct protocol *proto; { struct protocol *p, *next, *prev; prev = (struct protocol *)0; for (p = protocols; p; p = next) { next = p -> next; if (p == proto) { if (prev) prev -> next = p -> next; else protocols = p -> next; free (p); } } } Index: head/contrib/isc-dhcp/common/ethernet.c =================================================================== --- head/contrib/isc-dhcp/common/ethernet.c (revision 62104) +++ head/contrib/isc-dhcp/common/ethernet.c (revision 62105) @@ -1,110 +1,110 @@ /* packet.c Packet assembly code, originally contributed by Archie Cobbs. */ /* * Copyright (c) 1995, 1996 The Internet Software Consortium. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of The Internet Software Consortium nor the names * of its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This software has been written for the Internet Software Consortium * by Ted Lemon in cooperation with Vixie * Enterprises. To learn more about the Internet Software Consortium, * see ``http://www.vix.com/isc''. To learn more about Vixie * Enterprises, see ``http://www.vix.com''. */ #ifndef lint static char copyright[] = -"$Id: ethernet.c,v 1.1.2.1 1999/05/27 17:35:47 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: ethernet.c,v 1.1.2.2 1999/11/11 16:10:41 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" #if defined (PACKET_ASSEMBLY) || defined (PACKET_DECODING) #include "includes/netinet/if_ether.h" #endif /* PACKET_ASSEMBLY || PACKET_DECODING */ #if defined (PACKET_ASSEMBLY) /* Assemble an hardware header... */ /* XXX currently only supports ethernet; doesn't check for other types. */ void assemble_ethernet_header (interface, buf, bufix, to) struct interface_info *interface; unsigned char *buf; int *bufix; struct hardware *to; { struct ether_header eh; if (to && to -> hlen == 6) /* XXX */ memcpy (eh.ether_dhost, to -> haddr, sizeof eh.ether_dhost); else memset (eh.ether_dhost, 0xff, sizeof (eh.ether_dhost)); if (interface -> hw_address.hlen == sizeof (eh.ether_shost)) memcpy (eh.ether_shost, interface -> hw_address.haddr, sizeof (eh.ether_shost)); else memset (eh.ether_shost, 0x00, sizeof (eh.ether_shost)); #ifdef BROKEN_FREEBSD_BPF /* Fixed in FreeBSD 2.2 */ eh.ether_type = ETHERTYPE_IP; #else eh.ether_type = htons (ETHERTYPE_IP); #endif - memcpy (&buf [*bufix], &eh, sizeof eh); - *bufix += sizeof eh; + memcpy (&buf [*bufix], &eh, ETHER_HEADER_SIZE); + *bufix += ETHER_HEADER_SIZE; } #endif /* PACKET_ASSEMBLY */ #ifdef PACKET_DECODING /* Decode a hardware header... */ ssize_t decode_ethernet_header (interface, buf, bufix, from) struct interface_info *interface; unsigned char *buf; int bufix; struct hardware *from; { struct ether_header eh; - memcpy (&eh, buf + bufix, sizeof eh); + memcpy (&eh, buf + bufix, ETHER_HEADER_SIZE); #ifdef USERLAND_FILTER if (ntohs (eh.ether_type) != ETHERTYPE_IP) return -1; #endif memcpy (from -> haddr, eh.ether_shost, sizeof (eh.ether_shost)); from -> htype = ARPHRD_ETHER; from -> hlen = sizeof eh.ether_shost; return sizeof eh; } #endif /* PACKET_DECODING */ Index: head/contrib/isc-dhcp/common/lpf.c =================================================================== --- head/contrib/isc-dhcp/common/lpf.c (revision 62104) +++ head/contrib/isc-dhcp/common/lpf.c (revision 62105) @@ -1,347 +1,350 @@ /* lpf.c Linux packet filter code, contributed by Brian Murrel at Interlinx Support Services in Vancouver, B.C. */ /* * Copyright (c) 1995, 1996, 1998, 1999 * The Internet Software Consortium. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of The Internet Software Consortium nor the names * of its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This software has been written for the Internet Software Consortium * by Ted Lemon in cooperation with Vixie * Enterprises. To learn more about the Internet Software Consortium, * see ``http://www.vix.com/isc''. To learn more about Vixie * Enterprises, see ``http://www.vix.com''. */ #ifndef lint static char copyright[] = -"$Id: lpf.c,v 1.1.2.9 1999/05/27 17:44:52 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: lpf.c,v 1.1.2.10 1999/10/25 15:39:02 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE) #include #include #include #include #include #include #include "includes/netinet/ip.h" #include "includes/netinet/udp.h" #include "includes/netinet/if_ether.h" static void lpf_gen_filter_setup PROTO ((struct interface_info *)); static void lpf_tr_filter_setup PROTO ((struct interface_info *)); /* Reinitializes the specified interface after an address change. This is not required for packet-filter APIs. */ #ifdef USE_LPF_SEND void if_reinitialize_send (info) struct interface_info *info; { } #endif #ifdef USE_LPF_RECEIVE void if_reinitialize_receive (info) struct interface_info *info; { } #endif /* Called by get_interface_list for each interface that's discovered. Opens a packet filter for each interface and adds it to the select mask. */ int if_register_lpf (info) struct interface_info *info; { int sock; char filename[50]; int b; struct sockaddr sa; /* Make an LPF socket. */ if ((sock = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_ALL))) < 0) { if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || errno == EAFNOSUPPORT || errno == EINVAL) { warn ("socket: %m"); error ("Make sure to set %s %s!", "CONFIG_PACKET=y and CONFIG_FILTER=y", "in your kernel configuration"); } error("Open a socket for LPF: %m"); } /* Bind to the interface name */ memset (&sa, 0, sizeof sa); sa.sa_family = AF_PACKET; strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data); if (bind (sock, &sa, sizeof sa)) { if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || errno == EAFNOSUPPORT || errno == EINVAL) { warn ("bind: %m"); error ("Set %s %s!", "CONFIG_PACKET=y and CONFIG_FILTER=y", "in your kernel configuration"); } error("Bind socket to interface: %m"); } return sock; } #endif /* USE_LPF_SEND || USE_LPF_RECEIVE */ #ifdef USE_LPF_SEND void if_register_send (info) struct interface_info *info; { /* If we're using the lpf API for sending and receiving, we don't need to register this interface twice. */ #ifndef USE_LPF_RECEIVE info -> wfdesc = if_register_lpf (info, interface); #else info -> wfdesc = info -> rfdesc; #endif if (!quiet_interface_discovery) note ("Sending on LPF/%s/%s%s%s", info -> name, print_hw_addr (info -> hw_address.htype, info -> hw_address.hlen, info -> hw_address.haddr), (info -> shared_network ? "/" : ""), (info -> shared_network ? info -> shared_network -> name : "")); } #endif /* USE_LPF_SEND */ #ifdef USE_LPF_RECEIVE /* Defined in bpf.c. We can't extern these in dhcpd.h without pulling in bpf includes... */ extern struct sock_filter dhcp_bpf_filter []; extern int dhcp_bpf_filter_len; extern struct sock_filter dhcp_bpf_tr_filter []; extern int dhcp_bpf_tr_filter_len; + +static void lpf_gen_filter_setup (struct interface_info *); +static void lpf_tr_filter_setup (struct interface_info *); void if_register_receive (info) struct interface_info *info; { /* Open a LPF device and hang it on this interface... */ info -> rfdesc = if_register_lpf (info); if (info -> hw_address.htype == HTYPE_IEEE802) lpf_tr_filter_setup (info); else lpf_gen_filter_setup (info); if (!quiet_interface_discovery) note ("Listening on LPF/%s/%s%s%s", info -> name, print_hw_addr (info -> hw_address.htype, info -> hw_address.hlen, info -> hw_address.haddr), (info -> shared_network ? "/" : ""), (info -> shared_network ? info -> shared_network -> name : "")); } static void lpf_gen_filter_setup (info) struct interface_info *info; { struct sock_fprog p; /* Set up the bpf filter program structure. This is defined in bpf.c */ p.len = dhcp_bpf_filter_len; p.filter = dhcp_bpf_filter; /* Patch the server port into the LPF program... XXX changes to filter program may require changes to the insn number(s) used below! XXX */ dhcp_bpf_filter [8].k = ntohs (local_port); if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, &p, sizeof p) < 0) { if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || errno == EAFNOSUPPORT) error ("socket: %m - make sure %s %s!", "CONFIG_PACKET and CONFIG_FILTER are defined", "in your kernel configuration"); error ("Can't install packet filter program: %m"); } } static void lpf_tr_filter_setup (info) struct interface_info *info; { struct sock_fprog p; /* Set up the bpf filter program structure. This is defined in bpf.c */ p.len = dhcp_bpf_tr_filter_len; p.filter = dhcp_bpf_tr_filter; /* Patch the server port into the LPF program... XXX changes to filter program may require changes XXX to the insn number(s) used below! XXX Token ring filter is null - when/if we have a filter XXX that's not, we'll need this code. XXX dhcp_bpf_filter [?].k = ntohs (local_port); */ if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, &p, sizeof p) < 0) { if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || errno == EAFNOSUPPORT) error ("socket: %m - make sure %s %s!", "CONFIG_PACKET and CONFIG_FILTER are defined", "in your kernel configuration"); error ("Can't install packet filter program: %m"); } } #endif /* USE_LPF_RECEIVE */ #ifdef USE_LPF_SEND ssize_t send_packet (interface, packet, raw, len, from, to, hto) struct interface_info *interface; struct packet *packet; struct dhcp_packet *raw; size_t len; struct in_addr from; struct sockaddr_in *to; struct hardware *hto; { int bufp = 0; unsigned char buf [1500]; struct sockaddr sa; int result; if (!strcmp (interface -> name, "fallback")) return send_fallback (interface, packet, raw, len, from, to, hto); /* Assemble the headers... */ assemble_hw_header (interface, buf, &bufp, hto); assemble_udp_ip_header (interface, buf, &bufp, from.s_addr, to -> sin_addr.s_addr, to -> sin_port, (unsigned char *)raw, len); memcpy (buf + bufp, raw, len); /* For some reason, SOCK_PACKET sockets can't be connected, so we have to do a sentdo every time. */ memset (&sa, 0, sizeof sa); sa.sa_family = AF_PACKET; strncpy (sa.sa_data, (const char *)interface -> ifp, sizeof sa.sa_data); result = sendto (interface -> wfdesc, buf, bufp + len, 0, &sa, sizeof sa); if (result < 0) warn ("send_packet: %m"); return result; } #endif /* USE_LPF_SEND */ #ifdef USE_LPF_RECEIVE ssize_t receive_packet (interface, buf, len, from, hfrom) struct interface_info *interface; unsigned char *buf; size_t len; struct sockaddr_in *from; struct hardware *hfrom; { int nread; int length = 0; int offset = 0; unsigned char ibuf [1500]; int bufix = 0; length = read (interface -> rfdesc, ibuf, sizeof ibuf); if (length <= 0) return length; bufix = 0; /* Decode the physical header... */ offset = decode_hw_header (interface, ibuf, bufix, hfrom); /* If a physical layer checksum failed (dunno of any physical layer that supports this, but WTH), skip this packet. */ if (offset < 0) { return 0; } bufix += offset; length -= offset; /* Decode the IP and UDP headers... */ offset = decode_udp_ip_header (interface, ibuf, bufix, from, (unsigned char *)0, length); /* If the IP or UDP checksum was bad, skip the packet... */ if (offset < 0) return 0; bufix += offset; length -= offset; /* Copy out the data in the packet... */ memcpy (buf, &ibuf [bufix], length); return length; } int can_unicast_without_arp () { return 1; } int can_receive_unicast_unconfigured (ip) struct interface_info *ip; { return 1; } void maybe_setup_fallback () { struct interface_info *fbi; fbi = setup_fallback (); if (fbi) { if_register_fallback (fbi); add_protocol ("fallback", fallback_interface -> wfdesc, fallback_discard, fallback_interface); } } #endif Index: head/contrib/isc-dhcp/common/options.c =================================================================== --- head/contrib/isc-dhcp/common/options.c (revision 62104) +++ head/contrib/isc-dhcp/common/options.c (revision 62105) @@ -1,648 +1,662 @@ /* options.c DHCP options parsing and reassembly. */ /* * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of The Internet Software Consortium nor the names * of its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This software has been written for the Internet Software Consortium * by Ted Lemon in cooperation with Vixie * Enterprises. To learn more about the Internet Software Consortium, * see ``http://www.vix.com/isc''. To learn more about Vixie * Enterprises, see ``http://www.vix.com''. */ #ifndef lint static char copyright[] = -"$Id: options.c,v 1.26.2.10 1999/05/06 21:54:34 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; +"$Id: options.c,v 1.26.2.11 2000/06/24 07:24:02 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #define DHCP_OPTION_DATA #include "dhcpd.h" #include /* Parse all available options out of the specified packet. */ void parse_options (packet) struct packet *packet; { /* Initially, zero all option pointers. */ memset (packet -> options, 0, sizeof (packet -> options)); /* If we don't see the magic cookie, there's nothing to parse. */ if (memcmp (packet -> raw -> options, DHCP_OPTIONS_COOKIE, 4)) { packet -> options_valid = 0; return; } /* Go through the options field, up to the end of the packet or the End field. */ parse_option_buffer (packet, &packet -> raw -> options [4], packet -> packet_length - DHCP_FIXED_NON_UDP - 4); /* If we parsed a DHCP Option Overload option, parse more options out of the buffer(s) containing them. */ if (packet -> options_valid && packet -> options [DHO_DHCP_OPTION_OVERLOAD].data) { if (packet -> options [DHO_DHCP_OPTION_OVERLOAD].data [0] & 1) parse_option_buffer (packet, (unsigned char *) packet -> raw -> file, sizeof packet -> raw -> file); if (packet -> options [DHO_DHCP_OPTION_OVERLOAD].data [0] & 2) parse_option_buffer (packet, (unsigned char *) packet -> raw -> sname, sizeof packet -> raw -> sname); } } /* Parse options out of the specified buffer, storing addresses of option values in packet -> options and setting packet -> options_valid if no errors are encountered. */ void parse_option_buffer (packet, buffer, length) struct packet *packet; unsigned char *buffer; int length; { unsigned char *s, *t; unsigned char *end = buffer + length; int len; int code; for (s = buffer; *s != DHO_END && s < end; ) { code = s [0]; /* Pad options don't have a length - just skip them. */ if (code == DHO_PAD) { ++s; continue; } /* All other fields (except end, see above) have a one-byte length. */ len = s [1]; /* If the length is outrageous, the options are bad. */ if (s + len + 2 > end) { warn ("Option %s length %d overflows input buffer.", dhcp_options [code].name, len); packet -> options_valid = 0; return; } /* If we haven't seen this option before, just make space for it and copy it there. */ if (!packet -> options [code].data) { if (!(t = ((unsigned char *) dmalloc (len + 1, "parse_option_buffer")))) error ("Can't allocate storage for option %s.", dhcp_options [code].name); /* Copy and NUL-terminate the option (in case it's an ASCII string. */ memcpy (t, &s [2], len); t [len] = 0; packet -> options [code].len = len; packet -> options [code].data = t; } else { /* If it's a repeat, concatenate it to whatever we last saw. This is really only required for clients, but what the heck... */ t = ((unsigned char *) dmalloc (len + packet -> options [code].len + 1, "parse_option_buffer")); if (!t) error ("Can't expand storage for option %s.", dhcp_options [code].name); memcpy (t, packet -> options [code].data, packet -> options [code].len); memcpy (t + packet -> options [code].len, &s [2], len); packet -> options [code].len += len; t [packet -> options [code].len] = 0; dfree (packet -> options [code].data, "parse_option_buffer"); packet -> options [code].data = t; } s += len + 2; } packet -> options_valid = 1; } /* cons options into a big buffer, and then split them out into the three seperate buffers if needed. This allows us to cons up a set of vendor options using the same routine. */ int cons_options (inpacket, outpacket, mms, options, overload, terminate, bootpp, prl, prl_len) struct packet *inpacket; struct dhcp_packet *outpacket; int mms; struct tree_cache **options; int overload; /* Overload flags that may be set. */ int terminate; int bootpp; u_int8_t *prl; int prl_len; { unsigned char priority_list [300]; int priority_len; unsigned char buffer [4096]; /* Really big buffer... */ int main_buffer_size; int mainbufix, bufix; int option_size; int length; /* If the client has provided a maximum DHCP message size, use that; otherwise, if it's BOOTP, only 64 bytes; otherwise use up to the minimum IP MTU size (576 bytes). */ /* XXX if a BOOTP client specifies a max message size, we will honor it. */ if (!mms && inpacket && inpacket -> options [DHO_DHCP_MAX_MESSAGE_SIZE].data && (inpacket -> options [DHO_DHCP_MAX_MESSAGE_SIZE].len >= sizeof (u_int16_t))) mms = getUShort (inpacket -> options [DHO_DHCP_MAX_MESSAGE_SIZE].data); /* If the client has provided a maximum DHCP message size, use that; otherwise, if it's BOOTP, only 64 bytes; otherwise use up to the minimum IP MTU size (576 bytes). */ /* XXX if a BOOTP client specifies a max message size, we will honor it. */ if (mms) main_buffer_size = mms - DHCP_FIXED_LEN; else if (bootpp) main_buffer_size = 64; else main_buffer_size = 576 - DHCP_FIXED_LEN; if (main_buffer_size > sizeof buffer) main_buffer_size = sizeof buffer; /* Preload the option priority list with mandatory options. */ priority_len = 0; priority_list [priority_len++] = DHO_DHCP_MESSAGE_TYPE; priority_list [priority_len++] = DHO_DHCP_SERVER_IDENTIFIER; priority_list [priority_len++] = DHO_DHCP_LEASE_TIME; priority_list [priority_len++] = DHO_DHCP_MESSAGE; /* If the client has provided a list of options that it wishes returned, use it to prioritize. Otherwise, prioritize based on the default priority list. */ if (inpacket && inpacket -> options [DHO_DHCP_PARAMETER_REQUEST_LIST].data) { int prlen = (inpacket -> options [DHO_DHCP_PARAMETER_REQUEST_LIST].len); if (prlen + priority_len > sizeof priority_list) prlen = (sizeof priority_list) - priority_len; memcpy (&priority_list [priority_len], (inpacket -> options [DHO_DHCP_PARAMETER_REQUEST_LIST].data), prlen); priority_len += prlen; prl = priority_list; } else if (prl) { if (prl_len + priority_len > sizeof priority_list) prl_len = (sizeof priority_list) - priority_len; memcpy (&priority_list [priority_len], prl, prl_len); priority_len += prl_len; prl = priority_list; } else { memcpy (&priority_list [priority_len], dhcp_option_default_priority_list, sizeof_dhcp_option_default_priority_list); priority_len += sizeof_dhcp_option_default_priority_list; } /* Copy the options into the big buffer... */ option_size = store_options (buffer, (main_buffer_size - 7 + ((overload & 1) ? DHCP_FILE_LEN : 0) + ((overload & 2) ? DHCP_SNAME_LEN : 0)), options, priority_list, priority_len, main_buffer_size, (main_buffer_size + ((overload & 1) ? DHCP_FILE_LEN : 0)), terminate); /* Put the cookie up front... */ memcpy (outpacket -> options, DHCP_OPTIONS_COOKIE, 4); mainbufix = 4; /* If we're going to have to overload, store the overload option at the beginning. If we can, though, just store the whole thing in the packet's option buffer and leave it at that. */ if (option_size <= main_buffer_size - mainbufix) { memcpy (&outpacket -> options [mainbufix], buffer, option_size); mainbufix += option_size; if (mainbufix < main_buffer_size) outpacket -> options [mainbufix++] = DHO_END; length = DHCP_FIXED_NON_UDP + mainbufix; } else { outpacket -> options [mainbufix++] = DHO_DHCP_OPTION_OVERLOAD; outpacket -> options [mainbufix++] = 1; if (option_size > main_buffer_size - mainbufix + DHCP_FILE_LEN) outpacket -> options [mainbufix++] = 3; else outpacket -> options [mainbufix++] = 1; memcpy (&outpacket -> options [mainbufix], buffer, main_buffer_size - mainbufix); bufix = main_buffer_size - mainbufix; length = DHCP_FIXED_NON_UDP + mainbufix; if (overload & 1) { if (option_size - bufix <= DHCP_FILE_LEN) { memcpy (outpacket -> file, &buffer [bufix], option_size - bufix); mainbufix = option_size - bufix; if (mainbufix < DHCP_FILE_LEN) outpacket -> file [mainbufix++] = DHO_END; while (mainbufix < DHCP_FILE_LEN) outpacket -> file [mainbufix++] = DHO_PAD; } else { memcpy (outpacket -> file, &buffer [bufix], DHCP_FILE_LEN); bufix += DHCP_FILE_LEN; } } if ((overload & 2) && option_size < bufix) { memcpy (outpacket -> sname, &buffer [bufix], option_size - bufix); mainbufix = option_size - bufix; if (mainbufix < DHCP_SNAME_LEN) outpacket -> file [mainbufix++] = DHO_END; while (mainbufix < DHCP_SNAME_LEN) outpacket -> file [mainbufix++] = DHO_PAD; } } return length; } /* Store all the requested options into the requested buffer. */ int store_options (buffer, buflen, options, priority_list, priority_len, first_cutoff, second_cutoff, terminate) unsigned char *buffer; int buflen; struct tree_cache **options; unsigned char *priority_list; int priority_len; int first_cutoff, second_cutoff; int terminate; { int bufix = 0; int option_stored [256]; int i; int ix; int tto; /* Zero out the stored-lengths array. */ memset (option_stored, 0, sizeof option_stored); /* Copy out the options in the order that they appear in the priority list... */ for (i = 0; i < priority_len; i++) { /* Code for next option to try to store. */ int code = priority_list [i]; int optstart; /* Number of bytes left to store (some may already have been stored by a previous pass). */ int length; /* If no data is available for this option, skip it. */ if (!options [code]) { continue; } /* The client could ask for things that are mandatory, in which case we should avoid storing them twice... */ if (option_stored [code]) continue; option_stored [code] = 1; /* Find the value of the option... */ if (!tree_evaluate (options [code])) { continue; } /* We should now have a constant length for the option. */ length = options [code] -> len; /* Do we add a NUL? */ if (terminate && dhcp_options [code].format [0] == 't') { length++; tto = 1; } else { tto = 0; } /* Try to store the option. */ /* If the option's length is more than 255, we must store it in multiple hunks. Store 255-byte hunks first. However, in any case, if the option data will cross a buffer boundary, split it across that boundary. */ ix = 0; optstart = bufix; while (length) { unsigned char incr = length > 255 ? 255 : length; /* If this hunk of the buffer will cross a boundary, only go up to the boundary in this pass. */ if (bufix < first_cutoff && bufix + incr > first_cutoff) incr = first_cutoff - bufix; else if (bufix < second_cutoff && bufix + incr > second_cutoff) incr = second_cutoff - bufix; /* If this option is going to overflow the buffer, skip it. */ if (bufix + 2 + incr > buflen) { bufix = optstart; break; } /* Everything looks good - copy it in! */ buffer [bufix] = code; buffer [bufix + 1] = incr; if (tto && incr == length) { memcpy (buffer + bufix + 2, options [code] -> value + ix, incr - 1); buffer [bufix + 2 + incr - 1] = 0; } else { memcpy (buffer + bufix + 2, options [code] -> value + ix, incr); } length -= incr; ix += incr; bufix += 2 + incr; } } return bufix; } /* Format the specified option so that a human can easily read it. */ char *pretty_print_option (code, data, len, emit_commas, emit_quotes) unsigned int code; unsigned char *data; int len; int emit_commas; int emit_quotes; { static char optbuf [32768]; /* XXX */ int hunksize = 0; int numhunk = -1; int numelem = 0; char fmtbuf [32]; int i, j, k; char *op = optbuf; unsigned char *dp = data; struct in_addr foo; char comma; /* Code should be between 0 and 255. */ if (code > 255) error ("pretty_print_option: bad code %d\n", code); if (emit_commas) comma = ','; else comma = ' '; /* Figure out the size of the data. */ for (i = 0; dhcp_options [code].format [i]; i++) { if (!numhunk) { warn ("%s: Excess information in format string: %s\n", dhcp_options [code].name, &(dhcp_options [code].format [i])); break; } numelem++; fmtbuf [i] = dhcp_options [code].format [i]; switch (dhcp_options [code].format [i]) { case 'A': --numelem; fmtbuf [i] = 0; numhunk = 0; break; case 'X': for (k = 0; k < len; k++) { if (!isascii (data [k]) || !isprint (data [k])) break; } if (k == len) { fmtbuf [i] = 't'; numhunk = -2; } else { fmtbuf [i] = 'x'; hunksize++; comma = ':'; numhunk = 0; } fmtbuf [i + 1] = 0; break; case 't': fmtbuf [i] = 't'; fmtbuf [i + 1] = 0; numhunk = -2; break; case 'I': case 'l': case 'L': hunksize += 4; break; case 's': case 'S': hunksize += 2; break; case 'b': case 'B': case 'f': hunksize++; break; case 'e': break; default: warn ("%s: garbage in format string: %s\n", dhcp_options [code].name, &(dhcp_options [code].format [i])); break; } } /* Check for too few bytes... */ if (hunksize > len) { warn ("%s: expecting at least %d bytes; got %d", dhcp_options [code].name, hunksize, len); return ""; } /* Check for too many bytes... */ if (numhunk == -1 && hunksize < len) warn ("%s: %d extra bytes", dhcp_options [code].name, len - hunksize); /* If this is an array, compute its size. */ if (!numhunk) numhunk = len / hunksize; /* See if we got an exact number of hunks. */ if (numhunk > 0 && numhunk * hunksize < len) warn ("%s: %d extra bytes at end of array\n", dhcp_options [code].name, len - numhunk * hunksize); /* A one-hunk array prints the same as a single hunk. */ if (numhunk < 0) numhunk = 1; /* Cycle through the array (or hunk) printing the data. */ for (i = 0; i < numhunk; i++) { for (j = 0; j < numelem; j++) { switch (fmtbuf [j]) { case 't': if (emit_quotes) *op++ = '"'; - strcpy (op, (char *)dp); - op += strlen ((char *)dp); + for (; dp < data + len; dp++) { + if (!isascii (*dp) || + !isprint (*dp)) { + sprintf (op, "\\%03o", + *dp); + op += 4; + } else if (*dp == '"' || + *dp == '\'' || + *dp == '$' || + *dp == '`' || + *dp == '\\') { + *op++ = '\\'; + *op++ = *dp; + } else + *op++ = *dp; + } if (emit_quotes) *op++ = '"'; *op = 0; break; case 'I': foo.s_addr = htonl (getULong (dp)); strcpy (op, inet_ntoa (foo)); dp += 4; break; case 'l': sprintf (op, "%ld", (long)getLong (dp)); dp += 4; break; case 'L': sprintf (op, "%ld", (unsigned long)getULong (dp)); dp += 4; break; case 's': sprintf (op, "%d", getShort (dp)); dp += 2; break; case 'S': sprintf (op, "%d", getUShort (dp)); dp += 2; break; case 'b': sprintf (op, "%d", *(char *)dp++); break; case 'B': sprintf (op, "%d", *dp++); break; case 'x': sprintf (op, "%x", *dp++); break; case 'f': strcpy (op, *dp++ ? "true" : "false"); break; default: warn ("Unexpected format code %c", fmtbuf [j]); } op += strlen (op); if (j + 1 < numelem && comma != ':') *op++ = ' '; } if (i + 1 < numhunk) { *op++ = comma; } } return optbuf; } void do_packet (interface, packet, len, from_port, from, hfrom) struct interface_info *interface; struct dhcp_packet *packet; int len; unsigned int from_port; struct iaddr from; struct hardware *hfrom; { struct packet tp; int i; if (packet -> hlen > sizeof packet -> chaddr) { note ("Discarding packet with invalid hlen."); return; } memset (&tp, 0, sizeof tp); tp.raw = packet; tp.packet_length = len; tp.client_port = from_port; tp.client_addr = from; tp.interface = interface; tp.haddr = hfrom; parse_options (&tp); if (tp.options_valid && tp.options [DHO_DHCP_MESSAGE_TYPE].data) tp.packet_type = tp.options [DHO_DHCP_MESSAGE_TYPE].data [0]; if (tp.packet_type) dhcp (&tp); else bootp (&tp); /* Free the data associated with the options. */ for (i = 0; i < 256; i++) { if (tp.options [i].len && tp.options [i].data) dfree (tp.options [i].data, "do_packet"); } } Index: head/contrib/isc-dhcp/common/raw.c =================================================================== --- head/contrib/isc-dhcp/common/raw.c (revision 62104) +++ head/contrib/isc-dhcp/common/raw.c (revision 62105) @@ -1,153 +1,165 @@ /* socket.c BSD raw socket interface code... */ /* XXX It's not clear how this should work, and that lack of clarity is terribly detrimental to the NetBSD 1.1 kernel - it crashes and burns. Using raw sockets ought to be a big win over using BPF or something like it, because you don't need to deal with the complexities of the physical layer, but it appears not to be possible with existing raw socket implementations. This may be worth revisiting in the future. For now, this code can probably be considered a curiosity. Sigh. */ /* * Copyright (c) 1995, 1996, 1997, 1999 The Internet Software Consortium. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of The Internet Software Consortium nor the names * of its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This software has been written for the Internet Software Consortium * by Ted Lemon in cooperation with Vixie * Enterprises. To learn more about the Internet Software Consortium, * see ``http://www.vix.com/isc''. To learn more about Vixie * Enterprises, see ``http://www.vix.com''. */ #ifndef lint static char copyright[] = -"$Id: raw.c,v 1.11.2.3 1999/04/06 16:00:24 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: raw.c,v 1.11.2.4 1999/07/20 20:03:10 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" #if defined (USE_RAW_SEND) #include /* Generic interface registration routine... */ void if_register_send (info) struct interface_info *info; { struct sockaddr_in name; int sock; struct socklist *tmp; int flag; /* Set up the address we're going to connect to. */ name.sin_family = AF_INET; name.sin_port = local_port; name.sin_addr.s_addr = htonl (INADDR_BROADCAST); memset (name.sin_zero, 0, sizeof (name.sin_zero)); /* List addresses on which we're listening. */ if (!quiet_interface_discovery) - note ("Sending on %s, port %d", - piaddr (info -> address), htons (local_port)); + note ("Sending on Raw Socket/%s/%s%s%s", + info -> name, + print_hw_addr (info -> hw_address.htype, + info -> hw_address.hlen, + info -> hw_address.haddr), + (info -> shared_network ? "/" : ""), + (info -> shared_network ? + info -> shared_network -> name : "")); if ((sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0) error ("Can't create dhcp socket: %m"); /* Set the BROADCAST option so that we can broadcast DHCP responses. */ flag = 1; if (setsockopt (sock, SOL_SOCKET, SO_BROADCAST, &flag, sizeof flag) < 0) error ("Can't set SO_BROADCAST option on dhcp socket: %m"); /* Set the IP_HDRINCL flag so that we can supply our own IP headers... */ if (setsockopt (sock, IPPROTO_IP, IP_HDRINCL, &flag, sizeof flag) < 0) error ("Can't set IP_HDRINCL flag: %m"); info -> wfdesc = sock; if (!quiet_interface_discovery) note ("Sending on Raw/%s%s%s", info -> name, (info -> shared_network ? "/" : ""), (info -> shared_network ? info -> shared_network -> name : "")); } ssize_t send_packet (interface, packet, raw, len, from, to, hto) struct interface_info *interface; struct packet *packet; struct dhcp_packet *raw; size_t len; struct in_addr from; struct sockaddr_in *to; struct hardware *hto; { unsigned char buf [1500]; int bufp = 0; struct iovec iov [2]; int result; /* Assemble the headers... */ assemble_udp_ip_header (interface, buf, &bufp, from.s_addr, to -> sin_addr.s_addr, to -> sin_port, (unsigned char *)raw, len); if (len + bufp > sizeof buf) { warn ("send_packet: packet too large (%s)", len + bufp); return; } memcpy (buf + bufp, raw, len); bufp += len; result = sendto (interface -> wfdesc, (char *)buf, bufp, 0, (struct sockaddr *)to, sizeof *to); if (result < 0) warn ("send_packet: %m"); return result; } int can_unicast_without_arp () +{ + return 1; +} + +int can_receive_unicast_unconfigured (ip) + struct interface_info *ip; { return 1; } void maybe_setup_fallback () { } void if_reinitialize_send (info) struct interface_info *info; { } #endif /* USE_RAW_SEND */ Index: head/contrib/isc-dhcp/common/socket.c =================================================================== --- head/contrib/isc-dhcp/common/socket.c (revision 62104) +++ head/contrib/isc-dhcp/common/socket.c (revision 62105) @@ -1,297 +1,300 @@ /* socket.c BSD socket interface code... */ /* * Copyright (c) 1995, 1996, 1997, 1998, 1999 * The Internet Software Consortium. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of The Internet Software Consortium nor the names * of its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This software has been written for the Internet Software Consortium * by Ted Lemon in cooperation with Vixie * Enterprises. To learn more about the Internet Software Consortium, * see ``http://www.vix.com/isc''. To learn more about Vixie * Enterprises, see ``http://www.vix.com''. */ /* SO_BINDTODEVICE support added by Elliot Poger (poger@leland.stanford.edu). * This sockopt allows a socket to be bound to a particular interface, * thus enabling the use of DHCPD on a multihomed host. * If SO_BINDTODEVICE is defined in your system header files, the use of * this sockopt will be automatically enabled. * I have implemented it under Linux; other systems should be doable also. */ #ifndef lint static char copyright[] = -"$Id: socket.c,v 1.26.2.11 1999/03/29 22:07:14 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: socket.c,v 1.26.2.12 1999/10/25 15:39:55 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" #ifdef USE_SOCKET_FALLBACK -# define USE_SOCKET_SEND +# if !defined (USE_SOCKET_SEND) # define if_register_send if_register_fallback # define send_packet send_fallback # define if_reinitialize_send if_reinitialize_fallback +# endif #endif static int once = 0; /* Reinitializes the specified interface after an address change. This is not required for packet-filter APIs. */ -#ifdef USE_SOCKET_SEND +#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_FALLBACK) void if_reinitialize_send (info) struct interface_info *info; { #if 0 #ifndef USE_SOCKET_RECEIVE once = 0; close (info -> wfdesc); #endif if_register_send (info); #endif } #endif #ifdef USE_SOCKET_RECEIVE void if_reinitialize_receive (info) struct interface_info *info; { #if 0 once = 0; close (info -> rfdesc); if_register_receive (info); #endif } #endif -#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) +#if defined (USE_SOCKET_SEND) || \ + defined (USE_SOCKET_RECEIVE) || \ + defined (USE_SOCKET_FALLBACK) /* Generic interface registration routine... */ int if_register_socket (info) struct interface_info *info; { struct sockaddr_in name; int sock; int flag; #if !defined (HAVE_SO_BINDTODEVICE) && !defined (USE_FALLBACK) /* Make sure only one interface is registered. */ if (once) error ("The standard socket API can only support %s", "hosts with a single network interface."); once = 1; #endif /* Set up the address we're going to bind to. */ name.sin_family = AF_INET; name.sin_port = local_port; name.sin_addr.s_addr = INADDR_ANY; memset (name.sin_zero, 0, sizeof (name.sin_zero)); /* Make a socket... */ if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) error ("Can't create dhcp socket: %m"); /* Set the REUSEADDR option so that we don't fail to start if we're being restarted. */ flag = 1; if (setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, (char *)&flag, sizeof flag) < 0) error ("Can't set SO_REUSEADDR option on dhcp socket: %m"); /* Set the BROADCAST option so that we can broadcast DHCP responses. */ if (setsockopt (sock, SOL_SOCKET, SO_BROADCAST, (char *)&flag, sizeof flag) < 0) error ("Can't set SO_BROADCAST option on dhcp socket: %m"); /* Bind the socket to this interface's IP address. */ if (bind (sock, (struct sockaddr *)&name, sizeof name) < 0) error ("Can't bind to dhcp address: %m"); #if defined (HAVE_SO_BINDTODEVICE) /* Bind this socket to this interface. */ if (info -> ifp && setsockopt (sock, SOL_SOCKET, SO_BINDTODEVICE, (char *)(info -> ifp), sizeof *(info -> ifp)) < 0) { error("setsockopt: SO_BINDTODEVICE: %m"); } #endif return sock; } -#endif /* USE_SOCKET_SEND || USE_SOCKET_RECEIVE */ +#endif /* USE_SOCKET_SEND || USE_SOCKET_RECEIVE || USE_SOCKET_FALLBACK */ -#ifdef USE_SOCKET_SEND +#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_FALLBACK) void if_register_send (info) struct interface_info *info; { #ifndef USE_SOCKET_RECEIVE info -> wfdesc = if_register_socket (info); #else info -> wfdesc = info -> rfdesc; #endif if (!quiet_interface_discovery) note ("Sending on Socket/%s%s%s", info -> name, (info -> shared_network ? "/" : ""), (info -> shared_network ? info -> shared_network -> name : "")); } -#endif /* USE_SOCKET_SEND */ +#endif /* USE_SOCKET_SEND || USE_SOCKET_FALLBACK */ #ifdef USE_SOCKET_RECEIVE void if_register_receive (info) struct interface_info *info; { /* If we're using the socket API for sending and receiving, we don't need to register this interface twice. */ info -> rfdesc = if_register_socket (info); if (!quiet_interface_discovery) note ("Listening on Socket/%s%s%s", info -> name, (info -> shared_network ? "/" : ""), (info -> shared_network ? info -> shared_network -> name : "")); } #endif /* USE_SOCKET_RECEIVE */ -#ifdef USE_SOCKET_SEND +#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_FALLBACK) ssize_t send_packet (interface, packet, raw, len, from, to, hto) struct interface_info *interface; struct packet *packet; struct dhcp_packet *raw; size_t len; struct in_addr from; struct sockaddr_in *to; struct hardware *hto; { int result; #ifdef IGNORE_HOSTUNREACH int retry = 0; do { #endif result = sendto (interface -> wfdesc, (char *)raw, len, 0, (struct sockaddr *)to, sizeof *to); #ifdef IGNORE_HOSTUNREACH } while (to -> sin_addr.s_addr == htonl (INADDR_BROADCAST) && result < 0 && (errno == EHOSTUNREACH || errno == ECONNREFUSED) && retry++ < 10); #endif if (result < 0) { warn ("send_packet: %m"); if (errno == ENETUNREACH) warn ("send_packet: please consult README file %s", "regarding broadcast address."); } return result; } -#endif /* USE_SOCKET_SEND */ +#endif /* USE_SOCKET_SEND || USE_SOCKET_FALLBACK */ #ifdef USE_SOCKET_RECEIVE ssize_t receive_packet (interface, buf, len, from, hfrom) struct interface_info *interface; unsigned char *buf; size_t len; struct sockaddr_in *from; struct hardware *hfrom; { int flen = sizeof *from; int result; #ifdef IGNORE_HOSTUNREACH int retry = 0; do { #endif result = recvfrom (interface -> rfdesc, (char *)buf, len, 0, (struct sockaddr *)from, &flen); #ifdef IGNORE_HOSTUNREACH } while (result < 0 && (errno == EHOSTUNREACH || errno == ECONNREFUSED) && retry++ < 10); #endif return result; } #endif /* USE_SOCKET_RECEIVE */ -#ifdef USE_SOCKET_SEND +#if defined (USE_SOCKET_FALLBACK) /* This just reads in a packet and silently discards it. */ void fallback_discard (protocol) struct protocol *protocol; { char buf [1540]; struct sockaddr_in from; int flen = sizeof from; int status; struct interface_info *interface = protocol -> local; status = recvfrom (interface -> wfdesc, buf, sizeof buf, 0, (struct sockaddr *)&from, &flen); if (status < 0) warn ("fallback_discard: %m"); } -#endif /* USE_SOCKET_SEND */ +#endif /* USE_SOCKET_FALLBACK */ -#if defined (USE_SOCKET_SEND) && !defined (USE_SOCKET_FALLBACK) +#if defined (USE_SOCKET_SEND) int can_unicast_without_arp () { return 0; } int can_receive_unicast_unconfigured (ip) struct interface_info *ip; { #if defined (SOCKET_CAN_RECEIVE_UNICAST_UNCONFIGURED) return 1; #else return 0; #endif } /* If we have SO_BINDTODEVICE, set up a fallback interface; otherwise, do not. */ void maybe_setup_fallback () { -#if defined (SO_BINDTODEVICE) +#if defined (USE_SOCKET_FALLBACK) struct interface_info *fbi; fbi = setup_fallback (); if (fbi) { fbi -> wfdesc = if_register_socket (fbi); add_protocol ("fallback", fbi -> wfdesc, fallback_discard, fbi); } #endif } -#endif /* USE_SOCKET_SEND && !USE_SOCKET_FALLBACK */ +#endif /* USE_SOCKET_SEND */ Index: head/contrib/isc-dhcp/configure =================================================================== --- head/contrib/isc-dhcp/configure (nonexistent) +++ head/contrib/isc-dhcp/configure (revision 62105) @@ -0,0 +1,100 @@ +#!/bin/sh + +sysname=$1 + +uname=`uname -s` +machine=`uname -m` + +if [ "$sysname" = "" ]; then + case $uname in + AIX) + sysname=aix;; + Rhapsody) + sysname=rhapsody;; + ULTRIX) + sysname=ultrix;; + BSD/OS) + sysname=bsdos;; + OSF1) + if [ $machine = 'alpha' ]; then + sysname=alphaosf + fi;; + Linux) + release=`uname -r` + minor=`echo $release |sed -e 's/[0-9]*\.\([0-9][0-9]*\)\(\..*\)*$/\1/'` + major=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'` + + case $major in + 1) sysname=linux-1 ;; + 2) case $minor in + 0) sysname=linux-2.0 ;; + 1) sysname=linux-2.1 ;; + 2) sysname=linux-2.2 ;; + *) sysname=linux-2.2 ;; + esac;; + esac;; + SunOS) + case `uname -r` in + 4*) sysname=sunos4;; + 5*) + set `which gcc` + if [ $# = 1 ]; then + sysname=sunos5-gcc + else + sysname=sunos5-cc + fi;; + esac;; + NetBSD) + sysname=netbsd;; + FreeBSD) + sysname=freebsd;; + hpux) + sysname=hpux;; + HP-UX) + sysname=hpux;; + QNX) + sysname=qnx;; + NEXTSTEP) + sysname=nextstep;; + esac +fi + +if [ "$sysname" = "" ]; then + echo "UNIX name: $uname machine: $machine" + echo + echo "Unknown system. If this is an SCO system running ODT 3.0 or" + echo "higher, type \`\`./configure sco''. Otherwise, this is a" + echo "configuration that isn't supported or hasn't been tested." + echo + echo "Supported configurations are:" + echo " aix AIX 4.1.5.0" + echo " ultrix ULTRIX 4.2A or higher" + echo " bsdos BSDI BSD/OS 2.1" + echo " alphaosf DEC Alpha OSF/1" + echo " linux Linux" + echo " sunos4 Sunos 4.1.4 (earlier releases may work)" + echo " sunos5-cc Solaris 2.4 or higher with Sun cc" + echo " sunos5-gcc Solaris 2.4 or higher with gcc" + echo " netbsd NetBSD 1.1 or higher" + echo " freebsd FreeBSD" + echo " hpux HP-UX" + echo " qnx QNX 4.2 or higher" + echo " NEXTSTEP NeXTSTEP" + exit 1; +fi + +echo "System Type: $sysname" + +if [ x$major != x ] && [ x$minor != x ]; then + majversubst="-e /^##--majver--/,/^##--majver--/s/MajorVersion/$major/" + minversubst="-e /^##--minver--/,/^##--minver--/s/MinorVersion/$minor/" +fi + +for foo in . client server relay common; do + (sed $majversubst $minversubst \ + -e "/^##--${sysname}--/,/^##--${sysname}--/s/^#//" \ + $foo/Makefile +done + +exit 0 Property changes on: head/contrib/isc-dhcp/configure ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: head/contrib/isc-dhcp/includes/dhcpd.h =================================================================== --- head/contrib/isc-dhcp/includes/dhcpd.h (revision 62104) +++ head/contrib/isc-dhcp/includes/dhcpd.h (revision 62105) @@ -1,1035 +1,1035 @@ /* dhcpd.h Definitions for dhcpd... */ /* * Copyright (c) 1995, 1996, 1997, 1998, 1999 * The Internet Software Consortium. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of The Internet Software Consortium nor the names * of its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This software has been written for the Internet Software Consortium * by Ted Lemon in cooperation with Vixie * Enterprises. To learn more about the Internet Software Consortium, * see ``http://www.vix.com/isc''. To learn more about Vixie * Enterprises, see ``http://www.vix.com''. */ #ifndef __CYGWIN32__ #include #include #include #include #include #include #else #define fd_set cygwin_fd_set #include #endif #include #include #include #include #include #include #include #include #include "cdefs.h" #include "osdep.h" #include "dhcp.h" #include "tree.h" #include "hash.h" #include "inet.h" #include "sysconf.h" struct option_data { int len; u_int8_t *data; }; struct string_list { struct string_list *next; char string [1]; }; /* A name server, from /etc/resolv.conf. */ struct name_server { struct name_server *next; struct sockaddr_in addr; TIME rcdate; }; /* A domain search list element. */ struct domain_search_list { struct domain_search_list *next; char *domain; TIME rcdate; }; /* A dhcp packet and the pointers to its option values. */ struct packet { struct dhcp_packet *raw; int packet_length; int packet_type; int options_valid; int client_port; struct iaddr client_addr; struct interface_info *interface; /* Interface on which packet was received. */ struct hardware *haddr; /* Physical link address of local sender (maybe gateway). */ struct shared_network *shared_network; struct option_data options [256]; int got_requested_address; /* True if client sent the dhcp-requested-address option. */ }; struct hardware { u_int8_t htype; u_int8_t hlen; u_int8_t haddr [16]; }; /* A dhcp lease declaration structure. */ struct lease { struct lease *next; struct lease *prev; struct lease *n_uid, *n_hw; struct lease *waitq_next; struct iaddr ip_addr; TIME starts, ends, timestamp; unsigned char *uid; int uid_len; int uid_max; unsigned char uid_buf [32]; char *hostname; char *client_hostname; struct host_decl *host; struct subnet *subnet; struct shared_network *shared_network; struct hardware hardware_addr; int flags; # define STATIC_LEASE 1 # define BOOTP_LEASE 2 # define DYNAMIC_BOOTP_OK 4 # define PERSISTENT_FLAGS (DYNAMIC_BOOTP_OK) # define EPHEMERAL_FLAGS (BOOTP_LEASE) # define MS_NULL_TERMINATION 8 # define ABANDONED_LEASE 16 struct lease_state *state; }; struct lease_state { struct lease_state *next; struct interface_info *ip; TIME offered_expiry; struct tree_cache *options [256]; u_int32_t expiry, renewal, rebind; char filename [DHCP_FILE_LEN]; char *server_name; struct iaddr from; int max_message_size; u_int8_t *prl; int prl_len; int got_requested_address; /* True if client sent the dhcp-requested-address option. */ int got_server_identifier; /* True if client sent the dhcp-server-identifier option. */ struct shared_network *shared_network; /* Shared network of interface on which request arrived. */ u_int32_t xid; u_int16_t secs; u_int16_t bootp_flags; struct in_addr ciaddr; struct in_addr giaddr; u_int8_t hops; u_int8_t offer; }; #define ROOT_GROUP 0 #define HOST_DECL 1 #define SHARED_NET_DECL 2 #define SUBNET_DECL 3 #define CLASS_DECL 4 #define GROUP_DECL 5 /* Possible modes in which discover_interfaces can run. */ #define DISCOVER_RUNNING 0 #define DISCOVER_SERVER 1 #define DISCOVER_UNCONFIGURED 2 #define DISCOVER_RELAY 3 #define DISCOVER_REQUESTED 4 /* Group of declarations that share common parameters. */ struct group { struct group *next; struct subnet *subnet; struct shared_network *shared_network; TIME default_lease_time; TIME max_lease_time; TIME bootp_lease_cutoff; TIME bootp_lease_length; char *filename; char *server_name; struct iaddr next_server; int boot_unknown_clients; int dynamic_bootp; int allow_bootp; int allow_booting; int one_lease_per_client; int get_lease_hostnames; int use_host_decl_names; int use_lease_addr_for_default_route; int authoritative; int always_reply_rfc1048; struct tree_cache *options [256]; }; /* A dhcp host declaration structure. */ struct host_decl { struct host_decl *n_ipaddr; char *name; struct hardware interface; struct tree_cache *fixed_addr; struct group *group; }; struct shared_network { struct shared_network *next; char *name; struct subnet *subnets; struct interface_info *interface; struct lease *leases; struct lease *insertion_point; struct lease *last_lease; struct group *group; }; struct subnet { struct subnet *next_subnet; struct subnet *next_sibling; struct shared_network *shared_network; struct interface_info *interface; struct iaddr interface_address; struct iaddr net; struct iaddr netmask; struct group *group; }; struct class { char *name; struct group *group; }; /* DHCP client lease structure... */ struct client_lease { struct client_lease *next; /* Next lease in list. */ TIME expiry, renewal, rebind; /* Lease timeouts. */ struct iaddr address; /* Address being leased. */ char *server_name; /* Name of boot server. */ char *filename; /* Name of file we're supposed to boot. */ struct string_list *medium; /* Network medium. */ unsigned int is_static : 1; /* If set, lease is from config file. */ unsigned int is_bootp: 1; /* If set, lease was aquired with BOOTP. */ struct option_data options [256]; /* Options supplied with lease. */ }; /* Possible states in which the client can be. */ enum dhcp_state { S_REBOOTING, S_INIT, S_SELECTING, S_REQUESTING, S_BOUND, S_RENEWING, S_REBINDING }; /* Configuration information from the config file... */ struct client_config { struct option_data defaults [256]; /* Default values for options. */ enum { ACTION_DEFAULT, /* Use server value if present, otherwise default. */ ACTION_SUPERSEDE, /* Always use default. */ ACTION_PREPEND, /* Prepend default to server. */ ACTION_APPEND, /* Append default to server. */ } default_actions [256]; struct option_data send_options [256]; /* Send these to server. */ u_int8_t required_options [256]; /* Options server must supply. */ u_int8_t requested_options [256]; /* Options to request from server. */ int requested_option_count; /* Number of requested options. */ TIME timeout; /* Start to panic if we don't get a lease in this time period when SELECTING. */ TIME initial_interval; /* All exponential backoff intervals start here. */ TIME retry_interval; /* If the protocol failed to produce an address before the timeout, try the protocol again after this many seconds. */ TIME select_interval; /* Wait this many seconds from the first DHCPDISCOVER before picking an offered lease. */ TIME reboot_timeout; /* When in INIT-REBOOT, wait this long before giving up and going to INIT. */ TIME backoff_cutoff; /* When doing exponential backoff, never back off to an interval longer than this amount. */ struct string_list *media; /* Possible network media values. */ char *script_name; /* Name of config script. */ enum { IGNORE, ACCEPT, PREFER } bootp_policy; /* Ignore, accept or prefer BOOTP responses. */ struct string_list *medium; /* Current network medium. */ struct iaddrlist *reject_list; /* Servers to reject. */ }; /* Per-interface state used in the dhcp client... */ struct client_state { struct client_lease *active; /* Currently active lease. */ struct client_lease *new; /* New lease. */ struct client_lease *offered_leases; /* Leases offered to us. */ struct client_lease *leases; /* Leases we currently hold. */ struct client_lease *alias; /* Alias lease. */ enum dhcp_state state; /* Current state for this interface. */ struct iaddr destination; /* Where to send packet. */ u_int32_t xid; /* Transaction ID. */ u_int16_t secs; /* secs value from DHCPDISCOVER. */ TIME first_sending; /* When was first copy sent? */ TIME interval; /* What's the current resend interval? */ struct string_list *medium; /* Last media type tried. */ struct dhcp_packet packet; /* Outgoing DHCP packet. */ int packet_length; /* Actual length of generated packet. */ struct iaddr requested_address; /* Address we would like to get. */ struct client_config *config; /* Information from config file. */ }; /* Information about each network interface. */ struct interface_info { struct interface_info *next; /* Next interface in list... */ struct shared_network *shared_network; /* Networks connected to this interface. */ struct hardware hw_address; /* Its physical address. */ struct in_addr primary_address; /* Primary interface address. */ char name [IFNAMSIZ]; /* Its name... */ int rfdesc; /* Its read file descriptor. */ int wfdesc; /* Its write file descriptor, if different. */ unsigned char *rbuf; /* Read buffer, if required. */ size_t rbuf_max; /* Size of read buffer. */ size_t rbuf_offset; /* Current offset into buffer. */ size_t rbuf_len; /* Length of data in buffer. */ struct ifreq *ifp; /* Pointer to ifreq struct. */ u_int32_t flags; /* Control flags... */ #define INTERFACE_REQUESTED 1 #define INTERFACE_AUTOMATIC 2 /* Only used by DHCP client code. */ struct client_state *client; }; struct hardware_link { struct hardware_link *next; char name [IFNAMSIZ]; struct hardware address; }; struct timeout { struct timeout *next; TIME when; void (*func) PROTO ((void *)); void *what; }; struct protocol { struct protocol *next; int fd; void (*handler) PROTO ((struct protocol *)); void *local; }; /* Bitmask of dhcp option codes. */ typedef unsigned char option_mask [16]; /* DHCP Option mask manipulation macros... */ #define OPTION_ZERO(mask) (memset (mask, 0, 16)) #define OPTION_SET(mask, bit) (mask [bit >> 8] |= (1 << (bit & 7))) #define OPTION_CLR(mask, bit) (mask [bit >> 8] &= ~(1 << (bit & 7))) #define OPTION_ISSET(mask, bit) (mask [bit >> 8] & (1 << (bit & 7))) #define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit)) /* An option occupies its length plus two header bytes (code and length) for every 255 bytes that must be stored. */ #define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1)) /* Default path to dhcpd config file. */ #ifdef DEBUG #undef _PATH_DHCPD_CONF #define _PATH_DHCPD_CONF "dhcpd.conf" #undef _PATH_DHCPD_DB #define _PATH_DHCPD_DB "dhcpd.leases" #else #ifndef _PATH_DHCPD_CONF #define _PATH_DHCPD_CONF "/etc/dhcpd.conf" #endif #ifndef _PATH_DHCPD_DB #define _PATH_DHCPD_DB "/etc/dhcpd.leases" #endif #ifndef _PATH_DHCPD_PID #define _PATH_DHCPD_PID "/var/run/dhcpd.pid" #endif #endif #ifndef _PATH_DHCLIENT_CONF #define _PATH_DHCLIENT_CONF "/etc/dhclient.conf" #endif #ifndef _PATH_DHCLIENT_PID #define _PATH_DHCLIENT_PID "/var/run/dhclient.pid" #endif #ifndef _PATH_DHCLIENT_DB #define _PATH_DHCLIENT_DB "/etc/dhclient.leases" #endif #ifndef _PATH_RESOLV_CONF #define _PATH_RESOLV_CONF "/etc/resolv.conf" #endif #ifndef _PATH_DHCRELAY_PID #define _PATH_DHCRELAY_PID "/var/run/dhcrelay.pid" #endif #ifndef DHCPD_LOG_FACILITY #define DHCPD_LOG_FACILITY LOG_DAEMON #endif #define MAX_TIME 0x7fffffff #define MIN_TIME 0 /* External definitions... */ /* options.c */ void parse_options PROTO ((struct packet *)); void parse_option_buffer PROTO ((struct packet *, unsigned char *, int)); int cons_options PROTO ((struct packet *, struct dhcp_packet *, int, struct tree_cache **, int, int, int, u_int8_t *, int)); int store_options PROTO ((unsigned char *, int, struct tree_cache **, unsigned char *, int, int, int, int)); char *pretty_print_option PROTO ((unsigned int, unsigned char *, int, int, int)); void do_packet PROTO ((struct interface_info *, struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *)); /* errwarn.c */ extern int warnings_occurred; void error PROTO ((char *, ...)); int warn PROTO ((char *, ...)); int note PROTO ((char *, ...)); int debug PROTO ((char *, ...)); int parse_warn PROTO ((char *, ...)); /* dhcpd.c */ extern TIME cur_time; extern struct group root_group; extern u_int16_t local_port; extern u_int16_t remote_port; extern int log_priority; extern int log_perror; extern char *path_dhcpd_conf; extern char *path_dhcpd_db; extern char *path_dhcpd_pid; int main PROTO ((int, char **, char **)); void cleanup PROTO ((void)); void lease_pinged PROTO ((struct iaddr, u_int8_t *, int)); void lease_ping_timeout PROTO ((void *)); /* conflex.c */ extern int lexline, lexchar; extern char *token_line, *tlname; extern char comments [4096]; extern int comment_index; extern int eol_token; void new_parse PROTO ((char *)); int next_token PROTO ((char **, FILE *)); int peek_token PROTO ((char **, FILE *)); /* confpars.c */ int readconf PROTO ((void)); void read_leases PROTO ((void)); int parse_statement PROTO ((FILE *, struct group *, int, struct host_decl *, int)); void parse_allow_deny PROTO ((FILE *, struct group *, int)); void skip_to_semi PROTO ((FILE *)); int parse_boolean PROTO ((FILE *)); int parse_semi PROTO ((FILE *)); int parse_lbrace PROTO ((FILE *)); void parse_host_declaration PROTO ((FILE *, struct group *)); char *parse_host_name PROTO ((FILE *)); void parse_class_declaration PROTO ((FILE *, struct group *, int)); void parse_lease_time PROTO ((FILE *, TIME *)); void parse_shared_net_declaration PROTO ((FILE *, struct group *)); void parse_subnet_declaration PROTO ((FILE *, struct shared_network *)); void parse_group_declaration PROTO ((FILE *, struct group *)); void parse_hardware_param PROTO ((FILE *, struct hardware *)); char *parse_string PROTO ((FILE *)); struct tree *parse_ip_addr_or_hostname PROTO ((FILE *, int)); struct tree_cache *parse_fixed_addr_param PROTO ((FILE *)); void parse_option_param PROTO ((FILE *, struct group *)); TIME parse_timestamp PROTO ((FILE *)); struct lease *parse_lease_declaration PROTO ((FILE *)); void parse_address_range PROTO ((FILE *, struct subnet *)); TIME parse_date PROTO ((FILE *)); unsigned char *parse_numeric_aggregate PROTO ((FILE *, unsigned char *, int *, int, int, int)); void convert_num PROTO ((unsigned char *, char *, int, int)); /* tree.c */ pair cons PROTO ((caddr_t, pair)); struct tree_cache *tree_cache PROTO ((struct tree *)); struct tree *tree_host_lookup PROTO ((char *)); struct dns_host_entry *enter_dns_host PROTO ((char *)); struct tree *tree_const PROTO ((unsigned char *, int)); struct tree *tree_concat PROTO ((struct tree *, struct tree *)); struct tree *tree_limit PROTO ((struct tree *, int)); int tree_evaluate PROTO ((struct tree_cache *)); /* dhcp.c */ extern int outstanding_pings; void dhcp PROTO ((struct packet *)); void dhcpdiscover PROTO ((struct packet *)); void dhcprequest PROTO ((struct packet *)); void dhcprelease PROTO ((struct packet *)); void dhcpdecline PROTO ((struct packet *)); void dhcpinform PROTO ((struct packet *)); void nak_lease PROTO ((struct packet *, struct iaddr *cip)); void ack_lease PROTO ((struct packet *, struct lease *, unsigned int, TIME)); void dhcp_reply PROTO ((struct lease *)); struct lease *find_lease PROTO ((struct packet *, struct shared_network *, int *)); struct lease *mockup_lease PROTO ((struct packet *, struct shared_network *, struct host_decl *)); /* bootp.c */ void bootp PROTO ((struct packet *)); /* memory.c */ void enter_host PROTO ((struct host_decl *)); struct host_decl *find_hosts_by_haddr PROTO ((int, unsigned char *, int)); struct host_decl *find_hosts_by_uid PROTO ((unsigned char *, int)); struct subnet *find_host_for_network PROTO ((struct host_decl **, struct iaddr *, struct shared_network *)); void new_address_range PROTO ((struct iaddr, struct iaddr, struct subnet *, int)); extern struct subnet *find_grouped_subnet PROTO ((struct shared_network *, struct iaddr)); extern struct subnet *find_subnet PROTO ((struct iaddr)); void enter_shared_network PROTO ((struct shared_network *)); int subnet_inner_than PROTO ((struct subnet *, struct subnet *, int)); void enter_subnet PROTO ((struct subnet *)); void enter_lease PROTO ((struct lease *)); int supersede_lease PROTO ((struct lease *, struct lease *, int)); void release_lease PROTO ((struct lease *)); void abandon_lease PROTO ((struct lease *, char *)); struct lease *find_lease_by_uid PROTO ((unsigned char *, int)); struct lease *find_lease_by_hw_addr PROTO ((unsigned char *, int)); struct lease *find_lease_by_ip_addr PROTO ((struct iaddr)); void uid_hash_add PROTO ((struct lease *)); void uid_hash_delete PROTO ((struct lease *)); void hw_hash_add PROTO ((struct lease *)); void hw_hash_delete PROTO ((struct lease *)); struct class *add_class PROTO ((int, char *)); struct class *find_class PROTO ((int, unsigned char *, int)); struct group *clone_group PROTO ((struct group *, char *)); void write_leases PROTO ((void)); void dump_subnets PROTO ((void)); /* alloc.c */ VOIDPTR dmalloc PROTO ((int, char *)); void dfree PROTO ((VOIDPTR, char *)); struct packet *new_packet PROTO ((char *)); struct dhcp_packet *new_dhcp_packet PROTO ((char *)); struct tree *new_tree PROTO ((char *)); struct tree_cache *new_tree_cache PROTO ((char *)); struct hash_table *new_hash_table PROTO ((int, char *)); struct hash_bucket *new_hash_bucket PROTO ((char *)); struct lease *new_lease PROTO ((char *)); struct lease *new_leases PROTO ((int, char *)); struct subnet *new_subnet PROTO ((char *)); struct class *new_class PROTO ((char *)); struct shared_network *new_shared_network PROTO ((char *)); struct group *new_group PROTO ((char *)); struct protocol *new_protocol PROTO ((char *)); struct lease_state *new_lease_state PROTO ((char *)); struct domain_search_list *new_domain_search_list PROTO ((char *)); struct name_server *new_name_server PROTO ((char *)); void free_name_server PROTO ((struct name_server *, char *)); void free_domain_search_list PROTO ((struct domain_search_list *, char *)); void free_lease_state PROTO ((struct lease_state *, char *)); void free_protocol PROTO ((struct protocol *, char *)); void free_group PROTO ((struct group *, char *)); void free_shared_network PROTO ((struct shared_network *, char *)); void free_class PROTO ((struct class *, char *)); void free_subnet PROTO ((struct subnet *, char *)); void free_lease PROTO ((struct lease *, char *)); void free_hash_bucket PROTO ((struct hash_bucket *, char *)); void free_hash_table PROTO ((struct hash_table *, char *)); void free_tree_cache PROTO ((struct tree_cache *, char *)); void free_packet PROTO ((struct packet *, char *)); void free_dhcp_packet PROTO ((struct dhcp_packet *, char *)); void free_tree PROTO ((struct tree *, char *)); /* print.c */ char *print_hw_addr PROTO ((int, int, unsigned char *)); void print_lease PROTO ((struct lease *)); void dump_raw PROTO ((unsigned char *, int)); void dump_packet PROTO ((struct packet *)); void hash_dump PROTO ((struct hash_table *)); /* socket.c */ #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \ || defined (USE_SOCKET_FALLBACK) int if_register_socket PROTO ((struct interface_info *)); #endif -#ifdef USE_SOCKET_FALLBACK +#if defined (USE_SOCKET_FALLBACK) && !defined (USE_SOCKET_SEND) void if_reinitialize_fallback PROTO ((struct interface_info *)); void if_register_fallback PROTO ((struct interface_info *)); ssize_t send_fallback PROTO ((struct interface_info *, struct packet *, struct dhcp_packet *, size_t, struct in_addr, struct sockaddr_in *, struct hardware *)); #endif #ifdef USE_SOCKET_SEND void if_reinitialize_send PROTO ((struct interface_info *)); void if_register_send PROTO ((struct interface_info *)); ssize_t send_packet PROTO ((struct interface_info *, struct packet *, struct dhcp_packet *, size_t, struct in_addr, struct sockaddr_in *, struct hardware *)); #endif #if defined (USE_SOCKET_FALLBACK) void fallback_discard PROTO ((struct protocol *)); #endif #ifdef USE_SOCKET_RECEIVE void if_reinitialize_receive PROTO ((struct interface_info *)); void if_register_receive PROTO ((struct interface_info *)); ssize_t receive_packet PROTO ((struct interface_info *, unsigned char *, size_t, struct sockaddr_in *, struct hardware *)); #endif -#if defined (USE_SOCKET_SEND) && !defined (USE_SOCKET_FALLBACK) +#if defined (USE_SOCKET_SEND) int can_unicast_without_arp PROTO ((void)); int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); void maybe_setup_fallback PROTO ((void)); #endif /* bpf.c */ #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE) int if_register_bpf PROTO ( (struct interface_info *)); #endif #ifdef USE_BPF_SEND void if_reinitialize_send PROTO ((struct interface_info *)); void if_register_send PROTO ((struct interface_info *)); ssize_t send_packet PROTO ((struct interface_info *, struct packet *, struct dhcp_packet *, size_t, struct in_addr, struct sockaddr_in *, struct hardware *)); #endif #ifdef USE_BPF_RECEIVE void if_reinitialize_receive PROTO ((struct interface_info *)); void if_register_receive PROTO ((struct interface_info *)); ssize_t receive_packet PROTO ((struct interface_info *, unsigned char *, size_t, struct sockaddr_in *, struct hardware *)); #endif #if defined (USE_BPF_SEND) int can_unicast_without_arp PROTO ((void)); int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); void maybe_setup_fallback PROTO ((void)); #endif /* lpf.c */ #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE) int if_register_lpf PROTO ( (struct interface_info *)); #endif #ifdef USE_LPF_SEND void if_reinitialize_send PROTO ((struct interface_info *)); void if_register_send PROTO ((struct interface_info *)); ssize_t send_packet PROTO ((struct interface_info *, struct packet *, struct dhcp_packet *, size_t, struct in_addr, struct sockaddr_in *, struct hardware *)); #endif #ifdef USE_LPF_RECEIVE void if_reinitialize_receive PROTO ((struct interface_info *)); void if_register_receive PROTO ((struct interface_info *)); ssize_t receive_packet PROTO ((struct interface_info *, unsigned char *, size_t, struct sockaddr_in *, struct hardware *)); #endif #if defined (USE_LPF_SEND) int can_unicast_without_arp PROTO ((void)); int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); void maybe_setup_fallback PROTO ((void)); #endif /* nit.c */ #if defined (USE_NIT_SEND) || defined (USE_NIT_RECEIVE) int if_register_nit PROTO ( (struct interface_info *)); #endif #ifdef USE_NIT_SEND void if_reinitialize_send PROTO ((struct interface_info *)); void if_register_send PROTO ((struct interface_info *)); ssize_t send_packet PROTO ((struct interface_info *, struct packet *, struct dhcp_packet *, size_t, struct in_addr, struct sockaddr_in *, struct hardware *)); #endif #ifdef USE_NIT_RECEIVE void if_reinitialize_receive PROTO ((struct interface_info *)); void if_register_receive PROTO ((struct interface_info *)); ssize_t receive_packet PROTO ((struct interface_info *, unsigned char *, size_t, struct sockaddr_in *, struct hardware *)); #endif #if defined (USE_NIT_SEND) int can_unicast_without_arp PROTO ((void)); int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); void maybe_setup_fallback PROTO ((void)); #endif #ifdef USE_DLPI_SEND void if_reinitialize_send PROTO ((struct interface_info *)); void if_register_send PROTO ((struct interface_info *)); ssize_t send_packet PROTO ((struct interface_info *, struct packet *, struct dhcp_packet *, size_t, struct in_addr, struct sockaddr_in *, struct hardware *)); #endif #ifdef USE_DLPI_RECEIVE void if_reinitialize_receive PROTO ((struct interface_info *)); void if_register_receive PROTO ((struct interface_info *)); ssize_t receive_packet PROTO ((struct interface_info *, unsigned char *, size_t, struct sockaddr_in *, struct hardware *)); #endif #if defined (USE_DLPI_SEND) int can_unicast_without_arp PROTO ((void)); int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); void maybe_setup_fallback PROTO ((void)); #endif /* raw.c */ #ifdef USE_RAW_SEND void if_reinitialize_send PROTO ((struct interface_info *)); void if_register_send PROTO ((struct interface_info *)); ssize_t send_packet PROTO ((struct interface_info *, struct packet *, struct dhcp_packet *, size_t, struct in_addr, struct sockaddr_in *, struct hardware *)); int can_unicast_without_arp PROTO ((void)); int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); void maybe_setup_fallback PROTO ((void)); #endif /* dispatch.c */ extern struct interface_info *interfaces, *dummy_interfaces, *fallback_interface; extern struct protocol *protocols; extern int quiet_interface_discovery; extern void (*bootp_packet_handler) PROTO ((struct interface_info *, struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *)); extern struct timeout *timeouts; void discover_interfaces PROTO ((int)); struct interface_info *setup_fallback PROTO ((void)); void reinitialize_interfaces PROTO ((void)); void dispatch PROTO ((void)); int locate_network PROTO ((struct packet *)); void got_one PROTO ((struct protocol *)); void add_timeout PROTO ((TIME, void (*) PROTO ((void *)), void *)); void cancel_timeout PROTO ((void (*) PROTO ((void *)), void *)); void add_protocol PROTO ((char *, int, void (*) PROTO ((struct protocol *)), void *)); void remove_protocol PROTO ((struct protocol *)); /* hash.c */ struct hash_table *new_hash PROTO ((void)); void add_hash PROTO ((struct hash_table *, unsigned char *, int, unsigned char *)); void delete_hash_entry PROTO ((struct hash_table *, unsigned char *, int)); unsigned char *hash_lookup PROTO ((struct hash_table *, unsigned char *, int)); /* tables.c */ extern struct option dhcp_options [256]; extern unsigned char dhcp_option_default_priority_list []; extern int sizeof_dhcp_option_default_priority_list; extern char *hardware_types [256]; extern struct hash_table universe_hash; extern struct universe dhcp_universe; void initialize_universes PROTO ((void)); /* convert.c */ u_int32_t getULong PROTO ((unsigned char *)); int32_t getLong PROTO ((unsigned char *)); u_int16_t getUShort PROTO ((unsigned char *)); int16_t getShort PROTO ((unsigned char *)); void putULong PROTO ((unsigned char *, u_int32_t)); void putLong PROTO ((unsigned char *, int32_t)); void putUShort PROTO ((unsigned char *, unsigned int)); void putShort PROTO ((unsigned char *, int)); /* inet.c */ struct iaddr subnet_number PROTO ((struct iaddr, struct iaddr)); struct iaddr ip_addr PROTO ((struct iaddr, struct iaddr, u_int32_t)); struct iaddr broadcast_addr PROTO ((struct iaddr, struct iaddr)); u_int32_t host_addr PROTO ((struct iaddr, struct iaddr)); int addr_eq PROTO ((struct iaddr, struct iaddr)); char *piaddr PROTO ((struct iaddr)); /* dhclient.c */ extern char *path_dhclient_conf; extern char *path_dhclient_db; extern char *path_dhclient_pid; extern int interfaces_requested; extern struct client_config top_level_config; void dhcpoffer PROTO ((struct packet *)); void dhcpack PROTO ((struct packet *)); void dhcpnak PROTO ((struct packet *)); void send_discover PROTO ((void *)); void send_request PROTO ((void *)); void send_release PROTO ((void *)); void send_decline PROTO ((void *)); void state_reboot PROTO ((void *)); void state_init PROTO ((void *)); void state_selecting PROTO ((void *)); void state_requesting PROTO ((void *)); void state_bound PROTO ((void *)); void state_panic PROTO ((void *)); void bind_lease PROTO ((struct interface_info *)); void make_discover PROTO ((struct interface_info *, struct client_lease *)); void make_request PROTO ((struct interface_info *, struct client_lease *)); void make_decline PROTO ((struct interface_info *, struct client_lease *)); void make_release PROTO ((struct interface_info *, struct client_lease *)); void free_client_lease PROTO ((struct client_lease *)); void rewrite_client_leases PROTO ((void)); void write_client_lease PROTO ((struct interface_info *, struct client_lease *, int)); char *dhcp_option_ev_name PROTO ((struct option *)); void script_init PROTO ((struct interface_info *, char *, struct string_list *)); void script_write_params PROTO ((struct interface_info *, char *, struct client_lease *)); int script_go PROTO ((struct interface_info *)); struct client_lease *packet_to_lease PROTO ((struct packet *)); void go_daemon PROTO ((void)); void write_client_pid_file PROTO ((void)); void status_message PROTO ((struct sysconf_header *, void *)); void client_location_changed PROTO ((void)); /* db.c */ int write_lease PROTO ((struct lease *)); int commit_leases PROTO ((void)); void db_startup PROTO ((void)); void new_lease_file PROTO ((void)); /* packet.c */ u_int32_t checksum PROTO ((unsigned char *, int, u_int32_t)); u_int32_t wrapsum PROTO ((u_int32_t)); void assemble_hw_header PROTO ((struct interface_info *, unsigned char *, int *, struct hardware *)); void assemble_udp_ip_header PROTO ((struct interface_info *, unsigned char *, int *, u_int32_t, u_int32_t, unsigned int, unsigned char *, int)); ssize_t decode_hw_header PROTO ((struct interface_info *, unsigned char *, int, struct hardware *)); ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *, int, struct sockaddr_in *, unsigned char *, int)); /* ethernet.c */ void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *, int *, struct hardware *)); ssize_t decode_ethernet_header PROTO ((struct interface_info *, unsigned char *, int, struct hardware *)); /* tr.c */ void assemble_tr_header PROTO ((struct interface_info *, unsigned char *, int *, struct hardware *)); ssize_t decode_tr_header PROTO ((struct interface_info *, unsigned char *, int, struct hardware *)); /* dhxpxlt.c */ void convert_statement PROTO ((FILE *)); void convert_host_statement PROTO ((FILE *, jrefproto)); void convert_host_name PROTO ((FILE *, jrefproto)); void convert_class_statement PROTO ((FILE *, jrefproto, int)); void convert_class_decl PROTO ((FILE *, jrefproto)); void convert_lease_time PROTO ((FILE *, jrefproto, char *)); void convert_shared_net_statement PROTO ((FILE *, jrefproto)); void convert_subnet_statement PROTO ((FILE *, jrefproto)); void convert_subnet_decl PROTO ((FILE *, jrefproto)); void convert_host_decl PROTO ((FILE *, jrefproto)); void convert_hardware_decl PROTO ((FILE *, jrefproto)); void convert_hardware_addr PROTO ((FILE *, jrefproto)); void convert_filename_decl PROTO ((FILE *, jrefproto)); void convert_servername_decl PROTO ((FILE *, jrefproto)); void convert_ip_addr_or_hostname PROTO ((FILE *, jrefproto, int)); void convert_fixed_addr_decl PROTO ((FILE *, jrefproto)); void convert_option_decl PROTO ((FILE *, jrefproto)); void convert_timestamp PROTO ((FILE *, jrefproto)); void convert_lease_statement PROTO ((FILE *, jrefproto)); void convert_address_range PROTO ((FILE *, jrefproto)); void convert_date PROTO ((FILE *, jrefproto, char *)); void convert_numeric_aggregate PROTO ((FILE *, jrefproto, int, int, int, int)); void indent PROTO ((int)); /* route.c */ void add_route_direct PROTO ((struct interface_info *, struct in_addr)); void add_route_net PROTO ((struct interface_info *, struct in_addr, struct in_addr)); void add_route_default_gateway PROTO ((struct interface_info *, struct in_addr)); void remove_routes PROTO ((struct in_addr)); void remove_if_route PROTO ((struct interface_info *, struct in_addr)); void remove_all_if_routes PROTO ((struct interface_info *)); void set_netmask PROTO ((struct interface_info *, struct in_addr)); void set_broadcast_addr PROTO ((struct interface_info *, struct in_addr)); void set_ip_address PROTO ((struct interface_info *, struct in_addr)); /* clparse.c */ int read_client_conf PROTO ((void)); void read_client_leases PROTO ((void)); void parse_client_statement PROTO ((FILE *, struct interface_info *, struct client_config *)); int parse_X PROTO ((FILE *, u_int8_t *, int)); int parse_option_list PROTO ((FILE *, u_int8_t *)); void parse_interface_declaration PROTO ((FILE *, struct client_config *)); struct interface_info *interface_or_dummy PROTO ((char *)); void make_client_state PROTO ((struct interface_info *)); void make_client_config PROTO ((struct interface_info *, struct client_config *)); void parse_client_lease_statement PROTO ((FILE *, int)); void parse_client_lease_declaration PROTO ((FILE *, struct client_lease *, struct interface_info **)); struct option *parse_option_decl PROTO ((FILE *, struct option_data *)); void parse_string_list PROTO ((FILE *, struct string_list **, int)); int parse_ip_addr PROTO ((FILE *, struct iaddr *)); void parse_reject_statement PROTO ((FILE *, struct client_config *)); /* dhcrelay.c */ void relay PROTO ((struct interface_info *, struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *)); /* icmp.c */ void icmp_startup PROTO ((int, void (*) PROTO ((struct iaddr, u_int8_t *, int)))); int icmp_echorequest PROTO ((struct iaddr *)); void icmp_echoreply PROTO ((struct protocol *)); /* dns.c */ void dns_startup PROTO ((void)); int ns_inaddr_lookup PROTO ((u_int16_t, struct iaddr)); void dns_packet PROTO ((struct protocol *)); /* resolv.c */ extern char path_resolv_conf []; struct name_server *name_servers; struct domain_search_list *domains; void read_resolv_conf PROTO ((TIME)); struct sockaddr_in *pick_name_server PROTO ((void)); /* inet_addr.c */ #ifdef NEED_INET_ATON int inet_aton PROTO ((const char *, struct in_addr *)); #endif /* sysconf.c */ void sysconf_startup PROTO ((void (*) (struct sysconf_header *, void *))); void sysconf_restart PROTO ((void *)); void sysconf_message PROTO ((struct protocol *proto)); Index: head/contrib/isc-dhcp/includes/netinet/if_ether.h =================================================================== --- head/contrib/isc-dhcp/includes/netinet/if_ether.h (revision 62104) +++ head/contrib/isc-dhcp/includes/netinet/if_ether.h (revision 62105) @@ -1,74 +1,75 @@ /* $NetBSD: if_ether.h,v 1.20 1995/06/12 00:47:27 mycroft Exp $ */ /* * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)if_ether.h 8.1 (Berkeley) 6/10/93 */ /* * Ethernet address - 6 octets * this is only used by the ethers(3) functions. */ struct ether_addr { u_int8_t ether_addr_octet[6]; }; /* * Structure of a 10Mb/s Ethernet header. */ #define ETHER_ADDR_LEN 6 struct ether_header { u_int8_t ether_dhost[ETHER_ADDR_LEN]; u_int8_t ether_shost[ETHER_ADDR_LEN]; u_int16_t ether_type; }; #define ETHERTYPE_PUP 0x0200 /* PUP protocol */ #define ETHERTYPE_IP 0x0800 /* IP protocol */ #define ETHERTYPE_ARP 0x0806 /* address resolution protocol */ #define ETHERTYPE_REVARP 0x8035 /* reverse addr resolution protocol */ /* * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have * (type-ETHERTYPE_TRAIL)*512 bytes of data followed * by an ETHER type (as given above) and then the (variable-length) header. */ #define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ #define ETHERTYPE_NTRAILER 16 #define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */ #define ETHERMTU 1500 #define ETHERMIN (60-14) +#define ETHER_HEADER_SIZE (ETHER_ADDR_LEN * 2 + sizeof (u_int16_t)) Index: head/contrib/isc-dhcp/includes/osdep.h =================================================================== --- head/contrib/isc-dhcp/includes/osdep.h (revision 62104) +++ head/contrib/isc-dhcp/includes/osdep.h (revision 62105) @@ -1,292 +1,294 @@ /* osdep.h Operating system dependencies... */ /* * Copyright (c) 1996, 1997, 1998, 1999 The Internet Software Consortium. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of The Internet Software Consortium nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * * This software was written for the Internet Software Consortium by Ted Lemon * under a contract with Vixie Laboratories. */ #include "site.h" /* Porting:: If you add a new network API, you must add a check for it below: */ #if !defined (USE_SOCKETS) && \ !defined (USE_SOCKET_SEND) && \ !defined (USE_SOCKET_RECEIVE) && \ !defined (USE_RAW_SOCKETS) && \ !defined (USE_RAW_SEND) && \ !defined (USE_SOCKET_RECEIVE) && \ !defined (USE_BPF) && \ !defined (USE_BPF_SEND) && \ !defined (USE_BPF_RECEIVE) && \ !defined (USE_LPF) && \ !defined (USE_LPF_SEND) && \ !defined (USE_LPF_RECEIVE) && \ !defined (USE_NIT) && \ !defined (USE_NIT_SEND) && \ !defined (USE_NIT_RECEIVE) && \ !defined (USR_DLPI_SEND) && \ !defined (USE_DLPI_RECEIVE) # define USE_DEFAULT_NETWORK #endif /* Porting:: If you add a new system configuration file, include it here: */ #if defined (sun) # if defined (__svr4__) || defined (__SVR4) # include "cf/sunos5-5.h" # else # include "cf/sunos4.h" # endif #endif #ifdef aix # include "cf/aix.h" #endif #ifdef bsdi # include "cf/bsdos.h" #endif #ifdef __NetBSD__ # include "cf/netbsd.h" #endif #ifdef __FreeBSD__ # include "cf/freebsd.h" #endif #if defined (__osf__) && defined (__alpha) # include "cf/alphaosf.h" #endif #ifdef ultrix # include "cf/ultrix.h" #endif #ifdef linux # include "cf/linux.h" #endif #ifdef SCO # include "cf/sco.h" #endif -#ifdef hpux +#if defined (hpux) || defined (__hpux) # include "cf/hpux.h" #endif #ifdef __QNX__ # include "cf/qnx.h" #endif #ifdef __CYGWIN32__ # include "cf/cygwin32.h" #endif #ifdef __APPLE__ # include "cf/rhapsody.h" #else # if defined (NeXT) # include "cf/nextstep.h" # endif #endif #if defined(IRIX) || defined(__sgi) # include "cf/irix.h" #endif #if !defined (TIME_MAX) # define TIME_MAX 2147483647 #endif /* Porting:: If you add a new network API, and have it set up so that it can be used for sending or receiving, but doesn't have to be used for both, then set up an ifdef like the ones below: */ #ifdef USE_SOCKETS # define USE_SOCKET_SEND # define USE_SOCKET_RECEIVE #endif #ifdef USE_RAW_SOCKETS # define USE_RAW_SEND # define USE_SOCKET_RECEIVE #endif #ifdef USE_BPF # define USE_BPF_SEND # define USE_BPF_RECEIVE #endif #ifdef USE_LPF # define USE_LPF_SEND # define USE_LPF_RECEIVE #endif #ifdef USE_NIT # define USE_NIT_SEND # define USE_NIT_RECEIVE #endif #ifdef USE_DLPI # define USE_DLPI_SEND # define USE_DLPI_RECEIVE #endif #ifdef USE_UPF # define USE_UPF_SEND # define USE_UPF_RECEIVE #endif /* Porting:: If you add support for sending packets directly out an interface, and your support does not do ARP or routing, you must use a fallback mechanism to deal with packets that need to be sent to routers. Currently, all low-level packet interfaces use BSD sockets as a fallback. */ #if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \ defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || defined (USE_LPF_SEND) # define USE_SOCKET_FALLBACK # define USE_FALLBACK #endif /* Porting:: If you add support for sending packets directly out an interface and need to be able to assemble packets, add the USE_XXX_SEND definition for your interface to the list tested below. */ #if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \ defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \ defined (USE_DLPI_SEND) || defined (USE_LPF_SEND) # define PACKET_ASSEMBLY #endif /* Porting:: If you add support for receiving packets directly from an interface and need to be able to decode raw packets, add the USE_XXX_RECEIVE definition for your interface to the list tested below. */ #if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \ defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \ - defined (USE_DLPI_RECEIVE) || defined (USE_LPF_RECEIVE) + defined (USE_DLPI_RECEIVE) || \ + defined (USE_LPF_SEND) || \ + (defined (USE_SOCKET_SEND) && defined (SO_BINDTODEVICE)) # define PACKET_DECODING #endif /* If we don't have a DLPI packet filter, we have to filter in userland. Probably not worth doing, actually. */ #if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD) # define USERLAND_FILTER #endif /* jmp_buf is assumed to be a struct unless otherwise defined in the system header. */ #ifndef jbp_decl # define jbp_decl(x) jmp_buf *x #endif #ifndef jref # define jref(x) (&(x)) #endif #ifndef jdref # define jdref(x) (*(x)) #endif #ifndef jrefproto # define jrefproto jmp_buf * #endif #ifndef BPF_FORMAT # define BPF_FORMAT "/dev/bpf%d" #endif #if defined (IFF_POINTOPOINT) && !defined (HAVE_IFF_POINTOPOINT) # define HAVE_IFF_POINTOPOINT #endif #if defined (AF_LINK) && !defined (HAVE_AF_LINK) # define HAVE_AF_LINK #endif #if defined (ARPHRD_TUNNEL) && !defined (HAVE_ARPHRD_TUNNEL) # define HAVE_ARPHRD_TUNNEL #endif #if defined (ARPHRD_LOOPBACK) && !defined (HAVE_ARPHRD_LOOPBACK) # define HAVE_ARPHRD_LOOPBACK #endif #if defined (ARPHRD_ROSE) && !defined (HAVE_ARPHRD_ROSE) # define HAVE_ARPHRD_ROSE #endif #if defined (ARPHRD_IEEE802) && !defined (HAVE_ARPHRD_IEEE802) # define HAVE_ARPHRD_IEEE802 #endif #if defined (ARPHRD_FDDI) && !defined (HAVE_ARPHRD_FDDI) # define HAVE_ARPHRD_FDDI #endif #if defined (ARPHRD_AX25) && !defined (HAVE_ARPHRD_AX25) # define HAVE_ARPHRD_AX25 #endif #if defined (ARPHRD_NETROM) && !defined (HAVE_ARPHRD_NETROM) # define HAVE_ARPHRD_NETROM #endif #if defined (ARPHRD_METRICOM) && !defined (HAVE_ARPHRD_METRICOM) # define HAVE_ARPHRD_METRICOM #endif #if defined (SO_BINDTODEVICE) && !defined (HAVE_SO_BINDTODEVICE) # define HAVE_SO_BINDTODEVICE #endif #if defined (SIOCGIFHWADDR) && !defined (HAVE_SIOCGIFHWADDR) # define HAVE_SIOCGIFHWADDR #endif #if defined (AF_LINK) && !defined (HAVE_AF_LINK) # define HAVE_AF_LINK #endif Index: head/contrib/isc-dhcp/includes/version.h =================================================================== --- head/contrib/isc-dhcp/includes/version.h (revision 62104) +++ head/contrib/isc-dhcp/includes/version.h (revision 62105) @@ -1,3 +1,3 @@ /* Current version of ISC DHCP Distribution. */ -#define DHCP_VERSION "2.0" +#define DHCP_VERSION "2.0pl1"