Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
michael@714 | 1 | ## |
michael@714 | 2 | ## arpd.spec -- OpenPKG RPM Package Specification |
michael@714 | 3 | ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/> |
michael@714 | 4 | ## |
michael@714 | 5 | ## Permission to use, copy, modify, and distribute this software for |
michael@714 | 6 | ## any purpose with or without fee is hereby granted, provided that |
michael@714 | 7 | ## the above copyright notice and this permission notice appear in all |
michael@714 | 8 | ## copies. |
michael@714 | 9 | ## |
michael@714 | 10 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@714 | 11 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@714 | 12 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@714 | 13 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@714 | 14 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@714 | 15 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@714 | 16 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@714 | 17 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@714 | 18 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@714 | 19 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@714 | 20 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@714 | 21 | ## SUCH DAMAGE. |
michael@714 | 22 | ## |
michael@714 | 23 | |
michael@714 | 24 | # package information |
michael@714 | 25 | Name: arpd |
michael@714 | 26 | Summary: Address Resolution Protocol (ARP) Reply Daemon |
michael@714 | 27 | URL: http://www.honeyd.org/tools.php |
michael@714 | 28 | Vendor: Niels Provos, Dug Song |
michael@714 | 29 | Packager: OpenPKG Foundation e.V. |
michael@714 | 30 | Distribution: OpenPKG Community |
michael@714 | 31 | Class: EVAL |
michael@714 | 32 | Group: Mapping |
michael@714 | 33 | License: GNU |
michael@714 | 34 | Version: 0.2 |
michael@715 | 35 | Release: 20120800 |
michael@714 | 36 | |
michael@714 | 37 | # package options |
michael@714 | 38 | %option with_fsl yes |
michael@714 | 39 | |
michael@714 | 40 | # list of sources |
michael@714 | 41 | Source0: http://www.citi.umich.edu/u/provos/honeyd/arpd-%{version}.tar.gz |
michael@714 | 42 | Source1: rc.arpd |
michael@714 | 43 | Source2: fsl.arpd |
michael@714 | 44 | Patch0: arpd.patch |
michael@714 | 45 | |
michael@714 | 46 | # build information |
michael@715 | 47 | BuildPreReq: OpenPKG, openpkg >= 20100101, libdnet, libpcap, libevent, gcc, make |
michael@715 | 48 | PreReq: OpenPKG, openpkg >= 20100101, libdnet, libpcap, libevent |
michael@714 | 49 | %if "%{with_fsl}" == "yes" |
michael@714 | 50 | BuildPreReq: fsl |
michael@714 | 51 | PreReq: fsl |
michael@714 | 52 | %endif |
michael@714 | 53 | |
michael@714 | 54 | %description |
michael@714 | 55 | Arpd is an Address Resolution Protocol (ARP) daemon which replies to |
michael@714 | 56 | any ARP request for an IP address matching the specified destination |
michael@714 | 57 | network with the hardware MAC address of the own interface, but only |
michael@714 | 58 | after determining if another host already claims it. Any IP address |
michael@714 | 59 | claimed by arpd is eventually forgotten after a period of inactivity |
michael@714 | 60 | or after a hard timeout, and is relinquished if the real owner shows |
michael@714 | 61 | up. This enables a single host to claim all unassigned addresses on |
michael@714 | 62 | a LAN for network monitoring or simulation. |
michael@714 | 63 | |
michael@714 | 64 | %track |
michael@714 | 65 | prog arpd = { |
michael@714 | 66 | version = %{version} |
michael@714 | 67 | url = http://www.honeyd.org/tools.php |
michael@714 | 68 | regex = arpd-(__VER__)\.tar\.gz |
michael@714 | 69 | } |
michael@714 | 70 | |
michael@714 | 71 | %prep |
michael@714 | 72 | %setup -q -n arpd |
michael@714 | 73 | %patch -p0 |
michael@714 | 74 | %{l_shtool} subst \ |
michael@714 | 75 | -e 's;LIBS=$DNETLIB;LIBS="$LIBS $DNETLIB";' \ |
michael@714 | 76 | -e 's;CFLAGS=$DNETINC;CFLAGS="$CFLAGS $DNETINC";' \ |
michael@714 | 77 | -e 's;net/bpf\.h;pcap-bpf.h;g' \ |
michael@714 | 78 | configure |
michael@714 | 79 | %{l_shtool} subst \ |
michael@714 | 80 | -e 's;/var/run/arpd.pid;%{l_prefix}/var/arpd/arpd.pid;' \ |
michael@714 | 81 | arpd.c arpd.8 |
michael@714 | 82 | |
michael@714 | 83 | %build |
michael@714 | 84 | CC="%{l_cc}" \ |
michael@714 | 85 | CFLAGS="%{l_cflags -O}" \ |
michael@714 | 86 | CPPFLAGS="%{l_cppflags}" \ |
michael@714 | 87 | LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ |
michael@714 | 88 | LIBS="%{l_fsl_libs} -lpcap" \ |
michael@714 | 89 | ./configure \ |
michael@714 | 90 | --prefix=%{l_prefix} \ |
michael@714 | 91 | --with-libdnet=%{l_prefix} \ |
michael@714 | 92 | --with-libpcap=%{l_prefix} \ |
michael@714 | 93 | --with-libevent=%{l_prefix} |
michael@714 | 94 | %{l_make} %{l_mflags} |
michael@714 | 95 | |
michael@714 | 96 | %install |
michael@714 | 97 | # create directories |
michael@714 | 98 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@714 | 99 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ |
michael@714 | 100 | $RPM_BUILD_ROOT%{l_prefix}/var/arpd |
michael@714 | 101 | |
michael@714 | 102 | # install files |
michael@714 | 103 | %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT |
michael@714 | 104 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@714 | 105 | %{SOURCE rc.arpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@714 | 106 | |
michael@714 | 107 | # install OSSP fsl configuration |
michael@714 | 108 | %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
michael@714 | 109 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@714 | 110 | %{SOURCE fsl.arpd} \ |
michael@714 | 111 | $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
michael@714 | 112 | |
michael@714 | 113 | # determine file list |
michael@714 | 114 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
michael@714 | 115 | %{l_files_std} \ |
michael@714 | 116 | '%config %{l_prefix}/etc/fsl/fsl.arpd' \ |
michael@714 | 117 | '%attr(750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/arpd' |
michael@714 | 118 | |
michael@714 | 119 | %files -f files |
michael@714 | 120 | |
michael@714 | 121 | %clean |
michael@714 | 122 | |
michael@714 | 123 | %pre |
michael@714 | 124 | # before upgrade, save status and stop service |
michael@714 | 125 | [ $1 -eq 2 ] || exit 0 |
michael@714 | 126 | eval `%{l_rc} arpd status 2>/dev/null | tee %{l_tmpfile}` |
michael@714 | 127 | %{l_rc} arpd stop 2>/dev/null |
michael@714 | 128 | exit 0 |
michael@714 | 129 | |
michael@714 | 130 | %post |
michael@714 | 131 | if [ $1 -eq 1 ]; then |
michael@714 | 132 | # display final hints on initial installation |
michael@714 | 133 | ( echo "Before starting ARP daemon, please set the configuration variable" |
michael@714 | 134 | echo "\"arpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the" |
michael@714 | 135 | echo "used network interface." |
michael@714 | 136 | ) | %{l_rpmtool} msg -b -t notice |
michael@714 | 137 | fi |
michael@714 | 138 | if [ $1 -eq 2 ]; then |
michael@714 | 139 | # after upgrade, restore status |
michael@714 | 140 | eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} |
michael@714 | 141 | [ ".$arpd_active" = .yes ] && %{l_rc} arpd start |
michael@714 | 142 | fi |
michael@714 | 143 | exit 0 |
michael@714 | 144 | |
michael@714 | 145 | %preun |
michael@714 | 146 | # before erase, stop service and remove log files |
michael@714 | 147 | [ $1 -eq 0 ] || exit 0 |
michael@714 | 148 | %{l_rc} arpd stop 2>/dev/null |
michael@714 | 149 | rm -f $RPM_INSTALL_PREFIX/var/arpd/*.log* >/dev/null 2>&1 || true |
michael@714 | 150 | exit 0 |
michael@714 | 151 |