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
|
# pragma: parse and repeat external data --------------------------------------
PATH=$PATH:tcc/ext tcc -xif:echo 2>&1 >/dev/null
pragma("a" "b" "c");
$p = police(rate 1kbps,burst 2kB,pragma "what.ever" "et_cetera");
eth0 (pragma "foo=bar") {
prio {
class if conform police $p && count police $p;
class if 1;
}
}
EOF
pragma a b c
bucket 1 = 125 0 2048 2048 0 what.ever et_cetera
block eth0 egress foo=bar
action 3 = conform 1 action 0 action 2
action 0 = count 1 action 1
action 1 = class 1:1
action 2 = class 1:2
match action 3
# pragma: test pragma on device without prior use of parameters ---------------
PATH=$PATH:tcc/ext tcc -xif:echo 2>&1 >/dev/null
eth0 (pragma "foobar") {
prio {
class if 1;
}
}
EOF
block eth0 egress foobar
action 1 = class 1:1
match action 1
# pragma: qdiscs and classes --------------------------------------------------
PATH=$PATH:tcc/ext tcc -xif:echo -Xx,all 2>&1 >/dev/null | grep -v warning
dsmark (indices 4,pragma "hello") {
class (1,pragma "just" "a" "test") if 1;
}
EOF
block eth0 egress
qdisc 1 = dsmark indices 4 pragma hello
class 1 = pragma just a test
action 1 = class 1:1
match action 1
# pragma: empty global pragma is ignored (1) ----------------------------------
tcc -xif:err -Xx,all 2>&1 >/dev/null | grep -v '^#'
pragma ("");
fifo; /* put something so that grep doesn't fail */
EOF
block eth0 egress
qdisc 1 = fifo
action 0 = unspec
match action 0
# pragma: empty global pragma is ignored (2) ----------------------------------
tcc -xif:err -Xx,all 2>&1 >/dev/null | grep -v '^#'
pragma ("" "other");
EOF
pragma other
# pragma: empty pragma in parameters is ignored (1) ---------------------------
tcc -xif:err -Xx,all 2>&1 >/dev/null | grep -v '^#'
fifo (pragma "");
EOF
block eth0 egress
qdisc 1 = fifo
action 0 = unspec
match action 0
# pragma: empty pragma in parameters is ignored (2) ---------------------------
tcc -xif:err -Xx,all 2>&1 >/dev/null | grep -v '^#'
fifo (pragma "foo" "" "bar");
EOF
block eth0 egress
qdisc 1 = fifo pragma foo bar
action 0 = unspec
match action 0
|