Coverage Report

Created: 2025-12-27 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-isis-hello.c
Line
Count
Source
1
/* packet-isis-hello.c
2
 * Routines for decoding isis hello packets and their CLVs
3
 *
4
 * Stuart Stanley <stuarts@mxmail.net>
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
#include "config.h"
14
15
#include <epan/packet.h>
16
#include <epan/expert.h>
17
#include <epan/tfs.h>
18
#include <wsutil/array.h>
19
#include "packet-osi.h"
20
#include "packet-isis.h"
21
#include "packet-isis-clv.h"
22
23
24
/*
25
 * Declarations for L1/L2 hello base header.
26
 */
27
14
#define ISIS_HELLO_CTYPE_MASK           0x03
28
14
#define ISIS_HELLO_CT_RESERVED_MASK     0xfc
29
14
#define ISIS_HELLO_PRIORITY_MASK        0x7f
30
14
#define ISIS_HELLO_P_RESERVED_MASK      0x80
31
32
#define ISIS_HELLO_TYPE_RESERVED        0
33
#define ISIS_HELLO_TYPE_LEVEL_1         1
34
#define ISIS_HELLO_TYPE_LEVEL_2         2
35
#define ISIS_HELLO_TYPE_LEVEL_12        3
36
37
/*
38
 * misc. bittest macros
39
 */
40
41
14
#define ISIS_RESTART_RR                 0x01
42
38
#define ISIS_RESTART_RA                 0x02
43
14
#define ISIS_RESTART_SA                 0x04
44
#define ISIS_MASK_RESTART_RR(x)            ((x)&ISIS_RESTART_RR)
45
24
#define ISIS_MASK_RESTART_RA(x)            ((x)&ISIS_RESTART_RA)
46
#define ISIS_MASK_RESTART_SA(x)            ((x)&ISIS_RESTART_SA)
47
48
void proto_register_isis_hello(void);
49
void proto_reg_handoff_isis_hello(void);
50
51
static int proto_isis_hello;
52
53
/* hello packets */
54
static int hf_isis_hello_circuit;
55
static int hf_isis_hello_circuit_reserved;
56
static int hf_isis_hello_source_id;
57
static int hf_isis_hello_holding_timer;
58
static int hf_isis_hello_pdu_length;
59
static int hf_isis_hello_priority;
60
static int hf_isis_hello_priority_reserved;
61
static int hf_isis_hello_lan_id;
62
static int hf_isis_hello_clv_type;
63
static int hf_isis_hello_clv_length;
64
static int hf_isis_hello_local_circuit_id;
65
static int hf_isis_hello_clv_ipv4_int_addr;
66
static int hf_isis_hello_clv_ipv6_int_addr;
67
/* static int hf_isis_hello_clv_ptp_adj; */
68
static int hf_isis_hello_clv_mt;
69
static int hf_isis_hello_clv_restart_flags;
70
static int hf_isis_hello_clv_restart_flags_rr;
71
static int hf_isis_hello_clv_restart_flags_ra;
72
static int hf_isis_hello_clv_restart_flags_sa;
73
static int hf_isis_hello_clv_restart_remain_time;
74
static int hf_isis_hello_clv_restart_neighbor;
75
/* Generated from convert_proto_tree_add_text.pl */
76
static int hf_isis_hello_extended_local_circuit_id;
77
static int hf_isis_hello_adjacency_state;
78
static int hf_isis_hello_neighbor_systemid;
79
static int hf_isis_hello_digest;
80
static int hf_isis_hello_digest_v;
81
static int hf_isis_hello_digest_a;
82
static int hf_isis_hello_digest_d;
83
static int hf_isis_hello_ect;
84
static int hf_isis_hello_bvid;
85
static int hf_isis_hello_bvid_u;
86
static int hf_isis_hello_bvid_m;
87
static int hf_isis_hello_area_address;
88
static int hf_isis_hello_instance_identifier;
89
static int hf_isis_hello_supported_itid;
90
static int hf_isis_hello_clv_nlpid_nlpid;
91
static int hf_isis_hello_clv_ip_authentication;
92
static int hf_isis_hello_authentication;
93
94
static int hf_isis_hello_aux_mcid;
95
static int hf_isis_hello_mcid;
96
static int hf_isis_hello_is_neighbor;
97
static int hf_isis_hello_mtid;
98
static int hf_isis_hello_checksum;
99
static int hf_isis_hello_checksum_status;
100
static int hf_isis_hello_trill_neighbor_sf;
101
static int hf_isis_hello_trill_neighbor_lf;
102
static int hf_isis_hello_trill_neighbor_ff;
103
static int hf_isis_hello_trill_neighbor_of;
104
static int hf_isis_hello_trill_neighbor_size;
105
static int hf_isis_hello_trill_neighbor_reserved;
106
static int hf_isis_hello_trill_neighbor_mtu;
107
static int hf_isis_hello_trill_neighbor_snpa;
108
static int hf_isis_hello_reverse_metric_flags;
109
static int hf_isis_hello_reverse_metric_flag_reserved;
110
static int hf_isis_hello_reverse_metric_flag_u;
111
static int hf_isis_hello_reverse_metric_flag_w;
112
static int hf_isis_hello_reverse_metric_metric;
113
static int hf_isis_hello_reverse_metric_sub_length;
114
static int hf_isis_hello_reverse_metric_sub_data;
115
static int hf_isis_hello_bfd_enabled_nlpid;
116
static int hf_isis_hello_neighbor_extended_local_circuit_id;
117
static int hf_isis_hello_vlan_flags_port_id;
118
static int hf_isis_hello_vlan_flags_nickname;
119
static int hf_isis_hello_vlan_flags_af;
120
static int hf_isis_hello_vlan_flags_ac;
121
static int hf_isis_hello_vlan_flags_vm;
122
static int hf_isis_hello_vlan_flags_by;
123
static int hf_isis_hello_vlan_flags_outer_vlan;
124
static int hf_isis_hello_vlan_flags_tr;
125
static int hf_isis_hello_vlan_flags_reserved;
126
static int hf_isis_hello_vlan_flags_designated_vlan;
127
static int hf_isis_hello_enabled_vlans;
128
static int hf_isis_hello_appointed_vlans;
129
static int hf_isis_hello_af_nickname;
130
static int hf_isis_hello_af_start_vlan;
131
static int hf_isis_hello_af_end_vlan;
132
static int hf_isis_hello_trill_version;
133
static int hf_isis_hello_trill_hello_reduction;
134
static int hf_isis_hello_trill_unassigned_1;
135
static int hf_isis_hello_trill_hop_by_hop_flags;
136
static int hf_isis_hello_trill_unassigned_2;
137
static int hf_isis_hello_clv_ipv6_glb_int_addr;
138
139
static int ett_isis_hello;
140
static int ett_isis_hello_clv_area_addr;
141
static int ett_isis_hello_clv_instance_identifier;
142
static int ett_isis_hello_clv_is_neighbors;
143
static int ett_isis_hello_clv_padding;
144
static int ett_isis_hello_clv_unknown;
145
static int ett_isis_hello_clv_nlpid;
146
static int ett_isis_hello_clv_nlpid_nlpid;
147
static int ett_isis_hello_clv_authentication;
148
static int ett_isis_hello_clv_ip_authentication;
149
static int ett_isis_hello_clv_ipv4_int_addr;
150
static int ett_isis_hello_clv_ipv6_int_addr;
151
static int ett_isis_hello_clv_ptp_adj;
152
static int ett_isis_hello_clv_mt;
153
static int ett_isis_hello_clv_restart;
154
static int ett_isis_hello_clv_restart_flags;
155
static int ett_isis_hello_clv_mt_port_cap;
156
static int ett_isis_hello_clv_mt_port_cap_spb_mcid;
157
static int ett_isis_hello_clv_mt_port_cap_spb_digest;
158
static int ett_isis_hello_clv_mt_port_cap_spb_bvid_tuples;
159
static int ett_isis_hello_clv_mt_port_cap_vlan_flags;
160
static int ett_isis_hello_clv_mt_port_cap_enabled_vlans;
161
static int ett_isis_hello_clv_mt_port_cap_appointedfwrdrs;
162
static int ett_isis_hello_clv_mt_port_cap_port_trill_ver;
163
static int ett_isis_hello_clv_mt_port_cap_vlans_appointed;
164
static int ett_isis_hello_clv_trill_neighbor;
165
static int ett_isis_hello_clv_checksum;
166
static int ett_isis_hello_clv_reverse_metric;
167
static int ett_isis_hello_clv_bfd_enabled;
168
static int ett_isis_hello_clv_ipv6_glb_int_addr;
169
static int ett_isis_hello_reverse_metric_flags;
170
171
static expert_field ei_isis_hello_short_pdu;
172
static expert_field ei_isis_hello_long_pdu;
173
static expert_field ei_isis_hello_bad_checksum;
174
static expert_field ei_isis_hello_authentication;
175
static expert_field ei_isis_hello_subtlv;
176
static expert_field ei_isis_hello_short_clv;
177
static expert_field ei_isis_hello_clv_mt;
178
static expert_field ei_isis_hello_clv_unknown;
179
180
static const value_string isis_hello_circuit_type_vals[] = {
181
    { ISIS_HELLO_TYPE_RESERVED,    "Reserved 0 (discard PDU)"},
182
    { ISIS_HELLO_TYPE_LEVEL_1,    "Level 1 only"},
183
    { ISIS_HELLO_TYPE_LEVEL_2,    "Level 2 only"},
184
    { ISIS_HELLO_TYPE_LEVEL_12,    "Level 1 and 2"},
185
    { 0,        NULL} };
186
187
extern const range_string mtid_strings[];
188
189
static void
190
dissect_hello_mt_port_cap_spb_mcid_clv(tvbuff_t *tvb, packet_info* pinfo,
191
        proto_tree *tree, int offset, int subtype, int sublen)
192
17
{
193
17
    const int MCID_LEN = 51;
194
17
    const int SUBLEN   = 2 * MCID_LEN;
195
17
    proto_tree *subtree;
196
197
17
    if (sublen != SUBLEN) {
198
17
        proto_tree_add_expert_format(tree, pinfo, &ei_isis_hello_short_clv, tvb, offset, -1,
199
17
                                     "Short SPB MCID TLV (%d vs %d)", sublen, SUBLEN);
200
17
        return;
201
17
    }
202
203
204
0
    subtree = proto_tree_add_subtree_format( tree, tvb, offset-2, sublen+2, ett_isis_hello_clv_mt_port_cap_spb_mcid, NULL,
205
0
                                "SPB MCID: Type: 0x%02x, Length: %d", subtype, sublen);
206
207
    /* MCID: */
208
0
    proto_tree_add_item(subtree, hf_isis_hello_mcid, tvb, offset, MCID_LEN, ENC_NA);
209
0
    offset += MCID_LEN;
210
211
    /* Aux MCID: */
212
0
    proto_tree_add_item(subtree, hf_isis_hello_aux_mcid, tvb, offset, MCID_LEN, ENC_NA);
213
    /* offset += MCID_LEN; */
214
0
}
215
216
static void
217
dissect_hello_mt_port_cap_spb_digest_clv(tvbuff_t *tvb, packet_info* pinfo,
218
        proto_tree *tree, int offset, int subtype, int sublen)
