#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: allow_hosts
# REQUIRE: named
# KEYWORD: shutdown
#

. ${RC_ROUTER_HARNESS}/etc/rc.subr

name="allow_hosts"
desc="Allow hosts by DNS (from local DNS)"

start_cmd='allow_hosts_start'
stop_cmd='allow_hosts_stop'
rcvar='allow_hosts_enable'

load_rc_config 'allow_hosts'

if [ -z "${allow_hosts_rules}" ] 
then
    echo "Must have a route policy target file"
    exit 1
fi


allow_hosts_start()
{
    echo "Running allow hosts"
    echo "include \"${allow_hosts_rules}\"" > ${rc_router_gen_dir}/pf.rules.conf
    pfctl -a allow-hosts -f ${allow_hosts_rules}
}

allow_hosts_stop()
{
	true
}



################ Epilogue

run_rc_command "$1"

# vim: ft=bash
