npcap icon indicating copy to clipboard operation
npcap copied to clipboard

The direction of injected packets should be selectable per packet

Open gs-rs-21 opened this issue 4 years ago • 3 comments

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.

gs-rs-21 avatar Sep 28 '21 07:09 gs-rs-21

"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.

guyharris avatar Sep 28 '21 08:09 guyharris

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.

gs-rs-21 avatar Sep 28 '21 08:09 gs-rs-21

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.

dmiller-nmap avatar Sep 30 '21 18:09 dmiller-nmap