#!/bin/sh
# Copyright (C) 2009 Ubicom, Inc.

#
# Stop StreamEngine
#

. /etc/rgw_config

#
# main()
#	Entry point
# Is StreamEngine currently running?  If so then stop it.
#
if [ -e /sys/devices/system/ubicom_streamengine/ubicom_streamengine0 ] ; then
	echo Stopping StreamEngine
	./stop_se
fi
if [ -e /sys/devices/system/ubicom_default_classifier/ubicom_default_classifier0 ] ; then
	echo Stopping Default Classifier
	./stop_dc
fi

#
# Delete the linkage to the se_manual_rules_table
#
iptables -t mangle -D POSTROUTING -o $WAN_MODE_INTERFACE -m mark --mark 0 -j se_manual_rules_table 2> /dev/null

#
# Flush rules in the table
#
iptables -t mangle -F se_manual_rules_table 2> /dev/null

#
# Delete se_manual_rules_table
#
iptables -t mangle -X se_manual_rules_table 2> /dev/null