219
3
{
220
3
    const int DIGEST_LEN = 32;
221
3
    const int SUBLEN     = 1 + DIGEST_LEN;
222
3
    if (sublen != SUBLEN) {
223
3
        proto_tree_add_expert_format(tree, pinfo, &ei_isis_hello_short_clv, tvb, offset, -1,
224
3
                              "Short SPB Digest TLV (%d vs %d)", sublen, SUBLEN);
225
3
        return;
226
3
    }
227
0
    else {
228
0
        proto_tree *subtree;
229
230
0
        subtree = proto_tree_add_subtree_format( tree, tvb, offset-2, sublen+2, ett_isis_hello_clv_mt_port_cap_spb_digest, NULL,
231
0
                                  "SPB Digest: Type: 0x%02x, Length: %d", subtype, sublen);
232
233
0
        proto_tree_add_item( subtree, hf_isis_hello_digest_v, tvb, offset, 1, ENC_BIG_ENDIAN);
234
0
        proto_tree_add_item( subtree, hf_isis_hello_digest_a, tvb, offset, 1, ENC_BIG_ENDIAN);
235
0
        proto_tree_add_item( subtree, hf_isis_hello_digest_d, tvb, offset, 1, ENC_BIG_ENDIAN);
236
0
        ++offset;
237
238
        /* Digest: */
239
0
        proto_tree_add_item(subtree, hf_isis_hello_digest, tvb, offset, DIGEST_LEN, ENC_NA);
240
        /* offset += DIGEST_LEN; */
241
0
    }
242
3
}
243
244
static void
245
dissect_hello_mt_port_cap_spb_bvid_tuples_clv(tvbuff_t *tvb, packet_info* pinfo,
246
        proto_tree *tree, int offset, int subtype, int sublen)
247
28
{
248
28
    proto_tree *subtree;
249
28
    int subofs = offset;
250
251
28
    subtree = proto_tree_add_subtree_format( tree, tvb, offset-2, sublen+2, ett_isis_hello_clv_mt_port_cap_spb_bvid_tuples, NULL,
252
28
                              "SPB Base Vlan Identifiers: Type: 0x%02x, Length: %d", subtype, sublen);
253
254
105
    while (sublen > 0) {
255
88
        if (sublen < 6) {
256
11
            proto_tree_add_expert_format(tree, pinfo, &ei_isis_hello_short_clv, tvb, offset, -1,
257
11
                                  "Short SPB BVID header entry (%d vs %d)", sublen, 6);
258
11
            return;
259
11
        }
260
77
        else {
261
77
            proto_tree_add_item( subtree, hf_isis_hello_ect, tvb, subofs, 4, ENC_NA);
262
77
            proto_tree_add_item( subtree, hf_isis_hello_bvid, tvb, subofs+4, 2, ENC_BIG_ENDIAN);
263
77
            proto_tree_add_item( subtree, hf_isis_hello_bvid_u, tvb, subofs+4, 2, ENC_BIG_ENDIAN);
264
77
            proto_tree_add_item( subtree, hf_isis_hello_bvid_m, tvb, subofs+4, 2, ENC_BIG_ENDIAN);
265
77
        }
266
77
        sublen -= 6;
267
77
        subofs += 6;
268
77
    }
269
28
}
270
271
static void
272
dissect_hello_mt_port_cap_vlan_flags_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
273
        proto_tree *tree, int offset, int subtype, int sublen)
274
28
{
275
28
    proto_tree *subtree;
276
277
28
    subtree = proto_tree_add_subtree_format( tree, tvb, offset-2, sublen+2, ett_isis_hello_clv_mt_port_cap_vlan_flags, NULL,
278
28
                                "Special VLANs and Flags (t=%u, l=%u)", subtype, sublen);
279
280
28
    proto_tree_add_item(subtree, hf_isis_hello_vlan_flags_port_id, tvb, offset, 2, ENC_BIG_ENDIAN);
281
28
    offset += 2;
282
283
28
    proto_tree_add_item(subtree, hf_isis_hello_vlan_flags_nickname, tvb, offset, 2, ENC_BIG_ENDIAN);
284
28
    offset += 2;
285
286
28
    proto_tree_add_item(subtree, hf_isis_hello_vlan_flags_af, tvb, offset, 2, ENC_BIG_ENDIAN);
287
28
    proto_tree_add_item(subtree, hf_isis_hello_vlan_flags_ac, tvb, offset, 2, ENC_BIG_ENDIAN);
288
28
    proto_tree_add_item(subtree, hf_isis_hello_vlan_flags_vm, tvb, offset, 2, ENC_BIG_ENDIAN);
289
28
    proto_tree_add_item(subtree, hf_isis_hello_vlan_flags_by, tvb, offset, 2, ENC_BIG_ENDIAN);
290
28
    proto_tree_add_item(subtree, hf_isis_hello_vlan_flags_outer_vlan, tvb, offset, 2, ENC_BIG_ENDIAN);
291
28
    offset += 2;
292
293
28
    proto_tree_add_item(subtree, hf_isis_hello_vlan_flags_tr, tvb, offset, 2, ENC_BIG_ENDIAN);
294
28
    proto_tree_add_item(subtree, hf_isis_hello_vlan_flags_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
295
28
    proto_tree_add_item(subtree, hf_isis_hello_vlan_flags_designated_vlan, tvb, offset, 2, ENC_BIG_ENDIAN);
296
297
28
}
298
299
static void
300
parse_vlan_bitmap(proto_item *item, tvbuff_t *tvb, unsigned vlan, int offset, int sublen)
301
155
{
302
155
    int range=0, next=0;
303
155
    uint8_t mask, bitmap, i;
304
305
1.61k
    while (sublen>0) {
306
307
1.45k
        bitmap = tvb_get_uint8(tvb, offset);
308
1.45k
        mask = 0x80;
309
310
13.1k
        for (i=0; i<8; i++) {
311
312
11.6k
           if (bitmap & mask) {
313
314
3.71k
               if (range==0) {
315
1.50k
                   proto_item_append_text(item, "%s%u", next++ ? ", " : "", vlan);
316
1.50k
               }
317
3.71k
               range++;
318
319
7.93k
           } else {
320
321
7.93k
               if (range>1) {
322
522
                   proto_item_append_text(item, "-%u", vlan-1);
323
522
               }
324
7.93k
               range=0;
325
326
7.93k
           }
327
11.6k
           vlan++;
328
11.6k
           mask>>=1;
329
11.6k
        }
330
1.45k
        offset++;
331
1.45k
        sublen--;
332
1.45k
    }
333
334
155
    if (range>1) {
335
13
        proto_item_append_text(item, "-%u", vlan-1);
336
13
    }
337
155
}
338
339
340
static void
341
dissect_hello_mt_port_cap_enabled_vlans_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
342
        proto_tree *tree, int offset, int subtype, int sublen)
343
131
{
344
131
    proto_tree *subtree;
345
131
    proto_item *item;
346
131
    unsigned vlan;
347
348
131
    subtree = proto_tree_add_subtree_format( tree, tvb, offset-2, sublen+2, ett_isis_hello_clv_mt_port_cap_enabled_vlans, NULL,
349
131
                                "Enabled-VLANs (t=%u, l=%u)", subtype, sublen);
350
351
131
    vlan = tvb_get_ntohs(tvb, offset) & 0xfff;
352
131
    offset+=2;
353
131
    sublen-=2;
354
355
131
    item = proto_tree_add_string(subtree, hf_isis_hello_enabled_vlans, tvb, offset, sublen, "");
356
357
131
    parse_vlan_bitmap(item, tvb, vlan, offset, sublen);
358
131
}
359
360
static void
361
dissect_hello_mt_port_cap_appointedfwrdrs_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
362
        proto_tree *tree, int offset, int subtype, int sublen)
363
62
{
364
62
    proto_tree *subtree;
365
366
62
    subtree = proto_tree_add_subtree_format( tree, tvb, offset-2, sublen+2, ett_isis_hello_clv_mt_port_cap_appointedfwrdrs, NULL,
367
62
                                "Appointed Forwarders (t=%u, l=%u)", subtype, sublen);
368
369
67
    while (sublen>=6) {
370
5
        proto_tree_add_item(subtree, hf_isis_hello_af_nickname, tvb, offset, 2, ENC_BIG_ENDIAN);
371
5
        proto_tree_add_item(subtree, hf_isis_hello_af_start_vlan, tvb, offset+2, 2, ENC_BIG_ENDIAN);
372
5
        proto_tree_add_item(subtree, hf_isis_hello_af_end_vlan, tvb, offset+4, 2, ENC_BIG_ENDIAN);
373
374
5
        offset += 6;
375
5
        sublen -=6;
376
5
    }
377
62
}
378
379
static void
380
dissect_hello_mt_port_cap_port_trill_ver_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
381
        proto_tree *tree, int offset, int subtype, int sublen)
382
19
{
383
19
    proto_tree *subtree;
384
385
19
    subtree = proto_tree_add_subtree_format( tree, tvb, offset-2, sublen+2, ett_isis_hello_clv_mt_port_cap_port_trill_ver, NULL,
386
19
                                "Port TRILL Version (t=%u, l=%u)", subtype, sublen);
387
388
19
    proto_tree_add_item(subtree, hf_isis_hello_trill_version, tvb, offset, 1, ENC_BIG_ENDIAN);
389
390
19
    offset++;
391
392
19
    proto_tree_add_item(subtree, hf_isis_hello_trill_hello_reduction, tvb, offset, 4, ENC_BIG_ENDIAN);
393
19
    proto_tree_add_item(subtree, hf_isis_hello_trill_unassigned_1, tvb, offset, 4, ENC_BIG_ENDIAN);
394
19
    proto_tree_add_item(subtree, hf_isis_hello_trill_hop_by_hop_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
395
19
    proto_tree_add_item(subtree, hf_isis_hello_trill_unassigned_2, tvb, offset, 4, ENC_BIG_ENDIAN);
396
19
}
397
398
static void
399
dissect_hello_mt_port_cap_vlans_appointed_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
400
        proto_tree *tree, int offset, int subtype, int sublen)
