summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-03-29 17:22:30 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-03-29 17:30:19 -0700
commitfdd02b11dc07222c63d5831965ace2ae7e85fb18 (patch)
tree1d807e588276aa5ec886a62abb479848a423f6fe /scripts
parente110a69d6217a6a9fa7bc87bb7ff2a60cda152fa (diff)
downloadvyatta-cfg-qos-fdd02b11dc07222c63d5831965ace2ae7e85fb18.tar.gz
vyatta-cfg-qos-fdd02b11dc07222c63d5831965ace2ae7e85fb18.zip
Get ifb devices working
Need to have a match rule (even it is match all). Change naming convention for ifb devices Don't autocreate ifb0, ifb1
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 6fc38dc..68af9e1 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;
}