Coverage Report

Created: 2026-08-14 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-ipos.c
Line
Count
Source
1
/* packet-ipos.c
2
 * Routines for IPOS dissection
3
 * Copyright 2015, Chuan He <chuan.he@ericsson.com>
4
 *                 Anders Broman <anders.broman@ericsson.com>
5
 *
6
 * Wireshark - Network traffic analyzer
7
 * By Gerald Combs <gerald@wireshark.org>
8
 * Copyright 1998 Gerald Combs
9
 *
10
 * SPDX-License-Identifier: GPL-2.0-or-later
11
 */
12
13
/*
14
 * This is a dissector for Ericsson IPOS Linux kernel packets' header
15
 * exchanged between kernel and linecard. All fields are in network byte order.
16
 * This header follow the Linux cooked-mode capture(SLL) and will call REDBACK
17
 * dissector.
18
 *
19
 * IPOS is the network operating system running on a few Ericsson platforms
20
 * including SSR 8000 routers, Router 6000 series, and SP routers.
21
 *
22
 * Product details for Ericsson's IP Metro and Backhaul routers using IPOS:
23
 * http://www.ericsson.com/ourportfolio/products/ip-metro-and-backhaul
24
 *
25
 */
26
#include "config.h"
27
#include <epan/packet.h>
28
#include <epan/expert.h>
29
30
void proto_reg_handoff_ipos(void);
31
void proto_register_ipos(void);
32
33
static dissector_handle_t ipos_handle;
34
static dissector_handle_t redback_handle;
35
36
static int proto_ipos;
37
static int hf_ipos_protocol;
38
static int hf_ipos_priority;
39
static int hf_ipos_ppe;
40
static int hf_ipos_slot;
41
static int ett_ipos;
42
43
/* static expert_field ei_ipos_protocol; */
44
45
16
#define LINUX_SLL_P_IPOS_NETIPC  0x0030  /* IPOS IPC frames to/from AF_IPC module */
46
16
#define LINUX_SLL_P_IPOS_RBN     0x0031  /* IPOS IP frames to/from CTX module */
47
16
#define LINUX_SLL_P_IPOS_NETLINK 0x0032 /* IPOS data frames to/from AF_RBN_NETLINK module */
48
16
#define LINUX_SLL_P_IPOS_XCRP    0x0033 /* IPOS data frames to/from XCRP driver */
49
16
#define LINUX_SLL_P_IPOS_ISIS    0x0034 /* IPOS data frames to/from ISIS module */
50
16
#define LINUX_SLL_P_IPOS_PAKIO   0x0035 /* IPOS data frames to/from AF_RBN_PAKIO module */
51
52
static const value_string prototypenames[] = {
53
    { 0, "L2 Protocol" },
54
    { 1, "L3 Protocol" },
55
    { 2, "Control (IPC) message" },
56
    { 3, "ISIS packet" },
57
    { 4, "PAKIO packet" },
58
    { 0,  NULL }
59
};
60
61
static const value_string ppetypenames[] = {
62
    { 4,  "Output PPA" },
63
    { 6,  "Input PPA" },
64
    { 10, "SPPA" },
65
    { 0,   NULL }
66
};
67
68
/**
69
 *   Dissect a buffer containing IPOS kernel packet bit string.
70
 *
71
 *   @param tvb   The buffer to dissect.
72
 *   @param pinfo Packet Info.
73
 *   @param tree  The protocol tree.
74
 **/
