Coverage Report

Created: 2026-11-12 06:59

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/suricata8/src/decode-sll2.c
Line
Count
Source
1
/* Copyright (C) 2025 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
 * \ingroup decode
20
 *
21
 * @{
22
 */
23
24
/**
25
 * \file
26
 *
27
 * \author Jeff Lucovsky <jeff.lucovsky@corelight.com>
28
 *
29
 * Decodes Sll2
30
 */
31
32
#include "suricata-common.h"
33
#include "decode.h"
34
#include "decode-sll2.h"
35
#include "decode-events.h"
36
37
#include "util-validate.h"
38
#include "util-debug.h"
39
40
int DecodeSll2(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len)
41
10.8k
{
42
10.8k
    DEBUG_VALIDATE_BUG_ON(pkt == NULL);
43
44
10.8k
    StatsIncr(tv, dtv->counter_sll2);
45
46
10.8k
    if (unlikely(len < SLL2_HEADER_LEN)) {
47
1.93k
        ENGINE_SET_INVALID_EVENT(p, SLL2_PKT_TOO_SMALL);
48
1.93k
        return TM_ECODE_FAILED;
49
1.93k
    }
50
8.92k
    if (!PacketIncreaseCheckLayers(p)) {
51
0
        return TM_ECODE_FAILED;
52
0
    }
53
54
8.92k
    Sll2Hdr *sll2h = (Sll2Hdr *)pkt;
55
56
8.92k
    SCLogDebug("p %p pkt %p sll2_protocol %04x", p, pkt, SCNtohs(sll2h->sll_protocol));
57
58
8.92k
    DecodeNetworkLayer(
59
8.92k
            tv, dtv, SCNtohs(sll2h->sll_protocol), p, pkt + SLL2_HEADER_LEN, len - SLL2_HEADER_LEN);
60
61
8.92k
    return TM_ECODE_OK;
62
8.92k
}
63
/**
64
 * @}
65
 */