Files
qemu/net
Jason Wang 5193528b9f net/filter-redirector: add support for dynamic status on/off switching
Currently, filter-redirector does not implement the status_changed
callback, which means the 'status' property cannot be used to
dynamically enable/disable the filter at runtime. When status is
set to 'off' via QMP/HMP, the filter still receives data from the
indev chardev because the chardev handlers remain registered.

This patch adds proper support for the 'status' property:

1. Implement filter_redirector_status_changed() callback:
   - When status changes to 'off': remove chardev read handlers
   - When status changes to 'on': re-register chardev handlers
     (only if chardev is already open)

2. Update filter_redirector_setup() to respect initial status:
   - If filter is created with status=off, do not register handlers
   - This allows creating disabled filters via command line or QMP

3. Handle chardev OPENED/CLOSED events to re-arm handlers on reconnect:
   - Keep the chr_event callback installed on CLOSE so a later OPENED
     can re-register the read handlers when nf->on
   - Use qemu_chr_fe_set_handlers_full(..., set_open=false, sync_state=false)
     instead of qemu_chr_fe_set_handlers() because the latter forces
     sync_state=true and may emit CHR_EVENT_OPENED for an already-open
     backend. Doing that from inside the chr_event callback would cause
     recursive/re-entrant OPENED handling.

Signed-off-by: Jason Wang <jasowang@redhat.com>
2026-01-23 14:46:22 +08:00
..
2025-04-25 17:00:41 +02:00
2025-07-14 13:27:09 +08:00
2025-04-25 17:00:41 +02:00
2025-07-14 13:27:09 +08:00
2025-10-28 14:49:52 +01:00
2026-01-23 14:41:26 +08:00
2026-01-23 14:41:26 +08:00
2026-01-23 14:41:26 +08:00
2025-10-04 10:51:02 -04:00
2026-01-23 14:41:26 +08:00
2026-01-23 14:41:26 +08:00
2026-01-23 14:41:26 +08:00