On Thu, Dec 25, 2025 at 3:24 PM Jason Wang <[email protected]> wrote: > > Previously, when the 'interval' property was modified at runtime via > QMP, the new value would only take effect after the current timer > period elapsed. This could lead to unexpected behavior when users > expect immediate changes. > > Fix this by checking if the timer is already running when setting > the interval property. If so, reschedule the timer with the new > interval value immediately. > > Signed-off-by: Jason Wang <[email protected]>
LGTM. Reviewed-by: Zhang Chen <[email protected]> > --- > net/filter-buffer.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/net/filter-buffer.c b/net/filter-buffer.c > index a36be31dc8..427da24097 100644 > --- a/net/filter-buffer.c > +++ b/net/filter-buffer.c > @@ -159,6 +159,7 @@ static void filter_buffer_set_interval(Object *obj, > Visitor *v, > Error **errp) > { > FilterBufferState *s = FILTER_BUFFER(obj); > + NetFilterState *nf = NETFILTER(obj); > uint32_t value; > > if (!visit_type_uint32(v, name, &value, errp)) { > @@ -170,6 +171,11 @@ static void filter_buffer_set_interval(Object *obj, > Visitor *v, > return; > } > s->interval = value; > + > + if (nf->netdev && nf->on) { > + timer_mod(&s->release_timer, > + qemu_clock_get_us(QEMU_CLOCK_VIRTUAL) + s->interval); > + } > } > > static void filter_buffer_class_init(ObjectClass *oc, const void *data) > -- > 2.34.1 >
