Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ##FreshJR_QOS FakeTC method BETA2 released 02/08/2018
- ##Script Tested on ASUS AC-68U, FW382.2, using Adaptive QOS with Manual Bandwidth Settings
- ##Script Changes Unidentified Packet QOS destination from Default Traffic Container (Category7) into user definable (in WebUI) Other Traffic Container
- ##Script Changes Minimum Guaranteed Bandwidth per QOS category from 128Kbit into user defined percentages upload and download.
- ##Script supports custom QOS rules, to create rules copy applicable rule templates below, change filter parameters as desried, and then paste into custom rule start area.
- ## Included custom rule moves any TCP/UDP traffic on ports 500 & 4500 into VOIP traffic Container. (Wifi Calling)
- ## Included custom rule moves any TCP/UDP traffic on ports 16384 - 16415 into VOIP traffic Container. (Facetime)
- #---------------------------------------------------------------------------------------------------------------
- # VALID FLOW ID'S FOR CUSTOM RULES
- # ${VOIP}, ${Gaming}, ${Others}, ${Web}, ${Streaming}, ${Downloads}, ${Default}, ${Net}
- #
- # VALID MARKS FOR IPTABLES
- # ${VOIP_mark}, ${Gaming_mark}, ${Others_mark}, ${Web_mark}, ${Streaming_mark}, ${Downloads_mark}, ${Default_mark}, ${Net_mark}
- #
- # DOWNLOAD/INCOMMING TRAFFIC rule templates. See comments next to rule for details
- # ${tc} filter add dev br0 protocol all prio 2 u32 match ip dport 1234 0xffff flowid ${Downloads} #Template Rule 1 (All incomming traffic w/ LAN destination port 1234 goes to "Downloads" Traffic Container) (0xFFFF port mask defines only one port, if port range is desired see SNB forum post for guide)
- # ${tc} filter add dev br0 protocol all prio 2 u32 match ip dst 192.168.1.100/32 flowid ${VOIP} #Template Rule 2 (All incomming traffic w/ LAN destination ip 192.168.1.100 goes to "VOIP" Traffic Container)
- # ${tc} filter add dev br0 protocol all prio 2 u32 match u32 0xCCDDEEFF 0xffffffff at -16 flowid {VOIP} #Template Rule 3 (All incomming traffic w/ LAN destination MAC Address AA:BB:CC:DD:EE:FF goes to "VOIP" Traffic Container) **RULE USES LAST 8 MAC DIGITS
- # ${tc} filter add dev br0 protocol all prio 2 u32 match ip src 75.75.75.75/32 flowid ${Streaming} #Template Rule 4 (All incomming traffic w/ WAN server source ip 75.75.75.75 goes to "Streaming" Traffic Container) (/32 CIDR mask defines only one ip, if IP range is desired see SNB forum post for guide)
- #
- # UPLOAD/OUTOING TRAFFIC rule templates. See comments next to rule for details
- # ${tc} filter add dev eth0 protocol all prio 2 u32 match ip sport 1234 0xffff flowid ${Downloads} #Template Rule 1 (All outgoing traffic w/ LAN source port 1234 goes to "Downloads" Traffic Container) (0xFFFF port mask defines only one port, if port range is desired see SNB forum post for guide)
- # ${tc} filter add dev eth0 protocol all prio 2 u32 match ip src 192.168.1.100/32 flowid ${VOIP} #Template Rule 2 -->NOT WORKING/USE IPTABLES ALTERNATIVE<-- (All outgoing traffic w/ LAN source ip 192.168.1.123 goes to "VOIP" Traffic Container) **Reason this does not work is because you can only apply filters to egress traffic. The egress source IP of outgoing traffic is your Public WAN IP, not your Local LAN IP. So filter will not match on local IP.
- # ${tc} filter add dev eth0 protocol all prio 2 u32 match u16 0xEEFF 0xffff at -8 flowid {VOIP} #Template Rule 3 -->NOT WORKING/USE IPTABLES ALTERNATIVE<-- (All outgoing traffic w/ LAN source MAC Address AA:BB:CC:DD:EE:FF goes to "VOIP" Traffic Container) **RULE USES LAST 4 MAC DIGITS **Reason this does not work is because you can only apply filters to egress traffic. The egress source MAC ADDRESS of outgoing traffic is your Router MAC ADDRESS, not your client MAC ADDRESS. So filter will not match on local MAC ADDRESS.
- # ${tc} filter add dev eth0 protocol all prio 2 u32 match ip dst 75.75.75.75/32 flowid ${Streaming} #Template Rule 4 (All outgoing traffic w/ WAN server destination ip 75.75.75.75 goes to "Streaming" Traffic Container) (/32 CIDR mask defines only one ip, if IP range is desired see SNB forum post for guide)
- #
- # iptables -D POSTROUTING -t mangle -o eth0 -s 192.168.1.100/32 -j MARK --set-mark ${VOIP_mark} #Template Rule 2 WORKING ALTERNATIVE (Line1/2)
- # iptables -A POSTROUTING -t mangle -o eth0 -s 192.168.1.100/32 -j MARK --set-mark ${VOIP_mark} #Template Rule 2 WORKING ALTERNATIVE (Line2/2)
- # iptables -D POSTROUTING -t mangle -o eth0 -m mac --mac-source AA:BB:CC:DD:EE:FF -j MARK --set-mark ${VOIP_mark} #Template Rule 3 WORKING ALTERNATIVE (Line1/2)
- # iptables -A POSTROUTING -t mangle -o eth0 -m mac --mac-source AA:BB:CC:DD:EE:FF -j MARK --set-mark ${VOIP_mark} #Template Rule 3 WORKING ALTERNATIVE (Line2/2)
- #---------------------------------------------------------------------------------------------------------------
- #################### Bandwidth Setup #####################
- user_variables() {
- #Percent of download speed guaranteed per QOS category, change below as desired (sum should equal 100)
- NetControl_DownBandPercent=5 #This value can be adjust as desired
- VoIP_DownBandPercent=20 #This value can be adjust as desired
- Gaming_DownBandPercent=15 #This value can be adjust as desired
- Others_DownBandPercent=10 #This value can be adjust as desired #Note: New destination for all unidentified traffic per script default
- WebSurfing_DownBandPercent=10 #This value can be adjust as desired
- Video_DownBandPercent=30 #This value can be adjust as desired
- FileTransfer_DownBandPercent=5 #This value can be adjust as desired
- Default_DownBandPercent=5 #This value can be adjust as desired #Note: Original destination all for unidentified traffic, no traffic should flow here
- #Percent of upload speed guaranteed per QOS category, change below as desired (sum should equal 100)
- NetControl_UpBandPercent=5 #This value can be adjust as desired
- VoIP_UpBandPercent=20 #This value can be adjust as desired
- Gaming_UpBandPercent=15 #This value can be adjust as desired
- Others_UpBandPercent=30 #This value can be adjust as desired #Note: New destination for all unidentified traffic per script default
- WebSurfing_UpBandPercent=10 #This value can be adjust as desired
- Video_UpBandPercent=10 #This value can be adjust as desired
- FileTransfer_UpBandPercent=5 #This value can be adjust as desired
- Default_UpBandPercent=5 #This value can be adjust as desired #Note: Original destination all for unidentified traffic, no traffic should flow here
- }
- #################### Custom Rules Setup #####################
- custom_down_rules() {
- read_variables
- logger "Adaptive QOS: Applying Custom Download Rules"
- ##DOWNLOAD (INCOMMING TRAFFIC) CUSTOM RULES START HERE
- realtc filter add dev br0 protocol all prio 2 u32 match ip dport 500 0xffff flowid ${VOIP} #Wifi Calling (All incomming traffic w/ LAN destination port 500 goes to "VOIP" Traffic Container)
- realtc filter add dev br0 protocol all prio 2 u32 match ip dport 4500 0xffff flowid ${VOIP} #Wifi Calling (All incomming traffic w/ LAN destination port 4500 goes to "VOIP" Traffic Container)
- realtc filter add dev br0 protocol all prio 2 u32 match ip dport 16384 0xffe0 flowid ${VOIP} #Facetime
- realtc filter add dev br0 protocol all prio 2 u32 match mark 0x80000000 0x8000ffff match ip dst 192.168.1.100/30 flowid ${Gaming} #Gaming - Routed Unidentified Traffic into Gaming for specified LAN devices
- ##DOWNLOAD (INCOMMING TRAFFIC) CUSTOM RULES END HERE
- realtc filter add dev br0 protocol all prio 2 u32 match mark 0x80000000 0x8000ffff flowid ${Others} #Creates rule routing unidentified traffic into "Others" traffic container which user adjustable in webUI, instead of default reouting pf traffoc into non adjustable "Default" traffic container
- }
- custom_up_rules() {
- read_variables
- logger "Adaptive QOS: Applying Custom Upload Rules"
- ##UPLOAD (OUTGOING TRAFFIC) CUSTOM RULES START HERE
- realtc filter add dev eth0 protocol all prio 2 u32 match ip sport 500 0xffff flowid ${VOIP} #Wifi Calling (All outgoing traffic w/ LAN source port 500 goes to "VOIP" Traffic Container)
- realtc filter add dev eth0 protocol all prio 2 u32 match ip sport 4500 0xffff flowid ${VOIP} #Wifi Calling (All outgoing traffic w/ LAN source port 4500 goes to "VOIP" Traffic Container)
- realtc filter add dev eth0 protocol all prio 2 u32 match ip sport 16384 0xffe0 flowid ${VOIP} #Facetime
- iptables -D POSTROUTING -t mangle -o eth0 -s 192.168.1.100/30 -m mark --mark 0x40000000/0x4000ffff -j MARK --set-mark ${Gaming_mark} #Gaming - Routed Unidentified Traffic into Gaming for specified LAN devices (line 1/2)
- iptables -A POSTROUTING -t mangle -o eth0 -s 192.168.1.100/30 -m mark --mark 0x40000000/0x4000ffff -j MARK --set-mark ${Gaming_mark} #Gaming - Routed Unidentified Traffic into Gaming for specified LAN devices (line 2/2)
- ##UPLOAD (OUTGOING TRAFFIC) CUSTOM RULES END HERE
- realtc filter add dev eth0 protocol all prio 2 u32 match mark 0x40000000 0x4000ffff flowid ${Others} #Creates rule routing unidentified traffic into "Others" traffic container which user adjustable in webUI, instead of default reouting pf traffoc into non adjustable "Default" traffic container
- }
- rule22_down() {
- read_variables
- logger "Adaptive QOS: Modifying Download Rule 22 Container Destination"
- realtc filter add dev br0 protocol all prio 22 u32 match mark 0x80130000 0xc03f0000 flowid ${Web} #create https traffic that routes HTTPS traffic into "Web Surfing"
- }
- rule22_up() {
- read_variables
- logger "Adaptive QOS: Modifying Upload Rule 22 Container Destination"
- realtc filter add dev eth0 protocol all prio 22 u32 match mark 0x40130000 0xc03f0000 flowid ${Web} #create https traffic that routes HTTPS traffic into "Web Surfing"
- }
- #################### DO NOT MODIFY BELOW #####################
- #################### DO NOT MODIFY BELOW #####################
- #################### DO NOT MODIFY BELOW #####################
- #################### DO NOT MODIFY BELOW #####################
- #################### DO NOT MODIFY BELOW #####################
- #################### DO NOT MODIFY BELOW #####################
- #################### DO NOT MODIFY BELOW #####################
- #################### DO NOT MODIFY BELOW #####################
- #################### DO NOT MODIFY BELOW #####################
- #################### DO NOT MODIFY BELOW #####################
- #################### DO NOT MODIFY BELOW #####################
- read_variables() {
- [ -f /jffs/scripts/FreshJR_QOS.vars ] && logger -s "Adaptive QOS: -- ERROR -- FreshJR_QOS.vars file is missing -- QOS non-functional"
- source /jffs/scripts/FreshJR_QOS.vars
- VOIP_mark="0x40060001" #Marks to be used if using iptable rules
- Gaming_mark="0x40080001" #Note these marks are same as filter match/mask combo but have a 1 at the end. That trailing 1 prevents them from being caught by unidentified mask
- Others_mark="0x400a0001"
- Web_mark="0x400d0001"
- Streaming_mark="0x40040001"
- Downloads_mark="0x40030001"
- Default_mark="0x40000000"
- Net_mark="0x40090000"
- }
- set_variables() {
- logger "Adaptive QOS: Started (Reading User Variables)"
- VARFILE="/jffs/scripts/FreshJR_QOS.vars"
- echo "" > $VARFILE
- echo Net="1:10" >> $VARFILE
- user_variables # load user variables at beggining of script
- flowid=0
- while read -r line; # reads order of QOS filter rules and class catagories
- do
- case ${line%%,*} in # truncates rules present inside each catagory showing only first rule. Use these first rules to correlate each categories with their friendly name and their order
- '0')
- echo VOIP="1:1${flowid}" >> $VARFILE #VOIP
- eval "Cat${flowid}DownBandPercent=${VoIP_DownBandPercent}"
- eval "Cat${flowid}UpBandPercent=${VoIP_UpBandPercent}"
- ;;
- '1')
- echo Downloads="1:1${flowid}" >> $VARFILE #Downloads
- eval "Cat${flowid}DownBandPercent=${FileTransfer_DownBandPercent}"
- eval "Cat${flowid}UpBandPercent=${FileTransfer_UpBandPercent}"
- ;;
- '4')
- echo Streaming="1:1${flowid}" >> $VARFILE #Streaming
- eval "Cat${flowid}DownBandPercent=${Video_DownBandPercent}"
- eval "Cat${flowid}UpBandPercent=${Video_UpBandPercent}"
- ;;
- '7')
- echo Others="1:1${flowid}" >> $VARFILE #Others
- eval "Cat${flowid}DownBandPercent=${Others_DownBandPercent}"
- eval "Cat${flowid}UpBandPercent=${Others_UpBandPercent}"
- ;;
- '8')
- echo Gaming="1:1${flowid}" >> $VARFILE #Gaming
- eval "Cat${flowid}DownBandPercent=${Gaming_DownBandPercent}"
- eval "Cat${flowid}UpBandPercent=${Gaming_UpBandPercent}"
- ;;
- '9')
- Control="1:1${flowid}" #Net Control
- Cat0DownBandPercent=${NetControl_DownBandPercent}
- Cat0UpBandPercent=${NetControl_UpBandPercent}
- ;;
- '13')
- echo Web="1:1${flowid}" >> $VARFILE #Web Surfing
- eval "Cat${flowid}DownBandPercent=${WebSurfing_DownBandPercent}"
- eval "Cat${flowid}UpBandPercent=${WebSurfing_UpBandPercent}"
- ;;
- esac
- flowid=$((flowid + 1))
- done <<EOF
- $(nvram get bwdpi_app_rulelist | tr '<' '\n')
- EOF
- echo Default="1:17" >> $VARFILE #Default
- Cat7DownBandPercent=${Default_DownBandPercent}
- Cat7UpBandPercent=${Default_UpBandPercent}
- DownCeil="$(printf "%.0f" $(nvram get qos_ibw))" #Download rate defined in WebUI
- UpCeil="$(printf "%.0f" $(nvram get qos_obw))" #Upload rate defined in WebUI
- echo " " >> $VARFILE
- echo DownRate0="$(expr ${DownCeil} \* ${Cat0DownBandPercent} / 100)" >> $VARFILE #Minimum guarenteed Up/Down rates per QOS catagory corresponding to user defined percentages
- echo DownRate1="$(expr ${DownCeil} \* ${Cat1DownBandPercent} / 100)" >> $VARFILE
- echo DownRate2="$(expr ${DownCeil} \* ${Cat2DownBandPercent} / 100)" >> $VARFILE
- echo DownRate3="$(expr ${DownCeil} \* ${Cat3DownBandPercent} / 100)" >> $VARFILE
- echo DownRate4="$(expr ${DownCeil} \* ${Cat4DownBandPercent} / 100)" >> $VARFILE
- echo DownRate5="$(expr ${DownCeil} \* ${Cat5DownBandPercent} / 100)" >> $VARFILE
- echo DownRate6="$(expr ${DownCeil} \* ${Cat6DownBandPercent} / 100)" >> $VARFILE
- echo DownRate7="$(expr ${DownCeil} \* ${Cat7DownBandPercent} / 100)" >> $VARFILE
- echo " " >> $VARFILE
- echo UpRate0="$(expr ${UpCeil} \* ${Cat0UpBandPercent} / 100)" >> $VARFILE
- echo UpRate1="$(expr ${UpCeil} \* ${Cat1UpBandPercent} / 100)" >> $VARFILE
- echo UpRate2="$(expr ${UpCeil} \* ${Cat2UpBandPercent} / 100)" >> $VARFILE
- echo UpRate3="$(expr ${UpCeil} \* ${Cat3UpBandPercent} / 100)" >> $VARFILE
- echo UpRate4="$(expr ${UpCeil} \* ${Cat4UpBandPercent} / 100)" >> $VARFILE
- echo UpRate5="$(expr ${UpCeil} \* ${Cat5UpBandPercent} / 100)" >> $VARFILE
- echo UpRate6="$(expr ${UpCeil} \* ${Cat6UpBandPercent} / 100)" >> $VARFILE
- echo UpRate7="$(expr ${UpCeil} \* ${Cat7UpBandPercent} / 100)" >> $VARFILE
- #Minimum guarenteed Up/Down rates per QOS user within catagory (this allocation occurs after QOS catagory allotment)
- #Will be to 1/10 of the parent download catagories rate or a minimum of 25 kb/s
- #
- #echo " " >> $VARFILE #will be enabled for BETA2
- #echo subDownRate0="$(expr ${DownRate0} / 10)" >> $VARFILE #Might save in NVRAM instead of VAR file since subclasses are called and changed often
- #echo subDownRate1="$(expr ${DownRate1} / 10)" >> $VARFILE #Not enabled in BETA1 since want to check for existing bugs before experimental features
- #echo subDownRate2="$(expr ${DownRate2} / 10)" >> $VARFILE
- #echo subDownRate3="$(expr ${DownRate3} / 10)" >> $VARFILE
- #echo subDownRate4="$(expr ${DownRate4} / 10)" >> $VARFILE
- #echo subDownRate5="$(expr ${DownRate5} / 10)" >> $VARFILE
- #echo subDownRate6="$(expr ${DownRate6} / 10)" >> $VARFILE
- #echo subDownRate7="$(expr ${DownRate7} / 10)" >> $VARFILE
- #Will be to 1/10 of the parent download catagories rate or a minimum of 2 kb/s
- #
- #echo " " >> $VARFILE
- #echo subUpRate0="$(expr ${UpRate0} / 10)" >> $VARFILE
- #echo subUpRate1="$(expr ${UpRate1} / 10)" >> $VARFILE
- #echo subUpRate2="$(expr ${UpRate2} / 10)" >> $VARFILE
- #echo subUpRate3="$(expr ${UpRate3} / 10)" >> $VARFILE
- #echo subUpRate4="$(expr ${UpRate4} / 10)" >> $VARFILE
- #echo subUpRate5="$(expr ${UpRate5} / 10)" >> $VARFILE
- #echo subUpRate6="$(expr ${UpRate6} / 10)" >> $VARFILE
- #echo subUpRate7="$(expr ${UpRate7} / 10)" >> $VARFILE
- }
- #Main program here, will execute different things depending on arguments
- case "$@" in
- '-init')
- set_variables
- ;;
- '-custom_down_rules')
- custom_down_rules
- ;;
- '-custom_up_rules')
- custom_up_rules
- ;;
- '-rule22_down')
- rule22_down
- ;;
- '-rule22_up')
- rule22_up
- ;;
- '-start') ##RAN ON SCRIPT STARTUP
- if [ "/jffs/scripts/FreshJR_QOS_fakeTC" -ef "/usr/sbin/tc" ] ; then
- logger -s "Adaptive QOS: FreshJR fakeTC Enabled (No Change Required)"
- else
- umount /usr/sbin/tc
- mount -o bind /jffs/scripts/FreshJR_QOS_fakeTC /usr/sbin/tc #replaces tc with FreshJR_QOS_fakeTC on startup
- if [ "/jffs/scripts/FreshJR_QOS_fakeTC" -ef "/usr/sbin/tc" ] ; then
- logger -s "Adaptive QOS: FreshJR FakeTC Enabled"
- else
- logger -s "Adaptive QOS: Start Error - FreshJR FakeTC NOT enabled"
- fi
- fi
- set_variables #creates var file
- ;;
- 'install'|'enable') ## INSTALLS AND TURNS ON SCRIPT
- if [ "$(nvram get qos_enable)" = "1" ] ; then
- echo "Disable QOS before attempting to install - script NOT installed"
- else
- if [ -f /jffs/scripts/firewall-start ] ; then #check if firewall-start exists
- if grep -q "#!/bin/sh" /jffs/scripts/firewall-start ; then #check if firewall-start header is correct
- : #if header is correct, do nothing
- else #if header is incorrect, fix header
- echo "Detected improper header in firewall-start, fixing header"
- sed -i "1i #!/bin/sh" /jffs/scripts/firewall-start
- chmod 0755 /jffs/scripts/firewall-start
- fi
- if grep -q -x "/jffs/scripts/FreshJR_QOS -start" /jffs/scripts/firewall-start ; then #check if FreshJR_QOS is present as item in firewall start
- : #if FreshJR_QOS is present do nothing
- else #if not, appened it to the last line
- echo "Installing FreshJR QOS into firewall-start"
- echo "/jffs/scripts/FreshJR_QOS -start" >> /jffs/scripts/firewall-start
- fi
- else #if firewall-does not exist, set it up entirely
- echo "Firewall-start not detected, creating firewall-start"
- echo "Installing FreshJR QOS into firewall-start"
- echo "#!/bin/sh" > /jffs/scripts/firewall-start
- echo "/jffs/scripts/FreshJR_QOS -start" >> /jffs/scripts/firewall-start
- chmod 0755 /jffs/scripts/firewall-start
- fi
- if [ "/jffs/scripts/FreshJR_QOS_fakeTC" -ef "/usr/sbin/tc" ] ; then #check if FreshJR_QOS_fakeTC is running after install
- echo ""
- echo -e "\033[1;32m FreshJR QOS was successfully installed \033[0m"
- echo -e "\033[1;32m (Adaptive QOS is turned OFF in router UI) \033[0m"
- echo ""
- else
- umount /usr/sbin/tc
- mount -o bind /jffs/scripts/FreshJR_QOS_fakeTC /usr/sbin/tc #if not running, replace faketc with FreshJR_QOS_fakeTC
- if [ "/jffs/scripts/FreshJR_QOS_fakeTC" -ef "/usr/sbin/tc" ] ; then
- logger "Adaptive QOS: FreshJR QOS FakeTC Installed"
- echo ""
- echo -e "\033[1;32m FreshJR QOS was successfully installed \033[0m"
- echo -e "\033[1;32m (Adaptive QOS is turned OFF in router UI) \033[0m"
- echo -e '(Ignore "Cant Unmount - Invalid Argument" Error Message if present)'
- echo ""
- else
- logger -s "Adaptive QOS: Error Installing FreshJR_QOS"
- fi
- fi
- cru d FreshJR_QOS #removes cron job from old version of script
- fi
- ;;
- 'uninstall') ## UNINSTALLS SCRIPT AND DELETES FILES
- if [ "$(nvram get qos_enable)" = "1" ] ; then
- echo "Disable QOS before attempting to uninstall - script NOT uninstalled"
- else
- if [ "/usr/sbin/faketc" -ef "/usr/sbin/tc" ] ; then
- :
- else
- umount /usr/sbin/tc
- mount -o bind /usr/sbin/faketc /usr/sbin/tc #if script is enabled, replaces FreshJR_QOS_fakeTC with faketc
- fi
- sed -i '/FreshJR_QOS/d' /jffs/scripts/firewall-start #remove FreshJR_QOS from firewall start
- rm -f /jffs/scripts/FreshJR_QOS_fakeTC #deletes all related FreshJR_QOS files
- rm -f /jffs/scripts/FreshJR_QOS.vars
- rm -f /jffs/scripts/FreshJR_QOS
- if [ "/usr/sbin/faketc" -ef "/usr/sbin/tc" ] ; then
- logger -s "Adaptive QOS: FreshJR QOS Uninstalled"
- else
- logger -s "Adaptive QOS: Error Uninstalling FreshJR QOS"
- fi
- cru d FreshJR_QOS #removes cron job from old version of script
- fi
- ;;
- 'disable') ## TURNS OFF SCRIPT BUT KEEP FILES
- if [ "/usr/sbin/faketc" -ef "/usr/sbin/tc" ] ; then
- sed -i '/FreshJR_QOS/d' /jffs/scripts/firewall-start
- logger -s "Adaptive QOS: FreshJR_QOS_fakeTC Disabled"
- else
- if [ "$(nvram get qos_enable)" = "1" ] ; then
- echo "Disable QOS before attempting to disable the script - script not disabled"
- else
- umount /usr/sbin/tc
- mount -o bind /usr/sbin/faketc /usr/sbin/tc #replaces tc with faketc
- sed -i '/FreshJR_QOS/d' /jffs/scripts/firewall-start
- if [ "/usr/sbin/faketc" -ef "/usr/sbin/tc" ] ; then
- logger -s "Adaptive QOS: FreshJR_QOS_fakeTC Disabled"
- else
- logger -s "Adaptive QOS: Error Disabling FreshJR_QOS_fakeTC"
- fi
- fi
- fi
- ;;
- *)
- echo "These are available commands:"
- echo ""
- echo "FreshJR_QOS check status of script, views help file"
- echo "FreshJR_QOS enable starts script, enables autostart on boot"
- echo "FreshJR_QOS install starts script, enables autostart on boot"
- echo "FreshJR_QOS disable stops script, turns off autostart on boot"
- echo "FreshJR_QOS uninstall stops script, turns off autostart on boot, deletes from on disk "
- echo ""
- if [ "/jffs/scripts/FreshJR_QOS_fakeTC" -ef "/usr/sbin/tc" ] ; then
- echo -e "\033[1;32m FreshJR QOS fakeTC is enabled \033[0m"
- elif [ "/usr/sbin/faketc" -ef "/usr/sbin/tc" ] ; then
- echo -e "\033[1;32m FreshJR QOS fakeTC is NOT enabled \033[0m"
- else
- echo -e "\033[1;32m QOS System is left in a glitched state, please reboot router \033[0m"
- fi
- if [ "$(nvram get qos_enable)" = "1" ] ; then
- echo -e "\033[1;32m (Adaptive QOS is turned ON in router UI) \033[0m"
- else
- echo -e "\033[1;32m (Adaptive QOS is turned OFF in router UI) \033[0m"
- fi
- echo ""
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement