On Thu, Oct 05, 2023 at 07:15:23AM +0200, Kirill Miazine wrote:
> > This diff checks IFF_RUNNING flag within while (!ifq_empty()) loop of
> > wg_peer_destroy(). If the flag is not set queue will be purged and check
> > performed again. I intentionally keep netlock to prevent ifconfig
> > manipulations on the interface.
> 
> I confirm that just the diff below solved the issue

> > +            * XXX: `if_snd' of stopped interface could still packets

This sentnece is missing a verb.  ... could still contain packets?
Or: `if_snd' of stopped interface does not consume packets

OK bluhm@

> > Index: sys/net/if_wg.c
> > ===================================================================
> > RCS file: /cvs/src/sys/net/if_wg.c,v
> > retrieving revision 1.31
> > diff -u -p -r1.31 if_wg.c
> > --- sys/net/if_wg.c 26 Sep 2023 15:16:44 -0000      1.31
> > +++ sys/net/if_wg.c 4 Oct 2023 23:09:14 -0000
> > @@ -509,6 +509,13 @@ wg_peer_destroy(struct wg_peer *peer)
> >   
> >     NET_LOCK();
> >     while (!ifq_empty(&sc->sc_if.if_snd)) {
> > +           /*
> > +            * XXX: `if_snd' of stopped interface could still packets
> > +            */
> > +           if (!ISSET(sc->sc_if.if_flags, IFF_RUNNING)) {
> > +                   ifq_purge(&sc->sc_if.if_snd);
> > +                   continue;
> > +           }
> >             NET_UNLOCK();
> >             tsleep_nsec(sc, PWAIT, "wg_ifq", 1000);
> >             NET_LOCK();
> > 

Reply via email to