1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
# CBQ without -C (base for following tests) -----------------------------------
LD_LIBRARY_PATH=. PATH=$PATH:tcc/ext tcsim -n -Xc,-xif:test -v | \
sed '/.* c .*returns /s///p;d'
#include "ip.def"
dev eth0 10000 {
#include "tcngreg.def"
#include "fields.tc"
cbq (CBQ_PARAMS,weight 1Mbps) {
class (rate 5Mbps)
if (ip_tos & 2) == 0
{
class (rate 2Mbps) // looks funny ? well, the rule is that each
if ip_tos == 2; // "if" selects the final class, so the "inner"
class (rate 2Mbps) // ifs must not overlap with the "outer" if,
if ip_tos == 3; // because the latter, being first, takes
} // precedence
}
}
$ipproto=TCP $src=1.2.3.4 $dst=5.6.7.8
send IP_HDR($tos=0)
send IP_HDR($tos=1)
send IP_HDR($tos=2)
send IP_HDR($tos=3)
EOF
OK (0) (1:1, 0x0)
OK (0) (1:1, 0x0)
OK (0) (1:2, 0x0)
OK (0) (1:3, 0x0)
# CBQ with -C, no priomap -----------------------------------------------------
LD_LIBRARY_PATH=. PATH=$PATH:tcc/ext tcsim -n -Xc,-xif:test -Xx,nounspec -v | \
sed '/.* c .*returns /s///p;d'
#include "ip.def"
dev eth0 10000 {
#include "tcngreg.def"
#include "fields.tc"
cbq (CBQ_PARAMS,weight 1Mbps) {
class (1,rate 5Mbps)
if 0 /* dummy */
{
class (2,rate 2Mbps);
class (3,rate 2Mbps);
}
}
}
$ipproto=TCP $src=1.2.3.4 $dst=5.6.7.8
send IP_HDR($tos=0)
send IP_HDR($tos=1)
send IP_HDR($tos=2)
EOF
OK (0) (1:0, 0x0)
OK (0) (1:0, 0x0)
OK (0) (1:0, 0x0)
# CBQ with -C and priomap: basic ----------------------------------------------
LD_LIBRARY_PATH=. PATH=$PATH:tcc/ext tcsim -n -Xc,-xif:test -Xx,nounspec -v | \
sed '/.* c .*returns /s///p;d'
#include "ip.def"
dev eth0 10000 {
#include "tcngreg.def"
#include "fields.tc"
cbq (CBQ_PARAMS,weight 1Mbps) {
class (1,rate 5Mbps,priomap $c0 $c1)
if 1
{
$c0 = class (2,rate 2Mbps);
$c1 = class (3,rate 2Mbps);
}
}
}
$ipproto=TCP $src=1.2.3.4 $dst=5.6.7.8
send IP_HDR($tos=0)
send IP_HDR($tos=1)
send IP_HDR($tos=2)
send IP_HDR($tos=3)
send IP_HDR($tos=4)
EOF
OK (0) (1:2, 0x0)
OK (0) (1:2, 0x0)
OK (0) (1:3, 0x0)
OK (0) (1:3, 0x0)
OK (0) (1:2, 0x0)
# CBQ with -C and priomap: with local selector --------------------------------
LD_LIBRARY_PATH=. PATH=$PATH:tcc/ext tcsim -n -Xc,-xif:test -Xx,nounspec -v | \
sed '/.* c .*returns /s///p;d'
#include "ip.def"
dev eth0 10000 {
#include "tcngreg.def"
#include "fields.tc"
cbq (CBQ_PARAMS,weight 1Mbps,priomap $c0 $c1) {
$c0 = class (1,rate 2Mbps)
if ip_tos == 3;
$c1 = class (2,rate 2Mbps);
}
}
$ipproto=TCP $src=1.2.3.4 $dst=5.6.7.8
send IP_HDR($tos=0)
send IP_HDR($tos=1)
send IP_HDR($tos=2)
send IP_HDR($tos=3)
send IP_HDR($tos=4)
EOF
OK (0) (1:1, 0x0)
OK (0) (1:1, 0x0)
OK (0) (1:2, 0x0)
OK (0) (1:1, 0x0)
OK (0) (1:1, 0x0)
# CBQ with -C and priomap: cascaded -------------------------------------------
LD_LIBRARY_PATH=. PATH=$PATH:tcc/ext \
tcsim -n -Xc,-xif:test -Xc,-B -Xx,nounspec -v | \
sed '/.* c .*returns /s///p;d'
#include "ip.def"
dev eth0 10000 {
#include "tcngreg.def"
#include "fields.tc"
cbq (CBQ_PARAMS,weight 1Mbps,priomap $c0 $c1) {
$c0 = class (2,rate 2Mbps,priomap $c2) {
$c2 = class(4,rate 1Mbps);
}
$c1 = class (3,rate 2Mbps)
if 0;
}
}
$ipproto=TCP $src=1.2.3.4 $dst=5.6.7.8
send IP_HDR($tos=0)
send IP_HDR($tos=1)
send IP_HDR($tos=2)
send IP_HDR($tos=3)
EOF
OK (0) (1:4, 0x0)
OK (0) (1:4, 0x0)
OK (0) (1:3, 0x0)
OK (0) (1:3, 0x0)
|