Hello,

Diff below changes KASSERT() to if (). We have to prevent
packets to insert state to snapshot queue multiple times.
Hrvoje@ can trigger situation where state updates to pfsync
peer are more frequent than we are able to send out.

OK to go for this simple fix/workaround ?

thanks and
regards
sashan

--------8<---------------8<---------------8<------------------8<--------
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index d279ede9cd6..fdff3d7a509 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1362,10 +1362,17 @@ pfsync_grab_snapshot(struct pfsync_snapshot *sn, struct 
pfsync_softc *sc)
                TAILQ_INIT(&sn->sn_qs[q]);
 
                while ((st = TAILQ_FIRST(&sc->sc_qs[q])) != NULL) {
-                       KASSERT(st->snapped == 0);
                        TAILQ_REMOVE(&sc->sc_qs[q], st, sync_list);
-                       TAILQ_INSERT_TAIL(&sn->sn_qs[q], st, sync_snap);
-                       st->snapped = 1;
+                       if (st->snapped == 0) {
+                               TAILQ_INSERT_TAIL(&sn->sn_qs[q], st, sync_snap);
+                               st->snapped = 1;
+                       } else {
+                               /*
+                                * item is on snapshot list already, just give
+                                * up this attempt to update it.
+                                */
+                               pf_state_unref(st);
+                       }
                }
        }
 

Reply via email to