• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OISF / suricata / 22550902417

01 Mar 2026 07:32PM UTC coverage: 68.401% (-5.3%) from 73.687%
22550902417

Pull #14922

github

web-flow
github-actions: bump actions/upload-artifact from 6.0.0 to 7.0.0

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6.0.0 to 7.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #14922: github-actions: bump actions/upload-artifact from 6.0.0 to 7.0.0

218243 of 319063 relevant lines covered (68.4%)

3284926.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.21
/src/host-timeout.c
1
/* Copyright (C) 2007-2012 Open Information Security Foundation
2
 *
3
 * You can copy, redistribute or modify this Program under the terms of
4
 * the GNU General Public License version 2 as published by the Free
5
 * Software Foundation.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * version 2 along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15
 * 02110-1301, USA.
16
 */
17

18
/**
19
 * \file
20
 *
21
 * \author Victor Julien <victor@inliniac.net>
22
 */
23

24
#include "suricata-common.h"
25
#include "host.h"
26

27
#include "detect-engine-tag.h"
28

29
#include "host-bit.h"
30
#include "host-timeout.h"
31

32
#include "reputation.h"
33

34
/** \internal
35
 *  \brief See if we can really discard this host. Check use_cnt reference.
36
 *
37
 *  \param h host
38
 *  \param ts timestamp
39
 *
40
 *  \retval 0 not timed out just yet
41
 *  \retval 1 fully timed out, lets kill it
42
 */
43
static int HostHostTimedOut(Host *h, SCTime_t ts)
44
{
96✔
45
    int busy = 0;
96✔
46

47
    /** never prune a host that is used by a packet
48
     *  we are currently processing in one of the threads */
49
    if (SC_ATOMIC_GET(h->use_cnt) > 0) {
96✔
50
        return 0;
×
51
    }
×
52

53
    busy |= (h->iprep && SRepHostTimedOut(h) == 0);
96✔
54
    busy |= (TagHostHasTag(h) && TagTimeoutCheck(h, ts) == 0);
96✔
55
    busy |= (HostHasHostBits(h) && HostBitsTimedoutCheck(h, ts) == 0);
96✔
56
    SCLogDebug("host %p %s", h, busy ? "still active" : "timed out");
96✔
57
    return !busy;
96✔
58
}
96✔
59

60
/**
61
 *  \internal
62
 *
63
 *  \brief check all hosts in a hash row for timing out
64
 *
65
 *  \param hb host hash row *LOCKED*
66
 *  \param h last host in the hash row
67
 *  \param ts timestamp
68
 *
69
 *  \retval cnt timed out hosts
70
 */
71
static uint32_t HostHashRowTimeout(HostHashRow *hb, Host *h, SCTime_t ts)
72
{
96✔
73
    uint32_t cnt = 0;
96✔
74

75
    do {
96✔
76
        if (SCMutexTrylock(&h->m) != 0) {
96✔
77
            h = h->hprev;
×
78
            continue;
×
79
        }
×
80

81
        Host *next_host = h->hprev;
96✔
82

83
        /* check if the host is fully timed out and
84
         * ready to be discarded. */
85
        if (HostHostTimedOut(h, ts) == 1) {
96✔
86
            /* remove from the hash */
87
            if (h->hprev != NULL)
6✔
88
                h->hprev->hnext = h->hnext;
×
89
            if (h->hnext != NULL)
6✔
90
                h->hnext->hprev = h->hprev;
×
91
            if (hb->head == h)
6✔
92
                hb->head = h->hnext;
6✔
93
            if (hb->tail == h)
6✔
94
                hb->tail = h->hprev;
6✔
95

96
            h->hnext = NULL;
6✔
97
            h->hprev = NULL;
6✔
98

99
            HostClearMemory (h);
6✔
100

101
            /* no one is referring to this host, use_cnt 0, removed from hash
102
             * so we can unlock it and move it back to the spare queue. */
103
            SCMutexUnlock(&h->m);
6✔
104

105
            /* move to spare list */
106
            HostMoveToSpare(h);
6✔
107

108
            cnt++;
6✔
109
        } else {
90✔
110
            SCMutexUnlock(&h->m);
90✔
111
        }
90✔
112

113
        h = next_host;
96✔
114
    } while (h != NULL);
96✔
115

116
    return cnt;
×
117
}
96✔
118

119
/**
120
 *  \brief time out hosts from the hash
121
 *
122
 *  \param ts timestamp
123
 *
124
 *  \retval cnt number of timed out host
125
 */
126
uint32_t HostTimeoutHash(SCTime_t ts)
127
{
3,216✔
128
    uint32_t idx = 0;
3,216✔
129
    uint32_t cnt = 0;
3,216✔
130

131
    for (idx = 0; idx < host_config.hash_size; idx++) {
13,175,952✔
132
        HostHashRow *hb = &host_hash[idx];
13,172,736✔
133

134
        if (HRLOCK_TRYLOCK(hb) != 0)
13,172,736✔
135
            continue;
×
136

137
        /* host hash bucket is now locked */
138

139
        if (hb->tail == NULL) {
13,172,736✔
140
            HRLOCK_UNLOCK(hb);
13,172,640✔
141
            continue;
13,172,640✔
142
        }
13,172,640✔
143

144
        /* we have a host, or more than one */
145
        cnt += HostHashRowTimeout(hb, hb->tail, ts);
96✔
146
        HRLOCK_UNLOCK(hb);
96✔
147
    }
96✔
148

149
    return cnt;
3,216✔
150
}
3,216✔
151

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc