--- fwsync/driver/fwsync.c 2022/06/22 13:01:55 1.1.1.1 +++ fwsync/driver/fwsync.c 2022/07/04 13:29:10 1.3 @@ -11,9 +11,10 @@ static intptr_t fwsync_wchan; static void fwsync_edge_proc(void *arg) { - int e, rcvflg; + int e, rcvflg = 0; struct uio uio; struct mbuf *m = NULL; + struct fws_proto *pkt; DTRACE(); @@ -34,8 +35,14 @@ fwsync_edge_proc(void *arg) tsleep(&fwsync_wchan, 0, "edge_handler", hz); continue; } + pkt = mtod(m, struct fws_proto*); + if (m_length(m, NULL) != sizeof(struct fws_proto)) { + printf("FWSync packet length=%d isn't match expected %lu\n", + m_length(m, NULL), sizeof(struct fws_proto)); + continue; + } - printf("%u...-> %s\n", m->m_len, m->m_data); + printf("%u...-> %s version=%c\n", m->m_len, m->m_data, pkt->fws_version); } fws_ctx.config &= ~CTX_EDGE_ONLINE; @@ -285,8 +292,6 @@ fwsync_start(struct ip_fw_chain *ch, ip_fw3_opheader * fws_ctx.config |= CTX_COLLECTOR_2_ONLINE; } - /* at last but not at least, activate config status of started sync service */ - fws_cfg.cfg.on |= *n; return 0; } @@ -328,7 +333,5 @@ fwsync_stop(struct ip_fw_chain *ch, ip_fw3_opheader *o ipfw_unregister_alias_hook(); } - /* at last but not at least, stop sync service */ - fws_cfg.cfg.on &= ~*n; return 0; }