mfontanini / libtins

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

Tins::invalid_interface for send_recv() function #413

Closed hamedgk closed 1 year ago

hamedgk commented 3 years ago

the app throws invalid_interface but I set the default_interface in the PacketSender constructor here is my code:

Tins::NetworkInterface iface = Tins::NetworkInterface::default_interface();
            Tins::NetworkInterface::Info info = iface.addresses();
            Tins::EthernetII eth2 = Tins::EthernetII() /
                Tins::IP("172.217.18.132", info.ip_addr) /
                Tins::TCP(443, 443) /
                Tins::RawPDU("I'm payload!");
            Tins::PacketSender sender(iface);
            const std::unique_ptr<Tins::PDU> received_pdu(sender.send_recv(eth2));
            const Tins::EthernetII& Eth_content = received_pdu->rfind_pdu<Tins::EthernetII>();
            print(Eth_content.header_size())  //for example

also the send_recv() example of the documentation throws invalid_interface send() method works well ! I'm using GCC on debian based linux (VMWare)