Mon, 17 Sep 2012 19:05:03 +0200
Import package vendor original spec for necessary manipulations.
dhcpd/dhcpd.conf | file | annotate | diff | comparison | revisions | |
dhcpd/dhcpd.patch | file | annotate | diff | comparison | revisions | |
dhcpd/dhcpd.spec | file | annotate | diff | comparison | revisions | |
dhcpd/fsl.dhcpd | file | annotate | diff | comparison | revisions | |
dhcpd/rc.dhcpd | file | annotate | diff | comparison | revisions |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dhcpd/dhcpd.conf Mon Sep 17 19:05:03 2012 +0200 1.3 @@ -0,0 +1,88 @@ 1.4 +## 1.5 +## dhcpd.conf -- ISC DHCP Daemon Configuration 1.6 +## 1.7 + 1.8 +# Options applicable to all subnets 1.9 +option domain-name "example.com"; 1.10 +authoritative; 1.11 +default-lease-time 600; 1.12 +max-lease-time 7200; 1.13 +ddns-update-style none; 1.14 +use-host-decl-names on; 1.15 + 1.16 +# Define some non-standard options 1.17 +option freebsd-swappath code 128 = text; 1.18 +option freebsd-rootopts code 130 = text; 1.19 +option freebsd-swapopts code 131 = text; 1.20 + 1.21 +# Test drive using loopback 1.22 +subnet 127.0.0.0 netmask 255.0.0.0 { 1.23 +} 1.24 + 1.25 +# Define a particular sample subnet 1.26 +subnet 192.168.1.0 netmask 255.255.255.0 { 1.27 + 1.28 + # Options applicable to this particular subnet 1.29 + option broadcast-address 192.168.1.255; 1.30 + option subnet-mask 255.255.255.0; 1.31 + option routers 192.168.1.1; 1.32 + option domain-name-servers 192.168.1.2; 1.33 + 1.34 + # Dynamic DNS (DDNS) Updating 1.35 + ddns-updates off; 1.36 + ddns-domainname "example.com"; 1.37 + ddns-rev-domainname "in-addr.arpa"; 1.38 + 1.39 + # Pool of known clients (i.e. MAC known but IP not specified) 1.40 + pool { 1.41 + range 192.168.1.100 192.168.1.149; 1.42 + min-lease-time 600; # 10min 1.43 + default-lease-time 43200; # 12hour 1.44 + max-lease-time 86400; # 24hour 1.45 + deny unknown clients; 1.46 + } 1.47 + 1.48 + # Pool of unknown clients (i.e. MAC not known) 1.49 + pool { 1.50 + range 192.168.1.150 192.168.1.199; 1.51 + min-lease-time 300; # 5min 1.52 + default-lease-time 3600; # 1hour 1.53 + max-lease-time 10800; # 3hour 1.54 + allow unknown clients; 1.55 + } 1.56 +} 1.57 + 1.58 +# The list of clients we explicitly configure 1.59 +group { 1.60 + # Just assign a fixed IP address for machine "quux1" 1.61 + host quux1 { 1.62 + hardware ethernet 01:02:03:00:00:01; 1.63 + fixed-address 192.168.1.3; 1.64 + } 1.65 + 1.66 + # Provide full boot information for a FreeBSD diskless client "quux2": 1.67 + # On the server, create a 32MB swapfile /dlc/fs/swap/swap.192.168.1.4 1.68 + # with `dd if=/dev/zero of=swap.192.168.1.4 bs=1m count=32' and the 1.69 + # filesystem /dlc/fs/quux2 with `cd /usr/src; make buildworld; make 1.70 + # installworld DESTDIR=/dlc/fs/quux2'. Then use Etherboot for booting. 1.71 + host quux2 { 1.72 + hardware ethernet 01:02:03:00:00:02; 1.73 + fixed-address 192.168.1.4; 1.74 + next-server 192.168.1.2; 1.75 + option tftp-server-name "192.168.1.2"; 1.76 + filename "kernel.quux"; 1.77 + always-reply-rfc1048 on; 1.78 + option root-path "192.168.1.2:/dlc/fs/quux2"; 1.79 + option freebsd-rootopts "rw,noatime"; 1.80 + option swap-server 192.168.1.2; 1.81 + option freebsd-swappath "192.168.1.2:/dlc/fs/swap"; 1.82 + option freebsd-swapopts "sw"; 1.83 + } 1.84 +} 1.85 + 1.86 +# The list of clients we know, but which get IP addresses from pool 1.87 +group { 1.88 + host quux3 { hardware ethernet 01:02:03:00:00:03; } 1.89 + host quux4 { hardware ethernet 01:02:03:00:00:04; } 1.90 +} 1.91 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/dhcpd/dhcpd.patch Mon Sep 17 19:05:03 2012 +0200 2.3 @@ -0,0 +1,13 @@ 2.4 +Index: common/bpf.c 2.5 +--- common/bpf.c.orig 2009-11-20 02:48:59.000000000 +0100 2.6 ++++ common/bpf.c 2010-11-27 09:53:47.000000000 +0100 2.7 +@@ -580,6 +580,9 @@ 2.8 + */ 2.9 + switch (sa->sdl_type) { 2.10 + case IFT_ETHER: 2.11 ++#ifdef IFT_L2VLAN 2.12 ++ case IFT_L2VLAN: 2.13 ++#endif 2.14 + hw->hlen = sa->sdl_alen + 1; 2.15 + hw->hbuf[0] = HTYPE_ETHER; 2.16 + memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen);
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/dhcpd/dhcpd.spec Mon Sep 17 19:05:03 2012 +0200 3.3 @@ -0,0 +1,167 @@ 3.4 +## 3.5 +## dhcpd.spec -- OpenPKG RPM Package Specification 3.6 +## Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/> 3.7 +## 3.8 +## Permission to use, copy, modify, and distribute this software for 3.9 +## any purpose with or without fee is hereby granted, provided that 3.10 +## the above copyright notice and this permission notice appear in all 3.11 +## copies. 3.12 +## 3.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 3.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 3.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 3.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 3.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 3.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 3.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 3.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 3.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3.24 +## SUCH DAMAGE. 3.25 +## 3.26 + 3.27 +# package version 3.28 +%define V_opkg 4.2.3 3.29 +%define V_dist 4.2.3 3.30 + 3.31 +# package information 3.32 +Name: dhcpd 3.33 +Summary: DHCP Daemon 3.34 +URL: http://www.isc.org/products/DHCP/ 3.35 +Vendor: Internet Software Consortium 3.36 +Packager: OpenPKG Foundation e.V. 3.37 +Distribution: OpenPKG Community 3.38 +Class: BASE 3.39 +Group: DHCP 3.40 +License: ISC/BSD 3.41 +Version: %{V_opkg} 3.42 +Release: 20111211 3.43 + 3.44 +# package options 3.45 +%option with_fsl yes 3.46 + 3.47 +# list of sources 3.48 +Source0: ftp://ftp.isc.org/isc/dhcp/dhcp-%{V_dist}/dhcp-%{V_dist}.tar.gz 3.49 +Source1: dhcpd.conf 3.50 +Source2: rc.dhcpd 3.51 +Source3: fsl.dhcpd 3.52 +Patch0: dhcpd.patch 3.53 + 3.54 +# build information 3.55 +BuildPreReq: OpenPKG, openpkg >= 20100101 3.56 +PreReq: OpenPKG, openpkg >= 20100101 3.57 +BuildPreReq: openssl 3.58 +PreReq: openssl 3.59 +%if "%{with_fsl}" == "yes" 3.60 +BuildPreReq: fsl 3.61 +PreReq: fsl 3.62 +%endif 3.63 + 3.64 +%description 3.65 + This is the ISC DHCP daemon reference implementation. 3.66 + 3.67 +%track 3.68 + prog dhcpd = { 3.69 + version = %{V_dist} 3.70 + url = ftp://ftp.isc.org/isc/dhcp/ 3.71 + regex = dhcp-(\d+\.\d+\.\d+) 3.72 + } 3.73 + 3.74 +%prep 3.75 + %setup -q -n dhcp-%{V_dist} 3.76 + %patch -p0 3.77 + 3.78 +%build 3.79 + # configure program 3.80 + %{l_shtool} subst \ 3.81 + -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_PID[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/run/dhcpd.pid";' \ 3.82 + -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_DB[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/db/dhcpd.leases";' \ 3.83 + -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_CONF[^"]*\).*;\1 "%{l_prefix}/etc/dhcpd/dhcpd.conf";' \ 3.84 + includes/site.h 3.85 + CC="%{l_cc}" \ 3.86 + CFLAGS="%{l_cflags -O}" \ 3.87 + CPPFLAGS="%{l_cppflags} -DNOMINUM" \ 3.88 + LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ 3.89 + LIBS="%{l_fsl_libs}" \ 3.90 + ./configure \ 3.91 + --prefix=%{l_prefix} \ 3.92 + --mandir=%{l_prefix}/man \ 3.93 + --sysconfdir=%{l_prefix}/etc/dhcpd \ 3.94 + --localstatedir=%{l_prefix}/var/dhcpd \ 3.95 + --with-srv-lease-file=%{l_prefix}/var/dhcpd/db/dhcpd.leases \ 3.96 + --with-cli-lease-file=%{l_prefix}/var/dhcpd/db/dhclient.leases \ 3.97 + --with-srv-pid-file=%{l_prefix}/var/dhcpd/run/dhcpd.pid \ 3.98 + --with-cli-pid-file=%{l_prefix}/var/dhcpd/run/dhclient.pid \ 3.99 + --with-relay-pid-file=%{l_prefix}/var/dhcpd/run/dhrelay.pid \ 3.100 + --disable-dhcpv6 3.101 + 3.102 + # build program 3.103 + %{l_make} %{l_mflags} 3.104 + 3.105 +%install 3.106 + # install program 3.107 + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT 3.108 + 3.109 + # install default configuration 3.110 + %{l_shtool} install -c -m 644 \ 3.111 + %{SOURCE dhcpd.conf} \ 3.112 + $RPM_BUILD_ROOT%{l_prefix}/etc/dhcpd/dhcpd.conf 3.113 + 3.114 + # post-adjust and strip down installation 3.115 + rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dhclient-script 3.116 + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/dhclient-script.8 3.117 + strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true 3.118 + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true 3.119 + 3.120 + # install run-command script 3.121 + %{l_shtool} mkdir -f -p -m 755 \ 3.122 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 3.123 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 3.124 + %{SOURCE rc.dhcpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 3.125 + 3.126 + # install OSSP fsl configuration 3.127 + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 3.128 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 3.129 + %{SOURCE fsl.dhcpd} \ 3.130 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 3.131 + 3.132 + # create run-time directories 3.133 + %{l_shtool} mkdir -f -p -m 755 \ 3.134 + $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/db \ 3.135 + $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/run \ 3.136 + $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/log 3.137 + 3.138 + # determine installation files 3.139 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 3.140 + %{l_files_std} \ 3.141 + '%config %{l_prefix}/etc/fsl/fsl.dhcpd' \ 3.142 + '%config %{l_prefix}/etc/dhcpd/*' 3.143 + 3.144 +%files -f files 3.145 + 3.146 +%clean 3.147 + 3.148 +%post 3.149 + if [ $1 -eq 1 ]; then 3.150 + # display final hints on initial installation 3.151 + ( echo "Before starting DHCP daemon, please set the configuration variable" 3.152 + echo "\"dhcpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the" 3.153 + echo "used network interface." 3.154 + ) | %{l_rpmtool} msg -b -t notice 3.155 + fi 3.156 + 3.157 + # after upgrade, restart service 3.158 + [ $1 -eq 2 ] || exit 0 3.159 + eval `%{l_rc} dhcpd status 2>/dev/null` 3.160 + [ ".$dhcpd_active" = .yes ] && %{l_rc} dhcpd restart 3.161 + exit 0 3.162 + 3.163 +%preun 3.164 + # before erase, stop service and remove log files 3.165 + [ $1 -eq 0 ] || exit 0 3.166 + %{l_rc} dhcpd stop 2>/dev/null 3.167 + rm -f $RPM_INSTALL_PREFIX/var/dhcpd/db/* >/dev/null 2>&1 || true 3.168 + rm -f $RPM_INSTALL_PREFIX/var/dhcpd/run/* >/dev/null 2>&1 || true 3.169 + exit 0 3.170 +
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/dhcpd/fsl.dhcpd Mon Sep 17 19:05:03 2012 +0200 4.3 @@ -0,0 +1,52 @@ 4.4 +## 4.5 +## fsl.dhcpd -- OSSP fsl configuration 4.6 +## 4.7 + 4.8 +ident (dhcpd.*)/.+ q{ 4.9 + prefix( 4.10 + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " 4.11 + ) 4.12 + -> { 4.13 + debug: file( 4.14 + path="@l_prefix@/var/dhcpd/log/dhcpd.log", 4.15 + perm=0644 4.16 + ) 4.17 + } 4.18 +}; 4.19 + 4.20 +ident (dhclient.*)/.+ q{ 4.21 + prefix( 4.22 + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " 4.23 + ) 4.24 + -> { 4.25 + debug: file( 4.26 + path="@l_prefix@/var/dhcpd/log/dhclient.log", 4.27 + perm=0644 4.28 + ) 4.29 + } 4.30 +}; 4.31 + 4.32 +ident (dhrelay.*)/.+ q{ 4.33 + prefix( 4.34 + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " 4.35 + ) 4.36 + -> { 4.37 + debug: file( 4.38 + path="@l_prefix@/var/dhcpd/log/dhrelay.log", 4.39 + perm=0644 4.40 + ) 4.41 + } 4.42 +}; 4.43 + 4.44 +ident (omshell.*)/.+ q{ 4.45 + prefix( 4.46 + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " 4.47 + ) 4.48 + -> { 4.49 + debug: file( 4.50 + path="@l_prefix@/var/dhcpd/log/omshell.log", 4.51 + perm=0644 4.52 + ) 4.53 + } 4.54 +}; 4.55 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/dhcpd/rc.dhcpd Mon Sep 17 19:05:03 2012 +0200 5.3 @@ -0,0 +1,94 @@ 5.4 +#!@l_prefix@/bin/openpkg rc 5.5 +## 5.6 +## rc.dhcpd -- Run-Commands 5.7 +## 5.8 + 5.9 +%config 5.10 + dhcpd_enable="$openpkg_rc_def" 5.11 + dhcpd_flags="-q" 5.12 + dhcpd_if="" 5.13 + dhcpd_port="67" 5.14 + dhcpd_log_prolog="true" 5.15 + dhcpd_log_epilog="true" 5.16 + dhcpd_log_numfiles="10" 5.17 + dhcpd_log_minsize="1M" 5.18 + dhcpd_log_complevel="9" 5.19 + 5.20 +%common 5.21 + dhcpd_pidfile="@l_prefix@/var/dhcpd/run/dhcpd.pid" 5.22 + dhcpd_leases="@l_prefix@/var/dhcpd/db/dhcpd.leases" 5.23 + dhcpd_signal () { 5.24 + if [ ! -f $dhcpd_pidfile ]; then return 1; fi 5.25 + kill -$1 `cat $dhcpd_pidfile` 5.26 + } 5.27 + dhcpd_start () { 5.28 + if [ ! -f $dhcpd_leases ]; then 5.29 + touch $dhcpd_leases 5.30 + chmod 644 $dhcpd_leases 5.31 + chown @l_susr@:@l_mgrp@ $dhcpd_leases 5.32 + fi 5.33 + local cmd="@l_prefix@/sbin/dhcpd" 5.34 + cmd="$cmd -f" 5.35 + cmd="$cmd $dhcpd_flags" 5.36 + echo ".$dhcpd_flags" | grep -- -p >/dev/null 2>&1 5.37 + if [ $? -ne 0 -a ".$dhcpd_port" != . ]; then 5.38 + cmd="$cmd -p $dhcpd_port" 5.39 + fi 5.40 + if [ $# -gt 0 ]; then 5.41 + cmd="$cmd $@" 5.42 + fi 5.43 + ( eval "nohup $cmd </dev/null >/dev/null 2>&1 &" 5.44 + echo $! >$dhcpd_pidfile 5.45 + ) >/dev/null 2>&1 5.46 + } 5.47 + 5.48 +%status -u @l_susr@ -o 5.49 + dhcpd_usable="unknown" 5.50 + dhcpd_active="no" 5.51 + @l_prefix@/sbin/dhcpd -q -t || dhcpd_usable="no" 5.52 + [ ".$dhcpd_if" = . ] && dhcpd_usable="no" 5.53 + rcService dhcpd enable yes && \ 5.54 + dhcpd_signal 0 && dhcpd_active="yes" 5.55 + echo "dhcpd_enable=\"$dhcpd_enable\"" 5.56 + echo "dhcpd_usable=\"$dhcpd_usable\"" 5.57 + echo "dhcpd_active=\"$dhcpd_active\"" 5.58 + 5.59 +%start -u @l_susr@ 5.60 + rcService dhcpd enable yes || exit 0 5.61 + rcService dhcpd usable no && exit 0 5.62 + rcService dhcpd active yes && exit 0 5.63 + dhcpd_start $dhcpd_if 5.64 + 5.65 +%stop -u @l_susr@ 5.66 + rcService dhcpd enable yes || exit 0 5.67 + rcService dhcpd active no && exit 0 5.68 + dhcpd_signal TERM 5.69 + sleep 2 5.70 + rm -f $dhcpd_pidfile 2>/dev/null || true 5.71 + 5.72 +%restart -u @l_susr@ 5.73 + rcService dhcpd enable yes || exit 0 5.74 + rcService dhcpd active no && exit 0 5.75 + rc dhcpd stop start 5.76 + 5.77 +%reload -u @l_susr@ 5.78 + rcService dhcpd enable yes || exit 0 5.79 + dhcpd_signal HUP 5.80 + 5.81 +%daily -u @l_susr@ 5.82 + rcService dhcpd enable yes || exit 0 5.83 + rcTmp -i 5.84 + hintfile=`rcTmp -f -n hint` 5.85 + for tool in dhcpd dhclient dhrelay omshell; do 5.86 + shtool rotate -f \ 5.87 + -n $dhcpd_log_numfiles -s $dhcpd_log_minsize -d \ 5.88 + -z $dhcpd_log_complevel -m 644 -o @l_susr@ -g @l_mgrp@ \ 5.89 + -P "$dhcpd_log_prolog" \ 5.90 + -E "$dhcpd_log_epilog; echo 1 >$hintfile" \ 5.91 + @l_prefix@/var/dhcpd/log/$tool.log 5.92 + done 5.93 + if [ -s $hintfile ]; then 5.94 + rc dhcpd restart 5.95 + fi 5.96 + rcTmp -k 5.97 +