#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org

START=38

start() {
    # up interface first, otherwise the fpp will load failed
    ifconfig eth0 up

    if [ -e /proc/fppmode ]; then
        if [ "`grep "0" /proc/fppmode`" ]; then
            exit 0
        fi
    fi
    insmod comcerto_fpp
}

stop(){
        if [ -e /proc/fppmode ]; then
	  if [ "`grep "0" /proc/fppmode`" ]; then
            exit 0
          fi
        fi
# Fast Path processing MUST BE DISABLED before removing the module, otherwise the CSP will loose all network connectivity
	echo 0 > /sys/class/net/eth2/fast_path_enable
	echo 0 > /sys/class/net/eth0/fast_path_enable
	rmmod comcerto_fpp
}
