Subject: Re: Port mirroring (RFC)

From: Andrew Lunn <[email-masked]>
Date: Tue, 14 Dec 2021 19:27:20 +0100

On Tue, Dec 14, 2021 at 08:47:12AM -0600, Alex Elder wrote:
> I am implementing what amounts to port mirroring functionality
> for the IPA driver.
> 
> The IPA hardware isn't exactly a network switch (it's sort of
> more than that), but it has the ability to supply replicas of
> packets transferred within it to a special (read only) interface.

I think you need to explain "within it" in a bit more detail. Where
are these packets coming from/going to?

> My plan is to implement this using a new "ipa_mirror" network
> device, so it could be used with a raw socket to capture the
> arriving packets.  There currently exists one other netdev,
> which represents access through a modem to a WWAN network.
> 
> I would like some advice on how to proceed with this.  I want
> the result to match "best practice" upstream, and would like
> this to be as well integrated possible with existing network
> tools.
> 
> A few details about the stream of packets that arrive on
> this hardware interface:
> - Packet data is truncated if it's larger than a certain size
> - Each packet is preceded by a fixed-size header describing it
> - Packets (and their headers) are aggregated into a buffer; i.e.
>   a single receive might carry a dozen (truncated) packets

So this sounds something more like what you would attach pcap/tcpdump
to.  I'm not sure port mirroring is the correct model here. Maybe take
a look at wifi adaptors and their monitor mode? See if that fits
better?
 
	Andrew