# HG changeset patch # User Michael Schloh von Bennewitz # Date 1349375162 -7200 # Node ID 119553d296d29ddc8824b29cc3a0ed53d39a02db # Parent 940f3eb5d5e628f00efde87a1a114e2bb36059dc Import package vendor original spec for necessary manipulations. diff -r 940f3eb5d5e6 -r 119553d296d2 arpd/arpd.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/arpd/arpd.patch Thu Oct 04 20:26:02 2012 +0200 @@ -0,0 +1,56 @@ +--- arpd.c.dist 2003-07-02 16:49:31.000000000 +0200 ++++ arpd.c 2003-07-02 16:53:25.000000000 +0200 +@@ -111,9 +111,11 @@ + struct in_addr in; + ip_addr_t istart, iend; + +- second = p; ++ first = p; ++ second = strchr(p, '-'); ++ if (second != NULL) ++ *second++ = '\0'; + +- first = strsep(&second, "-"); + if (second == NULL) + errx(1, "%s: Invalid network range: %s", + __func__, p); +@@ -267,7 +267,7 @@ + spa->addr_ip, tha->addr_eth, tpa->addr_ip); + + if (op == ARP_OP_REQUEST) { +- syslog(LOG_DEBUG, __FUNCTION__ ": who-has %s tell %s", ++ syslog(LOG_DEBUG, "%s: who-has %s tell %s", __FUNCTION__, + addr_ntoa(tpa), addr_ntoa(spa)); + } else if (op == ARP_OP_REPLY) { + syslog(LOG_INFO, "arp reply %s is-at %s", +@@ -284,7 +284,7 @@ + int error; + + if (addr_cmp(addr, &arpd_ifent.intf_addr) == 0) { +- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s", ++ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__, + addr_ntoa(addr), addr_ntoa(&arpd_ifent.intf_link_addr)); + return (0); + } +@@ -293,10 +293,10 @@ + error = arp_get(arpd_arp, &arpent); + + if (error == -1) { +- syslog(LOG_DEBUG, __FUNCTION__ ": no entry for %s", ++ syslog(LOG_DEBUG, "%s: no entry for %s", __FUNCTION__, + addr_ntoa(addr)); + } else { +- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s", ++ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__, + addr_ntoa(addr), addr_ntoa(&arpent.arp_ha)); + } + return (error); +@@ -425,7 +425,7 @@ + if ((req = SPLAY_FIND(tree, &arpd_reqs, &tmp)) != NULL) { + addr_pack(&src.arp_ha, ADDR_TYPE_ETH, ETH_ADDR_BITS, + ethip->ar_sha, ETH_ADDR_LEN); +- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s", ++ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__, + addr_ntoa(&req->pa), addr_ntoa(&src.arp_ha)); + + /* This address is claimed */ diff -r 940f3eb5d5e6 -r 119553d296d2 arpd/arpd.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/arpd/arpd.spec Thu Oct 04 20:26:02 2012 +0200 @@ -0,0 +1,158 @@ +## +## arpd.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2008 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 information +Name: arpd +Summary: Address Resolution Protocol (ARP) Reply Daemon +URL: http://www.honeyd.org/tools.php +Vendor: Niels Provos, Dug Song +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: EVAL +Group: Mapping +License: GNU +Version: 0.2 +Release: 20080101 + +# package options +%option with_fsl yes + +# list of sources +Source0: http://www.citi.umich.edu/u/provos/honeyd/arpd-%{version}.tar.gz +Source1: rc.arpd +Source2: fsl.arpd +Patch0: arpd.patch + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20060823, libdnet, libpcap, libevent, gcc, make +PreReq: OpenPKG, openpkg >= 20060823, libdnet, libpcap, libevent +%if "%{with_fsl}" == "yes" +BuildPreReq: fsl +PreReq: fsl +%endif +AutoReq: no +AutoReqProv: no + +%description + Arpd is an Address Resolution Protocol (ARP) daemon which replies to + any ARP request for an IP address matching the specified destination + network with the hardware MAC address of the own interface, but only + after determining if another host already claims it. Any IP address + claimed by arpd is eventually forgotten after a period of inactivity + or after a hard timeout, and is relinquished if the real owner shows + up. This enables a single host to claim all unassigned addresses on + a LAN for network monitoring or simulation. + +%track + prog arpd = { + version = %{version} + url = http://www.honeyd.org/tools.php + regex = arpd-(__VER__)\.tar\.gz + } + +%prep + %setup -q -n arpd + %patch -p0 + %{l_shtool} subst \ + -e 's;LIBS=$DNETLIB;LIBS="$LIBS $DNETLIB";' \ + -e 's;CFLAGS=$DNETINC;CFLAGS="$CFLAGS $DNETINC";' \ + -e 's;net/bpf\.h;pcap-bpf.h;g' \ + configure + %{l_shtool} subst \ + -e 's;/var/run/arpd.pid;%{l_prefix}/var/arpd/arpd.pid;' \ + arpd.c arpd.8 + +%build + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ + CPPFLAGS="%{l_cppflags}" \ + LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ + LIBS="%{l_fsl_libs} -lpcap" \ + ./configure \ + --prefix=%{l_prefix} \ + --with-libdnet=%{l_prefix} \ + --with-libpcap=%{l_prefix} \ + --with-libevent=%{l_prefix} + %{l_make} %{l_mflags} + +%install + rm -rf $RPM_BUILD_ROOT + + # create directories + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ + $RPM_BUILD_ROOT%{l_prefix}/var/arpd + + # install files + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE rc.arpd} $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.arpd} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ + + # determine file list + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%config %{l_prefix}/etc/fsl/fsl.arpd' \ + '%attr(750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/arpd' + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%pre + # before upgrade, save status and stop service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} arpd status 2>/dev/null | tee %{l_tmpfile}` + %{l_rc} arpd stop 2>/dev/null + exit 0 + +%post + if [ $1 -eq 1 ]; then + # display final hints on initial installation + ( echo "Before starting ARP daemon, please set the configuration variable" + echo "\"arpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the" + echo "used network interface." + ) | %{l_rpmtool} msg -b -t notice + fi + if [ $1 -eq 2 ]; then + # after upgrade, restore status + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} + [ ".$arpd_active" = .yes ] && %{l_rc} arpd start + fi + exit 0 + +%preun + # before erase, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} arpd stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/arpd/*.log* >/dev/null 2>&1 || true + exit 0 + diff -r 940f3eb5d5e6 -r 119553d296d2 arpd/fsl.arpd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/arpd/fsl.arpd Thu Oct 04 20:26:02 2012 +0200 @@ -0,0 +1,16 @@ +## +## fsl.arpd -- OSSP fsl configuration +## + +ident (arpd)/.+ q{ + prefix( + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " + ) + -> { + debug: file( + path="@l_prefix@/var/arpd/arpd.log", + perm=0644 + ) + } +}; + diff -r 940f3eb5d5e6 -r 119553d296d2 arpd/rc.arpd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/arpd/rc.arpd Thu Oct 04 20:26:02 2012 +0200 @@ -0,0 +1,67 @@ +#!@l_prefix@/bin/openpkg rc +## +## rc.arpd -- Run-Commands +## + +%config + arpd_enable="$openpkg_rc_def" + arpd_log_prolog="true" + arpd_log_epilog="true" + arpd_log_numfiles="10" + arpd_log_minsize="1M" + arpd_log_complevel="9" + arpd_ip_network="192.168.100.0/24" + arpd_if="" + +%common + arpd_pidfile="@l_prefix@/var/arpd/arpd.pid" + arpd_signal () { + [ -f $arpd_pidfile ] && kill -$1 `cat $arpd_pidfile` + } + +%status -u @l_susr@ -o + arpd_usable="unknown" + arpd_active="no" + rcService arpd enable yes && \ + arpd_signal 0 && arpd_active="yes" + echo "arpd_enable=\"$arpd_enable\"" + echo "arpd_usable=\"$arpd_usable\"" + echo "arpd_active=\"$arpd_active\"" + +%start -u @l_susr@ + rcService arpd enable yes || exit 0 + rcService arpd active yes && exit 0 + if [ ".$arpd_if" != . ]; then + arpd_interface="-i $arpd_if" + fi + @l_prefix@/sbin/arpd \ + $arpd_interface \ + $arpd_ip_network \ + >/dev/null 2>&1 + +%stop -u @l_susr@ + rcService arpd enable yes || exit 0 + rcService arpd active no && exit 0 + arpd_signal TERM + +%restart -u @l_susr@ + rcService arpd enable yes || exit 0 + rcService arpd active no && exit 0 + rc arpd start + sleep 2 + rc arpd stop + +%reload -u @l_susr@ + rcService arpd enable yes || exit 0 + rcService arpd active no && exit 0 + arpd_signal HUP + +%daily -u @l_susr@ + rcService arpd enable yes || exit 0 + shtool rotate -f \ + -n ${arpd_log_numfiles} -s ${arpd_log_minsize} -d \ + -z ${arpd_log_complevel} -o @l_susr@ -g @l_rgrp@ -m 644 \ + -P "${arpd_log_prolog}" \ + -E "${arpd_log_epilog}; rc arpd restart" \ + @l_prefix@/var/arpd/arpd.log +