Repository navigation
test(cpworker): check gre, vxlan and zmq wire bytes against the wire-format docs - #315
Merged
Merged
Conversation
…format docs The GRE, VXLAN and ZMQ integration cases only count packets, so a wrong header field, tag, check byte or record layout still passes (#243 item 2). TestWireFormat builds its input frames, runs cpworker over them and compares what goes on the wire with bytes taken from the documents: - gre: flags 0x2000 and protocol 0x6558 (RFC 2784/2890), the key as direction << 28 | service_tag for configured service tags, inner frame unchanged. The key without a service_tag is left to #296. - vxlan: every header row of VXLAN-WIRE-FORMAT.md section 9 (vni1 with each direction, 0xFFFFFF, 0x123456; vni2), inner frame unchanged, and the capture-time trailer of section 6. - zmq: batch header, record framing, packet header and frame of ZMQ-WIRE-FORMAT.md sections 3-6, with a VLAN-tagged frame and one whose caplen is below len; and the 142-byte message of section 10. Each of these mutations fails only its own subtest: GRE protocol 0x6559, GRE direction shift 27, VXLAN check seed + 1, swapped ZMQ tag direction, ZMQ batch version 3, ZMQ pkt_hdr.len from caplen. Refs #243
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The GRE, VXLAN and ZMQ integration cases (
testdata/cases/*/verify.json) only count packets. A wrong GRE protocol or key, a wrong VXLAN tag or check byte, or a wrong ZMQ batch header, record length, packet header or MPLS-like tag still passes (#243 item 2). Only the heartbeat record was byte-checked.Change
cpworker/tests/integration/wire_format_test.go(TestWireFormat). It builds the input frames, runs cpworker over them and compares the bytes on the wire with bytes taken from the specs, not computed by the code under test:gre: flags0x2000and protocol0x6558(RFC 2784/2890); keydirection << 28 | service_tagfor configured service tags; inner frame unchanged.vxlan: every header row ofdocs/VXLAN-WIRE-FORMAT.md§9 (vni1with each direction,0xFFFFFF,0x123456;vni2with each direction); inner frame unchanged; capture-time trailer (§6).zmq: batch header, record framing, packet header and frame ofdocs/ZMQ-WIRE-FORMAT.md§3–§6, including a VLAN-tagged frame and a frame whose caplen is below its wire length.zmq_example: the 142-byte message ofdocs/ZMQ-WIRE-FORMAT.md§10, byte for byte.Not changed:
service_tagis not configured: that behaviour is cpworker: GRE output loses the packet direction when service_tag is unset (default 0xFFFFFFFF fills the direction bits) #296's subject, so the test does not assert it.Tests
The new tests pass on the current code. Each of these mutations fails only its own subtest:
0x6559→gregrevxlanzmq,zmq_examplezmq,zmq_examplepkt_hdr.lenfrom caplen →zmq(the caplen < len record)Suites run on Ubuntu 24.04:
run_test.sh allpasses (TestWireFormat8 s).Refs #243