currently thinking on a possibility to sniff at the same interface using only pcap and also inject the packets using pcap_inject.
The thing can be solved easily using either:
- persistent checksum tracking /large slow map/,
- checksum tracking - until all the data was injected, say, a first http request;
- hacking bpf/libipq/Netfilter to carry additional parameter for each real PHY packet
But:
pcap listens eth0 /realworld situation is closer to "pcap listens and drops via source magic"/, pcap sends packet via eth0's handle so they can be routed out. What is the theorethical base for libpcap to not capture packets that were injected to same interface using same library - e.g, injected packets are not going through all Berkeley's packet filter code?
Practical test TBD.