(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:MY_DIR) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(dirname)} {($ VSub_Number '$0')})]) left_token: <Left_CommandSub '$('> spids: [5 9] ) } spids: [4] ) ] spids: [4] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BPF_CGRP2_ARRAY_NAME) op: Equal rhs: {(SQ <test_cgrp2_array_pin>)} spids: [14] ) ] spids: [14] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BPF_PROG) op: Equal rhs: {(DQ ($ VSub_Name '$MY_DIR') (/test_cgrp2_tc_kern.o))} spids: [19] ) ] spids: [19] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:BPF_SECTION) op:Equal rhs:{(SQ <filter>)} spids:[25])] spids: [25] ) (AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_Name '$TC'))} {(Lit_Other ']')}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:TC) op:Equal rhs:{(SQ <tc>)} spids:[43])] spids: [43] ) ] ) (AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_Name '$IP'))} {(Lit_Other ']')}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:IP) op:Equal rhs:{(SQ <ip>)} spids:[60])] spids: [60] ) ] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:HOST_IFC) op:Equal rhs:{(SQ <ve>)} spids:[69])] spids: [69] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:NS_IFC) op:Equal rhs:{(SQ <vens>)} spids:[74])] spids: [74] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:NS) op:Equal rhs:{(SQ <ns>)} spids:[79])] spids: [79] ) (FuncDef name: find_mnt body: (BraceGroup children: [ (Pipeline children: [ (C {(cat)} {(/proc/mounts)}) (C {(awk)} {(SQ <'{ if ($3 == "'>) ($ VSub_Number '$1') (SQ <'" && mnt == "") { mnt = $2 }} END { print mnt }'>) } ) ] negated: F ) ] spids: [89] ) spids: [85 88] ) (FuncDef name: init_cgrp2_vars body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CGRP2_ROOT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(find_mnt)} {(cgroup2)})]) left_token: <Left_CommandSub '$('> spids: [124 128] ) } spids: [123] ) ] spids: [123] ) (If arms: [ (if_arm cond: [ (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_Name '$CGRP2_ROOT'))} {(Lit_Other ']')}) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CGRP2_ROOT) op: Equal rhs: {(SQ </mnt/cgroup2>)} spids: [147] ) ] spids: [147] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:MOUNT_CGRP2) op: Equal rhs: {(DQ (yes))} spids: [153] ) ] spids: [153] ) ] spids: [16777215 144] ) ] spids: [16777215 159] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CGRP2_TC) op: Equal rhs: {(DQ ($ VSub_Name '$CGRP2_ROOT') (/tc))} spids: [162] ) ] spids: [162] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CGRP2_TC_LEAF) op: Equal rhs: {(DQ ($ VSub_Name '$CGRP2_TC') (/leaf))} spids: [169] ) ] spids: [169] ) ] spids: [120] ) spids: [116 119] ) (FuncDef name: init_bpf_fs_vars body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:bpf_fs_root) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(find_mnt)} {(bpf)})]) left_token: <Left_CommandSub '$('> spids: [191 195] ) } spids: [190] ) ] spids: [188] ) (AndOr ops: [Op_DPipe] children: [ (C {(Lit_Other '[')} {(-n)} {(DQ ($ VSub_Name '$bpf_fs_root'))} {(Lit_Other ']')}) (ControlFlow token:<ControlFlow_Return return> arg_word:{(-1)}) ] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BPF_FS_TC_SHARE) op: Equal rhs: {(DQ ($ VSub_Name '$bpf_fs_root') (/tc/globals))} spids: [215] ) ] spids: [215] ) ] spids: [185] ) spids: [181 184] ) (FuncDef name: setup_cgrp2 body: (BraceGroup children: [ (Case to_match: {($ VSub_Number '$1')} arms: [ (case_arm pat_list: [{(start)}] action: [ (If arms: [ (if_arm cond: [ (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$MOUNT_CGRP2'))} {(Lit_Other '=') (Lit_Other '=')} {(SQ <yes>)} {(Lit_Other ']')} ) ] action: [ (AndOr ops: [Op_DPipe] children: [ (C {(Lit_Other '[')} {(-d)} {($ VSub_Name '$CGRP2_ROOT')} {(Lit_Other ']')} ) (C {(mkdir)} {(-p)} {($ VSub_Name '$CGRP2_ROOT')}) ] ) (AndOr ops: [Op_DPipe] children: [ (C {(mount)} {(-t)} {(cgroup2)} {(none)} {($ VSub_Name '$CGRP2_ROOT')}) (ControlFlow token: <ControlFlow_Return return> arg_word: {($ VSub_QMark '$?')} ) ] ) ] spids: [16777215 260] ) ] spids: [16777215 297] ) (C {(mkdir)} {(-p)} {($ VSub_Name '$CGRP2_TC_LEAF')}) ] spids: [238 239 307 16777215] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [ (AndOr ops: [Op_DAmp] children: [ (C {(rmdir)} {($ VSub_Name '$CGRP2_TC_LEAF')}) (C {(rmdir)} {($ VSub_Name '$CGRP2_TC')}) ] ) (AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$MOUNT_CGRP2'))} {(Lit_Other '=') (Lit_Other '=')} {(SQ <yes>)} {(Lit_Other ']')} ) (C {(umount)} {($ VSub_Name '$CGRP2_ROOT')}) ] ) ] spids: [310 311 347 16777215] ) ] spids: [231 235 350] ) ] spids: [228] ) spids: [224 227] ) (FuncDef name: setup_bpf_cgrp2_array body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:bpf_cgrp2_array) op: Equal rhs: {(DQ ($ VSub_Name '$BPF_FS_TC_SHARE') (/) ($ VSub_Name '$BPF_CGRP2_ARRAY_NAME'))} spids: [364] ) ] spids: [362] ) (Case to_match: {($ VSub_Number '$1')} arms: [ (case_arm pat_list: [{(start)}] action: [ (C {($ VSub_Name '$MY_DIR') (/test_cgrp2_array_pin)} {(-U)} {($ VSub_Name '$bpf_cgrp2_array')} {(-v)} {($ VSub_Name '$CGRP2_TC')} ) ] spids: [379 380 395 16777215] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [ (AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(-d)} {(DQ ($ VSub_Name '$BPF_FS_TC_SHARE'))} {(Lit_Other ']')} ) (C {(rm)} {(-f)} {($ VSub_Name '$bpf_cgrp2_array')}) ] ) ] spids: [398 399 421 16777215] ) ] spids: [372 376 424] ) ] spids: [359] ) spids: [355 358] ) (FuncDef name: setup_net body: (BraceGroup children: [ (Case to_match: {($ VSub_Number '$1')} arms: [ (case_arm pat_list: [{(start)}] action: [ (AndOr ops: [Op_DPipe] children: [ (C {($ VSub_Name '$IP')} {(link)} {(add)} {($ VSub_Name '$HOST_IFC')} {(type)} {(veth)} {(peer)} {(name)} {($ VSub_Name '$NS_IFC')} ) (ControlFlow token: <ControlFlow_Return return> arg_word: {($ VSub_QMark '$?')} ) ] ) (AndOr ops: [Op_DPipe] children: [ (C {($ VSub_Name '$IP')} {(link)} {(set)} {(dev)} {($ VSub_Name '$HOST_IFC')} {(up)} ) (ControlFlow token: <ControlFlow_Return return> arg_word: {($ VSub_QMark '$?')} ) ] ) (C {(sysctl)} {(-q)} {(net.ipv6.conf.) ($ VSub_Name '$HOST_IFC') (.accept_dad) (Lit_Other '=') (0)} ) (AndOr ops: [Op_DPipe] children: [ (C {($ VSub_Name '$IP')} {(netns)} {(add)} {(ns)}) (ControlFlow token: <ControlFlow_Return return> arg_word: {($ VSub_QMark '$?')} ) ] ) (AndOr ops: [Op_DPipe] children: [ (C {($ VSub_Name '$IP')} {(link)} {(set)} {(dev)} {($ VSub_Name '$NS_IFC')} {(netns)} {(ns)} ) (ControlFlow token: <ControlFlow_Return return> arg_word: {($ VSub_QMark '$?')} ) ] ) (AndOr ops: [Op_DPipe] children: [ (C {($ VSub_Name '$IP')} {(-n)} {($ VSub_Name '$NS')} {(link)} {(set)} {(dev)} {($ VSub_Name '$NS_IFC')} {(up)} ) (ControlFlow token: <ControlFlow_Return return> arg_word: {($ VSub_QMark '$?')} ) ] ) (C {($ VSub_Name '$IP')} {(netns)} {(exec)} {($ VSub_Name '$NS')} {(sysctl)} {(-q)} {(net.ipv6.conf.) ($ VSub_Name '$NS_IFC') (.accept_dad) (Lit_Other '=') (0)} ) (AndOr ops: [Op_DPipe] children: [ (C {($ VSub_Name '$TC')} {(qdisc)} {(add)} {(dev)} {($ VSub_Name '$HOST_IFC')} {(clsact)} ) (ControlFlow token: <ControlFlow_Return return> arg_word: {($ VSub_QMark '$?')} ) ] ) (AndOr ops: [Op_DPipe] children: [ (C {($ VSub_Name '$TC')} {(filter)} {(add)} {(dev)} {($ VSub_Name '$HOST_IFC')} {(egress)} {(bpf)} {(da)} {(obj)} {($ VSub_Name '$BPF_PROG')} {(sec)} {($ VSub_Name '$BPF_SECTION')} ) (ControlFlow token: <ControlFlow_Return return> arg_word: {($ VSub_QMark '$?')} ) ] ) ] spids: [443 444 631 16777215] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [ (C {($ VSub_Name '$IP')} {(netns)} {(del)} {($ VSub_Name '$NS')}) (C {($ VSub_Name '$IP')} {(link)} {(del)} {($ VSub_Name '$HOST_IFC')}) ] spids: [634 635 656 16777215] ) ] spids: [436 440 659] ) ] spids: [433] ) spids: [429 432] ) (FuncDef name: run_in_cgrp body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd) op: Equal rhs: {(SQ <'echo $$ > '>)} spids: [679] ) ] spids: [679] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd) op: Equal rhs: { (DQ ($ VSub_Name '$cmd') (' ') ($ VSub_Number '$1') ('/cgroup.procs; exec ') ($ VSub_Number '$2') ) } spids: [685] ) ] spids: [685] ) (C {(bash)} {(-c)} {(DQ ($ VSub_Name '$cmd'))}) ] spids: [668] ) spids: [664 667] ) (FuncDef name: do_test body: (BraceGroup children: [ (C {(run_in_cgrp)} {($ VSub_Name '$CGRP2_TC_LEAF')} {(DQ ('ping -6 -c3 ff02::1%') ($ VSub_Name '$HOST_IFC') (' >& /dev/null'))} ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:dropped) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {($ VSub_Name '$TC')} {(-s)} {(qdisc)} {(show)} {(dev)} {($ VSub_Name '$HOST_IFC')} ) (C {(tail)} {(-3)}) (C {(awk)} {(SQ <'/drop/{print substr($7, 0, index($7, ",")-1)}'>)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [727 755] ) } spids: [726] ) ] spids: [724] ) (If arms: [ (if_arm cond: [ (DBracket expr: (BoolBinary op_id: BoolBinary_eq left: {($ VSub_Name '$dropped')} right: {(0)} ) ) ] action: [ (C {(echo)} {(DQ (FAIL))}) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) ] spids: [16777215 771] ) ] else_action: [ (C {(echo)} {(DQ ('Successfully filtered ') ($ VSub_Name '$dropped') (' packets'))}) (ControlFlow token:<ControlFlow_Return return> arg_word:{(0)}) ] spids: [786 803] ) ] spids: [710] ) spids: [706 709] ) (FuncDef name: do_exit body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$DEBUG'))} {(Lit_Other '=') (Lit_Other '=')} {(DQ (yes))} {(Lit_Other ']')} ) (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$MODE'))} {(KW_Bang '!') (Lit_Other '=')} {(SQ <cleanuponly>)} {(Lit_Other ']')} ) ] ) ] action: [ (C {(echo)} {(DQ ('------ DEBUG ------'))}) (Sentence child: (C {(echo)} {(DQ ('mount: '))}) terminator: <Op_Semi ';'> ) (Sentence child: (Pipeline children: [(C {(mount)}) (C {(egrep)} {(SQ <'(cgroup2|bpf)'>)})] negated: F ) terminator: <Op_Semi ';'> ) (C {(echo)}) (Sentence child: (C {(echo)} {(DQ ($ VSub_Name '$CGRP2_TC_LEAF') (': '))}) terminator: <Op_Semi ';'> ) (Sentence child: (C {(ls)} {(-l)} {($ VSub_Name '$CGRP2_TC_LEAF')}) terminator: <Op_Semi ';'> ) (C {(echo)}) (If arms: [ (if_arm cond: [ (C {(Lit_Other '[')} {(-d)} {(DQ ($ VSub_Name '$BPF_FS_TC_SHARE'))} {(Lit_Other ']')} ) ] action: [ (Sentence child: (C {(echo)} {(DQ ($ VSub_Name '$BPF_FS_TC_SHARE') (': '))}) terminator: <Op_Semi ';'> ) (Sentence child: (C {(ls)} {(-l)} {($ VSub_Name '$BPF_FS_TC_SHARE')}) terminator: <Op_Semi ';'> ) (C {(echo)}) ] spids: [16777215 912] ) ] spids: [16777215 933] ) (C {(echo)} {(DQ ('Host net:'))}) (C {($ VSub_Name '$IP')} {(netns)}) (C {($ VSub_Name '$IP')} {(link)} {(show)} {(dev)} {($ VSub_Name '$HOST_IFC')}) (C {($ VSub_Name '$IP')} {(-6)} {(a)} {(show)} {(dev)} {($ VSub_Name '$HOST_IFC')}) (C {($ VSub_Name '$TC')} {(-s)} {(qdisc)} {(show)} {(dev)} {($ VSub_Name '$HOST_IFC')}) (C {(echo)}) (C {(echo)} {(DQ ($ VSub_Name '$NS') (' net:'))}) (C {($ VSub_Name '$IP')} {(-n)} {($ VSub_Name '$NS')} {(link)} {(show)} {(dev)} {($ VSub_Name '$NS_IFC')} ) (C {($ VSub_Name '$IP')} {(-n)} {($ VSub_Name '$NS')} {(-6)} {(link)} {(show)} {(dev)} {($ VSub_Name '$NS_IFC')} ) (C {(echo)} {(DQ ('------ DEBUG ------'))}) (C {(echo)}) ] spids: [16777215 850] ) ] spids: [16777215 1038] ) (If arms: [ (if_arm cond: [ (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$MODE'))} {(KW_Bang '!') (Lit_Other '=')} {(SQ <nocleanup>)} {(Lit_Other ']')} ) ] action: [ (C {(setup_net)} {(stop)}) (C {(setup_bpf_cgrp2_array)} {(stop)}) (C {(setup_cgrp2)} {(stop)}) ] spids: [16777215 1060] ) ] spids: [16777215 1078] ) ] spids: [812] ) spids: [808 811] ) (C {(init_cgrp2_vars)}) (C {(init_bpf_fs_vars)}) (While cond: [(DBracket expr:(BoolBinary op_id:BoolBinary_ge left:{($ VSub_Pound '$#')} right:{(1)}))] body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:a) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [1103] ) ] spids: [1103] ) (Case to_match: {($ VSub_Name '$a')} arms: [ (case_arm pat_list: [{(debug)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DEBUG) op: Equal rhs: {(SQ <yes>)} spids: [1120] ) ] spids: [1120] ) (C {(shift)} {(1)}) ] spids: [1116 1117 1131 16777215] ) (case_arm pat_list: [{(cleanup-only)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:MODE) op: Equal rhs: {(SQ <cleanuponly>)} spids: [1138] ) ] spids: [1138] ) (C {(shift)} {(1)}) ] spids: [1134 1135 1149 16777215] ) (case_arm pat_list: [{(no-cleanup)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:MODE) op: Equal rhs: {(SQ <nocleanup>)} spids: [1156] ) ] spids: [1156] ) (C {(shift)} {(1)}) ] spids: [1152 1153 1167 16777215] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [ (C {(echo)} {(DQ ('test_cgrp2_tc [debug] [cleanup-only | no-cleanup]'))}) (C {(echo)} {(DQ (' debug: Print cgrp and network setup details at the end of the test'))} ) (C {(echo)} { (DQ ( ' cleanup-only: Try to cleanup things from last test. No test will be run' ) ) } ) (C {(echo)} {(DQ (" no-cleanup: Run the test but don't do cleanup at the end"))}) (C {(echo)} { (DQ ( '[Note: If no arg is given, it will run the test and do cleanup at the end]' ) ) } ) (C {(echo)}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(-1)}) ] spids: [1170 1171 1217 16777215] ) ] spids: [1109 1113 1220] ) ] spids: [1100 1222] ) ) (C {(trap)} {(do_exit)} {(0)}) (AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$MODE'))} {(Lit_Other '=') (Lit_Other '=')} {(SQ <cleanuponly>)} {(Lit_Other ']')} ) (ControlFlow token:<ControlFlow_Exit exit>) ] ) (AndOr ops: [Op_DPipe] children: [ (C {(setup_cgrp2)} {(start)}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{($ VSub_QMark '$?')}) ] ) (AndOr ops: [Op_DPipe] children: [ (C {(setup_net)} {(start)}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{($ VSub_QMark '$?')}) ] ) (AndOr ops: [Op_DPipe] children: [ (C {(init_bpf_fs_vars)}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{($ VSub_QMark '$?')}) ] ) (AndOr ops: [Op_DPipe] children: [ (C {(setup_bpf_cgrp2_array)} {(start)}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{($ VSub_QMark '$?')}) ] ) (C {(do_test)}) (C {(echo)}) ] )