[RFC 0/5] net/filter-redirector: Add AF_PACKET support for vhost-net

Cindy Lu posted 5 patches 1 month, 3 weeks ago
Failed in applying to current master (apply log)
There is a newer version of this series
net/filter-mirror.c | 460 +++++++++++++++++++++++++++++++++++++++++---
net/filter.c        |   6 +-
qapi/qom.json       |  19 +-
3 files changed, 459 insertions(+), 26 deletions(-)
[RFC 0/5] net/filter-redirector: Add AF_PACKET support for vhost-net
Posted by Cindy Lu 1 month, 3 weeks ago
This series extends filter-redirector to support vhost-net backends by
introducing AF_PACKET based packet capture and injection.

TODO
========
This series introduces basic support for filter-redirector, enabling
simple mirroring of VM1's ingress traffic to VM2's mirror port. 
Additional functionality including filter_buffer and other filter features
will be added in following versions.

Example Usage
=============
Primary VM (mirror incoming packets to secondary via chardev socket):

  -netdev tap,id=net0,vhost=on,...
  -chardev socket,id=mirror0,host=...,port=...,server=on,wait=off
  -object filter-redirector,id=vm1redir,netdev=net0,in_netdev=net0,outdev=mirror0

Secondary VM (receive mirrored packets):

  -chardev socket,id=red0,host=...,port=...,reconnect-ms=1000
  -object filter-redirector,id=vm2redir,netdev=net0,indev=red0,out_netdev=net0

Testing
=======
- Tested with vhost=on/off TAP netdev on x86_64

Cindy Lu (5):
  net/filter: Allow redirector on vhost backends
  net/filter-redirector: add in/out_netdev properties
  net/filter-redirector: Add AF_PACKET sockets initialization
  net/filter-redirector: add AF_PACKET redirect datapath
  qapi: add in/out_netdev to filter-redirector

 net/filter-mirror.c | 460 +++++++++++++++++++++++++++++++++++++++++---
 net/filter.c        |   6 +-
 qapi/qom.json       |  19 +-
 3 files changed, 459 insertions(+), 26 deletions(-)

-- 
2.52.0
Re: [RFC 0/5] net/filter-redirector: Add AF_PACKET support for vhost-net
Posted by Zhang Chen 1 month, 3 weeks ago
On Fri, Feb 13, 2026 at 3:10 PM Cindy Lu <lulu@redhat.com> wrote:
>
> This series extends filter-redirector to support vhost-net backends by
> introducing AF_PACKET based packet capture and injection.
>

Very happy to see this series~

> TODO
> ========
> This series introduces basic support for filter-redirector, enabling
> simple mirroring of VM1's ingress traffic to VM2's mirror port.
> Additional functionality including filter_buffer and other filter features
> will be added in following versions.
>
> Example Usage
> =============
> Primary VM (mirror incoming packets to secondary via chardev socket):
>
>   -netdev tap,id=net0,vhost=on,...
>   -chardev socket,id=mirror0,host=...,port=...,server=on,wait=off
>   -object filter-redirector,id=vm1redir,netdev=net0,in_netdev=net0,outdev=mirror0
>
> Secondary VM (receive mirrored packets):
>
>   -chardev socket,id=red0,host=...,port=...,reconnect-ms=1000
>   -object filter-redirector,id=vm2redir,netdev=net0,indev=red0,out_netdev=net0

Whether the receive side need the same setup the  "-netdev
tap,id=net0,vhost=on" or not?

Thanks
Chen

>
> Testing
> =======
> - Tested with vhost=on/off TAP netdev on x86_64
>
> Cindy Lu (5):
>   net/filter: Allow redirector on vhost backends
>   net/filter-redirector: add in/out_netdev properties
>   net/filter-redirector: Add AF_PACKET sockets initialization
>   net/filter-redirector: add AF_PACKET redirect datapath
>   qapi: add in/out_netdev to filter-redirector
>
>  net/filter-mirror.c | 460 +++++++++++++++++++++++++++++++++++++++++---
>  net/filter.c        |   6 +-
>  qapi/qom.json       |  19 +-
>  3 files changed, 459 insertions(+), 26 deletions(-)
>
> --
> 2.52.0
>
Re: [RFC 0/5] net/filter-redirector: Add AF_PACKET support for vhost-net
Posted by Cindy Lu 1 month, 2 weeks ago
On Sat, Feb 14, 2026 at 11:05 AM Zhang Chen <zhangckid@gmail.com> wrote:
>
> On Fri, Feb 13, 2026 at 3:10 PM Cindy Lu <lulu@redhat.com> wrote:
> >
> > This series extends filter-redirector to support vhost-net backends by
> > introducing AF_PACKET based packet capture and injection.
> >
>
> Very happy to see this series~
>
thanks :)
> > TODO
> > ========
> > This series introduces basic support for filter-redirector, enabling
> > simple mirroring of VM1's ingress traffic to VM2's mirror port.
> > Additional functionality including filter_buffer and other filter features
> > will be added in following versions.
> >
> > Example Usage
> > =============
> > Primary VM (mirror incoming packets to secondary via chardev socket):
> >
> >   -netdev tap,id=net0,vhost=on,...
> >   -chardev socket,id=mirror0,host=...,port=...,server=on,wait=off
> >   -object filter-redirector,id=vm1redir,netdev=net0,in_netdev=net0,outdev=mirror0
> >
> > Secondary VM (receive mirrored packets):
> >
> >   -chardev socket,id=red0,host=...,port=...,reconnect-ms=1000
> >   -object filter-redirector,id=vm2redir,netdev=net0,indev=red0,out_netdev=net0
>
> Whether the receive side need the same setup the  "-netdev
> tap,id=net0,vhost=on" or not?
>
> Thanks
> Chen
>
Hi Chen,

Yes, the receive side still requires the -netdev tap,id=net0,vhost=on
setup. I will make this clearer in the next version of the series.

Best regards,
Cindy Lu
> >
> > Testing
> > =======
> > - Tested with vhost=on/off TAP netdev on x86_64
> >
> > Cindy Lu (5):
> >   net/filter: Allow redirector on vhost backends
> >   net/filter-redirector: add in/out_netdev properties
> >   net/filter-redirector: Add AF_PACKET sockets initialization
> >   net/filter-redirector: add AF_PACKET redirect datapath
> >   qapi: add in/out_netdev to filter-redirector
> >
> >  net/filter-mirror.c | 460 +++++++++++++++++++++++++++++++++++++++++---
> >  net/filter.c        |   6 +-
> >  qapi/qom.json       |  19 +-
> >  3 files changed, 459 insertions(+), 26 deletions(-)
> >
> > --
> > 2.52.0
> >
>