]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/initscripts/init.d/dhcp
2 # Begin $rc_base/init.d/dhcp
4 # Based on sysklogd script from LFS-3.1 and earlier.
5 # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
6 # Modified for IPFire by Michael Tremer - mitch@ipfire.org
10 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/ethernet
/settings
)
14 iptables
-F DHCPBLUEINPUT
15 if [ -e /var
/ipfire
/dhcp
/enable_green
]; then
16 devices
="${GREEN_DEV}"
18 if [ -e /var
/ipfire
/dhcp
/enable_blue
]; then
19 devices
+=" ${BLUE_DEV}"
21 iptables
-A DHCPBLUEINPUT
-p tcp
--source-port 68 --destination-port 67 -i ${BLUE_DEV} -j ACCEPT
> /dev
/null
2>&1
22 iptables
-A DHCPBLUEINPUT
-p udp
--source-port 68 --destination-port 67 -i ${BLUE_DEV} -j ACCEPT
> /dev
/null
2>&1
25 boot_mesg
"Starting DHCP Server..."
26 loadproc
/usr
/sbin
/dhcpd
-q ${devices}
28 (sleep 5 && chmod 644 /var
/run
/dhcpd.pid
) & # Fix because silly dhcpd creates its pid with mode 640
32 boot_mesg
"Stopping DHCP Server..."
33 killproc
-p /var
/run
/dhcpd.pid
/usr
/sbin
/dhcpd
34 if [ "$(ps -A | grep " dhcpd
")" != "" ] ; then
35 # if fail use the hard way ...
36 boot_mesg
"Killing DHCP Server..."
37 killall
-w -s KILL
/usr
/sbin
/dhcpd
> /dev
/null
2>&1
38 rm -f /var
/run
/dhcpd.pid
> /dev
/null
2>&1
45 boot_mesg
"Reloading DHCP Server..."
46 reloadproc
/usr
/sbin
/dhcpd
56 statusproc
/usr
/sbin
/dhcpd
60 echo "Usage: $0 {start|stop|reload|restart|status}"
65 # End $rc_base/init.d/dhcp