diff --git a/src/decode-ipv6.c b/src/decode-ipv6.c index 8e6e3088e3..b1eed491d0 100644 --- a/src/decode-ipv6.c +++ b/src/decode-ipv6.c @@ -309,10 +309,6 @@ DecodeIPV6ExtHdrs(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt /* set the header ptr first */ IPV6_EXTHDR_SET_FH(p, pkt); - nh = *pkt; - pkt += hdrextlen; - plen -= hdrextlen; - /* the rest is parsed upon reassembly */ SCReturn; diff --git a/src/detect-dce-opnum.c b/src/detect-dce-opnum.c index 8e19c1d2ee..2f8aa99526 100644 --- a/src/detect-dce-opnum.c +++ b/src/detect-dce-opnum.c @@ -227,11 +227,9 @@ static inline DetectDceOpnumData *DetectDceOpnumArgParse(const char *arg) goto error; if (prev_dor == NULL) { - prev_dor = dor; dod->range = dor; } else { prev_dor->next = dor; - prev_dor = dor; } if (dup_str_head != NULL) @@ -349,7 +347,6 @@ void DetectDceOpnumFree(void *ptr) if (dod != NULL) { dor = dod->range; - dor_temp = dod->range; while (dor != NULL) { dor_temp = dor; dor = dor->next; diff --git a/src/detect-engine-address.c b/src/detect-engine-address.c index ed9084102d..ac49abefe7 100644 --- a/src/detect-engine-address.c +++ b/src/detect-engine-address.c @@ -405,7 +405,6 @@ int DetectAddressInsert(DetectEngineCtx *de_ctx, DetectAddressHead *gh, /* see if it already exists or overlaps with existing ag's */ if (head != NULL) { cur = NULL; - r = 0; for (cur = head; cur != NULL; cur = cur->next) { r = DetectAddressCmp(new, cur); @@ -965,7 +964,7 @@ int DetectAddressParse2(DetectAddressHead *gh, DetectAddressHead *ghn, char *s, o_set = 0; } else if (d_set == 1) { address[x - 1] = '\0'; - x = 0; + rule_var_address = SCRuleVarsGetConfVar(address, SC_RULE_VARS_ADDRESS_GROUPS); if (rule_var_address == NULL) diff --git a/src/detect-engine-iponly.c b/src/detect-engine-iponly.c index 74145da067..ae4f3ba517 100644 --- a/src/detect-engine-iponly.c +++ b/src/detect-engine-iponly.c @@ -449,6 +449,7 @@ static void IPOnlyCIDRListSetSigNum(IPOnlyCIDRItem *tmphead, SigIntId i) { } } +#ifdef UNITTESTS /** * \brief This function print a IPOnlyCIDRItem list * \param tmphead Pointer to the head of IPOnlyCIDRItems list @@ -466,6 +467,7 @@ static void IPOnlyCIDRListPrint(IPOnlyCIDRItem *tmphead) { tmphead = tmphead->next; } } +#endif /** * \brief This function print a SigNumArray, it's used with the @@ -624,7 +626,7 @@ static IPOnlyCIDRItem *IPOnlyCIDRListParse2(char *s, int negate) o_set = 0; } else if (d_set == 1) { address[x - 1] = '\0'; - x = 0; + rule_var_address = SCRuleVarsGetConfVar(address, SC_RULE_VARS_ADDRESS_GROUPS); if (rule_var_address == NULL) diff --git a/src/detect-engine-port.c b/src/detect-engine-port.c index 53181dfa1a..481cd91574 100644 --- a/src/detect-engine-port.c +++ b/src/detect-engine-port.c @@ -1054,7 +1054,7 @@ static int DetectPortParseDo(DetectPort **head, DetectPort **nhead, char *s, o_set = 0; } else if (d_set == 1) { address[x - 1] = '\0'; - x = 0; + rule_var_port = SCRuleVarsGetConfVar(address, SC_RULE_VARS_PORT_GROUPS); if (rule_var_port == NULL) diff --git a/src/flow-timeout.c b/src/flow-timeout.c index d2555e0fe1..5425b7f707 100644 --- a/src/flow-timeout.c +++ b/src/flow-timeout.c @@ -433,9 +433,6 @@ static inline void FlowForceReassemblyForQ(FlowQueue *q) while (f != NULL) { PACKET_RECYCLE(reassemble_p); - client_ok = 0; - server_ok = 0; - /* Get the tcp session for the flow */ ssn = (TcpSession *)f->protoctx; diff --git a/src/log-file.c b/src/log-file.c index 4d09678430..1ed9e2127f 100644 --- a/src/log-file.c +++ b/src/log-file.c @@ -268,12 +268,10 @@ static TmEcode LogFileLogWrap(ThreadVars *tv, Packet *p, void *data, PacketQueue SCLogDebug("write failed: %s", strerror(errno)); close(file_fd); - file_fd = -1; continue; } close(file_fd); - file_fd = -1; if (ff->state == FILE_STATE_CLOSED || ff->state == FILE_STATE_TRUNCATED || diff --git a/src/source-pcap.c b/src/source-pcap.c index 82c7c2e352..0459905ecd 100644 --- a/src/source-pcap.c +++ b/src/source-pcap.c @@ -291,7 +291,6 @@ TmEcode ReceivePcapLoop(ThreadVars *tv, void *data, void *slot) r = PcapTryReopen(ptv); } while (r < 0); if (dbreak) { - r = 0; break; } } else if (ptv->cb_result == TM_ECODE_FAILED) { diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index d175ceb28b..c761f5bc3d 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -1104,7 +1104,6 @@ static int HandleSegmentStartsBeforeListSegment(ThreadVars *tv, TcpReassemblyThr if (end_after == TRUE || end_same == TRUE) { StreamTcpSegmentDataReplace(list_seg, seg, overlap_point, overlap); - end_after = FALSE; } else { SCLogDebug("using old data in starts before list case, " "list_seg->seq %" PRIu32 " policy %" PRIu32 " " @@ -1297,7 +1296,6 @@ static int HandleSegmentStartsAtSameListSegment(ThreadVars *tv, TcpReassemblyThr case OS_POLICY_HPUX11: if (end_after == TRUE || end_same == TRUE) { StreamTcpSegmentDataReplace(list_seg, seg, seg->seq, overlap); - end_after = FALSE; } else { SCLogDebug("using old data in starts at list case, " "list_seg->seq %" PRIu32 " policy %" PRIu32 " " @@ -1498,7 +1496,6 @@ static int HandleSegmentStartsAfterListSegment(ThreadVars *tv, TcpReassemblyThre case OS_POLICY_HPUX11: if (end_after == TRUE) { StreamTcpSegmentDataReplace(list_seg, seg, seg->seq, overlap); - end_after = FALSE; } else { SCLogDebug("using old data in starts beyond list case, " "list_seg->seq %" PRIu32 " policy %" PRIu32 " " @@ -1970,8 +1967,6 @@ static int StreamTcpReassembleInlineAppLayer (ThreadVars *tv, next_seq, seg->seq, stream->last_ack, gap_len); #endif - next_seq = seg->seq; - /* We have missed the packet and end host has ack'd it, so * IDS should advance it's ra_base_seq and should not consider this * packet any longer, even if it is retransmitted, as end host will @@ -2128,8 +2123,6 @@ static int StreamTcpReassembleInlineAppLayer (ThreadVars *tv, segment_done = TRUE; } } - } else { - payload_offset = 0; } } @@ -2460,8 +2453,6 @@ static int StreamTcpReassembleInlineRaw (TcpReassemblyThreadCtx *ra_ctx, segment_done = TRUE; } } - } else { - payload_offset = 0; } } @@ -2665,9 +2656,6 @@ static int StreamTcpReassembleAppLayer (ThreadVars *tv, "stream->last_ack %" PRIu32 ". Seq gap %" PRIu32"", next_seq, seg->seq, stream->last_ack, gap_len); #endif - - next_seq = seg->seq; - /* We have missed the packet and end host has ack'd it, so * IDS should advance it's ra_base_seq and should not consider this * packet any longer, even if it is retransmitted, as end host will @@ -2861,8 +2849,6 @@ static int StreamTcpReassembleAppLayer (ThreadVars *tv, segment_done = TRUE; } } - } else { - payload_offset = 0; } } @@ -3043,8 +3029,6 @@ static int StreamTcpReassembleRaw (TcpReassemblyThreadCtx *ra_ctx, "stream->last_ack %" PRIu32 ". Seq gap %" PRIu32"", next_seq, seg->seq, stream->last_ack, gap_len); - next_seq = seg->seq; - if (smsg == NULL) { smsg = StreamMsgGetFromPool(); if (smsg == NULL) { @@ -3230,8 +3214,6 @@ static int StreamTcpReassembleRaw (TcpReassemblyThreadCtx *ra_ctx, segment_done = TRUE; } } - } else { - payload_offset = 0; } } diff --git a/src/stream-tcp.c b/src/stream-tcp.c index 42218ca6da..1bd4093cff 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -4467,7 +4467,6 @@ static int StreamTcpHandleTimestamp (TcpSession *ssn, Packet *p) { sender_stream->last_ts = ts; sender_stream->last_pkt_ts = p->ts.tv_sec; - ret = 1; SCLogDebug("timestamp considered valid anyway"); } else { diff --git a/src/util-debug-filters.c b/src/util-debug-filters.c index d4f739613a..f4c2e84dfa 100644 --- a/src/util-debug-filters.c +++ b/src/util-debug-filters.c @@ -486,15 +486,13 @@ int SCLogPrintFGFilters() */ int SCLogMatchFDFilter(const char *function) { +#ifndef DEBUG + return 1; +#else SCLogFDFilterThreadList *thread_list = NULL; -// pid_t self = syscall(SYS_gettid); pthread_t self = pthread_self(); -#ifndef DEBUG - return 1; -#endif - if (sc_log_module_initialized != 1) { printf("Logging module not initialized. Call SCLogInitLogModule() " "first before using the debug API\n"); @@ -527,6 +525,7 @@ int SCLogMatchFDFilter(const char *function) SCMutexUnlock(&sc_log_fd_filters_tl_m); return 0; +#endif } /** @@ -575,10 +574,7 @@ int SCLogCheckFDFilterEntry(const char *function) SCMutexLock(&sc_log_fd_filters_tl_m); thread_list = sc_log_fd_filters_tl; - thread_list_temp = thread_list; while (thread_list != NULL) { - thread_list_temp = thread_list; - if (pthread_equal(self, thread_list->t)) break; diff --git a/src/util-host-os-info.c b/src/util-host-os-info.c index 40e42e9b9e..2d02aaef5e 100644 --- a/src/util-host-os-info.c +++ b/src/util-host-os-info.c @@ -304,13 +304,15 @@ int SCHInfoAddHostOSInfo(char *host_os, char *host_os_ip_range, int is_ipv4) } if (recursive == TRUE) { - recursive = FALSE; SCHInfoAddHostOSInfo(host_os, ip_str_rem, is_ipv4); } - if (ip_str != NULL) SCFree(ip_str); - if (ipv4_addr != NULL) SCFree(ipv4_addr); - if (ipv6_addr != NULL) SCFree(ipv6_addr); + if (ip_str != NULL) + SCFree(ip_str); + if (ipv4_addr != NULL) + SCFree(ipv4_addr); + if (ipv6_addr != NULL) + SCFree(ipv6_addr); return *user_data; } diff --git a/src/util-print.c b/src/util-print.c index 1cf85d7e41..5d6741301f 100644 --- a/src/util-print.c +++ b/src/util-print.c @@ -96,7 +96,6 @@ void PrintRawDataFp(FILE *fp, uint8_t *buf, uint32_t buflen) { for (u = 0; u < buflen; u+=16) { fprintf(fp ," %04X ", u); - ch = 0; for (ch = 0; (u+ch) < buflen && ch < 16; ch++) { fprintf(fp, "%02X ", (uint8_t)buf[u+ch]); diff --git a/src/util-spm-bs.c b/src/util-spm-bs.c index 8410783529..4c7556a769 100644 --- a/src/util-spm-bs.c +++ b/src/util-spm-bs.c @@ -106,7 +106,6 @@ uint8_t *BasicSearchNocase(const uint8_t *haystack, uint32_t haystack_len, const if (needle_len == 0 || needle_len > haystack_len) return NULL; - n = needle; for (n = needle; nmax - n <= hmax - haystack; haystack++) { if (u8_tolower(*haystack) != u8_tolower(*n)) { continue;