tcprewrite - fix adding vlan tag with missing options - #994
Merged
fklassen merged 1 commit intoJul 17, 2026
Conversation
Fix an issue where using tcprewrite to add a vlan tag to untagged packets, and omitting either the --enet-vlan-cfi, or the --enet-vlan-pri option, the resulting pcap is truncated by 4 bytes (size of vlan header). This also changes the following so that the vlan tag value is manatory, but the priority and the format are optional: * Both options --enet-vlan-pri/--enet-vlan-cfi now explicitly default to 0 * Add a one-time warning if either option is missing, then proceed and use default * update the doc so that --enet-vlan-tag option is marked as mandatory when adding a vlan tag. Fixes: appneta#990 Assisted-by: Claude Opus 4.8 Signed-off-by: Gabriel Ganne <gabriel.ganne@gmail.com>
This was referenced Jul 17, 2026
Merged
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.
Fix an issue where using tcprewrite to add a vlan tag to untagged packets, and omitting either the
--enet-vlan-cfi, or the--enet-vlan-prioption, the resulting pcap is truncated by 4 bytes (size of vlan header).This also changes the following so that the vlan tag value is manatory, but the priority and the format are optional:
--enet-vlan-pri/--enet-vlan-cfinow explicitly default to 0--enet-vlan-tagoption is marked as mandatory when adding a vlan tag.The conditions for the issue to happen are a tiny bit more narrow than in the linked issue: for example if the packet is already vlan-tagged, we're not taking the same branch and have no issue (eg. feed the output of the buggy tcprewrite command to itself). Because of this (and following LLM-assisted review advice) I added comments on the branch to explicit the else branches to make it clear this branch is already handled and a warning has been sent during option parsing.
Fixes: #990
Assisted-by: Claude Opus 4.8