File: precond

package info (click to toggle)
tcng 10b-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,632 kB
  • ctags: 2,515
  • sloc: ansic: 19,038; pascal: 4,640; yacc: 2,619; sh: 1,908; perl: 1,546; lex: 772; makefile: 755
file content (99 lines) | stat: -rw-r--r-- 2,735 bytes parent folder | download | duplicates (5)
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
# precond: non-field means "true" ---------------------------------------------
tcc -xif:err 2>&1 >/dev/null | grep match
prio {
    class if precond 666;
}
EOF
match action 1
# precond: no precondition means "true" ---------------------------------------
tcc -xif:err 2>&1 >/dev/null | grep match
field foo = raw[1];

prio {
    class if precond foo;
}
EOF
match action 1
# precond: single precondition on access --------------------------------------
tcc -xif:err 2>&1 >/dev/null |  sed 's/match \\(.*\\) action.*/\\1/p;d'
field foo = raw[1] if raw == 1;

prio {
    class if precond foo;
}
EOF
0:0:8=0x01
# precond: two preconditions on accesses separated by || ----------------------
tcc -xif:err 2>&1 >/dev/null |  sed 's/match \\(.*\\) action.*/\\1/p;d'
field one = raw[1] if raw[0] == 1;
field two = raw[1] if raw[2] == 2;

prio {
    class if precond(one || two);
}
EOF
0:0:8=0x01 0:16:8=0x02
# precond: two preconditions on accesses separated by || (check order) --------
tcc -xif:err 2>&1 >/dev/null |  sed 's/match \\(.*\\) action.*/\\1/p;d'
field one = raw[raw[10]] if raw[raw[20]] == 1;
field two = raw[raw[10]] if raw[raw[30]] == 2;

prio {
    class if precond(one || two);
}
EOF
100:0:8=0x01 101:0:8=0x02
# precond: nested preconditions on access -------------------------------------
tcc -xif:err 2>&1 >/dev/null |  sed 's/match \\(.*\\) action.*/\\1/p;d'
field one = raw[1] if raw[0] == 1;
field two = one if raw[2] == 2;

prio {
    class if precond(two == 67);
}
EOF
0:0:8=0x01 0:16:8=0x02
# precond: precondition on access in precondition -----------------------------
tcc -xif:err 2>&1 >/dev/null | sed 's/match \\(.*\\) action.*/\\1/p;d'
field one = raw[1] if raw[0] == 1;
field two = raw[2] if one == 2;

prio {
    class if precond(two == 67);
}
EOF
0:0:16=0x0102
# precond: precondition on precondition in precondition -----------------------
tcc -xif:err 2>&1 >/dev/null | sed 's/match \\(.*\\) action.*/\\1/p;d'
field one = raw[1] if raw[0] == 1;
field two = raw[2] if one == 2;
field three = raw[3] if two == 3;
prio {
    class if precond(three == 34);
}
EOF
0:0:24=0x010203
# precond: precondition on one access (of two, in ||) in precondition ---------
tcc -xif:err 2>&1 >/dev/null | sed 's/match \\(.*\\) action.*/\\1/p;d'
field one = raw[1] if raw[0] == 1;
field two = raw[2] if raw[0] == 0 || one == 2;

prio {
    class if precond(two == 67);
}
EOF
0:0:8=0x00
0:0:16=0x0102
# precond: precondition on one access (of two, in &&) in precondition ---------
tcc -xif:err 2>&1 >/dev/null | grep -v '^#'
field one = raw[1] if raw[0] == 1;
field two = raw[2] if raw[0] == 0 && one == 2;

prio {
    class if precond(two == 67);
}
EOF
block eth0 egress
action 0 = unspec
action 1 = class 1:1
match action 0