[PATCH] Wondershaper uci config and modules fix
Hi, this patch adds uci config style for wshaper and also fixes a small problem with the loaded modules (act_police needs to be loaded). Signed-off-by: Manuel Munz <freifunk@somakoma.de> git-svn-id: svn://svn.openwrt.org/openwrt/packages@28454 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
a29fc4a78b
commit
b877ab2750
@ -8,7 +8,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=wshaper
|
PKG_NAME:=wshaper
|
||||||
PKG_VERSION:=0.1
|
PKG_VERSION:=0.2
|
||||||
|
|
||||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||||
|
|
||||||
@ -44,6 +44,7 @@ define Package/wshaper/install
|
|||||||
$(INSTALL_DIR) $(1)/usr/sbin/ $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/usr/sbin/ $(1)/etc/init.d
|
||||||
$(INSTALL_BIN) ./files/wshaper.htb $(1)/usr/sbin/
|
$(INSTALL_BIN) ./files/wshaper.htb $(1)/usr/sbin/
|
||||||
$(INSTALL_BIN) ./files/wshaper.init $(1)/etc/init.d/wshaper
|
$(INSTALL_BIN) ./files/wshaper.init $(1)/etc/init.d/wshaper
|
||||||
|
$(INSTALL_DATA) ./files/wshaper.config $(1)/etc/config/wshaper
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,wshaper))
|
$(eval $(call BuildPackage,wshaper))
|
||||||
|
4
net/wshaper/files/wshaper.config
Normal file
4
net/wshaper/files/wshaper.config
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
config 'wshaper' 'settings'
|
||||||
|
option 'network' 'wan'
|
||||||
|
option 'downlink' '2000'
|
||||||
|
option 'uplink' '240'
|
@ -5,23 +5,36 @@
|
|||||||
# Set the following values to somewhat less than your actual download
|
# Set the following values to somewhat less than your actual download
|
||||||
# and uplink speed. In kilobits. Also set the device that is to be shaped.
|
# and uplink speed. In kilobits. Also set the device that is to be shaped.
|
||||||
|
|
||||||
MODULES='sch_ingress sch_sfq sch_htb cls_u32'
|
# All config needs to be done in /etc/config/wshaper
|
||||||
DOWNLINK=2000
|
|
||||||
UPLINK=240
|
. /etc/functions.sh
|
||||||
DEV=eth0
|
config_load wshaper
|
||||||
|
for s in downlink uplink network nopriohostdst nopriohostsrc noprioportdst noprioportsrc; do
|
||||||
|
config_get $s settings $s
|
||||||
|
done
|
||||||
|
|
||||||
|
device=$(uci_get_state network "$network" device)
|
||||||
|
[ -z "$device" ] && logger -t wondershaper "Error: Could not find the device for network $network, aborting." && exit 1
|
||||||
|
[ -z "$downlink" ] && logger -t wondershaper "Error: Downlink speed not set, aborting." && exit 1
|
||||||
|
[ -z "$uplink" ] && logger -t wondershaper "Error: Uplink speed not set, aborting." && exit 1
|
||||||
|
|
||||||
|
MODULES='sch_ingress sch_sfq sch_htb cls_u32 act_police'
|
||||||
|
DOWNLINK="$downlink"
|
||||||
|
UPLINK="$uplink"
|
||||||
|
DEV="$device"
|
||||||
|
|
||||||
# low priority OUTGOING traffic - you can leave this blank if you want
|
# low priority OUTGOING traffic - you can leave this blank if you want
|
||||||
# low priority source netmasks
|
# low priority source netmasks
|
||||||
NOPRIOHOSTSRC=
|
NOPRIOHOSTSRC="$nopriohostsrc"
|
||||||
|
|
||||||
# low priority destination netmasks
|
# low priority destination netmasks
|
||||||
NOPRIOHOSTDST=
|
NOPRIOHOSTDST="$nopriohostdst"
|
||||||
|
|
||||||
# low priority source ports
|
# low priority source ports
|
||||||
NOPRIOPORTSRC=
|
NOPRIOPORTSRC="$noprioportsrc"
|
||||||
|
|
||||||
# low priority destination ports
|
# low priority destination ports
|
||||||
NOPRIOPORTDST="21"
|
NOPRIOPORTDST="$noprioportdst"
|
||||||
|
|
||||||
if [ "$1" = "status" ]
|
if [ "$1" = "status" ]
|
||||||
then
|
then
|
||||||
@ -144,3 +157,5 @@ tc qdisc add dev $DEV handle ffff: ingress
|
|||||||
|
|
||||||
tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
|
tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
|
||||||
0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1
|
0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1
|
||||||
|
|
||||||
|
logger -t wondershaper "Wondershaper was started on device $device."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user