mfontanini / libtins

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

matches_response() implementation for EthernetII / Dot3 #523

Open markvmk opened 8 months ago

markvmk commented 8 months ago

Hi,

In both Dot3 and EthernetII implementations of the matches_response(), the same check is done twice:

    if (address_type(header_.src_mac) == address_type(eth_ptr->dst_mac)) {
        if (address_type(header_.src_mac) == address_type(eth_ptr->dst_mac) || 

It seems that the second check is not necessary (probably introducing a bug) or maybe intended to check the second pair of addresses, e.g.

    if (address_type(header_.src_mac) == address_type(eth_ptr->dst_mac)) {
        if (address_type(header_.dst_mac) == address_type(eth_ptr->src_mac) ||