Open
Conversation
…he switch adds extra padding bytes to ARP packets to meet the 64-byte minimum frame size. Signed-off-by: jiasheng.yu <jiasheng.yu@ucloud.cn>
6d3efd0 to
9d77e4f
Compare
wenyingd
reviewed
Sep 4, 2025
| IPDst net.IP | ||
| // The actual test shows that ARP reply packets sent by the H3C switch include an additional 14 bytes. | ||
| // This is done by the switch to meet the minimum frame length requirement of 64 bytes. | ||
| Padding []byte |
There was a problem hiding this comment.
No need to define a dedicated field for padding, you can directly update the function Len() by adding the corresponding length to meet the minimum frame length requirement of 64 bytes..
| a.IPDst = make([]byte, a.ProtoLength) | ||
| copy(a.IPDst, data[n:n+int(a.ProtoLength)]) | ||
| n += int(a.ProtoLength) | ||
| if len(data[n:]) > 0 { |
There was a problem hiding this comment.
ditto. No need to copy the "padding" bytes, since it is not a valid case that a component consumes the padding bytes.
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 the ARP packet parsing code to adapt to the scenario where the switch adds extra padding bytes to ARP packets to meet the 64-byte minimum frame size.
Error stack: