I'm trying to implement replaying packets stored in .pcap files using libpcap.
The process is very simple: I would open the pcap file with 'pcap_open_offline' then pass packets to the device opened with pcap_open_live
, and send them with pcap_inject
through the interface.
Now the NIC doesn't have an ethernet cable connected to it. I know that pcap_open_live
won't tell whether the device opened supports sending, so I get errors from pcap_inject (errno 100
). Is this to be expected? If I simply use tcpreplay from the cmd line, it finishes and presents no error, with or without the ethernet cable plugged in.
Anyone know how tcpreplay/tcpedit handles "dead" interfaces? Does tcpreplay rewrite packet headers whereas I'm trying to send them raw? Any help is appreciated!
I'm on Ubuntu 14.04 and the interface is address-less and in promisc mode:
auto eth1
iface eth1 inet manual
up ifconfig eth1 promisc up
down ifconfig eth1 promisc down