]>
git.ipfire.org Git - 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
)
12 function flush_chains
() {
13 iptables
-F DHCPGREENINPUT
14 iptables
-F DHCPGREENOUTPUT
15 iptables
-F DHCPBLUEINPUT
16 iptables
-F DHCPBLUEOUTPUT
23 if [ -n "${GREEN_DEV}" -a -e "/var/ipfire/dhcp/enable_green" ]; then
24 devices
="${GREEN_DEV}"
26 iptables
-A DHCPGREENINPUT
-i "${GREEN_DEV}" -j DHCPINPUT
27 iptables
-A DHCPGREENOUTPUT
-o "${GREEN_DEV}" -j DHCPOUTPUT
29 if [ -n "${BLUE_DEV}" -a -e "/var/ipfire/dhcp/enable_blue" ]; then
30 devices
+=" ${BLUE_DEV}"
32 iptables
-A DHCPBLUEINPUT
-i "${BLUE_DEV}" -j DHCPINPUT
33 iptables
-A DHCPBLUEOUTPUT
-o "${BLUE_DEV}" -j DHCPOUTPUT
36 boot_mesg
"Starting DHCP Server..."
37 loadproc
/usr
/sbin
/dhcpd
-q ${devices}
39 (sleep 5 && chmod 644 /var
/run
/dhcpd.pid
) & # Fix because silly dhcpd creates its pid with mode 640
45 boot_mesg
"Stopping DHCP Server..."
46 killproc
-p /var
/run
/dhcpd.pid
/usr
/sbin
/dhcpd
47 if [ "$(ps -A | grep " dhcpd
")" != "" ] ; then
48 # if fail use the hard way ...
49 boot_mesg
"Killing DHCP Server..."
50 killall
-w -s KILL
/usr
/sbin
/dhcpd
> /dev
/null
2>&1
51 rm -f /var
/run
/dhcpd.pid
> /dev
/null
2>&1
58 boot_mesg
"Reloading DHCP Server..."
59 reloadproc
/usr
/sbin
/dhcpd
69 statusproc
/usr
/sbin
/dhcpd
73 echo "Usage: $0 {start|stop|reload|restart|status}"
78 # End $rc_base/init.d/dhcp