• 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

94.87
/src/flow-queue.c
1
/* Copyright (C) 2007-2020 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
 * Flow queue handler functions
24
 */
25

26
#include "suricata-common.h"
27
#include "threads.h"
28
#include "flow-private.h"
29
#include "flow-queue.h"
30
#include "flow-util.h"
31
#include "util-error.h"
32
#include "util-debug.h"
33
#include "util-print.h"
34

35
FlowQueue *FlowQueueNew(void)
36
{
5,634✔
37
    FlowQueue *q = (FlowQueue *)SCMalloc(sizeof(FlowQueue));
5,634✔
38
    if (q == NULL) {
5,634✔
39
        SCLogError("Fatal error encountered in FlowQueueNew. Exiting...");
×
40
        exit(EXIT_SUCCESS);
×
41
    }
×
42
    q = FlowQueueInit(q);
5,634✔
43
    return q;
5,634✔
44
}
5,634✔
45

46
FlowQueue *FlowQueueInit (FlowQueue *q)
47
{
7,204✔
48
    if (q != NULL) {
7,204✔
49
        memset(q, 0, sizeof(FlowQueue));
7,204✔
50
        FQLOCK_INIT(q);
7,204✔
51
    }
7,204✔
52
    return q;
7,204✔
53
}
7,204✔
54

55
/**
56
 *  \brief Destroy a flow queue
57
 *
58
 *  \param q the flow queue to destroy
59
 */
60
void FlowQueueDestroy (FlowQueue *q)
61
{
1,564✔
62
    FQLOCK_DESTROY(q);
1,564✔
63
}
1,564✔
64

65
void FlowQueuePrivateAppendFlow(FlowQueuePrivate *fqc, Flow *f)
66
{
15,739,066✔
67
    if (fqc->top == NULL) {
15,739,066✔
68
        fqc->top = fqc->bot = f;
159,815✔
69
        fqc->len = 1;
159,815✔
70
    } else {
15,579,251✔
71
        fqc->bot->next = f;
15,579,251✔
72
        fqc->bot = f;
15,579,251✔
73
        fqc->len++;
15,579,251✔
74
    }
15,579,251✔
75
    f->next = NULL;
15,739,066✔
76
}
15,739,066✔
77

78
void FlowQueuePrivatePrependFlow(FlowQueuePrivate *fqc, Flow *f)
79
{
1,497✔
80
    f->next = fqc->top;
1,497✔
81
    fqc->top = f;
1,497✔
82
    if (f->next == NULL) {
1,497✔
83
        fqc->bot = f;
×
84
    }
×
85
    fqc->len++;
1,497✔
86
}
1,497✔
87

88
void FlowQueuePrivateAppendPrivate(FlowQueuePrivate *dest, FlowQueuePrivate *src)
89
{
607✔
90
    if (src->top == NULL)
607✔
91
        return;
×
92

93
    if (dest->bot == NULL) {
607✔
94
        dest->top = src->top;
580✔
95
        dest->bot = src->bot;
580✔
96
        dest->len = src->len;
580✔
97
    } else {
593✔
98
        dest->bot->next = src->top;
27✔
99
        dest->bot = src->bot;
27✔
100
        dest->len += src->len;
27✔
101
    }
27✔
102
    src->top = src->bot = NULL;
607✔
103
    src->len = 0;
607✔
104
}
607✔
105

106
static inline void FlowQueueAtomicSetNonEmpty(FlowQueue *fq)
107
{
2,439✔
108
    if (!SC_ATOMIC_GET(fq->non_empty)) {
2,439✔
109
        SC_ATOMIC_SET(fq->non_empty, true);
1,565✔
110
    }
1,565✔
111
}
2,439✔
112
static inline void FlowQueueAtomicSetEmpty(FlowQueue *fq)
113
{
286,467✔
114
    if (SC_ATOMIC_GET(fq->non_empty)) {
286,467✔
115
        SC_ATOMIC_SET(fq->non_empty, false);
1,565✔
116
    }
1,565✔
117
}
286,467✔
118

119
void FlowQueueAppendPrivate(FlowQueue *fq, FlowQueuePrivate *fqc)
120
{
1,520✔
121
    if (fqc->top == NULL)
1,520✔
122
        return;
466✔
123

124
    FQLOCK_LOCK(fq);
1,054✔
125
    if (fq->qbot == NULL) {
1,054✔
126
        fq->qtop = fqc->top;
985✔
127
        fq->qbot = fqc->bot;
985✔
128
        fq->qlen = fqc->len;
985✔
129
    } else {
985✔
130
        fq->qbot->next = fqc->top;
69✔
131
        fq->qbot = fqc->bot;
69✔
132
        fq->qlen += fqc->len;
69✔
133
    }
69✔
134
    FlowQueueAtomicSetNonEmpty(fq);
1,054✔
135
    FQLOCK_UNLOCK(fq);
1,054✔
136
    fqc->top = fqc->bot = NULL;
1,054✔
137
    fqc->len = 0;
1,054✔
138
}
1,054✔
139

140
FlowQueuePrivate FlowQueueExtractPrivate(FlowQueue *fq)
141
{
284,903✔
142
    FQLOCK_LOCK(fq);
284,903✔
143
    FlowQueuePrivate fqc = fq->priv;
284,903✔
144
    fq->qtop = fq->qbot = NULL;
284,903✔
145
    fq->qlen = 0;
284,903✔
146
    FlowQueueAtomicSetEmpty(fq);
284,903✔
147
    FQLOCK_UNLOCK(fq);
284,903✔
148
    return fqc;
284,903✔
149
}
284,903✔
150

151
Flow *FlowQueuePrivateGetFromTop(FlowQueuePrivate *fqc)
152
{
16,130,230✔
153
    Flow *f = fqc->top;
16,130,230✔
154
    if (f == NULL) {
16,130,230✔
155
        return NULL;
449,668✔
156
    }
449,668✔
157

158
    fqc->top = f->next;
15,680,562✔
159
    f->next = NULL;
15,680,562✔
160
    fqc->len--;
15,680,562✔
161
    if (fqc->top == NULL) {
15,680,562✔
162
        fqc->bot = NULL;
159,119✔
163
    }
159,119✔
164
    return f;
15,680,562✔
165
}
16,130,230✔
166

167
/**
168
 *  \brief add a flow to a queue
169
 *
170
 *  \param q queue
171
 *  \param f flow
172
 */
173
void FlowEnqueue (FlowQueue *q, Flow *f)
174
{
1,385✔
175
#ifdef DEBUG
176
    BUG_ON(q == NULL || f == NULL);
177
#endif
178
    FQLOCK_LOCK(q);
1,385✔
179
    FlowQueuePrivateAppendFlow(&q->priv, f);
1,385✔
180
    FlowQueueAtomicSetNonEmpty(q);
1,385✔
181
    FQLOCK_UNLOCK(q);
1,385✔
182
}
1,385✔
183

184
/**
185
 *  \brief remove a flow from the queue
186
 *
187
 *  \param q queue
188
 *
189
 *  \retval f flow or NULL if empty list.
190
 */
191
Flow *FlowDequeue (FlowQueue *q)
192
{
1,564✔
193
    FQLOCK_LOCK(q);
1,564✔
194
    Flow *f = FlowQueuePrivateGetFromTop(&q->priv);
1,564✔
195
    if (f == NULL)
1,564✔
196
        FlowQueueAtomicSetEmpty(q);
1,564✔
197
    FQLOCK_UNLOCK(q);
1,564✔
198
    return f;
1,564✔
199
}
1,564✔
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