# ct state . ct mark vmap { new . 0x12345678 : drop}
map%d test-ip4 b
map%d test-ip4 0
- element 00000008 12345678 : 0 [end]
+ element 00000008 12345678 : 0 [end]
ip test-ip4 output
[ ct load state => reg 1 ]
[ ct load mark => reg 9 ]
return ""
return rule
+def payload_check_elems_to_set(elems):
+ newset = set()
+
+ for n, line in enumerate(elems.split('[end]')):
+ e = line.strip()
+ if e in newset:
+ print_error("duplicate", e, n)
+ return newset
+
+ newset.add(e)
+
+ return newset
+
+def payload_check_set_elems(want, got):
+
+ if want.find('element') < 0 or want.find('[end]') < 0:
+ return 0
+
+ if got.find('element') < 0 or got.find('[end]') < 0:
+ return 0
+
+ set_want = payload_check_elems_to_set(want)
+ set_got = payload_check_elems_to_set(got)
+
+ return set_want == set_got
+
def payload_check(payload_buffer, file, cmd):
file.seek(0, 0)
if want_line.find(']') < 0 and line.find(']') < 0:
continue
+ if payload_check_set_elems(want_line, line):
+ continue
+
print_differences_warning(file.name, lineno, want_line.strip(), line.strip(), cmd);
return 0