2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
25 [ -e "/etc/sysconfig/dhcpd" ] && .
/etc
/sysconfig
/dhcpd
27 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/ethernet
/settings
)
28 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/dhcp
/settings
)
30 function flush_chains
() {
31 iptables
-F DHCPGREENINPUT
32 iptables
-F DHCPGREENOUTPUT
33 iptables
-F DHCPBLUEINPUT
34 iptables
-F DHCPBLUEOUTPUT
41 if [ -n "${GREEN_DEV}" -a -e "/var/ipfire/dhcp/enable_green" ]; then
42 LISTEN_INTERFACES
+=" ${GREEN_DEV}"
44 iptables
-A DHCPGREENINPUT
-i "${GREEN_DEV}" -j DHCPINPUT
45 iptables
-A DHCPGREENOUTPUT
-o "${GREEN_DEV}" -j DHCPOUTPUT
47 if [ -n "${BLUE_DEV}" -a -e "/var/ipfire/dhcp/enable_blue" ]; then
48 LISTEN_INTERFACES
+=" ${BLUE_DEV}"
50 iptables
-A DHCPBLUEINPUT
-i "${BLUE_DEV}" -j DHCPINPUT
51 iptables
-A DHCPBLUEOUTPUT
-o "${BLUE_DEV}" -j DHCPOUTPUT
54 boot_mesg
"Starting DHCP Server..."
55 loadproc
/usr
/sbin
/dhcpd
-q ${LISTEN_INTERFACES}
57 # Start Unbound DHCP Lease Bridge unless RFC2136 is used
58 if [ "${DNS_UPDATE_ENABLED}" != on
]; then
59 boot_mesg
"Starting Unbound DHCP Leases Bridge..."
60 loadproc
/usr
/sbin
/unbound-dhcp-leases-bridge
-d
63 (sleep 5 && chmod 644 /var
/run
/dhcpd.pid
) & # Fix because silly dhcpd creates its pid with mode 640
69 boot_mesg
"Stopping DHCP Server..."
70 killproc
-p /var
/run
/dhcpd.pid
/usr
/sbin
/dhcpd
71 if [ "$(ps -A | grep " dhcpd
")" != "" ] ; then
72 # if fail use the hard way ...
73 boot_mesg
"Killing DHCP Server..."
74 killall
-w -s KILL
/usr
/sbin
/dhcpd
> /dev
/null
2>&1
75 rm -f /var
/run
/dhcpd.pid
> /dev
/null
2>&1
79 boot_mesg
"Stopping Unbound DHCP Leases Bridge..."
80 killproc
/usr
/sbin
/unbound-dhcp-leases-bridge
84 boot_mesg
"Reloading DHCP Server..."
85 reloadproc
/usr
/sbin
/dhcpd
95 statusproc
/usr
/sbin
/dhcpd
96 statusproc
/usr
/sbin
/unbound-dhcp-leases-bridge
100 echo "Usage: $0 {start|stop|reload|restart|status}"