wireless-net/trunk/sysconfig/interfaces/up.d/ppp/wlan-up.py
arekm
cvs at pld-linux.org
Thu Mar 23 21:16:17 CET 2006
Author: arekm
Date: Thu Mar 23 21:16:12 2006
New Revision: 7298
Modified:
wireless-net/trunk/sysconfig/interfaces/up.d/ppp/wlan-up.py
Log:
Limits are now handled at imq level.
Modified: wireless-net/trunk/sysconfig/interfaces/up.d/ppp/wlan-up.py
==============================================================================
--- wireless-net/trunk/sysconfig/interfaces/up.d/ppp/wlan-up.py (original)
+++ wireless-net/trunk/sysconfig/interfaces/up.d/ppp/wlan-up.py Thu Mar 23 21:16:12 2006
@@ -69,35 +69,12 @@
fl.write("%s: \"%s\" logged in [iface=%s, ip=%s, mac=%s]\n"
% (time.asctime(time.gmtime()), user, ppp_iface, ip, reth_mac))
- # setup proper bandwidth limits
- os.system("/sbin/tc qdisc del root dev %s 2> /dev/null" % ppp_iface)
- os.system("/sbin/tc qdisc del dev %s ingress 2> /dev/null" % ppp_iface)
-
- if int(speed_down) != 0:
- # downstream
- os.system("/sbin/tc qdisc add dev %s root tbf rate %skbit latency 50ms burst 4096"
- % (ppp_iface, speed_down))
-
- if int(speed_up) != 0:
- # upstream
- os.system("/sbin/tc qdisc add dev %s handle ffff: ingress" % ppp_iface)
- os.system("/sbin/tc filter add dev %s parent ffff: protocol ip prio 50 u32 match ip src 0.0.0.0/0 police rate %skbit burst 4096 drop flowid :1" % (ppp_iface, speed_up))
-
# filtering
os.system("iptables --flush wlanfilter_%s 2> /dev/null" % ppp_iface)
os.system("iptables -N wlanfilter_%s 2> /dev/null" % ppp_iface)
os.system("iptables -A wlanfilter_%s -i %s ! -s %s -j DROP" % (ppp_iface, ppp_iface, ppp_remip))
os.system("iptables -A wlanfilter_%s -o %s ! -d %s -j DROP" % (ppp_iface, ppp_iface, ppp_remip))
- # limit pkt/s
- if limit_packets_pppoa > 0 and speed_up != "0":
- # 8 bits, 1500/2 bytes
- speed_up_sec = int(round(int(speed_up)/(limit_packets_pppoa*(1.5/2))))
- if speed_up_sec < 1:
- speed_up_sec = 1
- os.system("iptables -A wlanfilter_%s -i %s -s %s -m limit --limit %s/s -m length --length 151:1500 -j RETURN" % (ppp_iface, ppp_iface, ppp_remip, speed_up_sec))
- os.system("iptables -A wlanfilter_%s -i %s -s %s -m length --length 151: -j DROP" % (ppp_iface, ppp_iface, ppp_remip))
-
os.system("iptables -A wlanfilter_%s -j RETURN" % ppp_iface)
os.system("iptables -I wlanfilter -j wlanfilter_%s" % ppp_iface)
More information about the pld-cvs-commit
mailing list