Thu, 04 Oct 2012 20:26:02 +0200
Import package vendor original spec for necessary manipulations.
arpd/arpd.patch | file | annotate | diff | comparison | revisions | |
arpd/arpd.spec | file | annotate | diff | comparison | revisions | |
arpd/fsl.arpd | file | annotate | diff | comparison | revisions | |
arpd/rc.arpd | file | annotate | diff | comparison | revisions |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/arpd/arpd.patch Thu Oct 04 20:26:02 2012 +0200 1.3 @@ -0,0 +1,56 @@ 1.4 +--- arpd.c.dist 2003-07-02 16:49:31.000000000 +0200 1.5 ++++ arpd.c 2003-07-02 16:53:25.000000000 +0200 1.6 +@@ -111,9 +111,11 @@ 1.7 + struct in_addr in; 1.8 + ip_addr_t istart, iend; 1.9 + 1.10 +- second = p; 1.11 ++ first = p; 1.12 ++ second = strchr(p, '-'); 1.13 ++ if (second != NULL) 1.14 ++ *second++ = '\0'; 1.15 + 1.16 +- first = strsep(&second, "-"); 1.17 + if (second == NULL) 1.18 + errx(1, "%s: Invalid network range: %s", 1.19 + __func__, p); 1.20 +@@ -267,7 +267,7 @@ 1.21 + spa->addr_ip, tha->addr_eth, tpa->addr_ip); 1.22 + 1.23 + if (op == ARP_OP_REQUEST) { 1.24 +- syslog(LOG_DEBUG, __FUNCTION__ ": who-has %s tell %s", 1.25 ++ syslog(LOG_DEBUG, "%s: who-has %s tell %s", __FUNCTION__, 1.26 + addr_ntoa(tpa), addr_ntoa(spa)); 1.27 + } else if (op == ARP_OP_REPLY) { 1.28 + syslog(LOG_INFO, "arp reply %s is-at %s", 1.29 +@@ -284,7 +284,7 @@ 1.30 + int error; 1.31 + 1.32 + if (addr_cmp(addr, &arpd_ifent.intf_addr) == 0) { 1.33 +- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s", 1.34 ++ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__, 1.35 + addr_ntoa(addr), addr_ntoa(&arpd_ifent.intf_link_addr)); 1.36 + return (0); 1.37 + } 1.38 +@@ -293,10 +293,10 @@ 1.39 + error = arp_get(arpd_arp, &arpent); 1.40 + 1.41 + if (error == -1) { 1.42 +- syslog(LOG_DEBUG, __FUNCTION__ ": no entry for %s", 1.43 ++ syslog(LOG_DEBUG, "%s: no entry for %s", __FUNCTION__, 1.44 + addr_ntoa(addr)); 1.45 + } else { 1.46 +- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s", 1.47 ++ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__, 1.48 + addr_ntoa(addr), addr_ntoa(&arpent.arp_ha)); 1.49 + } 1.50 + return (error); 1.51 +@@ -425,7 +425,7 @@ 1.52 + if ((req = SPLAY_FIND(tree, &arpd_reqs, &tmp)) != NULL) { 1.53 + addr_pack(&src.arp_ha, ADDR_TYPE_ETH, ETH_ADDR_BITS, 1.54 + ethip->ar_sha, ETH_ADDR_LEN); 1.55 +- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s", 1.56 ++ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__, 1.57 + addr_ntoa(&req->pa), addr_ntoa(&src.arp_ha)); 1.58 + 1.59 + /* This address is claimed */
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/arpd/arpd.spec Thu Oct 04 20:26:02 2012 +0200 2.3 @@ -0,0 +1,158 @@ 2.4 +## 2.5 +## arpd.spec -- OpenPKG RPM Package Specification 2.6 +## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/> 2.7 +## 2.8 +## Permission to use, copy, modify, and distribute this software for 2.9 +## any purpose with or without fee is hereby granted, provided that 2.10 +## the above copyright notice and this permission notice appear in all 2.11 +## copies. 2.12 +## 2.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 2.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 2.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 2.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 2.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 2.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 2.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2.24 +## SUCH DAMAGE. 2.25 +## 2.26 + 2.27 +# package information 2.28 +Name: arpd 2.29 +Summary: Address Resolution Protocol (ARP) Reply Daemon 2.30 +URL: http://www.honeyd.org/tools.php 2.31 +Vendor: Niels Provos, Dug Song 2.32 +Packager: OpenPKG Foundation e.V. 2.33 +Distribution: OpenPKG Community 2.34 +Class: EVAL 2.35 +Group: Mapping 2.36 +License: GNU 2.37 +Version: 0.2 2.38 +Release: 20080101 2.39 + 2.40 +# package options 2.41 +%option with_fsl yes 2.42 + 2.43 +# list of sources 2.44 +Source0: http://www.citi.umich.edu/u/provos/honeyd/arpd-%{version}.tar.gz 2.45 +Source1: rc.arpd 2.46 +Source2: fsl.arpd 2.47 +Patch0: arpd.patch 2.48 + 2.49 +# build information 2.50 +Prefix: %{l_prefix} 2.51 +BuildRoot: %{l_buildroot} 2.52 +BuildPreReq: OpenPKG, openpkg >= 20060823, libdnet, libpcap, libevent, gcc, make 2.53 +PreReq: OpenPKG, openpkg >= 20060823, libdnet, libpcap, libevent 2.54 +%if "%{with_fsl}" == "yes" 2.55 +BuildPreReq: fsl 2.56 +PreReq: fsl 2.57 +%endif 2.58 +AutoReq: no 2.59 +AutoReqProv: no 2.60 + 2.61 +%description 2.62 + Arpd is an Address Resolution Protocol (ARP) daemon which replies to 2.63 + any ARP request for an IP address matching the specified destination 2.64 + network with the hardware MAC address of the own interface, but only 2.65 + after determining if another host already claims it. Any IP address 2.66 + claimed by arpd is eventually forgotten after a period of inactivity 2.67 + or after a hard timeout, and is relinquished if the real owner shows 2.68 + up. This enables a single host to claim all unassigned addresses on 2.69 + a LAN for network monitoring or simulation. 2.70 + 2.71 +%track 2.72 + prog arpd = { 2.73 + version = %{version} 2.74 + url = http://www.honeyd.org/tools.php 2.75 + regex = arpd-(__VER__)\.tar\.gz 2.76 + } 2.77 + 2.78 +%prep 2.79 + %setup -q -n arpd 2.80 + %patch -p0 2.81 + %{l_shtool} subst \ 2.82 + -e 's;LIBS=$DNETLIB;LIBS="$LIBS $DNETLIB";' \ 2.83 + -e 's;CFLAGS=$DNETINC;CFLAGS="$CFLAGS $DNETINC";' \ 2.84 + -e 's;net/bpf\.h;pcap-bpf.h;g' \ 2.85 + configure 2.86 + %{l_shtool} subst \ 2.87 + -e 's;/var/run/arpd.pid;%{l_prefix}/var/arpd/arpd.pid;' \ 2.88 + arpd.c arpd.8 2.89 + 2.90 +%build 2.91 + CC="%{l_cc}" \ 2.92 + CFLAGS="%{l_cflags -O}" \ 2.93 + CPPFLAGS="%{l_cppflags}" \ 2.94 + LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ 2.95 + LIBS="%{l_fsl_libs} -lpcap" \ 2.96 + ./configure \ 2.97 + --prefix=%{l_prefix} \ 2.98 + --with-libdnet=%{l_prefix} \ 2.99 + --with-libpcap=%{l_prefix} \ 2.100 + --with-libevent=%{l_prefix} 2.101 + %{l_make} %{l_mflags} 2.102 + 2.103 +%install 2.104 + rm -rf $RPM_BUILD_ROOT 2.105 + 2.106 + # create directories 2.107 + %{l_shtool} mkdir -f -p -m 755 \ 2.108 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ 2.109 + $RPM_BUILD_ROOT%{l_prefix}/var/arpd 2.110 + 2.111 + # install files 2.112 + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT 2.113 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 2.114 + %{SOURCE rc.arpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 2.115 + 2.116 + # install OSSP fsl configuration 2.117 + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 2.118 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 2.119 + %{SOURCE fsl.arpd} \ 2.120 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 2.121 + 2.122 + # determine file list 2.123 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 2.124 + %{l_files_std} \ 2.125 + '%config %{l_prefix}/etc/fsl/fsl.arpd' \ 2.126 + '%attr(750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/arpd' 2.127 + 2.128 +%files -f files 2.129 + 2.130 +%clean 2.131 + rm -rf $RPM_BUILD_ROOT 2.132 + 2.133 +%pre 2.134 + # before upgrade, save status and stop service 2.135 + [ $1 -eq 2 ] || exit 0 2.136 + eval `%{l_rc} arpd status 2>/dev/null | tee %{l_tmpfile}` 2.137 + %{l_rc} arpd stop 2>/dev/null 2.138 + exit 0 2.139 + 2.140 +%post 2.141 + if [ $1 -eq 1 ]; then 2.142 + # display final hints on initial installation 2.143 + ( echo "Before starting ARP daemon, please set the configuration variable" 2.144 + echo "\"arpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the" 2.145 + echo "used network interface." 2.146 + ) | %{l_rpmtool} msg -b -t notice 2.147 + fi 2.148 + if [ $1 -eq 2 ]; then 2.149 + # after upgrade, restore status 2.150 + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} 2.151 + [ ".$arpd_active" = .yes ] && %{l_rc} arpd start 2.152 + fi 2.153 + exit 0 2.154 + 2.155 +%preun 2.156 + # before erase, stop service and remove log files 2.157 + [ $1 -eq 0 ] || exit 0 2.158 + %{l_rc} arpd stop 2>/dev/null 2.159 + rm -f $RPM_INSTALL_PREFIX/var/arpd/*.log* >/dev/null 2>&1 || true 2.160 + exit 0 2.161 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/arpd/fsl.arpd Thu Oct 04 20:26:02 2012 +0200 3.3 @@ -0,0 +1,16 @@ 3.4 +## 3.5 +## fsl.arpd -- OSSP fsl configuration 3.6 +## 3.7 + 3.8 +ident (arpd)/.+ q{ 3.9 + prefix( 3.10 + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " 3.11 + ) 3.12 + -> { 3.13 + debug: file( 3.14 + path="@l_prefix@/var/arpd/arpd.log", 3.15 + perm=0644 3.16 + ) 3.17 + } 3.18 +}; 3.19 +
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/arpd/rc.arpd Thu Oct 04 20:26:02 2012 +0200 4.3 @@ -0,0 +1,67 @@ 4.4 +#!@l_prefix@/bin/openpkg rc 4.5 +## 4.6 +## rc.arpd -- Run-Commands 4.7 +## 4.8 + 4.9 +%config 4.10 + arpd_enable="$openpkg_rc_def" 4.11 + arpd_log_prolog="true" 4.12 + arpd_log_epilog="true" 4.13 + arpd_log_numfiles="10" 4.14 + arpd_log_minsize="1M" 4.15 + arpd_log_complevel="9" 4.16 + arpd_ip_network="192.168.100.0/24" 4.17 + arpd_if="" 4.18 + 4.19 +%common 4.20 + arpd_pidfile="@l_prefix@/var/arpd/arpd.pid" 4.21 + arpd_signal () { 4.22 + [ -f $arpd_pidfile ] && kill -$1 `cat $arpd_pidfile` 4.23 + } 4.24 + 4.25 +%status -u @l_susr@ -o 4.26 + arpd_usable="unknown" 4.27 + arpd_active="no" 4.28 + rcService arpd enable yes && \ 4.29 + arpd_signal 0 && arpd_active="yes" 4.30 + echo "arpd_enable=\"$arpd_enable\"" 4.31 + echo "arpd_usable=\"$arpd_usable\"" 4.32 + echo "arpd_active=\"$arpd_active\"" 4.33 + 4.34 +%start -u @l_susr@ 4.35 + rcService arpd enable yes || exit 0 4.36 + rcService arpd active yes && exit 0 4.37 + if [ ".$arpd_if" != . ]; then 4.38 + arpd_interface="-i $arpd_if" 4.39 + fi 4.40 + @l_prefix@/sbin/arpd \ 4.41 + $arpd_interface \ 4.42 + $arpd_ip_network \ 4.43 + >/dev/null 2>&1 4.44 + 4.45 +%stop -u @l_susr@ 4.46 + rcService arpd enable yes || exit 0 4.47 + rcService arpd active no && exit 0 4.48 + arpd_signal TERM 4.49 + 4.50 +%restart -u @l_susr@ 4.51 + rcService arpd enable yes || exit 0 4.52 + rcService arpd active no && exit 0 4.53 + rc arpd start 4.54 + sleep 2 4.55 + rc arpd stop 4.56 + 4.57 +%reload -u @l_susr@ 4.58 + rcService arpd enable yes || exit 0 4.59 + rcService arpd active no && exit 0 4.60 + arpd_signal HUP 4.61 + 4.62 +%daily -u @l_susr@ 4.63 + rcService arpd enable yes || exit 0 4.64 + shtool rotate -f \ 4.65 + -n ${arpd_log_numfiles} -s ${arpd_log_minsize} -d \ 4.66 + -z ${arpd_log_complevel} -o @l_susr@ -g @l_rgrp@ -m 644 \ 4.67 + -P "${arpd_log_prolog}" \ 4.68 + -E "${arpd_log_epilog}; rc arpd restart" \ 4.69 + @l_prefix@/var/arpd/arpd.log 4.70 +