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