Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Multicast packet ( specifically fieldbus) is not parsed #512

Open
ranifisch92 opened this issue Aug 14, 2023 · 0 comments
Open

Multicast packet ( specifically fieldbus) is not parsed #512

ranifisch92 opened this issue Aug 14, 2023 · 0 comments

Comments

@ranifisch92
Copy link

Hi,

I try to parse multicast(fieldbus) packets( see attached zipped pcap file, containing single packet).

Environment: Ubuntu 18.04.6

Below is the code I wrote to reproduce the issue:

#include <iostream>
#include <tins/tins.h>

int main(int args, char * argv[])
{
    int count = 0;
    try {
        Tins::FileSniffer reader("/path/to/pcap");

        while (Tins::Packet packet = reader.next_packet()) {
            std::cout << "Packet length: " << packet.pdu()->size() << " bytes" << std::endl;
            count += 1;
        }
    } catch (const std::exception &ex) {
        std::cerr << "Error: " << ex.what() << std::endl;
        return 1;
    }

    std::cout << "Total packets: " << count << std::endl;

    return 0;
}

The expected output is: Total packets: 1
The actual output is : Total packets: 0

I have dug a little into the library's code, and I think the problem originates from this line:
data->pdu = safe_alloc<EthernetII( (const uint8_t*)bytes, h->caplen); ( sniff_loop_eth_handler function, in sniffer.cpp file)
this line of code sets the data->pdu to NULL, instead of setting non-NULL value

Let me know if there is additional information needed,

Tnx.

mcast_fieldbus_packet.zip

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant