netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/4] net: Add port mirroring support to the kernel
@ 2009-12-15 16:29 Neil Horman
  2009-12-15 16:36 ` [RFC PATCH 1/4] net: port mirroring: add tracepoints to appropriate network paths Neil Horman
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Neil Horman @ 2009-12-15 16:29 UTC (permalink / raw)
  To: netdev; +Cc: davem

Hey all-
	One of the features that many multi-port Networking devices offer as a
debug facility is port mirroring.  The Linux kernels currently offers this
feature in only a very limited fashion,  Frames can be mangled and resent out
various devices using netfilter rules, but the reach of those rules is limited,
as they are largely protocol specific.  Ebtables is an option, but it applies
only to devices in a bridge configuration.  I'd like to propose a solution which
is protocol agnostic, simple to configure, and always available to debug.  by
doing this we can offer the ability to capture frames on a tertiary device when
the system under test is too heavily loaded to support capturing the data on a
network card without adversely affecting the performance or behavior of the
system

My proposed solution is:

1) Insert tracepoints at the start of the receive path in the network stack
(netif_receive_skb) and at the end of the send path (dev_hard_start_xmit).  By
using tracepoints performance impact can be minimized when mirroring is not in
use, and it lets us avoid adding additional data to the net_device or sk_buff
structures in support of this feature.

2) Add mirroring code which hooks those tracepoints (when activated), and for
each frame sent or received, inspects a table of configured devices.  matching
the sent/received skb to each source skb in the table, the buffer is cloned to
each configured destination device and sent there as well

3) Add a sysfs attribute called mirror_to.  This file holds the names of devices
that the addressed device should mirror skbs to.  eg, this commmand:
echo -n eth1 > /sys/class/net/eth0/mirror_to
would cause all frames sent and received on eth0 to be sent out of eth1
likewise, this command:
echo -n -eth1 > /sys/class/net/eth0/mirror_to
would remove eth1 from the mirroring table

I've tested this code out here and it works fairly well.  I think there lots of
room for optimizations, but this is functional, and IMHO a good stake in the
ground from which incremental improvements can be made.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-12-16 12:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-15 16:29 [RFC PATCH 0/4] net: Add port mirroring support to the kernel Neil Horman
2009-12-15 16:36 ` [RFC PATCH 1/4] net: port mirroring: add tracepoints to appropriate network paths Neil Horman
2009-12-15 16:44   ` Stephen Hemminger
2009-12-15 17:02     ` Neil Horman
2009-12-15 17:22       ` Stephen Hemminger
2009-12-15 17:49         ` Neil Horman
2009-12-15 17:54           ` Stephen Hemminger
2009-12-15 20:41             ` Neil Horman
2009-12-15 21:50               ` Stephen Hemminger
2009-12-16 12:00                 ` Neil Horman
2009-12-15 16:37 ` [RFC PATCH 2/4] net: port mirroring: add port mirroring core code to kernel Neil Horman
2009-12-15 16:38 ` [RFC PATCH 3/4] net: port mirroring: add config options to enable port mirroring Neil Horman
2009-12-15 16:54 ` [RFC PATCH 4/4] net: port mirroring: Add maintainer Neil Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).