summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-03-29 17:30:23 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-03-29 17:30:23 -0700
commitea3d7f634d828e97a689d3e7cec9fdd9950be8c6 (patch)
tree99f5ca31bae4b3a959933fdbafe4438f01a69874 /scripts
parent4e6e6ff12dd1b3c402717d71f9ee1f8f68545213 (diff)
parentfdd02b11dc07222c63d5831965ace2ae7e85fb18 (diff)
downloadvyatta-cfg-qos-ea3d7f634d828e97a689d3e7cec9fdd9950be8c6.tar.gz
vyatta-cfg-qos-ea3d7f634d828e97a689d3e7cec9fdd9950be8c6.zip
Merge branch 'larkspur' of vm:git/vyatta-cfg-qos into larkspur
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-qos.pl18
1 files changed, 14 insertions, 4 deletions
diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl
index 4a3783e..94cd179 100755
--- a/scripts/vyatta-qos.pl
+++ b/scripts/vyatta-qos.pl
@@ -109,8 +109,9 @@ sub delete_interface {
system($cmd);
# remove IFB device if any
- if ($direction eq 'in') {
- $cmd = "sudo ip link delete dev $interface-in";
+ my $ifb = "ifb.$interface";
+ if ( -d "/sys/class/net/$ifb") {
+ $cmd = "sudo ip link delete dev $ifb";
system ($cmd);
}
}
@@ -175,16 +176,25 @@ sub update_interface {
# For non-ingress Qos use ifb device
elsif ($direction eq 'in') {
- my $ifb = $device . "-in";
+ # load module but don't make any ifb's
+ system("sudo modprobe ifb numifbs=0") unless ( -d '/sys/module/ifb' );
+
+ # create new ifb device
+ my $ifb = "ifb.$device";
system("sudo ip link add dev $ifb type ifb") == 0
or die "Can't create $ifb: $!";
-
system("sudo ip link set dev $ifb up") == 0
or die "Can't bring $ifb up: $!";
+ # create ingress queue discipline
print "qdisc add dev $device ingress\n";
+
+ # redirect incoming packets to ifb
print "filter add dev $device parent ffff: protocol all prio 10";
+ print " u32 match u32 0 0 flowid 1:1";
print " action mirred egress redirect dev $ifb\n";
+
+ # tell shaper to use ifb device
$device = $ifb;
}