-
Notifications
You must be signed in to change notification settings - Fork 683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not build gratuitous ARP request properly #1682
Comments
I think it might be better to move the conditional zeroing to the non-raw data constructor. Afterwards we can have a bool flag to skip the zeroing in the constructor, or add a new constructor that takes a special tag struct (e.g. Also I think it might be beneficial to add factory methods or constructors that take precisely the parameters needed to form the request, instead of relying the user to input all the data correctly. For example, from what I understand, a normal ARP request should zero the target mac address. So we can have a factory method that only takes the minimum required parameters to form the request ( |
Opened a PR (#1684) with potential implementation on how it can be done, if you could look it over @tigercosmos. |
I think the simplest option is adding a boolean flag to |
Why are we actually zeroing the target MAC in the compute instead of checking it in the ctor? Also, could you look at the draft PR I linked? I know the ARP test fails, but I would appreciate feedback on the concept. |
I left some comments on @Dimi1010's PR. I think it's fine. It is even clearer than adding another argument flag in the constructor. |
Bug description
Describe the bug
RFC 5227 stipulates that gratuitous ARP can be a request, which is also described in the wireshark wiki.
The characteristics of gratuitous ARP are that the sending and source IP addresses are both the IP address of the prober, and the target MAC and source MAC addresses are both the MAC address of the prober.
Currently, the function 'computeCalculateFields' in Arplayer implemented by PcapPlusPlusPlus will set the targetMacAddr of the ARP request message to all zeros, which will cause the scenario of constructing a gratuitous ARP message to not work properly.
Code example to reproduce
Expected behavior
It is recommended to remove this default behavior (the targetMacAddr field of the ARP request type is set to all zeros by default) or to control whether to clear it through an additional field.
PcapPlusPlus versions tested on
PcapPlusPlus master branch
Other PcapPlusPlus version (if applicable)
No response
Operating systems tested on
Windows
Other operation systems (if applicable)
No response
Compiler version
GCC 10.2.0
Packet capture backend (if applicable)
WinPcap
The text was updated successfully, but these errors were encountered: