Chapter 5: Multi-Subnet Policy Checks with Reusable flow(c, s)
Write a multi-packet firewall check once using placeholder names, then replay it across Floor 1, Floor 2, Guest Wi-Fi, or IPv4 + IPv6.
Three campus user VLANs (floor1_pc, floor2_pc, wifi_user) all need to pass the same 4-packet TCP + TLS handshake to sso_gw without copy-pasting 12 lines.
What You'll Pull Off Here
- Define
flow name(c, s) { ... }betweenhostandcompile. - Reference only the placeholder parameter names (
c,s) inside theflowbody. - Call
tls_check(...)insidecompileacross multiple subnet pairs (including IPv4 and IPv6 pairs).
Lab 5: Run tls_check for wifi_user
Add tls_check(wifi_user, sso_gw) inside compile { ... } so all 3 campus subnets execute the 4-packet handshake (12 frames total).
- 1.Locate
compile { ... }at the bottom of the editor. - 2.Add
tls_check(wifi_user, sso_gw)right belowtls_check(floor2_pc, sso_gw). - 3.Click Check Exercise to confirm all 12 frames compile cleanly.
1. flow(c, s) — Reusable Packet Stencils Without Loops
Copy-pasting the same 4-packet TCP + TLS handshake across five campus subnets makes captures tedious to read and easy to mistype.
A flow block sits between host and compile. Give it placeholder names in parentheses (flow tls_check(c, s) { ... }), then call tls_check(floor1_pc, sso_gw) inside compile for each subnet pair you want to test.
- Parentheses with >= 1 parameter are required:
flow tls_check(c, s) { ... }. - Inside the
flowbraces, only use the parameter names (c,s), never globalhostnames. - There is no
loopkeyword: eachflowcall insidecompileexpands predictably in order.
Word-by-Word Syntax BreakdownDefine the exchange once, then stamp it out for any host pair:
flow tls_check(c, s) { ... } -> compile { tls_check(floor1_pc, sso_gw) }flow tls_check(c, s)Stencil HeaderReusable template taking two placeholder endpoints c and sc -> s tcp syn ...Stencil BodyUses c and s so any IPv4 pair or IPv6 pair can plug right intls_check(floor1_pc, sso_gw)Flow CallExpands all 4 frames inside compile for floor1_pc <-> sso_gwQuick Formatting Reference (2 rules)
| Item | Valid .frasm | Avoid |
|---|---|---|
| Flow parameters | flow tls_check(c, s) { c -> s tcp syn dstport 443 } | flow tls_check { floor1_pc -> sso_gw tcp syn } |
| Repeating sequences | compile { tls_check(a, s) tls_check(b, s) } | loop 2 { ... } // no loop keyword in FrameAssembly |
tls.handshake.type == 1