pfsync_update_state() is too paranoid about pf_state::pfsync_state.
authorsashan <sashan@openbsd.org>
Mon, 5 Jun 2023 08:45:20 +0000 (08:45 +0000)
committersashan <sashan@openbsd.org>
Mon, 5 Jun 2023 08:45:20 +0000 (08:45 +0000)
For example it should not be surprised if caller asks to remove
state from pfsync queue which has been removed already. That kind
of race is sorted out later when pfsync_update_state() calls to
pfsync_q_ins()/pfsync_q_del().  Change relaxes pfsync_update_state()
to panic on sync_state value which is unknown.

OK dlg@

sys/net/if_pfsync.c

index 2bf9330..2457796 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if_pfsync.c,v 1.316 2023/05/26 12:13:26 kn Exp $      */
+/*     $OpenBSD: if_pfsync.c,v 1.317 2023/06/05 08:45:20 sashan Exp $  */
 
 /*
  * Copyright (c) 2002 Michael Shalayeff
@@ -1991,6 +1991,11 @@ pfsync_update_state(struct pf_state *st)
                st->sync_updates = 0;
                break;
 
+       case PFSYNC_S_DEL:
+       case PFSYNC_S_COUNT:
+       case PFSYNC_S_DEFER:
+               break;
+
        default:
                panic("pfsync_update_state: unexpected sync state %d",
                    st->sync_state);