Thu, 04 Oct 2012 20:30:05 +0200
Correct out of date build configuration, porting to Solaris 11 network
link infrastructure and new libpcap logic. This additionally allows for
device drivers in subdirectories of /dev. Correct packaged nmap
personalities and signatures to work out of the box. Finally, hack
arpd logic to properly close sockets and quit on TERM by repeating
signaling in the run command script. Sadly, all this fails to correct
the run time behaviour of honeyd which fails to bind to the IP layer.
1 #!@l_prefix@/bin/openpkg rc
2 ##
3 ## rc.dhcpd -- Run-Commands
4 ##
6 %config
7 dhcpd_enable="$openpkg_rc_def"
8 dhcpd_flags="-q"
9 dhcpd_if=""
10 dhcpd_port="67"
11 dhcpd_log_prolog="true"
12 dhcpd_log_epilog="true"
13 dhcpd_log_numfiles="10"
14 dhcpd_log_minsize="1M"
15 dhcpd_log_complevel="9"
17 %common
18 dhcpd_pidfile="@l_prefix@/var/dhcpd/run/dhcpd.pid"
19 dhcpd_leases="@l_prefix@/var/dhcpd/db/dhcpd.leases"
20 dhcpd_signal () {
21 if [ ! -f $dhcpd_pidfile ]; then return 1; fi
22 kill -$1 `cat $dhcpd_pidfile`
23 }
24 dhcpd_start () {
25 if [ ! -f $dhcpd_leases ]; then
26 touch $dhcpd_leases
27 chmod 644 $dhcpd_leases
28 chown @l_susr@:@l_mgrp@ $dhcpd_leases
29 fi
30 local cmd="@l_prefix@/sbin/dhcpd"
31 cmd="$cmd -f"
32 cmd="$cmd $dhcpd_flags"
33 echo ".$dhcpd_flags" | grep -- -p >/dev/null 2>&1
34 if [ $? -ne 0 -a ".$dhcpd_port" != . ]; then
35 cmd="$cmd -p $dhcpd_port"
36 fi
37 if [ $# -gt 0 ]; then
38 cmd="$cmd $@"
39 fi
40 ( eval "nohup $cmd </dev/null >/dev/null 2>&1 &"
41 echo $! >$dhcpd_pidfile
42 ) >/dev/null 2>&1
43 }
45 %status -u @l_susr@ -o
46 dhcpd_usable="unknown"
47 dhcpd_active="no"
48 @l_prefix@/sbin/dhcpd -q -t || dhcpd_usable="no"
49 [ ".$dhcpd_if" = . ] && dhcpd_usable="no"
50 rcService dhcpd enable yes && \
51 dhcpd_signal 0 && dhcpd_active="yes"
52 echo "dhcpd_enable=\"$dhcpd_enable\""
53 echo "dhcpd_usable=\"$dhcpd_usable\""
54 echo "dhcpd_active=\"$dhcpd_active\""
56 %start -u @l_susr@
57 rcService dhcpd enable yes || exit 0
58 rcService dhcpd usable no && exit 0
59 rcService dhcpd active yes && exit 0
60 dhcpd_start $dhcpd_if
62 %stop -u @l_susr@
63 rcService dhcpd enable yes || exit 0
64 rcService dhcpd active no && exit 0
65 dhcpd_signal TERM
66 sleep 2
67 rm -f $dhcpd_pidfile 2>/dev/null || true
69 %restart -u @l_susr@
70 rcService dhcpd enable yes || exit 0
71 rcService dhcpd active no && exit 0
72 rc dhcpd stop start
74 %reload -u @l_susr@
75 rcService dhcpd enable yes || exit 0
76 dhcpd_signal HUP
78 %daily -u @l_susr@
79 rcService dhcpd enable yes || exit 0
80 rcTmp -i
81 hintfile=`rcTmp -f -n hint`
82 for tool in dhcpd dhclient dhrelay omshell; do
83 shtool rotate -f \
84 -n $dhcpd_log_numfiles -s $dhcpd_log_minsize -d \
85 -z $dhcpd_log_complevel -m 644 -o @l_susr@ -g @l_mgrp@ \
86 -P "$dhcpd_log_prolog" \
87 -E "$dhcpd_log_epilog; echo 1 >$hintfile" \
88 @l_prefix@/var/dhcpd/log/$tool.log
89 done
90 if [ -s $hintfile ]; then
91 rc dhcpd restart
92 fi
93 rcTmp -k