#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=65
EXTRA_COMMANDS="status"
EXTRA_HELP="        status Print the status of the service"

WPORTAL_LIBDIR=/lib/wportal
. $WPORTAL_LIBDIR/config.sh


start() {
	local radiusclient_pid=`ps | grep radiusclient | grep -v grep | awk '{print $1}'`
	kill $radiusclient_pid 2>/dev/null
	wportal_restart

	# sfe & NSS flush
	local sfe_switch=`uci -q get sfe.setting.switch`
	local nss_switch=`uci -q get ecm.global.enable`
	[ "$sfe_switch" == "on" ] && {
		dnete xfwdm -F
	}
	[ "$nss_switch" == "on" ] && {
		echo 1 > /sys/kernel/debug/ecm/ecm_db/defunct_all
	}
	
	[ -e "/etc/init.d/hwnat" ] && {
		dnete hwnat -y
	}

}

stop() {
	vnete /usr/bin/wifidog-init stop
	vnete /etc/init.d/nginx stop 2>/dev/null
}

status() {
	vnete /usr/bin/wifidog-init status
}