401
27
{
402
27
    proto_tree *subtree;
403
27
    proto_item *item;
404
27
    unsigned vlan;
405
406
27
    subtree = proto_tree_add_subtree_format( tree, tvb, offset-2, sublen+2, ett_isis_hello_clv_mt_port_cap_vlans_appointed, NULL,
407
27
                                "Appointed VLANs (t=%u, l=%u)", subtype, sublen);
408
409
27
    vlan = tvb_get_ntohs(tvb, offset) & 0xfff;
410
27
    offset+=2;
411
27
    sublen-=2;
412
413
27
    item = proto_tree_add_string(subtree, hf_isis_hello_appointed_vlans, tvb, offset, sublen, "");
414
415
27
    parse_vlan_bitmap(item, tvb, vlan, offset, sublen);
416
27
}
417
418
static void
419
dissect_hello_mt_port_cap_clv(tvbuff_t *tvb, packet_info* pinfo,
420
        proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
421
113
{
422
113
    if (length >= 2) {
423
        /* mtid */
424
107
        proto_tree_add_item(tree, hf_isis_hello_mtid, tvb, offset, 2, ENC_BIG_ENDIAN);
425
107
        length -= 2;
426
107
        offset += 2;
427
1.12k
        while (length >= 2) {
428
1.11k
            uint8_t subtype   = tvb_get_uint8(tvb, offset);
429
1.11k
            uint8_t subtlvlen = tvb_get_uint8(tvb, offset+1);
430
1.11k
            length -= 2;
431
1.11k
            offset += 2;
432
1.11k
            if (subtlvlen > length) {
433
72
                proto_tree_add_expert_format(tree, pinfo, &ei_isis_hello_short_clv, tvb, offset, -1,
434
72
                                      "Short type %d TLV (%d vs %d)", subtype, subtlvlen, length);
435
72
                return;
436
72
            }
437
1.04k
            switch(subtype)
438
1.04k
            {
439
28
            case 1:  /* TRILL Special VLANs and Flags */
440
28
                dissect_hello_mt_port_cap_vlan_flags_clv(tvb, pinfo, tree, offset, subtype, subtlvlen);
441
28
                break;
442
131
            case 2:  /* TRILL Enabled VLANs */
443
131
                dissect_hello_mt_port_cap_enabled_vlans_clv(tvb, pinfo, tree, offset, subtype, subtlvlen);
444
131
                break;
445
62
            case 3:  /* TRILL Appointed Forwarders */
446
62
                dissect_hello_mt_port_cap_appointedfwrdrs_clv(tvb, pinfo, tree, offset, subtype, subtlvlen);
447
62
                break;
448
17
            case 4:  /* SPB MCID */
449
17
                dissect_hello_mt_port_cap_spb_mcid_clv(tvb, pinfo, tree, offset, subtype, subtlvlen);
450
17
                break;
451
3
            case 5:  /* SPB Digest */
452
3
                dissect_hello_mt_port_cap_spb_digest_clv(tvb, pinfo, tree, offset, subtype, subtlvlen);
453
3
                break;
454
28
            case 6:  /* SPB BVID Tuples */
455
28
                dissect_hello_mt_port_cap_spb_bvid_tuples_clv(tvb, pinfo, tree, offset, subtype, subtlvlen);
456
28
                break;
457
19
            case 7:  /* Port TRILL Version */
458
19
                dissect_hello_mt_port_cap_port_trill_ver_clv(tvb, pinfo, tree, offset, subtype, subtlvlen);
459
19
                break;
460
27
            case 8:  /* TRILL VLANs Appointed */
461
27
                dissect_hello_mt_port_cap_vlans_appointed_clv(tvb, pinfo, tree, offset, subtype, subtlvlen);
462
27
                break;
463
718
            default:
464
718
                proto_tree_add_expert_format(tree, pinfo, &ei_isis_hello_subtlv, tvb, offset-2, subtlvlen+2,
465
718
                         "Unknown Sub-TLV: Type: %d, Length: %d", subtype, subtlvlen );
466
1.04k
            }
467
1.01k
            length -= subtlvlen;
468
1.01k
            offset += subtlvlen;
469
1.01k
        }
470
107
    }
471
113
}
472
473
/*
474
 * The Restart CLV is documented in RFC 3847 (Restart Signaling for
475
 * Intermediate System to Intermediate System).  The CLV looks like this
476
 *
477
 *  Type   211
478
 *  Length # of octets in the value field (1 to (3 + ID Length))
479
 *  Value
480
 *
481
 *                                    No. of octets
482
 *     +-----------------------+
483
 *     |   Flags               |     1
484
 *     +-----------------------+
485
 *     | Remaining Time        |     2
486
 *     +-----------------------+
487
 *     | Restarting Neighbor ID|     ID Length
488
 *     +-----------------------+
489
 *
490
 *   Flags (1 octet)
491
 *
492
 *      0  1  2  3  4  5  6  7
493
 *     +--+--+--+--+--+--+--+--+
494
 *     |  Reserved    |SA|RA|RR|
495
 *     +--+--+--+--+--+--+--+--+
496
 *
497
 *     RR - Restart Request
498
 *     RA - Restart Acknowledgement
499
 *     SA - Suppress adjacency advertisement
500
 *
501
 * The Remaining Time and Restarting Neighbor ID fields are only required when
502
 * the RA flag is set.  The Flags field is always required.
503
 *
504
 */
505
/*
506
 * Name: dissect_hello_restart_clv()
507
 *
508
 * Description:
509
 *    Decode for a restart clv - only found in IIHs
510
 *      hence no call in the common clv dissector
511
 *
512
 */
513
514
static void
515
dissect_hello_restart_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
516
        proto_tree *tree, int offset, isis_data_t *isis, int length)
517
15
{
518
15
    int restart_options=0;
519
15
    proto_item *hold_time_item;
520
521
15
    if (length >= 1) {
522
13
        static int * const flags[] = {
523
13
            &hf_isis_hello_clv_restart_flags_sa,
524
13
            &hf_isis_hello_clv_restart_flags_ra,
525
13
            &hf_isis_hello_clv_restart_flags_rr,
526
13
            NULL
527
13
        };
528
529
13
        restart_options = tvb_get_uint8(tvb, offset);
530
13
        proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_isis_hello_clv_restart_flags, ett_isis_hello_clv_restart_flags, flags, ENC_NA, BMT_NO_FALSE|BMT_NO_TFS);
531
13
    }
532
533
    /* The Remaining Time field should only be present if the RA flag is
534
     * set
535
     */
536
15
    if (length >= 3 && ISIS_MASK_RESTART_RA(restart_options)) {
537
7
        hold_time_item = proto_tree_add_item( tree, hf_isis_hello_clv_restart_remain_time,
538
7
            tvb, offset+1, 2, ENC_BIG_ENDIAN );
539
7
        proto_item_append_text( hold_time_item, "s" );
540
7
    }
541
542
    /* The Restarting Neighbor ID should only be present if the RA flag is
543
     * set.
544
     */
545
15
    if (length >= 3 + isis->system_id_len && ISIS_MASK_RESTART_RA(restart_options)) {
546
7
        proto_tree_add_item( tree, hf_isis_hello_clv_restart_neighbor, tvb, offset+3, isis->system_id_len, ENC_NA);
547
7
    }
548
15
}
549
550
/*
551
 * Name: dissect_hello_nlpid_clv()
552
 *
553
 * Description:
554
 *    Decode for a hello packets NLPID clv.  Calls into the
555
 *    clv common one.
556
 *
557
 * Input:
558
 *    tvbuff_t * : tvbuffer for packet data
559
 *    proto_tree * : proto tree to build on (may be null)
560
 *    int : current offset into packet data
561
 *    int : length of IDs in packet.
562
 *    int : length of this clv
563
 *
564
 * Output:
565
 *    void, will modify proto_tree if not null.
566
 */
567
static void
568
dissect_hello_nlpid_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
569
    proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
570
28
{
571
28
    isis_dissect_nlpid_clv(tvb, tree, ett_isis_hello_clv_nlpid_nlpid, hf_isis_hello_clv_nlpid_nlpid, offset, length);
572
28
}
573
574
/*
575
 * Name: dissect_hello_mt_clv()
576
 *
577
 * Description:
578
 *    Decode for a hello packets Multi Topology clv.  Calls into the
579
 *    clv common one.
580
 *
581
 * Input:
582
 *    tvbuff_t * : tvbuffer for packet data
583
 *    proto_tree * : proto tree to build on (may be null)
584
 *    int : current offset into packet data
585
 *    int : length of IDs in packet.
586
 *    int : length of this clv
587
 *
588
 * Output:
589
 *    void, will modify proto_tree if not null.
590
 */
591
592
static void
593
dissect_hello_mt_clv(tvbuff_t *tvb, packet_info* pinfo,
594
    proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
595
13
{
596
13
    isis_dissect_mt_clv(tvb, pinfo, tree, offset, length,
597
13
        hf_isis_hello_clv_mt, &ei_isis_hello_clv_mt);
598
13
}
599
600
/*
601
 * Name: dissect_hello_ip_int_addr_clv()
602
 *
603
 * Description:
604
 *    Decode for a hello packets ip interface addr clv.  Calls into the
605
 *    clv common one.
606
 *
607
 * Input:
608
 *    tvbuff_t * : tvbuffer for packet data
609
 *    proto_tree * : proto tree to build on (may be null)
610
 *    int : current offset into packet data
611
 *    int : length of IDs in packet.
612
 *    int : length of this clv
613
 *
614
 * Output:
615
 *    void, will modify proto_tree if not null.
616
 */
617
static void
618
dissect_hello_ip_int_addr_clv(tvbuff_t *tvb, packet_info* pinfo,
619
    proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
620
24
{
621
24
    isis_dissect_ip_int_clv(tree, pinfo, tvb, &ei_isis_hello_short_clv,
622
24
        offset, length, hf_isis_hello_clv_ipv4_int_addr );
623
24
}
624
625
/*
626
 * Name: dissect_hello_ipv6_int_addr_clv()
627
 *
628
 * Description:
629
 *    Decode for a hello packets ipv6 interface addr clv.  Calls into the
630
 *    clv common one.
631
 *
632
 * Input:
633
 *    tvbuff_t * : tvbuffer for packet data
634
 *    proto_tree * : proto tree to build on (may be null)
635
 *    int : current offset into packet data
636
 *    int : length of IDs in packet.
637
 *    int : length of this clv
638
 *
639
 * Output:
640
 *    void, will modify proto_tree if not null.
641
 */
642
static void
643
dissect_hello_ipv6_int_addr_clv(tvbuff_t *tvb, packet_info* pinfo,
644
    proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
645
14
{
646
14
    isis_dissect_ipv6_int_clv(tree, pinfo, tvb, &ei_isis_hello_short_clv,
647
14
        offset, length, hf_isis_hello_clv_ipv6_int_addr );
648
14
}
649
650
/*
651
 * Name: dissect_hello_authentication_clv()
652
 *
653
 * Description:
654
 *    Decode for a hello packets authentication clv.
655
 *      Calls into the CLV common one.
656
 *
657
 * Input:
658
 *    tvbuff_t * : tvbuffer for packet data
659
 *    proto_tree * : proto tree to build on (may be null)
660
 *    int : current offset into packet data
661
 *    int : length of IDs in packet.
662
 *    int : length of this clv
663
 *
664
 * Output:
665
 *    void, will modify proto_tree if not null.
666
 */
667
static void
668
dissect_hello_authentication_clv(tvbuff_t *tvb, packet_info* pinfo,
669
    proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
670
79
{
671
79
    isis_dissect_authentication_clv(tree, pinfo, tvb, hf_isis_hello_authentication, hf_isis_clv_key_id, &ei_isis_hello_authentication, offset, length);
672
79
}
673
674
/*
675
 * Name: dissect_hello_ip_authentication_clv()
676
 *
677
 * Description:
678
 *    Decode for a hello packets IP authentication clv.
679
 *      Calls into the CLV common one.
680
 *
681
 * Input:
682
 *    tvbuff_t * : tvbuffer for packet data
683
 *    proto_tree * : proto tree to build on (may be null)
684
 *    int : current offset into packet data
685
 *    int : length of IDs in packet.
686
 *    int : length of this clv
687
 *
688
 * Output:
689
 *    void, will modify proto_tree if not null.
690
 */
691
static void
692
dissect_hello_ip_authentication_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
693
    proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
694
6
{
695
6
    if ( length != 0 ) {
696
5
       proto_tree_add_item( tree, hf_isis_hello_clv_ip_authentication, tvb, offset, length, ENC_ASCII);
697
5
    }
698
6
}
699
700
/*
701
 * Name: dissect_hello_trill_neighbor_clv
702
 */
703
static void
704
dissect_hello_trill_neighbor_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
705
49
        proto_tree *tree, int offset, isis_data_t *isis _U_, int length) {
706
707
49
    uint8_t size = (tvb_get_uint8(tvb, offset)) & 0x1f;
708
709
49
    if(size==0)
710
10
        size=6;
711
712
49
    proto_tree_add_item(tree, hf_isis_hello_trill_neighbor_sf, tvb, offset, 1, ENC_NA);
713
49
    proto_tree_add_item(tree, hf_isis_hello_trill_neighbor_lf, tvb, offset, 1, ENC_NA);
714
49
    proto_tree_add_item(tree, hf_isis_hello_trill_neighbor_size, tvb, offset, 1, ENC_BIG_ENDIAN);
715
716
49
    offset++;
717
49
    length--;
718
719
468
    while(length>=(size+3)) {
720
419
        proto_tree_add_item(tree, hf_isis_hello_trill_neighbor_ff, tvb, offset, 1, ENC_NA);
721
419
        proto_tree_add_item(tree, hf_isis_hello_trill_neighbor_of, tvb, offset, 1, ENC_NA);
722
419
        proto_tree_add_item(tree, hf_isis_hello_trill_neighbor_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
723
724
419
        offset++;
725
419
        length--;
726
727
419
        proto_tree_add_item(tree, hf_isis_hello_trill_neighbor_mtu, tvb, offset, 2, ENC_BIG_ENDIAN);
728
729
419
        offset += 2;
730
419
        length -= 2;
731
732
419
        proto_tree_add_item(tree, hf_isis_hello_trill_neighbor_snpa, tvb, offset, 6, ENC_NA);
733
734
419
        offset += 6;
735
419
        length -= 6;
736
419
    }
737
49
}
738
739
/*
740
 * Name: dissect_hello_reverse_metric_clv
741
 */
742
static void
743
dissect_hello_reverse_metric_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
744
65
        proto_tree *tree, int offset, isis_data_t *isis _U_, int length _U_) {
745
746
65
    uint32_t sub_length;
747
748
65
    static int * const flags[] = {
749
65
        &hf_isis_hello_reverse_metric_flag_reserved,
750
65
        &hf_isis_hello_reverse_metric_flag_u,
751
65
        &hf_isis_hello_reverse_metric_flag_w,
752
65
        NULL
753
65
    };
754
755
65
    proto_tree_add_bitmask(tree, tvb, offset, hf_isis_hello_reverse_metric_flags, ett_isis_hello_reverse_metric_flags, flags, ENC_NA);
756
65
    offset += 1;
757
65
    proto_tree_add_item(tree, hf_isis_hello_reverse_metric_metric, tvb, offset, 3, ENC_BIG_ENDIAN);
758
65
    offset += 3;
759
65
    proto_tree_add_item_ret_uint(tree, hf_isis_hello_reverse_metric_sub_length, tvb, offset, 1, ENC_BIG_ENDIAN, &sub_length);
760
65
    offset += 1;
761
65
    if (sub_length > 0) {
762
46
        proto_tree_add_item(tree, hf_isis_hello_reverse_metric_sub_data, tvb, offset, sub_length, ENC_NA);
763
46
    }
764
65
}
765
766
/*
767
 * Name: dissect_hello_bfd_enabled_clv
768
 *
769
 * Description:
770
 *    Decode for a hello packets BFD enabled clv.
771
 *
772
 * Input:
773
 *    tvbuff_t * : tvbuffer for packet data
774
 *    proto_tree * : proto tree to build on (may be null)
775
 *    int : current offset into packet data
776
 *    int : length of IDs in packet.
777
 *    int : length of this clv
778
 *
779
 * Output:
780
 *    void, will modify proto_tree if not null.
781
 */
782
static void
783
dissect_hello_bfd_enabled_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
784
12
        proto_tree *tree, int offset, isis_data_t *isis _U_, int length) {
785
786
96
    while (length >= 3) {
787
        /* mtid */
788
84
        proto_tree_add_item(tree, hf_isis_hello_mtid, tvb, offset, 2, ENC_BIG_ENDIAN);
789
84
        length -= 2;
790
84
        offset += 2;
791
        /* nlpid */
792
84
        proto_tree_add_item(tree, hf_isis_hello_bfd_enabled_nlpid, tvb, offset, 1, ENC_NA);
793
84
        length -= 1;
794
84
        offset += 1;
795
84
    };
796
12
}
797
798
/*
799
 * Name: dissect_hello_checksum_clv()
800
 *
801
 * Description:
802
 *      dump and verify the optional checksum in TLV 12
803
 *
804
 * Input:
805
 *      tvbuff_t * : tvbuffer for packet data
806
 *      proto_tree * : protocol display tree to fill out.  May be NULL
807
 *      int : offset into packet data where we are.
808
 *      int : length of clv we are decoding
809
 *
810
 * Output:
811
 *      void, but we will add to proto tree if !NULL.
812
 */
813
814
static void
815
dissect_hello_checksum_clv(tvbuff_t *tvb, packet_info* pinfo,
816
26
        proto_tree *tree, int offset, isis_data_t *isis, int length) {
817
818
26
    uint16_t checksum, cacl_checksum=0;
819
820
26
    if ( length != 2 ) {
821
20
        proto_tree_add_expert_format(tree, pinfo, &ei_isis_hello_short_clv, tvb, offset, length,
822
20
                                "incorrect checksum length (%u), should be (2)", length );
823
20
        return;
824
20
    }
825
826
6
    checksum = tvb_get_ntohs(tvb, offset);
827
828
6
    if (checksum == 0) {
829
        /* No checksum present */
830
1
        proto_tree_add_checksum(tree, tvb, offset, hf_isis_hello_checksum, hf_isis_hello_checksum_status, &ei_isis_hello_bad_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT);
831
5
    } else {
832
5
        if (osi_check_and_get_checksum(tvb, 0, isis->pdu_length, offset, &cacl_checksum)) {
833
            /* Successfully processed checksum, verify it */
834
0
            proto_tree_add_checksum(tree, tvb, offset, hf_isis_hello_checksum, hf_isis_hello_checksum_status, &ei_isis_hello_bad_checksum, pinfo, cacl_checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
835
5
        } else {
836
            /* We didn't capture the entire packet, so we can't verify it */
837
5
            proto_tree_add_checksum(tree, tvb, offset, hf_isis_hello_checksum, hf_isis_hello_checksum_status, &ei_isis_hello_bad_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
838
5
        }
839
5
    }
840
6
}
841
842
843
844
/*
845
 * Name: dissect_hello_area_address_clv()
846
 *
847
 * Description:
848
 *    Decode for a hello packets area address clv.
849
 *      Calls into the CLV common one.
850
 *
851
 * Input:
852
 *    tvbuff_t * : tvbuffer for packet data
853
 *    proto_tree * : proto tree to build on (may be null)
854
 *    int : current offset into packet data
855
 *    int : length of IDs in packet.
856
 *    int : length of this clv
857
 *
858
 * Output:
859
 *    void, will modify proto_tree if not null.
860
 */
861
static void
862
dissect_hello_area_address_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
863
    proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
864
518
{
865
518
    isis_dissect_area_address_clv(tree, pinfo, tvb, &ei_isis_hello_short_clv, hf_isis_hello_area_address, offset, length);
866
518
}
867
868
/*
869
 * Name: dissect_hello_instance_identifier_clv()
870
 *
871
 * Description:
872
 *    Decode for a hello packets Instance Identifier clv.
873
 *      Calls into the CLV common one.
874
 *
875
 * Input:
876
 *    tvbuff_t * : tvbuffer for packet data
877
 *    proto_tree * : proto tree to build on (may be null)
878
 *    int : current offset into packet data
879
 *    int : length of IDs in packet.
880
 *    int : length of this clv
881
 *
882
 * Output:
883
 *    void, will modify proto_tree if not null.
884
 */
885
static void
886
dissect_hello_instance_identifier_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
887
    proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
888
82
{
889
82
    isis_dissect_instance_identifier_clv(tree, pinfo, tvb, &ei_isis_hello_short_clv, hf_isis_hello_instance_identifier, hf_isis_hello_supported_itid, offset, length);
890
82
}
891
892
static const value_string adj_state_vals[] = {
893
    { 0, "Up" },
894
    { 1, "Initializing" },
895
    { 2, "Down" },
896
    { 0, NULL }
897
};
898
899
static void
900
dissect_hello_ptp_adj_clv(tvbuff_t *tvb, packet_info* pinfo,
901
        proto_tree *tree, int offset, isis_data_t *isis, int length)
902
2
{
903
2
    switch(length)
904
2
    {
905
1
    case 1:
906
1
        proto_tree_add_item(tree, hf_isis_hello_adjacency_state, tvb, offset, 1, ENC_BIG_ENDIAN);
907
1
        break;
908
0
    case 5:
909
0
        proto_tree_add_item(tree, hf_isis_hello_adjacency_state, tvb, offset, 1, ENC_BIG_ENDIAN);
910
0
        proto_tree_add_item(tree, hf_isis_hello_extended_local_circuit_id, tvb, offset+1, 4, ENC_BIG_ENDIAN);
911
0
        break;
912
0
    case 11:
913
0
        proto_tree_add_item(tree, hf_isis_hello_adjacency_state, tvb, offset, 1, ENC_BIG_ENDIAN);
914
0
        proto_tree_add_item(tree, hf_isis_hello_extended_local_circuit_id, tvb, offset+1, 4, ENC_BIG_ENDIAN);
915
0
        proto_tree_add_item(tree, hf_isis_hello_neighbor_systemid, tvb, offset+5, isis->system_id_len, ENC_NA);
916
0
    break;
917
0
    case 15:
918
0
        proto_tree_add_item(tree, hf_isis_hello_adjacency_state, tvb, offset, 1, ENC_BIG_ENDIAN);
919
0
        proto_tree_add_item(tree, hf_isis_hello_extended_local_circuit_id, tvb, offset+1, 4, ENC_BIG_ENDIAN);
920
0
        proto_tree_add_item(tree, hf_isis_hello_neighbor_systemid, tvb, offset+5, isis->system_id_len, ENC_NA);
921
0
        proto_tree_add_item(tree, hf_isis_hello_neighbor_extended_local_circuit_id, tvb, offset+5+isis->system_id_len, 4, ENC_BIG_ENDIAN);
922
0
    break;
923
1
    default:
924
1
        proto_tree_add_expert_format(tree, pinfo, &ei_isis_hello_short_clv, tvb, offset, -1,
925
1
                   "malformed TLV (%d vs 1,5,11,15)", length );
926
2
    }
927
2
}
928
929
/*
930
 * Name: isis_dissect_is_neighbors_clv()
931
 *
932
 * Description:
933
 *    Take apart a IS neighbor packet.  A neighbor is n 6 byte packets.
934
 *    (they tend to be an 802.3 MAC address, but it's not required).
935
 *
936
 * Input:
937
 *    tvbuff_t * : tvbuffer for packet data
938
 *    proto_tree * : protocol display tree to fill out.  May be NULL
939
 *    int : offset into packet data where we are.
940
 *    int : length of IDs in packet.
941
 *    int : length of clv we are decoding
942
 *
943
 * Output:
944
 *    void, but we will add to proto tree if !NULL.
945
 */
946
static void
947
dissect_hello_is_neighbors_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
948
    isis_data_t *isis _U_, int length)
949
155
{
950
603
    while ( length > 0 ) {
951
491
        if (length<6) {
952
43
            proto_tree_add_expert_format(tree, pinfo, &ei_isis_hello_short_clv, tvb, offset, -1,
953
43
                "short is neighbor (%d vs 6)", length );
954
43
            return;
955
43
        }
956
        /*
957
         * Lets turn the area address into "standard" 0000.0000.etc
958
         * format string.
959
         */
960
448
        proto_tree_add_item(tree, hf_isis_hello_is_neighbor, tvb, offset, 6, ENC_NA);
961
448
        offset += 6;
962
448
        length -= 6;
963
448
    }
964
155
}
965
966
/*
967
 * Name: dissect_hello_padding_clv()
968
 *
969
 * Description:
970
 *    Decode for a hello packet's padding clv.  Padding does nothing,
971
 *    so we just return.
972
 *
973
 * Input:
974
 *    tvbuff_t * : tvbuffer for packet data
975
 *    proto_tree * : proto tree to build on (may be null)
976
 *    int : current offset into packet data
977
 *    int : length of IDs in packet.
978
 *    int : length of this clv
979
 *
980
 * Output:
981
 *    void
982
 */
983
static void
984
dissect_hello_padding_clv(tvbuff_t *tvb _U_, packet_info* pinfo _U_, proto_tree *tree _U_, int offset _U_,
985
    isis_data_t *isis _U_, int length _U_)
986
44
{
987
    /* nothing to do here! */
988
44
}
989
990
/*
991
 * Name: dissect_hello_ipv6_glb_int_addr_clv()
992
 *
993
 * Description:
994
 *    Decode for a hello packets ipv6 gobal interface addr clv.  Calls into the
995
 *    clv 233.
996
 *
997
 * Input:
998
 *    tvbuff_t * : tvbuffer for packet data
999
 *    proto_tree * : proto tree to build on (may be null)
1000
 *    int : current offset into packet data
1001
 *    int : length of IDs in packet.
1002
 *    int : length of this clv
1003
 *
1004
 * Output:
1005
 *    void, will modify proto_tree if not null.
1006
 */
1007
static void
1008
dissect_hello_ipv6_glb_int_addr_clv(tvbuff_t *tvb, packet_info* pinfo,
1009
    proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
1010
20
{
1011
20
    isis_dissect_ipv6_int_clv(tree, pinfo, tvb, &ei_isis_hello_short_clv,
1012
20
        offset, length, hf_isis_hello_clv_ipv6_glb_int_addr );
1013
20
}
1014
static const isis_clv_handle_t clv_l1_hello_opts[] = {
1015
    {
1016
        ISIS_CLV_AREA_ADDRESS,
1017
        "Area address(es)",
1018
        &ett_isis_hello_clv_area_addr,
1019
        dissect_hello_area_address_clv
1020
    },
1021
    {
1022
        ISIS_CLV_IS_NEIGHBORS,
1023
        "IS Neighbor(s)",
1024
        &ett_isis_hello_clv_is_neighbors,
1025
        dissect_hello_is_neighbors_clv
1026
    },
1027
    {
1028
        ISIS_CLV_INSTANCE_IDENTIFIER,
1029
        "Instance Identifier",
1030
        &ett_isis_hello_clv_instance_identifier,
1031
        dissect_hello_instance_identifier_clv
1032
    },
1033
    {
1034
        ISIS_CLV_PADDING,
1035
        "Padding",
1036
        &ett_isis_hello_clv_padding,
1037
        dissect_hello_padding_clv
1038
    },
1039
    {
1040
        ISIS_CLV_PROTOCOLS_SUPPORTED,
1041
        "Protocols Supported",
1042
        &ett_isis_hello_clv_nlpid,
1043
        dissect_hello_nlpid_clv
1044
    },
1045
    {
1046
        ISIS_CLV_IP_ADDR,
1047
        "IP Interface address(es)",
1048
        &ett_isis_hello_clv_ipv4_int_addr,
1049
        dissect_hello_ip_int_addr_clv
1050
    },
1051
    {
1052
        ISIS_CLV_IP6_ADDR,
1053
        "IPv6 Interface address(es)",
1054
        &ett_isis_hello_clv_ipv6_int_addr,
1055
        dissect_hello_ipv6_int_addr_clv
1056
    },
1057
    {
1058
        ISIS_CLV_RESTART,
1059
        "Restart Signaling",
1060
        &ett_isis_hello_clv_restart,
1061
        dissect_hello_restart_clv
1062
    },
1063
    {
1064
        ISIS_CLV_AUTHENTICATION,
1065
        "Authentication",
1066
        &ett_isis_hello_clv_authentication,
1067
        dissect_hello_authentication_clv
1068
    },
1069
    {
1070
        ISIS_CLV_IP_AUTHENTICATION,
1071
        "IP Authentication",
1072
        &ett_isis_hello_clv_ip_authentication,
1073
        dissect_hello_ip_authentication_clv
1074
    },
1075
    {
1076
        ISIS_CLV_MT_PORT_CAP,
1077
        "MT Port Capability",
1078
        &ett_isis_hello_clv_mt_port_cap,
1079
        dissect_hello_mt_port_cap_clv
1080
    },
1081
    {
1082
        ISIS_CLV_MT_SUPPORTED,
1083
        "Multi Topology",
1084
        &ett_isis_hello_clv_mt,
1085
        dissect_hello_mt_clv
1086
    },
1087
    {
1088
        ISIS_CLV_TRILL_NEIGHBOR,
1089
        "TRILL Neighbor",
1090
        &ett_isis_hello_clv_trill_neighbor,
1091
        dissect_hello_trill_neighbor_clv
1092
    },
1093
    {
1094
        ISIS_CLV_CHECKSUM,
1095
        "Checksum",
1096
        &ett_isis_hello_clv_checksum,
1097
        dissect_hello_checksum_clv
1098
    },
1099
    {
1100
        ISIS_CLV_IPV6_GBL_INT_ADDR,
1101
        "IPv6 Global Interface Address",
1102
        &ett_isis_hello_clv_ipv6_glb_int_addr,
1103
        dissect_hello_ipv6_glb_int_addr_clv
1104
    },
1105
    {
1106
        ISIS_CLV_REVERSE_METRIC,
1107
        "Reverse Metric",
1108
        &ett_isis_hello_clv_reverse_metric,
1109
        dissect_hello_reverse_metric_clv
1110
    },
1111
    {
1112
        ISIS_CLV_BFD_ENABLED,
1113
        "BFD Enabled",
1114
        &ett_isis_hello_clv_bfd_enabled,
1115
        dissect_hello_bfd_enabled_clv
1116
    },
1117
    {
1118
        0,
1119
        "",
1120
        NULL,
1121
        NULL
1122
    }
1123
};
1124
1125
static const isis_clv_handle_t clv_l2_hello_opts[] = {
1126
    {
1127
        ISIS_CLV_AREA_ADDRESS,
1128
        "Area address(es)",
1129
        &ett_isis_hello_clv_area_addr,
1130
        dissect_hello_area_address_clv
1131
    },
1132
    {
1133
        ISIS_CLV_IS_NEIGHBORS,
1134
        "IS Neighbor(s)",
1135
        &ett_isis_hello_clv_is_neighbors,
1136
        dissect_hello_is_neighbors_clv
1137
    },
1138
    {
1139
        ISIS_CLV_INSTANCE_IDENTIFIER,
1140
        "Instance Identifier",
1141
        &ett_isis_hello_clv_instance_identifier,
1142
        dissect_hello_instance_identifier_clv
1143
    },
1144
    {
1145
        ISIS_CLV_PADDING,
1146
        "Padding",
1147
        &ett_isis_hello_clv_padding,
1148
        dissect_hello_padding_clv
1149
    },
1150
    {
1151
        ISIS_CLV_PROTOCOLS_SUPPORTED,
1152
        "Protocols Supported",
1153
        &ett_isis_hello_clv_nlpid,
1154
        dissect_hello_nlpid_clv
1155
    },
1156
    {
1157
        ISIS_CLV_IP_ADDR,
1158
        "IP Interface address(es)",
1159
        &ett_isis_hello_clv_ipv4_int_addr,
1160
        dissect_hello_ip_int_addr_clv
1161
    },
1162
    {
1163
        ISIS_CLV_IP6_ADDR,
1164
        "IPv6 Interface address(es)",
1165
        &ett_isis_hello_clv_ipv6_int_addr,
1166
        dissect_hello_ipv6_int_addr_clv
1167
    },
1168
    {
1169
        ISIS_CLV_AUTHENTICATION,
1170
        "Authentication",
1171
        &ett_isis_hello_clv_authentication,
1172
        dissect_hello_authentication_clv
1173
    },
1174
    {
1175
        ISIS_CLV_IP_AUTHENTICATION,
1176
        "IP Authentication",
1177
        &ett_isis_hello_clv_ip_authentication,
1178
        dissect_hello_ip_authentication_clv
1179
    },
1180
    {
1181
        ISIS_CLV_RESTART,
1182
        "Restart Signaling",
1183
        &ett_isis_hello_clv_restart,
1184
        dissect_hello_restart_clv
1185
    },
1186
    {
1187
        ISIS_CLV_MT_SUPPORTED,
1188
        "Multi Topology",
1189
        &ett_isis_hello_clv_mt,
1190
        dissect_hello_mt_clv
1191
    },
1192
    {
1193
        ISIS_CLV_CHECKSUM,
1194
        "Checksum",
1195
        &ett_isis_hello_clv_checksum,
1196
        dissect_hello_checksum_clv
1197
    },
1198
    {
1199
        ISIS_CLV_IPV6_GBL_INT_ADDR,
1200
        "IPv6 Global Interface Address",
1201
        &ett_isis_hello_clv_ipv6_glb_int_addr,
1202
        dissect_hello_ipv6_glb_int_addr_clv
1203
    },
1204
    {
1205
        ISIS_CLV_BFD_ENABLED,
1206
        "BFD Enabled",
1207
        &ett_isis_hello_clv_bfd_enabled,
1208
        dissect_hello_bfd_enabled_clv
1209
    },
1210
    {
1211
        0,
1212
        "",
1213
        NULL,
1214
        NULL
1215
    }
1216
};
1217
1218
static const isis_clv_handle_t clv_ptp_hello_opts[] = {
1219
    {
1220
        ISIS_CLV_AREA_ADDRESS,
1221
        "Area address(es)",
1222
        &ett_isis_hello_clv_area_addr,
1223
        dissect_hello_area_address_clv
1224
    },
1225
    {
1226
        ISIS_CLV_INSTANCE_IDENTIFIER,
1227
        "Instance Identifier",
1228
        &ett_isis_hello_clv_instance_identifier,
1229
        dissect_hello_instance_identifier_clv
1230
    },
1231
    {
1232
        ISIS_CLV_PADDING,
1233
        "Padding",
1234
        &ett_isis_hello_clv_padding,
1235
        dissect_hello_padding_clv
1236
    },
1237
    {
1238
        ISIS_CLV_PROTOCOLS_SUPPORTED,
1239
        "Protocols Supported",
1240
        &ett_isis_hello_clv_nlpid,
1241
        dissect_hello_nlpid_clv
1242
    },
1243
    {
1244
        ISIS_CLV_IP_ADDR,
1245
        "IP Interface address(es)",
1246
        &ett_isis_hello_clv_ipv4_int_addr,
1247
        dissect_hello_ip_int_addr_clv
1248
    },
1249
    {
1250
        ISIS_CLV_IP6_ADDR,
1251
        "IPv6 Interface address(es)",
1252
        &ett_isis_hello_clv_ipv6_int_addr,
1253
        dissect_hello_ipv6_int_addr_clv
1254
    },
1255
    {
1256
        ISIS_CLV_AUTHENTICATION,
1257
        "Authentication",
1258
        &ett_isis_hello_clv_authentication,
1259
        dissect_hello_authentication_clv
1260
    },
1261
    {
1262
        ISIS_CLV_IP_AUTHENTICATION,
1263
        "IP Authentication",
1264
        &ett_isis_hello_clv_ip_authentication,
1265
        dissect_hello_ip_authentication_clv
1266
    },
1267
    {
1268
        ISIS_CLV_MT_PORT_CAP,
1269
        "MT Port Capability",
1270
        &ett_isis_hello_clv_mt_port_cap,
1271
        dissect_hello_mt_port_cap_clv
1272
    },
1273
    {
1274
        ISIS_CLV_RESTART,
1275
        "Restart Signaling",
1276
        &ett_isis_hello_clv_restart,
1277
        dissect_hello_restart_clv
1278
    },
1279
    {
1280
        ISIS_CLV_PTP_ADJ_STATE,
1281
        "Point-to-point Adjacency State",
1282
        &ett_isis_hello_clv_ptp_adj,
1283
        dissect_hello_ptp_adj_clv
1284
    },
1285
    {
1286
        ISIS_CLV_MT_SUPPORTED,
1287
        "Multi Topology",
1288
        &ett_isis_hello_clv_mt,
1289
        dissect_hello_mt_clv
1290
    },
1291
    {
1292
        ISIS_CLV_CHECKSUM,
1293
        "Checksum",
1294
        &ett_isis_hello_clv_checksum,
1295
        dissect_hello_checksum_clv
1296
    },
1297
    {
1298
        ISIS_CLV_IPV6_GBL_INT_ADDR,
1299
        "IPv6 Global Interface Address",
1300
        &ett_isis_hello_clv_ipv6_glb_int_addr,
1301
        dissect_hello_ipv6_glb_int_addr_clv
1302
    },
1303
    {
1304
        ISIS_CLV_BFD_ENABLED,
1305
        "BFD Enabled",
1306
        &ett_isis_hello_clv_bfd_enabled,
1307
        dissect_hello_bfd_enabled_clv
1308
    },
1309
    {
1310
        0,
1311
        "",
1312
        NULL,
1313
        NULL
1314
    }
1315
};
1316
1317
/*
1318
 * Name: isis_dissect_isis_hello()
1319
 *
1320
 * Description:
1321
 *    This procedure rips apart the various types of ISIS hellos.  L1H and
1322
 *    L2H's are identical for the most part, while the PTP hello has
1323
 *    a shorter header.
1324
 */
1325
static void
1326
dissect_isis_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
1327
    const isis_clv_handle_t *opts, isis_data_t *isis)
1328
282
{
1329
282
    proto_item    *ti;
1330
282
    proto_tree    *hello_tree;
1331
282
    uint16_t       pdu_length;
1332
282
    bool           pdu_length_too_short = false;
1333
1334
    /*
1335
     * We are passed a tvbuff for the entire ISIS PDU, because some ISIS
1336
     * PDUs may contain a checksum CLV, and that's a checksum covering
1337
     * the entire PDU.  Skip the part of the header that's already been
1338
     * dissected.
1339
     */
1340
282
    offset += 8;
1341
1342
282
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISIS HELLO");
1343
1344
282
    ti = proto_tree_add_item(tree, proto_isis_hello, tvb, offset, -1, ENC_NA);
1345
282
    hello_tree = proto_item_add_subtree(ti, ett_isis_hello);
1346
1347
282
    if (isis->header_length < 8 + 1) {
1348
        /* Not large enough to include the part of the header that
1349
           we dissect here. */
1350
0
        expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
1351
0
        return;
1352
0
    }
1353
282
    proto_tree_add_item(hello_tree, hf_isis_hello_circuit, tvb, offset, 1, ENC_BIG_ENDIAN);
1354
282
    proto_tree_add_item(hello_tree, hf_isis_hello_circuit_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1355
282
    offset += 1;
1356
1357
282
    if (isis->header_length < 8 + 1 + isis->system_id_len) {
1358
        /* Not large enough to include the part of the header that
1359
           we dissect here. */
1360
2
        expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
1361
2
        return;
1362
2
    }
1363
280
    proto_tree_add_item(hello_tree, hf_isis_hello_source_id, tvb, offset, isis->system_id_len, ENC_NA);
1364
280
    col_append_fstr(pinfo->cinfo, COL_INFO, ", System-ID: %s", tvb_print_system_id( pinfo->pool, tvb, offset, isis->system_id_len ));
1365
280
    offset += isis->system_id_len;
1366
1367
280
    if (isis->header_length < 8 + 1 + isis->system_id_len + 2) {
1368
        /* Not large enough to include the part of the header that
1369
           we dissect here. */
1370
1
        expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
1371
1
        return;
1372
1
    }
1373
279
    proto_tree_add_item(hello_tree, hf_isis_hello_holding_timer, tvb,
1374
279
                        offset, 2, ENC_BIG_ENDIAN);
1375
279
    offset += 2;
1376
1377
279
    if (isis->header_length < 8 + 1 + isis->system_id_len + 2 + 2) {
1378
        /* Not large enough to include the part of the header that
1379
           we dissect here. */
1380
1
        expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
1381
1
        return;
1382
1
    }
1383
278
    pdu_length = tvb_get_ntohs(tvb, offset);
1384
278
    ti = proto_tree_add_uint(hello_tree, hf_isis_hello_pdu_length, tvb,
1385
278
                             offset, 2, pdu_length);
1386
278
    if (pdu_length < isis->header_length) {
1387
3
        expert_add_info(pinfo, ti, &ei_isis_hello_short_pdu);
1388
3
        pdu_length_too_short = true;
1389
275
    } else if (pdu_length > tvb_reported_length(tvb) + isis->header_length) {
1390
257
        expert_add_info(pinfo, ti, &ei_isis_hello_long_pdu);
1391
257
    }
1392
278
    offset += 2;
1393
1394
278
    if (opts == clv_ptp_hello_opts) {
1395
71
        if (isis->header_length < 8 + 1 + isis->system_id_len + 2 + 2 + 1) {
1396
            /* Not large enough to include the part of the header that
1397
               we dissect here. */
1398
0
            expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
1399
0
            return;
1400
0
        }
1401
71
        proto_tree_add_item(hello_tree, hf_isis_hello_local_circuit_id, tvb,
1402
71
                         offset, 1, ENC_BIG_ENDIAN );
1403
71
        offset += 1;
1404
207
    } else {
1405
207
        if (isis->header_length < 8 + 1 + isis->system_id_len + 2 + 2 + 1) {
1406
            /* Not large enough to include the part of the header that
1407
               we dissect here. */
1408
0
            expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
1409
0
            return;
1410
0
        }
1411
207
        proto_tree_add_item(hello_tree, hf_isis_hello_priority, tvb, offset, 1, ENC_BIG_ENDIAN);
1412
207
        proto_tree_add_item(hello_tree, hf_isis_hello_priority_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1413
207
        offset += 1;
1414
1415
207
        if (isis->header_length < 8 + 1 + isis->system_id_len + 2 + 2 + 1 + isis->system_id_len + 1) {
1416
            /* Not large enough to include the part of the header that
1417
               we dissect here. */
1418
2
            expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
1419
2
            return;
1420
2
        }
1421
205
        proto_tree_add_item(hello_tree, hf_isis_hello_lan_id, tvb, offset, isis->system_id_len + 1, ENC_NA);
1422
205
        offset += isis->system_id_len + 1;
1423
205
    }
1424
1425
276
    if (pdu_length_too_short) {
1426
3
        return;
1427
3
    }
1428
    /*
1429
     * Now, we need to decode our CLVs.  We need to pass in
1430
     * our list of valid ones!
1431
     */
1432
273
    isis->pdu_length = pdu_length;
1433
273
    isis_dissect_clvs(tvb, pinfo, hello_tree, offset,
1434
273
            opts, &ei_isis_hello_short_clv, isis, ett_isis_hello_clv_unknown,
1435
273
            hf_isis_hello_clv_type, hf_isis_hello_clv_length,
1436
273
            &ei_isis_hello_clv_unknown);
1437
273
}
1438
1439
1440
static int
1441
dissect_isis_l1_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1442
155
{
1443
155
    isis_data_t* isis = (isis_data_t*)data;
1444
155
    dissect_isis_hello(tvb, pinfo, tree, 0, clv_l1_hello_opts, isis);
1445
155
    return tvb_captured_length(tvb);
1446
155
}
1447
1448
static int
1449
dissect_isis_l2_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1450
52
{
1451
52
    isis_data_t* isis = (isis_data_t*)data;
1452
52
    dissect_isis_hello(tvb, pinfo, tree, 0, clv_l2_hello_opts, isis);
1453
52
    return tvb_captured_length(tvb);
1454
52
}
1455
1456
static int
1457
dissect_isis_ptp_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1458
75
{
1459
75
    isis_data_t* isis = (isis_data_t*)data;
1460
75
    dissect_isis_hello(tvb, pinfo, tree, 0, clv_ptp_hello_opts, isis);
1461
75
    return tvb_captured_length(tvb);
1462
75
}
1463
1464
/*
1465
 * Name: isis_register_hello()
1466
 *
1467
 * Description:
1468
 *    Register our protocol sub-sets with protocol manager.
1469
 *
1470
 * Input:
1471
 *    int : protocol index for the ISIS protocol
1472
 *
1473
 * Output:
1474
 *    void
1475
 */
1476
void
1477
proto_register_isis_hello(void)
1478
14
{
1479
14
    static hf_register_info hf[] = {
1480
14
        { &hf_isis_hello_circuit,
1481
14
        { "Circuit type", "isis.hello.circuit_type",
1482
14
            FT_UINT8, BASE_HEX, VALS(isis_hello_circuit_type_vals), ISIS_HELLO_CTYPE_MASK, NULL, HFILL }},
1483
1484
14
        { &hf_isis_hello_circuit_reserved,
1485
14
        { "Reserved", "isis.hello.reserved",
1486
14
            FT_UINT8, BASE_HEX, NULL, ISIS_HELLO_CT_RESERVED_MASK, NULL, HFILL }},
1487
1488
14
        { &hf_isis_hello_source_id,
1489
14
        { "SystemID {Sender of PDU}", "isis.hello.source_id",
1490
14
            FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1491
1492
14
        { &hf_isis_hello_holding_timer,
1493
14
        { "Holding timer", "isis.hello.holding_timer",
1494
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1495
1496
14
        { &hf_isis_hello_pdu_length,
1497
14
        { "PDU length", "isis.hello.pdu_length",
1498
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1499
1500
14
        { &hf_isis_hello_priority,
1501
14
         { "Priority", "isis.hello.priority",
1502
14
            FT_UINT8, BASE_DEC, NULL, ISIS_HELLO_PRIORITY_MASK, NULL, HFILL }},
1503
1504
14
        { &hf_isis_hello_priority_reserved,
1505
14
         { "Reserved", "isis.hello.reserved",
1506
14
            FT_UINT8, BASE_DEC, NULL, ISIS_HELLO_P_RESERVED_MASK, NULL, HFILL }},
1507
1508
14
        { &hf_isis_hello_lan_id,
1509
14
        { "SystemID {Designated IS}", "isis.hello.lan_id",
1510
14
            FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1511
1512
14
        { &hf_isis_hello_clv_type,
1513
14
        { "Type", "isis.hello.clv.type",
1514
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1515
1516
14
        { &hf_isis_hello_clv_length,
1517
14
        { "Length", "isis.hello.clv.length",
1518
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1519
1520
14
        { &hf_isis_hello_local_circuit_id,
1521
14
        { "Local circuit ID", "isis.hello.local_circuit_id",
1522
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1523
1524
14
        { &hf_isis_hello_clv_ipv4_int_addr,
1525
14
        { "IPv4 interface address", "isis.hello.clv_ipv4_int_addr",
1526
14
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1527
1528
14
        { &hf_isis_hello_clv_ipv6_int_addr,
1529
14
        { "IPv6 interface address", "isis.hello.clv_ipv6_int_addr",
1530
14
            FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1531
1532
#if 0
1533
        { &hf_isis_hello_clv_ptp_adj,
1534
        { "Point-to-point Adjacency", "isis.hello.clv_ptp_adj",
1535
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1536
#endif
1537
1538
14
        { &hf_isis_hello_clv_mt,
1539
14
        { "MT-ID", "isis.hello.clv_mt",
1540
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1541
1542
14
        { &hf_isis_hello_clv_restart_flags,
1543
14
        { "Restart Signaling Flags", "isis.hello.clv_restart_flags",
1544
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1545
1546
14
        { &hf_isis_hello_clv_restart_flags_rr,
1547
14
        { "Restart Request", "isis.hello.clv_restart_flags.rr",
1548
14
            FT_BOOLEAN, 8, NULL, ISIS_RESTART_RR,
1549
14
            "When set, the router is beginning a graceful restart", HFILL }},
1550
1551
14
        { &hf_isis_hello_clv_restart_flags_ra,
1552
14
        { "Restart Acknowledgment", "isis.hello.clv_restart_flags.ra",
1553
14
            FT_BOOLEAN, 8, NULL, ISIS_RESTART_RA,
1554
14
            "When set, the router is willing to enter helper mode", HFILL }},
1555
1556
14
        { &hf_isis_hello_clv_restart_flags_sa,
1557
14
        { "Suppress Adjacency", "isis.hello.clv_restart_flags.sa",
1558
14
            FT_BOOLEAN, 8, NULL, ISIS_RESTART_SA,
1559
14
            "When set, the router is starting as opposed to restarting", HFILL }},
1560
1561
14
        { &hf_isis_hello_clv_restart_remain_time,
1562
14
        { "Remaining holding time", "isis.hello.clv_restart.remain_time",
1563
14
            FT_UINT16, BASE_DEC, NULL, 0x0,
1564
14
            "How long the helper router will maintain the existing adjacency", HFILL }},
1565
1566
14
        { &hf_isis_hello_clv_restart_neighbor,
1567
14
        { "Restarting Neighbor ID", "isis.hello.clv_restart.neighbor",
1568
14
            FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
1569
14
            "The System ID of the restarting neighbor", HFILL }},
1570
1571
      /* Generated from convert_proto_tree_add_text.pl */
1572
14
      { &hf_isis_hello_mcid, { "MCID", "isis.hello.mcid", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1573
14
      { &hf_isis_hello_aux_mcid, { "Aux MCID", "isis.hello.aux_mcid", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1574
14
      { &hf_isis_hello_digest, { "Digest", "isis.hello.digest", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1575
14
      { &hf_isis_hello_digest_v, { "V", "isis.hello.digest.v", FT_UINT8, BASE_DEC, NULL, 0x10, NULL, HFILL }},
1576
14
      { &hf_isis_hello_digest_a, { "A", "isis.hello.digest.a", FT_UINT8, BASE_DEC, NULL, 0x0c, NULL, HFILL }},
1577
14
      { &hf_isis_hello_digest_d, { "D", "isis.hello.digest.d", FT_UINT8, BASE_DEC, NULL, 0x03, NULL, HFILL }},
1578
14
      { &hf_isis_hello_ect, { "ECT", "isis.hello.ect", FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL }},
1579
14
      { &hf_isis_hello_bvid, { "BVID", "isis.hello.bvid", FT_UINT16, BASE_HEX_DEC, NULL, 0xFFF0, NULL, HFILL }},
1580
14
      { &hf_isis_hello_bvid_u, { "U", "isis.hello.bvid.u", FT_UINT16, BASE_HEX_DEC, NULL, 0x0008, NULL, HFILL }},
1581
14
      { &hf_isis_hello_bvid_m, { "M", "isis.hello.bvid.m", FT_UINT16, BASE_HEX_DEC, NULL, 0x0004, NULL, HFILL }},
1582
14
      { &hf_isis_hello_area_address, { "Area address", "isis.hello.area_address", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1583
14
      { &hf_isis_hello_instance_identifier, { "Instance Identifier", "isis.hello.iid", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1584
14
      { &hf_isis_hello_supported_itid, { "Supported ITID", "isis.hello.supported_itid", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1585
14
      { &hf_isis_hello_clv_nlpid_nlpid, { "NLPID", "isis.hello.clv_nlpid.nlpid", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1586
14
      { &hf_isis_hello_clv_ip_authentication, { "NLPID", "isis.hello.clv_ip_authentication", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1587
14
      { &hf_isis_hello_authentication, { "Authentication", "isis.hello.clv_authentication", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1588
14
      { &hf_isis_hello_mtid, { "Topology ID", "isis.hello.mtid", FT_UINT16, BASE_DEC|BASE_RANGE_STRING, RVALS(mtid_strings), 0x0fff, NULL, HFILL }},
1589
14
      { &hf_isis_hello_trill_neighbor_sf, { "Smallest flag", "isis.hello.trill_neighbor.sf", FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80, NULL, HFILL }},
1590
14
      { &hf_isis_hello_trill_neighbor_lf, { "Largest flag", "isis.hello.trill_neighbor.lf", FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x40, NULL, HFILL }},
1591
14
      { &hf_isis_hello_trill_neighbor_size, { "SNPA Size", "isis.hello.trill_neighbor.size", FT_UINT8, BASE_DEC, NULL, 0x1f, NULL, HFILL }},
1592
14
      { &hf_isis_hello_trill_neighbor_ff, { "Failed flag", "isis.hello.trill_neighbor.ff", FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80, NULL, HFILL }},
1593
14
      { &hf_isis_hello_trill_neighbor_of, { "OOMF flag", "isis.hello.trill_neighbor.of", FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x40, NULL, HFILL }},
1594
14
      { &hf_isis_hello_trill_neighbor_reserved, { "Reserved", "isis.hello.trill_neighbor.reserved", FT_UINT8, BASE_DEC, NULL, 0x3f, NULL, HFILL }},
1595
14
      { &hf_isis_hello_trill_neighbor_mtu, { "Tested MTU", "isis.hello.trill_neighbor.mtu", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1596
14
      { &hf_isis_hello_trill_neighbor_snpa, { "SNPA", "isis.hello.trill_neighbor.snpa", FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1597
14
      { &hf_isis_hello_checksum, { "Checksum", "isis.hello.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1598
14
      { &hf_isis_hello_checksum_status, { "Checksum Status", "isis.hello.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }},
1599
14
      { &hf_isis_hello_adjacency_state, { "Adjacency State", "isis.hello.adjacency_state", FT_UINT8, BASE_DEC, VALS(adj_state_vals), 0x0, NULL, HFILL }},
1600
14
      { &hf_isis_hello_extended_local_circuit_id, { "Extended Local circuit ID", "isis.hello.extended_local_circuit_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1601
14
      { &hf_isis_hello_neighbor_systemid, { "Neighbor SystemID", "isis.hello.neighbor_systemid", FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1602
14
      { &hf_isis_hello_neighbor_extended_local_circuit_id, { "Neighbor Extended Local circuit ID", "isis.hello.neighbor_extended_local_circuit_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1603
14
      { &hf_isis_hello_vlan_flags_port_id, { "Port ID", "isis.hello.vlan_flags.port_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1604
14
      { &hf_isis_hello_vlan_flags_nickname, { "Nickname", "isis.hello.vlan_flags.nickname", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
1605
14
      { &hf_isis_hello_vlan_flags_af, { "Appointed Forwarder", "isis.hello.vlan_flags.af", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x8000, NULL, HFILL }},
1606
14
      { &hf_isis_hello_vlan_flags_ac, { "Access Port", "isis.hello.vlan_flags.ac", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x4000, NULL, HFILL }},
1607
14
      { &hf_isis_hello_vlan_flags_vm, { "VLAN Mapping Detected", "isis.hello.vlan_flags.vm", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x2000, NULL, HFILL }},
1608
14
      { &hf_isis_hello_vlan_flags_by, { "Bypass Pseudonode", "isis.hello.vlan_flags.by", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x1000, NULL, HFILL }},
1609
14
      { &hf_isis_hello_vlan_flags_outer_vlan, { "Outer VLAN", "isis.hello.vlan_flags.outer_vlan", FT_UINT16, BASE_DEC, NULL, 0x0fff, NULL, HFILL }},
1610
14
      { &hf_isis_hello_vlan_flags_tr, { "Trunk Port", "isis.hello.vlan_flags.tr", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x8000, NULL, HFILL }},
1611
14
      { &hf_isis_hello_vlan_flags_reserved, { "Reserved", "isis.hello.vlan_flags.reserved", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x7000, NULL, HFILL }},
1612
14
      { &hf_isis_hello_vlan_flags_designated_vlan, { "Designated VLAN", "isis.hello.vlan_flags.designated_vlan", FT_UINT16, BASE_DEC, NULL, 0x0fff, NULL, HFILL }},
1613
14
      { &hf_isis_hello_enabled_vlans, { "Enabled VLANs", "isis.hello.enabled_vlans", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1614
14
      { &hf_isis_hello_appointed_vlans, { "Appointed VLANs", "isis.hello.appointed_vlans", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1615
14
      { &hf_isis_hello_af_nickname, { "Nickname", "isis.hello.af.nickname", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
1616
14
      { &hf_isis_hello_af_start_vlan, { "Start VLAN", "isis.hello.af.start_vlan", FT_UINT16, BASE_DEC, NULL, 0x0fff, NULL, HFILL }},
1617
14
      { &hf_isis_hello_af_end_vlan, { "End VLAN", "isis.hello.af.end_vlan", FT_UINT16, BASE_DEC, NULL, 0x0fff, NULL, HFILL }},
1618
14
      { &hf_isis_hello_trill_version, { "Maximum version", "isis.hello.trill.maximum_version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1619
14
      { &hf_isis_hello_trill_hello_reduction, { "Hello Reduction", "isis.hello.trill.hello_reduction", FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x80000000, NULL, HFILL }},
1620
14
      { &hf_isis_hello_trill_unassigned_1, { "Unassigned", "isis.hello.trill.unassigned_1", FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x60000000, NULL, HFILL }},
1621
14
      { &hf_isis_hello_trill_hop_by_hop_flags, { "Hop-by-hop Extended Header Flags", "isis.hello.trill.hop_by_hop_flags", FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x1ffc0000, NULL, HFILL }},
1622
14
      { &hf_isis_hello_trill_unassigned_2, { "Unassigned", "isis.hello.trill.unassigned_2",FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x0003ffff, NULL, HFILL }},
1623
14
      { &hf_isis_hello_is_neighbor, { "IS Neighbor", "isis.hello.is_neighbor", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1624
14
      { &hf_isis_hello_reverse_metric_flags, { "Flags", "isis.hello.reverse_metric.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1625
14
      { &hf_isis_hello_reverse_metric_flag_reserved, { "Reserved", "isis.hello.reverse_metric.flags.reserved", FT_UINT8, BASE_HEX, NULL, 0xFC, NULL, HFILL }},
1626
14
      { &hf_isis_hello_reverse_metric_flag_u, { "U", "isis.hello.reverse_metric.flags.u", FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02, NULL, HFILL }},
1627
14
      { &hf_isis_hello_reverse_metric_flag_w, { "W", "isis.hello.reverse_metric.flags.w", FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01, NULL, HFILL }},
1628
14
      { &hf_isis_hello_reverse_metric_metric, { "Metric", "isis.hello.reverse_metric.metric", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1629
14
      { &hf_isis_hello_reverse_metric_sub_length, { "Sub-TLV length", "isis.hello.reverse_metric.sub_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1630
14
      { &hf_isis_hello_reverse_metric_sub_data, { "Sub-TLV data", "isis.hello.reverse_metric.sub_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1631
14
      { &hf_isis_hello_bfd_enabled_nlpid, { "NLPID", "isis.hello.bfd_enabled.nlpid", FT_UINT8, BASE_HEX, VALS(nlpid_vals), 0x0, NULL, HFILL }},
1632
1633
      /* rfc6119 */
1634
14
      { &hf_isis_hello_clv_ipv6_glb_int_addr,
1635
14
        { "IPv6 Global interface address", "isis.hello.clv_ipv6_glb_int_addr",
1636
14
            FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1637
14
    };
1638
1639
14
    static int *ett[] = {
1640
14
        &ett_isis_hello,
1641
14
        &ett_isis_hello_clv_area_addr,
1642
14
        &ett_isis_hello_clv_instance_identifier,
1643
14
        &ett_isis_hello_clv_is_neighbors,
1644
14
        &ett_isis_hello_clv_padding,
1645
14
        &ett_isis_hello_clv_unknown,
1646
14
        &ett_isis_hello_clv_nlpid,
1647
14
        &ett_isis_hello_clv_nlpid_nlpid,
1648
14
        &ett_isis_hello_clv_authentication,
1649
14
        &ett_isis_hello_clv_ip_authentication,
1650
14
        &ett_isis_hello_clv_ipv4_int_addr,
1651
14
        &ett_isis_hello_clv_ipv6_int_addr,
1652
14
        &ett_isis_hello_clv_ptp_adj,
1653
14
        &ett_isis_hello_clv_mt,
1654
14
        &ett_isis_hello_clv_restart,
1655
14
        &ett_isis_hello_clv_restart_flags,
1656
14
        &ett_isis_hello_clv_mt_port_cap,
1657
14
        &ett_isis_hello_clv_mt_port_cap_spb_mcid,
1658
14
        &ett_isis_hello_clv_mt_port_cap_spb_digest,
1659
14
        &ett_isis_hello_clv_mt_port_cap_spb_bvid_tuples,
1660
14
        &ett_isis_hello_clv_mt_port_cap_vlan_flags,
1661
14
        &ett_isis_hello_clv_mt_port_cap_enabled_vlans,
1662
14
        &ett_isis_hello_clv_mt_port_cap_appointedfwrdrs,
1663
14
        &ett_isis_hello_clv_mt_port_cap_port_trill_ver,
1664
14
        &ett_isis_hello_clv_mt_port_cap_vlans_appointed,
1665
14
        &ett_isis_hello_clv_trill_neighbor,
1666
14
        &ett_isis_hello_clv_checksum,
1667
14
        &ett_isis_hello_clv_reverse_metric,
1668
14
        &ett_isis_hello_clv_bfd_enabled,
1669
14
        &ett_isis_hello_clv_ipv6_glb_int_addr, /* CLV 233, rfc6119 */
1670
14
        &ett_isis_hello_reverse_metric_flags
1671
14
    };
1672
1673
14
    static ei_register_info ei[] = {
1674
14
        { &ei_isis_hello_short_pdu, { "isis.lsp.hello_pdu.bad_length_short", PI_MALFORMED, PI_ERROR, "PDU length less than header length", EXPFILL }},
1675
14
        { &ei_isis_hello_long_pdu, { "isis.lsp.hello_pdu.bad_length_long", PI_MALFORMED, PI_ERROR, "PDU length greater than packet length", EXPFILL }},
1676
14
        { &ei_isis_hello_bad_checksum, { "isis.hello.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
1677
14
        { &ei_isis_hello_subtlv, { "isis.hello.subtlv.unknown", PI_PROTOCOL, PI_WARN, "Unknown Sub-TLV", EXPFILL }},
1678
14
        { &ei_isis_hello_authentication, { "isis.hello.authentication.unknown", PI_PROTOCOL, PI_WARN, "Unknown authentication type", EXPFILL }},
1679
14
        { &ei_isis_hello_short_clv, { "isis.hello.short_clv", PI_MALFORMED, PI_ERROR, "Short CLV", EXPFILL }},
1680
14
        { &ei_isis_hello_clv_mt, { "isis.hello.clv_mt.malformed", PI_MALFORMED, PI_ERROR, "malformed MT-ID", EXPFILL }},
1681
14
        { &ei_isis_hello_clv_unknown, { "isis.hello.clv.unknown", PI_UNDECODED, PI_NOTE, "Unknown option", EXPFILL }},
1682
14
    };
1683
1684
14
    expert_module_t* expert_isis_hello;
1685
1686
    /* Register the protocol name and description */
1687
14
    proto_isis_hello = proto_register_protocol("ISIS HELLO", "ISIS HELLO", "isis.hello");
1688
1689
14
    proto_register_field_array(proto_isis_hello, hf, array_length(hf));
1690
14
    proto_register_subtree_array(ett, array_length(ett));
1691
14
    expert_isis_hello = expert_register_protocol(proto_isis_hello);
1692
14
    expert_register_field_array(expert_isis_hello, ei, array_length(ei));
1693
14
}
1694
1695
void
1696
proto_reg_handoff_isis_hello(void)
1697
14
{
1698
14
    dissector_add_uint("isis.type", ISIS_TYPE_L1_HELLO, create_dissector_handle(dissect_isis_l1_hello, proto_isis_hello));
1699
14
    dissector_add_uint("isis.type", ISIS_TYPE_L2_HELLO, create_dissector_handle(dissect_isis_l2_hello, proto_isis_hello));
1700
14
    dissector_add_uint("isis.type", ISIS_TYPE_PTP_HELLO, create_dissector_handle(dissect_isis_ptp_hello, proto_isis_hello));
1701
14
}
1702
1703
/*
1704
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
1705
 *
1706
 * Local variables:
1707
 * c-basic-offset: 4
1708
 * tab-width: 8
1709
 * indent-tabs-mode: nil
1710
 * End:
1711
 *
1712
 * vi: set shiftwidth=4 tabstop=8 expandtab:
1713
 * :indentSize=4:tabSize=8:noTabs=true:
1714
 */