Repository navigation
fix(cpworker): keep the L2 header stack under zmq slice and count runt drops - #302
Merged
Merged
Conversation
…t drops A zmq output dropped every packet when slice was below 18 bytes, because slice was applied before the fixed 18-byte minimum. The dropped packets were not counted in any output statistic. slice now truncates the payload only. The record always keeps the Ethernet header and the whole VLAN tag stack. A frame whose Ethernet header or tag stack was not fully captured produces no record and is counted as error_drop. The fixed 18-byte minimum is gone: untagged frames need 14 bytes, and QinQ frames keep both tags.
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
slice< 18 dropped every packet.slicewas applied first, then a fixed 18-byte minimum rejected the result.docs/ZMQ-WIRE-FORMAT.mdsaidslicekeeps at least Ethernet + one VLAN header.nb_too_small_packetscounter. No output statistic changed, sofwd + direction_drop + error_drop + ratelimit_dropdid not add up to the packets the output handled.slicecut into a QinQ tag stack (slice: 18kept the outer tag and rewrote its EtherType to0x8847).Change
slicetruncates the payload only; the Ethernet header and the whole VLAN tag stack are always kept.l2_header_len()measures Ethernet + complete tag stack on the original caplen, beforesliceis applied.sliceismax(slice, l2_len).error_drop_packets/error_drop_bytes. Thenb_too_small_packetswarning stays and now names the reason.zmq_send_packetis removed; the record reusesl2_len.docs/ZMQ-WIRE-FORMAT.md§1 and §4.1 describe the new rule.slice: 10, one VLAN tagslice: 18, QinQslice: 26, 4 tags (#231 frame)error_dropThe two #231 tests are rewritten for the new rule. The 60-byte frame filled with
0x8100tags has a tag stack that never ends within caplen, so it is now anerror_dropinstead of a record with 11 tags.Tests
cpworker/tests/unit/output_zmq.c: slice keeps one tag / both QinQ tags / the 4-tag stack / the untagged header; 14-byte untagged frame sent; < 14 bytes, cut tag and unterminated tag stack counted aserror_drop; a runt plus a normal frame givesfwd = 1,error_drop = 1.run_test.sh allpasses.Fixes #271