Open LegITdevel opened 9 years ago
I'll have a look at this later, thanks for the report.
in packet_sender.h:
PDU *recv_l2(PDU &pdu, struct sockaddr *link_addr, uint32_t len_addr,
const NetworkInterface &iface = NetworkInterface());
Yes, that was my initial concern. Raw sockets on Windows have a lot of limitations, and I'm not sure if you can read ARP packets from them. This can be done using winpcap, but PacketSender doesn't use that (and for a reason, since timeouts on libpcap/winpcap work pretty badly).
I didnt had the spare time to read through the complete lib, but in my view this (read any kind of packages from raw sockets) is an essential feature. Would be best if it can be patched to work without winpcap yes, but if required it should be possible to pass an argument due compilation to use winpcap for it if not possible another way.
The problem is that, IIRC from some stuff I worked on some time ago, the winpcap/libpcap capture timeout simply doesn't work. So if you don't receive a packet, the recv_l2 function will just hang forever.
You can always start a capture thread, send the packets, and match the responses (you can actually use PDU::matches_response, so you don't actually have to do the matching yourself), like the traceroute example does.
Using the ARP request sample from http://libtins.github.io/tutorial/sending/
if(response) { const ARP &arp = response->rfind_pdu();
std::cout << "Hardware address: " << arp.sender_hw_addr() << std::endl;
}
does not receive any response, while wireshark properly detects the correct answer from the given ip
surely c++11 is used, memory included