]>
Commit | Line | Data |
---|---|---|
6bdd769d MT |
1 | #!/bin/sh |
2 | # Begin $rc_base/init.d/dhcp | |
3 | ||
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 | |
7 | ||
8 | . /etc/sysconfig/rc | |
9 | . $rc_functions | |
10 | eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) | |
11 | ||
12 | case "$1" in | |
13 | start) | |
14 | iptables -F DHCPBLUEINPUT | |
15 | if [ -e /var/ipfire/dhcp/enable_green ]; then | |
16 | devices="${GREEN_DEV}" | |
17 | fi | |
18 | if [ -e /var/ipfire/dhcp/enable_blue ]; then | |
19 | devices=+" ${BLUE_DEV}" | |
20 | ||
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 | |
23 | fi | |
24 | ||
25 | boot_mesg "Starting DHCP Server..." | |
26 | loadproc /usr/sbin/dhcpd -q ${devices} | |
27 | ||
28 | chmod 644 /var/run/dhcpd.pid # Fix because silly dhcpd creates its pid with mode 640 | |
29 | ;; | |
30 | ||
31 | stop) | |
32 | boot_mesg "Stopping DHCP Server..." | |
33 | killproc /usr/sbin/dhcpd | |
34 | ;; | |
35 | ||
36 | reload) | |
37 | boot_mesg "Reloading DHCP Server..." | |
38 | reloadproc /usr/sbin/dhcpd | |
39 | ;; | |
40 | ||
41 | restart) | |
42 | $0 stop | |
43 | sleep 1 | |
44 | $0 start | |
45 | ;; | |
46 | ||
47 | status) | |
48 | statusproc /usr/sbin/dhcpd | |
49 | ;; | |
50 | ||
51 | *) | |
52 | echo "Usage: $0 {start|stop|reload|restart|status}" | |
53 | exit 1 | |
54 | ;; | |
55 | esac | |
56 | ||
57 | # End $rc_base/init.d/dhcp |