Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions etc/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2014,6 +2014,10 @@
"status": {
"type": "integer"
},
"status_string": {
"description": "status string when it is not a valid integer (like 2XX)",
"type": "string"
},
"true_client_ip": {
"type": "string"
},
Expand Down
8 changes: 2 additions & 6 deletions src/output-json-http.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,8 @@ static void EveHttpLogJSONExtended(JsonBuilder *js, htp_tx_t *tx)
if (resp > 0) {
jb_set_uint(js, "status", (uint32_t)resp);
} else if (tx->response_status != NULL) {
const size_t status_size = bstr_len(tx->response_status) * 2 + 1;
char status_string[status_size];
BytesToStringBuffer(bstr_ptr(tx->response_status), bstr_len(tx->response_status),
status_string, status_size);
unsigned int val = strtoul(status_string, NULL, 10);
jb_set_uint(js, "status", val);
jb_set_string_from_bytes(js, "status_string", bstr_ptr(tx->response_status),
(uint32_t)bstr_len(tx->response_status));
}

htp_header_t *h_location = htp_table_get_c(tx->response_headers, "location");
Expand Down
16 changes: 9 additions & 7 deletions src/source-af-packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,7 @@ void TmModuleDecodeAFPRegister (void)
tmm_modules[TMM_DECODEAFP].flags = TM_FLAG_DECODE_TM;
}


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

static inline void AFPDumpCounters(AFPThreadVars *ptv)
{
Expand Down Expand Up @@ -1290,7 +1289,7 @@ static int AFPTryReopen(AFPThreadVars *ptv)
/* ref cnt 0, we can close the old socket */
AFPCloseSocket(ptv);

int afp_activate_r = AFPCreateSocket(ptv, ptv->iface, 0);
int afp_activate_r = AFPCreateSocket(ptv, ptv->iface, 0, false);
if (afp_activate_r != 0) {
if (ptv->down_count % AFP_DOWN_COUNTER_INTERVAL == 0) {
SCLogWarning("%s: can't reopen interface", ptv->iface);
Expand Down Expand Up @@ -1334,7 +1333,7 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
break;
}
}
r = AFPCreateSocket(ptv, ptv->iface, 1);
r = AFPCreateSocket(ptv, ptv->iface, 1, true);
if (r < 0) {
switch (-r) {
case AFP_FATAL_ERROR:
Expand All @@ -1345,7 +1344,6 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
"%s: failed to init socket for interface, retrying soon", ptv->iface);
}
}
AFPPeersListReachedInc();
}
if (ptv->afp_state == AFP_STATE_UP) {
SCLogDebug("Thread %s using socket %d", tv->name, ptv->socket);
Expand Down Expand Up @@ -1869,7 +1867,8 @@ static int SetEbpfFilter(AFPThreadVars *ptv)
}
#endif

static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
/** \param peer_update increment peers reached */
static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose, const bool peer_update)
{
int r;
int ret = AFP_FATAL_ERROR;
Expand Down Expand Up @@ -1994,7 +1993,10 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose)
}
}
#endif

/* bind() done, allow next thread to continue */
if (peer_update) {
AFPPeersListReachedInc();
}
ret = AFPSetupRing(ptv, devname);
if (ret != 0)
goto socket_err;
Expand Down