# HG changeset patch # User Michael Schloh von Bennewitz # Date 1347901503 -7200 # Node ID 8402f4294f859ac4476cf68c817aa1fbd783c131 # Parent d612d08c0455a3a936bea8d71c48d198e4176041 Import package vendor original spec for necessary manipulations. diff -r d612d08c0455 -r 8402f4294f85 dhcpd/dhcpd.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dhcpd/dhcpd.conf Mon Sep 17 19:05:03 2012 +0200 @@ -0,0 +1,88 @@ +## +## dhcpd.conf -- ISC DHCP Daemon Configuration +## + +# Options applicable to all subnets +option domain-name "example.com"; +authoritative; +default-lease-time 600; +max-lease-time 7200; +ddns-update-style none; +use-host-decl-names on; + +# Define some non-standard options +option freebsd-swappath code 128 = text; +option freebsd-rootopts code 130 = text; +option freebsd-swapopts code 131 = text; + +# Test drive using loopback +subnet 127.0.0.0 netmask 255.0.0.0 { +} + +# Define a particular sample subnet +subnet 192.168.1.0 netmask 255.255.255.0 { + + # Options applicable to this particular subnet + option broadcast-address 192.168.1.255; + option subnet-mask 255.255.255.0; + option routers 192.168.1.1; + option domain-name-servers 192.168.1.2; + + # Dynamic DNS (DDNS) Updating + ddns-updates off; + ddns-domainname "example.com"; + ddns-rev-domainname "in-addr.arpa"; + + # Pool of known clients (i.e. MAC known but IP not specified) + pool { + range 192.168.1.100 192.168.1.149; + min-lease-time 600; # 10min + default-lease-time 43200; # 12hour + max-lease-time 86400; # 24hour + deny unknown clients; + } + + # Pool of unknown clients (i.e. MAC not known) + pool { + range 192.168.1.150 192.168.1.199; + min-lease-time 300; # 5min + default-lease-time 3600; # 1hour + max-lease-time 10800; # 3hour + allow unknown clients; + } +} + +# The list of clients we explicitly configure +group { + # Just assign a fixed IP address for machine "quux1" + host quux1 { + hardware ethernet 01:02:03:00:00:01; + fixed-address 192.168.1.3; + } + + # Provide full boot information for a FreeBSD diskless client "quux2": + # On the server, create a 32MB swapfile /dlc/fs/swap/swap.192.168.1.4 + # with `dd if=/dev/zero of=swap.192.168.1.4 bs=1m count=32' and the + # filesystem /dlc/fs/quux2 with `cd /usr/src; make buildworld; make + # installworld DESTDIR=/dlc/fs/quux2'. Then use Etherboot for booting. + host quux2 { + hardware ethernet 01:02:03:00:00:02; + fixed-address 192.168.1.4; + next-server 192.168.1.2; + option tftp-server-name "192.168.1.2"; + filename "kernel.quux"; + always-reply-rfc1048 on; + option root-path "192.168.1.2:/dlc/fs/quux2"; + option freebsd-rootopts "rw,noatime"; + option swap-server 192.168.1.2; + option freebsd-swappath "192.168.1.2:/dlc/fs/swap"; + option freebsd-swapopts "sw"; + } +} + +# The list of clients we know, but which get IP addresses from pool +group { + host quux3 { hardware ethernet 01:02:03:00:00:03; } + host quux4 { hardware ethernet 01:02:03:00:00:04; } +} + diff -r d612d08c0455 -r 8402f4294f85 dhcpd/dhcpd.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dhcpd/dhcpd.patch Mon Sep 17 19:05:03 2012 +0200 @@ -0,0 +1,13 @@ +Index: common/bpf.c +--- common/bpf.c.orig 2009-11-20 02:48:59.000000000 +0100 ++++ common/bpf.c 2010-11-27 09:53:47.000000000 +0100 +@@ -580,6 +580,9 @@ + */ + switch (sa->sdl_type) { + case IFT_ETHER: ++#ifdef IFT_L2VLAN ++ case IFT_L2VLAN: ++#endif + hw->hlen = sa->sdl_alen + 1; + hw->hbuf[0] = HTYPE_ETHER; + memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen); diff -r d612d08c0455 -r 8402f4294f85 dhcpd/dhcpd.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dhcpd/dhcpd.spec Mon Sep 17 19:05:03 2012 +0200 @@ -0,0 +1,167 @@ +## +## dhcpd.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2011 OpenPKG Foundation e.V. +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## 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. +## + +# package version +%define V_opkg 4.2.3 +%define V_dist 4.2.3 + +# package information +Name: dhcpd +Summary: DHCP Daemon +URL: http://www.isc.org/products/DHCP/ +Vendor: Internet Software Consortium +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: BASE +Group: DHCP +License: ISC/BSD +Version: %{V_opkg} +Release: 20111211 + +# package options +%option with_fsl yes + +# list of sources +Source0: ftp://ftp.isc.org/isc/dhcp/dhcp-%{V_dist}/dhcp-%{V_dist}.tar.gz +Source1: dhcpd.conf +Source2: rc.dhcpd +Source3: fsl.dhcpd +Patch0: dhcpd.patch + +# build information +BuildPreReq: OpenPKG, openpkg >= 20100101 +PreReq: OpenPKG, openpkg >= 20100101 +BuildPreReq: openssl +PreReq: openssl +%if "%{with_fsl}" == "yes" +BuildPreReq: fsl +PreReq: fsl +%endif + +%description + This is the ISC DHCP daemon reference implementation. + +%track + prog dhcpd = { + version = %{V_dist} + url = ftp://ftp.isc.org/isc/dhcp/ + regex = dhcp-(\d+\.\d+\.\d+) + } + +%prep + %setup -q -n dhcp-%{V_dist} + %patch -p0 + +%build + # configure program + %{l_shtool} subst \ + -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_PID[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/run/dhcpd.pid";' \ + -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_DB[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/db/dhcpd.leases";' \ + -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_CONF[^"]*\).*;\1 "%{l_prefix}/etc/dhcpd/dhcpd.conf";' \ + includes/site.h + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ + CPPFLAGS="%{l_cppflags} -DNOMINUM" \ + LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ + LIBS="%{l_fsl_libs}" \ + ./configure \ + --prefix=%{l_prefix} \ + --mandir=%{l_prefix}/man \ + --sysconfdir=%{l_prefix}/etc/dhcpd \ + --localstatedir=%{l_prefix}/var/dhcpd \ + --with-srv-lease-file=%{l_prefix}/var/dhcpd/db/dhcpd.leases \ + --with-cli-lease-file=%{l_prefix}/var/dhcpd/db/dhclient.leases \ + --with-srv-pid-file=%{l_prefix}/var/dhcpd/run/dhcpd.pid \ + --with-cli-pid-file=%{l_prefix}/var/dhcpd/run/dhclient.pid \ + --with-relay-pid-file=%{l_prefix}/var/dhcpd/run/dhrelay.pid \ + --disable-dhcpv6 + + # build program + %{l_make} %{l_mflags} + +%install + # install program + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT + + # install default configuration + %{l_shtool} install -c -m 644 \ + %{SOURCE dhcpd.conf} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/dhcpd/dhcpd.conf + + # post-adjust and strip down installation + rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dhclient-script + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/dhclient-script.8 + strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true + + # install run-command script + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE rc.dhcpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # install OSSP fsl configuration + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + %{SOURCE fsl.dhcpd} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ + + # create run-time directories + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/db \ + $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/run \ + $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/log + + # determine installation files + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%config %{l_prefix}/etc/fsl/fsl.dhcpd' \ + '%config %{l_prefix}/etc/dhcpd/*' + +%files -f files + +%clean + +%post + if [ $1 -eq 1 ]; then + # display final hints on initial installation + ( echo "Before starting DHCP daemon, please set the configuration variable" + echo "\"dhcpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the" + echo "used network interface." + ) | %{l_rpmtool} msg -b -t notice + fi + + # after upgrade, restart service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} dhcpd status 2>/dev/null` + [ ".$dhcpd_active" = .yes ] && %{l_rc} dhcpd restart + exit 0 + +%preun + # before erase, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} dhcpd stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/dhcpd/db/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/dhcpd/run/* >/dev/null 2>&1 || true + exit 0 + diff -r d612d08c0455 -r 8402f4294f85 dhcpd/fsl.dhcpd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dhcpd/fsl.dhcpd Mon Sep 17 19:05:03 2012 +0200 @@ -0,0 +1,52 @@ +## +## fsl.dhcpd -- OSSP fsl configuration +## + +ident (dhcpd.*)/.+ q{ + prefix( + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " + ) + -> { + debug: file( + path="@l_prefix@/var/dhcpd/log/dhcpd.log", + perm=0644 + ) + } +}; + +ident (dhclient.*)/.+ q{ + prefix( + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " + ) + -> { + debug: file( + path="@l_prefix@/var/dhcpd/log/dhclient.log", + perm=0644 + ) + } +}; + +ident (dhrelay.*)/.+ q{ + prefix( + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " + ) + -> { + debug: file( + path="@l_prefix@/var/dhcpd/log/dhrelay.log", + perm=0644 + ) + } +}; + +ident (omshell.*)/.+ q{ + prefix( + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " + ) + -> { + debug: file( + path="@l_prefix@/var/dhcpd/log/omshell.log", + perm=0644 + ) + } +}; + diff -r d612d08c0455 -r 8402f4294f85 dhcpd/rc.dhcpd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dhcpd/rc.dhcpd Mon Sep 17 19:05:03 2012 +0200 @@ -0,0 +1,94 @@ +#!@l_prefix@/bin/openpkg rc +## +## rc.dhcpd -- Run-Commands +## + +%config + dhcpd_enable="$openpkg_rc_def" + dhcpd_flags="-q" + dhcpd_if="" + dhcpd_port="67" + dhcpd_log_prolog="true" + dhcpd_log_epilog="true" + dhcpd_log_numfiles="10" + dhcpd_log_minsize="1M" + dhcpd_log_complevel="9" + +%common + dhcpd_pidfile="@l_prefix@/var/dhcpd/run/dhcpd.pid" + dhcpd_leases="@l_prefix@/var/dhcpd/db/dhcpd.leases" + dhcpd_signal () { + if [ ! -f $dhcpd_pidfile ]; then return 1; fi + kill -$1 `cat $dhcpd_pidfile` + } + dhcpd_start () { + if [ ! -f $dhcpd_leases ]; then + touch $dhcpd_leases + chmod 644 $dhcpd_leases + chown @l_susr@:@l_mgrp@ $dhcpd_leases + fi + local cmd="@l_prefix@/sbin/dhcpd" + cmd="$cmd -f" + cmd="$cmd $dhcpd_flags" + echo ".$dhcpd_flags" | grep -- -p >/dev/null 2>&1 + if [ $? -ne 0 -a ".$dhcpd_port" != . ]; then + cmd="$cmd -p $dhcpd_port" + fi + if [ $# -gt 0 ]; then + cmd="$cmd $@" + fi + ( eval "nohup $cmd /dev/null 2>&1 &" + echo $! >$dhcpd_pidfile + ) >/dev/null 2>&1 + } + +%status -u @l_susr@ -o + dhcpd_usable="unknown" + dhcpd_active="no" + @l_prefix@/sbin/dhcpd -q -t || dhcpd_usable="no" + [ ".$dhcpd_if" = . ] && dhcpd_usable="no" + rcService dhcpd enable yes && \ + dhcpd_signal 0 && dhcpd_active="yes" + echo "dhcpd_enable=\"$dhcpd_enable\"" + echo "dhcpd_usable=\"$dhcpd_usable\"" + echo "dhcpd_active=\"$dhcpd_active\"" + +%start -u @l_susr@ + rcService dhcpd enable yes || exit 0 + rcService dhcpd usable no && exit 0 + rcService dhcpd active yes && exit 0 + dhcpd_start $dhcpd_if + +%stop -u @l_susr@ + rcService dhcpd enable yes || exit 0 + rcService dhcpd active no && exit 0 + dhcpd_signal TERM + sleep 2 + rm -f $dhcpd_pidfile 2>/dev/null || true + +%restart -u @l_susr@ + rcService dhcpd enable yes || exit 0 + rcService dhcpd active no && exit 0 + rc dhcpd stop start + +%reload -u @l_susr@ + rcService dhcpd enable yes || exit 0 + dhcpd_signal HUP + +%daily -u @l_susr@ + rcService dhcpd enable yes || exit 0 + rcTmp -i + hintfile=`rcTmp -f -n hint` + for tool in dhcpd dhclient dhrelay omshell; do + shtool rotate -f \ + -n $dhcpd_log_numfiles -s $dhcpd_log_minsize -d \ + -z $dhcpd_log_complevel -m 644 -o @l_susr@ -g @l_mgrp@ \ + -P "$dhcpd_log_prolog" \ + -E "$dhcpd_log_epilog; echo 1 >$hintfile" \ + @l_prefix@/var/dhcpd/log/$tool.log + done + if [ -s $hintfile ]; then + rc dhcpd restart + fi + rcTmp -k +