Skip to content

Commit 5560c7e

Browse files
committed
Revert "af-packet: speed up thread sync during startup"
This reverts commit 923ad6a. Several issues have been reported: 1. non-deterministic thread to queue mapping (privately reported) 2. race condition causing IPS mode to loose packets, or get stuck completely, ticket 8667. Ticket: OISF#8667. (cherry picked from commit 2b19f86)
1 parent 36fb9ae commit 5560c7e

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

src/source-af-packet.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ void TmModuleDecodeAFPRegister (void)
607607
tmm_modules[TMM_DECODEAFP].flags = TM_FLAG_DECODE_TM;
608608
}
609609

610-
static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose, const bool peer_update);
610+
static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose);
611611

612612
static inline void AFPDumpCounters(AFPThreadVars *ptv)
613613
{
@@ -1282,7 +1282,7 @@ static int AFPTryReopen(AFPThreadVars *ptv)
12821282
/* ref cnt 0, we can close the old socket */
12831283
AFPCloseSocket(ptv);
12841284

1285-
int afp_activate_r = AFPCreateSocket(ptv, ptv->iface, 0, false);
1285+
int afp_activate_r = AFPCreateSocket(ptv, ptv->iface, 0);
12861286
if (afp_activate_r != 0) {
12871287
if (ptv->down_count % AFP_DOWN_COUNTER_INTERVAL == 0) {
12881288
SCLogWarning("%s: can't reopen interface", ptv->iface);
@@ -1326,7 +1326,7 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
13261326
break;
13271327
}
13281328
}
1329-
r = AFPCreateSocket(ptv, ptv->iface, 1, true);
1329+
r = AFPCreateSocket(ptv, ptv->iface, 1);
13301330
if (r < 0) {
13311331
switch (-r) {
13321332
case AFP_FATAL_ERROR:
@@ -1337,6 +1337,7 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
13371337
"%s: failed to init socket for interface, retrying soon", ptv->iface);
13381338
}
13391339
}
1340+
AFPPeersListReachedInc();
13401341
}
13411342
if (ptv->afp_state == AFP_STATE_UP) {
13421343
SCLogDebug("Thread %s using socket %d", tv->name, ptv->socket);
@@ -1938,8 +1939,7 @@ static TmEcode SetEbpfFilter(AFPThreadVars *ptv)
19381939
}
19391940
#endif
19401941

1941-
/** \param peer_update increment peers reached */
1942-
static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose, const bool peer_update)
1942+
static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
19431943
{
19441944
int r;
19451945
int ret = AFP_FATAL_ERROR;
@@ -2064,10 +2064,7 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose, const
20642064
}
20652065
}
20662066
#endif
2067-
/* bind() done, allow next thread to continue */
2068-
if (peer_update) {
2069-
AFPPeersListReachedInc();
2070-
}
2067+
20712068
ret = AFPSetupRing(ptv, devname);
20722069
if (ret != 0)
20732070
goto socket_err;

0 commit comments

Comments
 (0)