From 6750e63177f58c8f6753a0e9bab1095cdecf1ac7 Mon Sep 17 00:00:00 2001 From: Bill Yuan Date: Fri, 9 Jun 2017 00:35:55 +0800 Subject: [PATCH] ipfw3sync: dont call the sync func when centre not running --- sys/net/ipfw3/ip_fw3_sync.c | 4 ---- sys/net/ipfw3_basic/ip_fw3_basic.c | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/net/ipfw3/ip_fw3_sync.c b/sys/net/ipfw3/ip_fw3_sync.c index 2151b48ff8..e4ed327a59 100644 --- a/sys/net/ipfw3/ip_fw3_sync.c +++ b/sys/net/ipfw3/ip_fw3_sync.c @@ -434,10 +434,6 @@ ipfw_sync_send_state(struct ip_fw_state *state, int cpu, int hash) int error, i, len, nsize; struct cmd_send_state cmd; - if ((sync_ctx.running & 2) == 0) { - /* ipfw3sync: centre not running */ - return; - } len = sizeof(struct cmd_send_state); m = m_getl(len, M_WAITOK, MT_DATA, M_PKTHDR, &nsize); if (m == NULL) { diff --git a/sys/net/ipfw3_basic/ip_fw3_basic.c b/sys/net/ipfw3_basic/ip_fw3_basic.c index 662bbf7353..69328c0938 100644 --- a/sys/net/ipfw3_basic/ip_fw3_basic.c +++ b/sys/net/ipfw3_basic/ip_fw3_basic.c @@ -74,6 +74,7 @@ #define TIME_LEQ(a, b) ((int)((a) - (b)) <= 0) extern struct ipfw_context *ipfw_ctx[MAXCPU]; +extern struct ipfw_sync_context sync_ctx; extern int fw_verbose; extern ipfw_basic_delete_state_t *ipfw_basic_flush_state_prt; extern ipfw_basic_append_state_t *ipfw_basic_append_state_prt; @@ -392,7 +393,10 @@ install_state(struct ip_fw *rule, ipfw_insn *cmd, struct ip_fw_args *args) state_ctx->state = state; state_ctx->last = state; state_ctx->count++; - ipfw_sync_send_state_prt(state, mycpuid, hash); + + if (sync_ctx.running & 2) { + ipfw_sync_send_state_prt(state, mycpuid, hash); + } return state; } -- 2.41.0