npcap
npcap copied to clipboard
The direction of injected packets should be selectable per packet
As explained in #544 injected packets are sent to the miniport and looped back to the protocols.
The package injection API ( pcap_inject() ) should be extended to allow the selection of the direction per injected packet.
"Extended" won't mean "adding an additional argument", as the libpcap API and ABI must not change.
If it must be selectable per packet, rather than per pcap_t, then it'll have to be with a new routine with an additional argument.
If it is possible to open an instance multiple times than it could be a setting of the instance handle. The application could open one handle that injects to miniport and another that injects to the protocols.
From Npcap's perspective, this would be easiest implemented as a per-handle option. The API via libpcap would probably involve another pcap_set_XXX() function, though I'd leave that up to them to decide after implementing it as a PacketSetXXX() function. It'd be great if all of those were one function with features selectable via preprocessor-defined code, but I think that might break backwards compatibility too much. Maybe we'll use that for any new features, so that libpcap can do runtime detection of support.