75
static int
76
dissect_ipos(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
77
0
{
78
0
    proto_item  *ti = NULL;
79
0
    proto_tree  *ipos_tree = NULL;
80
0
    tvbuff_t  *next_tvb;
81
0
    int         offset = 0;
82
83
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPOS");
84
0
    col_clear(pinfo->cinfo, COL_INFO);
85
86
0
    ti = proto_tree_add_item(tree, proto_ipos, tvb, 0, -1, ENC_NA);
87
0
    ipos_tree = proto_item_add_subtree(ti, ett_ipos);
88
0
    proto_tree_add_item(ipos_tree, hf_ipos_protocol, tvb, offset, 1, ENC_BIG_ENDIAN);
89
0
    proto_tree_add_item(ipos_tree, hf_ipos_priority, tvb, offset, 1, ENC_BIG_ENDIAN);
90
0
    offset += 1;
91
0
    proto_tree_add_item(ipos_tree, hf_ipos_ppe, tvb, offset, 1, ENC_BIG_ENDIAN);
92
0
    offset += 1;
93
0
    proto_tree_add_item(ipos_tree, hf_ipos_slot, tvb, offset, 2, ENC_BIG_ENDIAN);
94
0
    offset += 2;
95
96
0
    if (redback_handle) {
97
0
        next_tvb = tvb_new_subset_remaining(tvb, offset);
98
0
        call_dissector(redback_handle, next_tvb, pinfo, tree);
99
0
    }
100
101
0
    return tvb_reported_length(tvb);
102
0
}
103
104
void
105
proto_register_ipos(void)
106
16
{
107
16
    static hf_register_info hf[] = {
108
16
        { &hf_ipos_protocol,
109
16
        { "Protocol", "ipos.proto", FT_UINT8, BASE_DEC, VALS(prototypenames), 0xF0,
110
16
        NULL, HFILL }},
111
112
16
        { &hf_ipos_priority,
113
16
        { "Priority", "ipos.priority", FT_UINT8, BASE_DEC, NULL, 0x0F,
114
16
        NULL, HFILL }},
115
116
16
        { &hf_ipos_ppe,
117
16
        { "Packet Processing Engine", "ipos.ppe", FT_UINT8, BASE_HEX, VALS(ppetypenames), 0x0,
118
16
        NULL, HFILL }},
119
120
16
        { &hf_ipos_slot,
121
16
        { "Destination (source) Slot", "ipos.slot", FT_UINT16, BASE_DEC, NULL, 0x0,
122
16
        NULL, HFILL }}
123
16
    };
124
125
16
    static int *ett[] = {
126
16
        &ett_ipos
127
16
    };
128
129
#if 0
130
    static ei_register_info ei[] = {
131
        { &ei_ipos_protocol,
132
        { "ipos.protocol.unknown", PI_PROTOCOL, PI_WARN,
133
        "Unknown Protocol Data", EXPFILL }}
134
    };
135
136
    expert_module_t* expert_ipos;
137
#endif
138
139
16
    proto_ipos = proto_register_protocol("IPOS Kernel Packet Protocol", "IPOS", "ipos");
140
16
    proto_register_field_array(proto_ipos, hf, array_length(hf));
141
16
    proto_register_subtree_array(ett, array_length(ett));
142
#if 0
143
    expert_ipos = expert_register_protocol(proto_ipos);
144
    expert_register_field_array(expert_ipos, ei, array_length(ei));
145
#endif
146
16
    ipos_handle = register_dissector("ipos", dissect_ipos, proto_ipos);
147
16
}
148
149
void
150
proto_reg_handoff_ipos(void)
151
16
{
152
16
    redback_handle = find_dissector_add_dependency("redback", proto_ipos);
153
154
    /*dissector_add_uint("wtap_encap", WTAP_ENCAP_IPOS, ipos_handle); */
155
16
    dissector_add_uint("sll.ltype", LINUX_SLL_P_IPOS_NETIPC, ipos_handle);
156
16
    dissector_add_uint("sll.ltype", LINUX_SLL_P_IPOS_RBN, ipos_handle);
157
16
    dissector_add_uint("sll.ltype", LINUX_SLL_P_IPOS_NETLINK, ipos_handle);
158
16
    dissector_add_uint("sll.ltype", LINUX_SLL_P_IPOS_XCRP, ipos_handle);
159
16
    dissector_add_uint("sll.ltype", LINUX_SLL_P_IPOS_ISIS, ipos_handle);
160
16
    dissector_add_uint("sll.ltype", LINUX_SLL_P_IPOS_PAKIO, ipos_handle);
161
162
16
    dissector_add_for_decode_as("ethertype", ipos_handle);
163
16
}
164
165
/*
166
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
167
 *
168
 * Local variables:
169
 * c-basic-offset: 4
170
 * tab-width: 8
171
 * indent-tabs-mode: nil
172
 * End:
173
 *
174
 * vi: set shiftwidth=4 tabstop=8 expandtab:
175
 * :indentSize=4:tabSize=8:noTabs=true:
176
 */