mfontanini / libtins

High-level, multiplatform C++ network packet sniffing and crafting library.
http://libtins.github.io/
BSD 2-Clause "Simplified" License
1.89k stars 373 forks source link

[bug] UDP::matches_response() return 0 when no inner PDU is available #521

Open markvmk opened 6 months ago

markvmk commented 6 months ago

Hi,

When trying to match against UDP response that has no payload the UDP::matches_response() fails (returns false). https://github.com/mfontanini/libtins/blob/master/src/udp.cpp#L173

For EthernetII and IP PDUs the implementation of matches_response() returns true in case no inner PDU is present. I am not sure if the UDP implementation is intentionally done like that but as I could not find this in the documentation I assume that this is a bug and UDP::matches_response() should also return true when inner PDU is not present.