| # Copyright 2014 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "Run the access point manager daemon" |
| author "chromium-os-dev@chromium.org" |
| |
| start on starting system-services and stopped iptables |
| stop on stopping system-services |
| expect fork |
| |
| env APMANAGER_LOG_LEVEL=0 |
| env APMANAGER_DHCP_SERVER_PORT=67 |
| |
| pre-start script |
| # Add a rule to the firewall to allow DHCP traffic except from the |
| # loopback interface. |
| iptables -I INPUT -p udp --dport ${APMANAGER_DHCP_SERVER_PORT} -j ACCEPT |
| iptables -I INPUT -i lo -p udp --dport ${APMANAGER_DHCP_SERVER_PORT} -j REJECT |
| end script |
| |
| exec /usr/bin/apmanager --v="${APMANAGER_LOG_LEVEL}" |
| |
| post-stop script |
| # Delete the rules we previously added |
| iptables -D INPUT -p udp --dport ${APMANAGER_DHCP_SERVER_PORT} -j ACCEPT |
| iptables -D INPUT -i lo -p udp --dport ${APMANAGER_DHCP_SERVER_PORT} -j REJECT |
| end script |