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

OISF / suricata / 23374838686

21 Mar 2026 07:29AM UTC coverage: 59.341% (-20.0%) from 79.315%
23374838686

Pull #15075

github

web-flow
Merge 90b4e834f into 6587e363a
Pull Request #15075: Stack 8001 v16.4

38 of 70 new or added lines in 10 files covered. (54.29%)

34165 existing lines in 563 files now uncovered.

119621 of 201584 relevant lines covered (59.34%)

650666.92 hits per line

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

73.68
/src/defrag-stack.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
 * Defrag tracker queue handler functions
24
 */
25

26
#include "suricata-common.h"
27
#include "defrag-stack.h"
28
#include "util-error.h"
29
#include "util-debug.h"
30
#include "util-print.h"
31

32
DefragTrackerStack *DefragTrackerStackInit(DefragTrackerStack *q)
33
{
2✔
34
    if (q != NULL) {
2✔
35
        memset(q, 0, sizeof(DefragTrackerStack));
2✔
36
        DQLOCK_INIT(q);
2✔
37
    }
2✔
38
    return q;
2✔
39
}
2✔
40

41
/**
42
 *  \brief Destroy a tracker queue
43
 *
44
 *  \param q the tracker queue to destroy
45
 */
46
void DefragTrackerStackDestroy(DefragTrackerStack *q)
UNCOV
47
{
×
UNCOV
48
    DQLOCK_DESTROY(q);
×
UNCOV
49
}
×
50

51
/**
52
 *  \brief add a tracker to a queue
53
 *
54
 *  \param q queue
55
 *  \param dt tracker
56
 */
57
void DefragTrackerEnqueue(DefragTrackerStack *q, DefragTracker *dt)
58
{
66,131✔
59
#ifdef DEBUG
60
    BUG_ON(q == NULL || dt == NULL);
61
#endif
62

63
    DQLOCK_LOCK(q);
66,131✔
64
    dt->lnext = q->s;
66,131✔
65
    q->s = dt;
66,131✔
66
    q->len++;
66,131✔
67
#ifdef DBG_PERF
68
    if (q->len > q->dbg_maxlen)
69
        q->dbg_maxlen = q->len;
70
#endif /* DBG_PERF */
71
    DQLOCK_UNLOCK(q);
66,131✔
72
}
66,131✔
73

74
/**
75
 *  \brief remove a tracker from the queue
76
 *
77
 *  \param q queue
78
 *
79
 *  \retval dt tracker or NULL if empty list.
80
 */
81
DefragTracker *DefragTrackerDequeue(DefragTrackerStack *q)
82
{
131,083✔
83
    DQLOCK_LOCK(q);
131,083✔
84

85
    DefragTracker *dt = q->s;
131,083✔
86
    if (dt == NULL) {
131,083✔
87
        DQLOCK_UNLOCK(q);
70,494✔
88
        return NULL;
70,494✔
89
    }
70,494✔
90
    q->s = dt->lnext;
60,589✔
91
    dt->lnext = NULL;
60,589✔
92

93
#ifdef DEBUG
94
    BUG_ON(q->len == 0);
95
#endif
96
    if (q->len > 0)
60,589✔
97
        q->len--;
60,589✔
98
    DQLOCK_UNLOCK(q);
60,589✔
99
    return dt;
60,589✔
100
}
131,083✔
101

102
/**
103
 *  \brief return stack size
104
 */
105
uint32_t DefragTrackerStackSize(DefragTrackerStack *q)
UNCOV
106
{
×
UNCOV
107
    uint32_t len;
×
UNCOV
108
    DQLOCK_LOCK(q);
×
UNCOV
109
    len = q->len;
×
UNCOV
110
    DQLOCK_UNLOCK(q);
×
UNCOV
111
    return len;
×
UNCOV
112
}
×
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