Coverage Report

Created: 2026-11-12 07:01

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-shicp.c
Line
Count
Source
1
/* packet-shicp.c
2
 * Routines for Secure Host IP Configuration Protocol dissection
3
 * Copyright 2021, Filip Kågesson <exfik@hms.se>
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
 */
11
12
#include <config.h>
13
14
#include <epan/packet.h>
15
#include <epan/expert.h>
16
#include <epan/addr_resolv.h>
17
#include <epan/tfs.h>
18
#include <wsutil/array.h>
19
#include "packet-udp.h"
20
21
void proto_reg_handoff_shicp(void);
22
void proto_register_shicp(void);
23
24
/* Protocols and header fields */
25
static int proto_shicp;
26
static int hf_shicp_header;
27
static int hf_shicp_protocol_version;
28
static int hf_shicp_dst;
29
static int hf_shicp_src;
30
static int hf_shicp_flags;
31
static int hf_shicp_msgclass_flag;
32
static int hf_shicp_error_flag;
33
static int hf_shicp_reserved_flag;
34
static int hf_shicp_msgtype;
35
static int hf_shicp_error;
36
static int hf_shicp_error_string;
37
static int hf_shicp_auth_req;
38
static int hf_shicp_module_version;
39
static int hf_shicp_module_desc;
40
static int hf_shicp_supported_msg;
41
static int hf_shicp_ip;
42
static int hf_shicp_sn;
43
static int hf_shicp_gw;
44
static int hf_shicp_dns1;
45
static int hf_shicp_dns2;
46
static int hf_shicp_dhcp;
47
static int hf_shicp_hn;
48
static int hf_shicp_hn_max_len;
49
static int hf_shicp_pswd_max_len;
50
static int hf_shicp_challenge;
51
static int hf_shicp_validity_period;
52
static int hf_shicp_token;
53
static int hf_shicp_pswd;
54
static int hf_shicp_wink_type;
55
static int hf_shicp_restart_mode;
56
57
static int ett_shicp;
58
static int ett_shicp_flags;
59
60
static expert_field ei_shicp_error;
61
static expert_field ei_shicp_malformed;
62
63
176
#define SHICP_UDP_PORT 3250
64
65
0
#define SHICP_MIN_LENGTH 2
66
0
#define SHICP_MAX_LENGTH 548
67
0
#define SHICP_HEADER_SIZE 2
68
0
#define SHICP_ADDRESS_SIZE 6
69
0
#define SHICP_FLAGS_SIZE 1
70
0
#define SHICP_MSG_TYPE_SIZE 1
71
0
#define SHICP_ERROR_SIZE 1
72
0
#define SHICP_CHALLENGE_SIZE 4
73
0
#define SHICP_VALIDITY_PERIOD_SIZE 1
74
0
#define SHICP_TOKEN_SIZE 36
75
0
#define SHICP_WINK_TYPE_SIZE 1
76
0
#define SHICP_RESTART_MODE_SIZE 1
77
176
#define SHICP_FIXED_LEN 18
78
0
#define SHICP_MSG_CLASS_FLAG 0x01
79
0
#define SHICP_ERROR_FLAG 0x02
80
#define SHICP_RESERVED_FLAG 0xFC
81
82
/* Values of the supported message types. */
83
0
#define SHICP_DISCOVER_MSG_TYPE 0x00
84
0
#define SHICP_AUTH_CHALLENGE_MSG_TYPE 0x01
85
0
#define SHICP_CONFIG_MSG_TYPE 0x02
86
0
#define SHICP_WINK_MSG_TYPE 0x03
87
0
#define SHICP_RESTART_MSG_TYPE 0x04
88
#define SHICP_MASS_RESTART_MSG_TYPE 0x05
89
90
/* Keys of the parameters associated with discover messages. */
91
0
#define SHICP_DISCOVER_AUTH_REQ_KEY 0x00
92
0
#define SHICP_DISCOVER_MODULE_VERSION_KEY 0x01
93
0
#define SHICP_DISCOVER_MODULE_DESC_KEY 0x02
94
0
#define SHICP_DISCOVER_SUPPORTED_MSG_KEY 0x03
95
0
#define SHICP_DISCOVER_IP_KEY 0x04
96
0
#define SHICP_DISCOVER_SN_KEY 0x05
97
0
#define SHICP_DISCOVER_GW_KEY 0x06
98
0
#define SHICP_DISCOVER_DNS1_KEY 0x07
99
0
#define SHICP_DISCOVER_DNS2_KEY 0x08
100
0
#define SHICP_DISCOVER_DHCP_KEY 0x09
101
0
#define SHICP_DISCOVER_HN_KEY 0x0A
102
0
#define SHICP_DISCOVER_HN_MAX_LEN_KEY 0x0B
103
0
#define SHICP_DISCOVER_PSWD_MAX_LEN_KEY 0x0C
104
105
/* Keys of the parameters associated with configuration messages. */
106
0
#define SHICP_CONFIG_IP_KEY 0x00
107
0
#define SHICP_CONFIG_SN_KEY 0x01
108
0
#define SHICP_CONFIG_GW_KEY 0x02
109
0
#define SHICP_CONFIG_DNS1_KEY 0x03
110
0
#define SHICP_CONFIG_DNS2_KEY 0x04
111
0
#define SHICP_CONFIG_DHCP_KEY 0x05
112
0
#define SHICP_CONFIG_HN_KEY 0x06
113
0
#define SHICP_CONFIG_PSWD_KEY 0x07
114
115
/* The types of messages supported. */
116
static const value_string message_types[] = {
117
    {SHICP_DISCOVER_MSG_TYPE, "Discover"},
118
    {SHICP_AUTH_CHALLENGE_MSG_TYPE, "Authentication challenge"},
119
    {SHICP_CONFIG_MSG_TYPE, "Configuration"},
120
    {SHICP_WINK_MSG_TYPE, "Wink"},
121
    {SHICP_RESTART_MSG_TYPE, "Restart"},
122
    {SHICP_MASS_RESTART_MSG_TYPE, "Mass-restart"},
123
    {0, NULL}
124
};
125
/* The error codes that are supported. */
126
static const value_string error_types[] = {
127
    {0x00, "Request was rejected"},
128
    {0x01, "Authentication failed"},
129
    {0x02, "Authentication required"},
130
    {0x03, "Unsupported message type"},
131
    {0x1F, "Hostname too long"},
132
    {0x20, "Password too long"},
133
    {0x21, "Bad config"},
134
    {0, NULL}
135
};
136
/* The types of restart mode that are supported. */
137
static const value_string restart_mode_types[] = {
138
    {0x00, "Immediate restart"},
139
    {0x01, "Delayed restart"},
140
    {0, NULL}
141
};
142
143
static bool
144
test_shicp(packet_info* pinfo, tvbuff_t* tvb, int offset, void* data _U_)
145
176
{
146
    /* Check that the port matches the port used by SHICP. */
147
176
    if (pinfo->destport != SHICP_UDP_PORT) {
148
176
        return false;
149
176
    }
150
151
    /* Check that the length of the message is within allowed boundaries. */
152
0
    if (tvb_reported_length(tvb) < SHICP_MIN_LENGTH || tvb_reported_length(tvb) > SHICP_MAX_LENGTH) {
153
0
        return false;
154
0
    }
155
156
    /* Check that the header tag starts with 0xABC0. */
157
0
    if ((tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN) & 0xFFF8) != 0xABC0) {
158
0
        return false;
159
0
    }
160
161
0
    return true;
162
0
}
163
164
static int
165
dissect_shicp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
166
        void *data _U_)
167
0
{
168
0
    proto_item* ti;
169
0
    proto_item* flags_pi;
170
0
    proto_item* error_pi;
171
0
    proto_tree* shicp_tree;
172
0
    unsigned offset = 0;
173
0
    unsigned payload_end;
174
0
    unsigned keyvalue_key = 0;
175
0
    unsigned keyvalue_length = 0;
176
0
    unsigned keyvalue_offset = 0;
177
0
    unsigned keyvalue_end = 0;
178
0
    uint8_t supported_message_value = 0;
179
0
    uint16_t payload_length = 0;
180
0
    uint32_t version = 0;
181
0
    uint32_t msgtype_value = 0;
182
0
    uint32_t error_value = 0;
183
0
    uint64_t flags_value = 0;
184
185
0
    wmem_strbuf_t* supported_messages = wmem_strbuf_new(pinfo->pool, "");
186
0
    wmem_strbuf_t* module_addr_strbuf = wmem_strbuf_new(pinfo->pool, "");
187
188
0
    static int* flags[] = {
189
0
        &hf_shicp_reserved_flag,
190
0
        &hf_shicp_error_flag,
191
0
        &hf_shicp_msgclass_flag,
192
0
        NULL
193
0
    };
194
195
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "SHICP");
196
0
    col_clear(pinfo->cinfo, COL_INFO);
197
198
0
    ti = proto_tree_add_item(tree, proto_shicp, tvb, offset, -1, ENC_NA);
199
200
0
    shicp_tree = proto_item_add_subtree(ti, ett_shicp);
201
0
    proto_item_append_text(ti,
202
0
        ", Src:%s, Dst:%s",
203
0
        address_with_resolution_to_str(pinfo->pool, &pinfo->dl_src),
204
0
        address_with_resolution_to_str(pinfo->pool, &pinfo->dl_dst));
205
0
    proto_tree_add_item_ret_uint(shicp_tree, hf_shicp_header, tvb, offset, SHICP_HEADER_SIZE, ENC_LITTLE_ENDIAN, &version);
206
0
    proto_tree_add_uint(shicp_tree, hf_shicp_protocol_version, tvb, offset, SHICP_HEADER_SIZE, version & 0x07);
207
0
    offset += SHICP_HEADER_SIZE;
208
0
    proto_tree_add_item(shicp_tree, hf_shicp_dst, tvb, offset, SHICP_ADDRESS_SIZE, ENC_NA);
209
0
    char* dst = tvb_address_to_str(pinfo->pool, tvb, AT_ETHER, offset);
210
0
    offset += SHICP_ADDRESS_SIZE;
211
0
    proto_tree_add_item(shicp_tree, hf_shicp_src, tvb, offset, SHICP_ADDRESS_SIZE, ENC_NA);
212
0
    char* src = tvb_address_to_str(pinfo->pool, tvb, AT_ETHER, offset);
213
0
    offset += SHICP_ADDRESS_SIZE;
214
0
    flags_pi = proto_tree_add_bitmask_ret_uint64(shicp_tree, tvb, offset, hf_shicp_flags, ett_shicp_flags, flags, ENC_LITTLE_ENDIAN, &flags_value);
215
0
    offset += SHICP_FLAGS_SIZE;
216
0
    proto_tree_add_item_ret_uint(shicp_tree, hf_shicp_msgtype, tvb, offset, SHICP_MSG_TYPE_SIZE, ENC_LITTLE_ENDIAN, &msgtype_value);
217
0
    offset += SHICP_MSG_TYPE_SIZE;
218
0
    payload_length = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN);
219
0
    offset += 1;
220
0
    if (flags_value & SHICP_ERROR_FLAG) {
221
0
        proto_item_set_text(flags_pi,
222
0
            "Message flags: 0x%02x (%s, %s)",
223
0
            (unsigned)flags_value,
224
0
            tfs_get_string(flags_value & SHICP_MSG_CLASS_FLAG, &tfs_response_request), "Error");
225
0
        if (payload_length != 1) {
226
0
            error_pi = proto_tree_add_string(shicp_tree, hf_shicp_error_string, tvb, offset, 0, "Malformed message");
227
0
            expert_add_info(pinfo, error_pi, &ei_shicp_malformed);
228
0
            col_append_str(pinfo->cinfo, COL_INFO, "Error: Malformed message");
229
0
        }
230
0
        else {
231
0
            error_pi = proto_tree_add_item_ret_uint(shicp_tree, hf_shicp_error, tvb, offset, SHICP_ERROR_SIZE, ENC_LITTLE_ENDIAN, &error_value);
232
0
            expert_add_info(pinfo, error_pi, &ei_shicp_error);
233
0
            col_append_fstr(pinfo->cinfo, COL_INFO, "Error: %s", val_to_str(pinfo->pool, error_value, error_types, "%d"));
234
0
        }
235
0
    }
236
0
    else {
237
0
        proto_item_set_text(flags_pi,
238
0
            "Message flags: 0x%02x (%s)",
239
0
            (unsigned)flags_value,
240
0
            tfs_get_string(flags_value & SHICP_MSG_CLASS_FLAG, &tfs_response_request));
241
0
        col_append_fstr(pinfo->cinfo,
242
0
            COL_INFO,
243
0
            "%s, Type: %s",
244
0
            tfs_get_string(flags_value & SHICP_MSG_CLASS_FLAG, &tfs_response_request),
245
0
            val_to_str(pinfo->pool, msgtype_value, message_types, "%d"));
246
0
        payload_end = offset + payload_length;
247
0
        switch (msgtype_value)
248
0
        {
249
0
        case SHICP_DISCOVER_MSG_TYPE:
250
0
            while (offset < payload_end) {
251
0
                keyvalue_key = tvb_get_uint8(tvb, offset);
252
0
                offset += 1;
253
0
                keyvalue_length = tvb_get_uint8(tvb, offset);
254
0
                offset += 1;
255
0
                switch (keyvalue_key)
256
0
                {
257
0
                case SHICP_DISCOVER_AUTH_REQ_KEY:
258
0
                    proto_tree_add_item(shicp_tree, hf_shicp_auth_req, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
259
0
                    break;
260
0
                case SHICP_DISCOVER_MODULE_VERSION_KEY:
261
0
                    proto_tree_add_item(shicp_tree, hf_shicp_module_version, tvb, offset, keyvalue_length, ENC_ASCII);
262
0
                    break;
263
0
                case SHICP_DISCOVER_MODULE_DESC_KEY:
264
0
                    proto_tree_add_item(shicp_tree, hf_shicp_module_desc, tvb, offset, keyvalue_length, ENC_ASCII);
265
0
                    break;
266
0
                case SHICP_DISCOVER_SUPPORTED_MSG_KEY:
267
0
                    keyvalue_end = offset + keyvalue_length;
268
0
                    keyvalue_offset = offset;
269
0
                    supported_message_value = tvb_get_uint8(tvb, keyvalue_offset);
270
0
                    wmem_strbuf_append(supported_messages, val_to_str(pinfo->pool, supported_message_value, message_types, "%d"));
271
0
                    keyvalue_offset += 1;
272
0
                    while (keyvalue_offset < keyvalue_end) {
273
0
                        supported_message_value = tvb_get_uint8(tvb, keyvalue_offset);
274
0
                        wmem_strbuf_append_printf(supported_messages, ", %s", val_to_str(pinfo->pool, supported_message_value, message_types, "%d"));
275
0
                        keyvalue_offset += 1;
276
0
                    }
277
0
                    proto_tree_add_string(shicp_tree, hf_shicp_supported_msg, tvb, offset, keyvalue_length, wmem_strbuf_get_str(supported_messages));
278
0
                    break;
279
0
                case SHICP_DISCOVER_IP_KEY:
280
0
                    proto_tree_add_item(shicp_tree, hf_shicp_ip, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
281
0
                    break;
282
0
                case SHICP_DISCOVER_SN_KEY:
283
0
                    proto_tree_add_item(shicp_tree, hf_shicp_sn, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
284
0
                    break;
285
0
                case SHICP_DISCOVER_GW_KEY:
286
0
                    proto_tree_add_item(shicp_tree, hf_shicp_gw, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
287
0
                    break;
288
0
                case SHICP_DISCOVER_DNS1_KEY:
289
0
                    proto_tree_add_item(shicp_tree, hf_shicp_dns1, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
290
0
                    break;
291
0
                case SHICP_DISCOVER_DNS2_KEY:
292
0
                    proto_tree_add_item(shicp_tree, hf_shicp_dns2, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
293
0
                    break;
294
0
                case SHICP_DISCOVER_DHCP_KEY:
295
0
                    proto_tree_add_item(shicp_tree, hf_shicp_dhcp, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
296
0
                    break;
297
0
                case SHICP_DISCOVER_HN_KEY:
298
0
                    proto_tree_add_item(shicp_tree, hf_shicp_hn, tvb, offset, keyvalue_length, ENC_ASCII);
299
0
                    break;
300
0
                case SHICP_DISCOVER_HN_MAX_LEN_KEY:
301
0
                    proto_tree_add_item(shicp_tree, hf_shicp_hn_max_len, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
302
0
                    break;
303
0
                case SHICP_DISCOVER_PSWD_MAX_LEN_KEY:
304
0
                    proto_tree_add_item(shicp_tree, hf_shicp_pswd_max_len, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
305
0
                    break;
306
0
                default:
307
0
                    break;
308
0
                }
309
0
                offset += keyvalue_length;
310
0
            }
311
0
            break;
312
0
        case SHICP_AUTH_CHALLENGE_MSG_TYPE:
313
0
            if (payload_length >= 5) {
314
0
                proto_tree_add_item(shicp_tree, hf_shicp_challenge, tvb, offset, SHICP_CHALLENGE_SIZE, ENC_LITTLE_ENDIAN);
315
0
                offset += SHICP_CHALLENGE_SIZE;
316
0
                proto_tree_add_item(shicp_tree, hf_shicp_validity_period, tvb, offset, SHICP_VALIDITY_PERIOD_SIZE, ENC_LITTLE_ENDIAN);
317
0
            }
318
0
            break;
319
0
        case SHICP_CONFIG_MSG_TYPE:
320
0
            if (payload_length >= SHICP_TOKEN_SIZE) {
321
0
                proto_tree_add_item(shicp_tree, hf_shicp_token, tvb, offset, SHICP_TOKEN_SIZE, ENC_NA);
322
0
                offset += SHICP_TOKEN_SIZE;
323
0
            }
324
0
            else if (payload_length == SHICP_ERROR_SIZE) {
325
0
                proto_tree_add_item(shicp_tree, hf_shicp_error, tvb, offset, SHICP_ERROR_SIZE, ENC_NA);
326
0
                break;
327
0
            }
328
0
            while (offset < payload_end) {
329
0
                keyvalue_key = tvb_get_uint8(tvb, offset);
330
0
                offset += 1;
331
0
                keyvalue_length = tvb_get_uint8(tvb, offset);
332
0
                offset += 1;
333
0
                switch (keyvalue_key)
334
0
                {
335
0
                case SHICP_CONFIG_IP_KEY:
336
0
                    proto_tree_add_item(shicp_tree, hf_shicp_ip, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
337
0
                    break;
338
0
                case SHICP_CONFIG_SN_KEY:
339
0
                    proto_tree_add_item(shicp_tree, hf_shicp_sn, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
340
0
                    break;
341
0
                case SHICP_CONFIG_GW_KEY:
342
0
                    proto_tree_add_item(shicp_tree, hf_shicp_gw, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
343
0
                    break;
344
0
                case SHICP_CONFIG_DNS1_KEY:
345
0
                    proto_tree_add_item(shicp_tree, hf_shicp_dns1, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
346
0
                    break;
347
0
                case SHICP_CONFIG_DNS2_KEY:
348
0
                    proto_tree_add_item(shicp_tree, hf_shicp_dns2, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
349
0
                    break;
350
0
                case SHICP_CONFIG_DHCP_KEY:
351
0
                    proto_tree_add_item(shicp_tree, hf_shicp_dhcp, tvb, offset, keyvalue_length, ENC_LITTLE_ENDIAN);
352
0
                    break;
353
0
                case SHICP_CONFIG_HN_KEY:
354
0
                    proto_tree_add_item(shicp_tree, hf_shicp_hn, tvb, offset, keyvalue_length, ENC_ASCII);
355
0
                    break;
356
0
                case SHICP_CONFIG_PSWD_KEY:
357
0
                    proto_tree_add_item(shicp_tree, hf_shicp_pswd, tvb, offset, keyvalue_length, ENC_ASCII);
358
0
                    break;
359
0
                default:
360
0
                    break;
361
0
                }
362
0
                offset += keyvalue_length;
363
0
            }
364
0
            break;
365
0
        case SHICP_WINK_MSG_TYPE:
366
0
            if (payload_length >= SHICP_TOKEN_SIZE + SHICP_WINK_TYPE_SIZE) {
367
0
                proto_tree_add_item(shicp_tree, hf_shicp_token, tvb, offset, SHICP_TOKEN_SIZE, ENC_NA);
368
0
                offset += SHICP_TOKEN_SIZE;
369
0
                proto_tree_add_item(shicp_tree, hf_shicp_wink_type, tvb, offset, SHICP_WINK_TYPE_SIZE, ENC_LITTLE_ENDIAN);
370
0
            }
371
0
            break;
372
0
        case SHICP_RESTART_MSG_TYPE:
373
0
            if (payload_length >= SHICP_TOKEN_SIZE + SHICP_RESTART_MODE_SIZE) {
374
0
                proto_tree_add_item(shicp_tree, hf_shicp_token, tvb, offset, SHICP_TOKEN_SIZE, ENC_NA);
375
0
                offset += SHICP_TOKEN_SIZE;
376
0
                proto_tree_add_item(shicp_tree, hf_shicp_restart_mode, tvb, offset, SHICP_RESTART_MODE_SIZE, ENC_LITTLE_ENDIAN);
377
0
            }
378
0
            break;
379
0
        default:
380
0
            break;
381
0
        }
382
0
    }
383
384
0
    wmem_strbuf_append(module_addr_strbuf, (flags_value & SHICP_MSG_CLASS_FLAG) ? src : dst);
385
0
    if (strcmp(wmem_strbuf_get_str(module_addr_strbuf), "ff:ff:ff:ff:ff:ff") != 0) {
386
0
        col_append_fstr(pinfo->cinfo, COL_INFO, ", Module MAC address: %s", wmem_strbuf_get_str(module_addr_strbuf));
387
0
    }
388
389
0
    return tvb_captured_length(tvb);
390
0
}
391
392
static unsigned
393
get_shicp_len(packet_info* pinfo _U_, tvbuff_t* tvb, int offset _U_, void* data _U_)
394
0
{
395
0
    return (unsigned)tvb_reported_length(tvb);
396
0
}
397
398
static bool
399
dissect_shicp_heur_udp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data)
400
176
{
401
176
        return (udp_dissect_pdus(tvb, pinfo, tree, SHICP_FIXED_LEN, test_shicp,
402
176
            get_shicp_len, dissect_shicp, data) != 0);
403
176
}
404
405
void
406
proto_register_shicp(void)
407
16
{
408
16
    expert_module_t* expert_shicp;
409
410
16
    static hf_register_info hf[] = {
411
16
        { &hf_shicp_header,
412
16
          { "Header", "shicp.header",
413
16
            FT_UINT16, BASE_HEX,
414
16
            NULL, 0x0,
415
16
            NULL, HFILL }
416
16
        },
417
16
        { &hf_shicp_protocol_version,
418
16
          { "Protocol version", "shicp.protocolversion",
419
16
            FT_UINT8, BASE_DEC,
420
16
            NULL, 0x0,
421
16
            NULL, HFILL }
422
16
        },
423
16
        { &hf_shicp_dst,
424
16
          { "Destination", "shicp.dst",
425
16
            FT_ETHER, BASE_NONE,
426
16
            NULL, 0x0,
427
16
            NULL, HFILL }
428
16
        },
429
16
        { &hf_shicp_src,
430
16
          { "Source", "shicp.src",
431
16
            FT_ETHER, BASE_NONE,
432
16
            NULL, 0x0,
433
16
            NULL, HFILL }
434
16
        },
435
16
        { &hf_shicp_flags,
436
16
          { "Message flags", "shicp.flags",
437
16
            FT_UINT8, BASE_HEX,
438
16
            NULL, 0x0,
439
16
            NULL, HFILL }
440
16
        },
441
16
        { &hf_shicp_reserved_flag,
442
16
          { "Reserved", "shicp.flags.reserved",
443
16
            FT_BOOLEAN, 8,
444
16
            TFS(&tfs_set_notset), 0xFC,
445
16
            NULL, HFILL }
446
16
        },
447
16
        { &hf_shicp_error_flag,
448
16
          { "Error", "shicp.flags.error",
449
16
            FT_BOOLEAN, 8,
450
16
            TFS(&tfs_set_notset), 0x02,
451
16
            NULL, HFILL }
452
16
        },
453
16
        { &hf_shicp_msgclass_flag,
454
16
          { "Class", "shicp.flags.msgclass",
455
16
            FT_BOOLEAN, 8,
456
16
            TFS(&tfs_response_request), 0x01,
457
16
            NULL, HFILL }
458
16
        },
459
16
        { &hf_shicp_msgtype,
460
16
          { "Message type", "shicp.msgtype",
461
16
            FT_UINT8, BASE_HEX,
462
16
            VALS(message_types), 0x0,
463
16
            NULL, HFILL }
464
16
        },
465
16
        { &hf_shicp_error,
466
16
          { "Error", "shicp.error",
467
16
            FT_UINT8, BASE_HEX,
468
16
            NULL, 0x0,
469
16
            NULL, HFILL }
470
16
        },
471
16
        { &hf_shicp_error_string,
472
16
          { "Error", "shicp.error.string",
473
16
            FT_STRINGZ, BASE_NONE,
474
16
            NULL, 0x0,
475
16
            NULL, HFILL }
476
16
        },
477
16
        { &hf_shicp_auth_req,
478
16
          { "Authentication required", "shicp.authreq",
479
16
            FT_BOOLEAN, BASE_NONE,
480
16
            NULL, 0x0,
481
16
            NULL, HFILL }
482
16
        },
483
16
        { &hf_shicp_module_version,
484
16
          { "Module version", "shicp.moduleversion",
485
16
            FT_STRINGZ, BASE_NONE,
486
16
            NULL, 0x0,
487
16
            NULL, HFILL }
488
16
        },
489
16
        { &hf_shicp_module_desc,
490
16
          { "Module description", "shicp.moduledesc",
491
16
            FT_STRINGZ, BASE_NONE,
492
16
            NULL, 0x0,
493
16
            NULL, HFILL }
494
16
        },
495
16
        { &hf_shicp_supported_msg,
496
16
          { "Supported messages", "shicp.supportedmsg",
497
16
            FT_STRINGZ, BASE_NONE,
498
16
            NULL, 0x0,
499
16
            NULL, HFILL }
500
16
        },
501
16
        { &hf_shicp_ip,
502
16
          { "IP address", "shicp.ip",
503
16
            FT_IPv4, BASE_NONE,
504
16
            NULL, 0x0,
505
16
            NULL, HFILL }
506
16
        },
507
16
        { &hf_shicp_sn,
508
16
          { "Subnet mask", "shicp.sn",
509
16
            FT_IPv4, BASE_NONE,
510
16
            NULL, 0x0,
511
16
            NULL, HFILL }
512
16
        },
513
16
        { &hf_shicp_gw,
514
16
          { "Gateway address", "shicp.gw",
515
16
            FT_IPv4, BASE_NONE,
516
16
            NULL, 0x0,
517
16
            NULL, HFILL }
518
16
        },
519
16
        { &hf_shicp_dns1,
520
16
          { "Primary DNS address", "shicp.dns1",
521
16
            FT_IPv4, BASE_NONE,
522
16
            NULL, 0x0,
523
16
            NULL, HFILL }
524
16
        },
525
16
        { &hf_shicp_dns2,
526
16
          { "Secondary DNS address", "shicp.dns2",
527
16
            FT_IPv4, BASE_NONE,
528
16
            NULL, 0x0,
529
16
            NULL, HFILL }
530
16
        },
531
16
        { &hf_shicp_dhcp,
532
16
          { "DHCP", "shicp.dhcp",
533
16
            FT_BOOLEAN, BASE_NONE,
534
16
            TFS(&tfs_enabled_disabled), 0x0,
535
16
            NULL, HFILL }
536
16
        },
537
16
        { &hf_shicp_hn,
538
16
          { "Hostname", "shicp.hn",
539
16
            FT_STRINGZ, BASE_NONE,
540
16
            NULL, 0x0,
541
16
            NULL, HFILL }
542
16
        },
543
16
        { &hf_shicp_hn_max_len,
544
16
          { "Hostname max length", "shicp.hnmaxlen",
545
16
            FT_UINT8, BASE_DEC,
546
16
            NULL, 0x0,
547
16
            NULL, HFILL }
548
16
        },
549
16
        { &hf_shicp_pswd_max_len,
550
16
          { "Password max length", "shicp.pswdmaxlen",
551
16
            FT_UINT8, BASE_DEC,
552
16
            NULL, 0x0,
553
16
            NULL, HFILL }
554
16
        },
555
16
        { &hf_shicp_challenge,
556
16
          { "Challenge", "shicp.challenge",
557
16
            FT_UINT32, BASE_HEX,
558
16
            NULL, 0x0,
559
16
            NULL, HFILL }
560
16
        },
561
16
        { &hf_shicp_validity_period,
562
16
          { "Validity period (seconds)", "shicp.validityperiod",
563
16
            FT_UINT8, BASE_DEC,
564
16
            NULL, 0x0,
565
16
            NULL, HFILL }
566
16
        },
567
16
        { &hf_shicp_token,
568
16
          { "Authentication token", "shicp.token",
569
16
            FT_BYTES, BASE_NONE,
570
16
            NULL, 0x0,
571
16
            NULL, HFILL }
572
16
        },
573
16
        { &hf_shicp_pswd,
574
16
          { "Password", "shicp.pswd",
575
16
            FT_STRINGZ, BASE_NONE,
576
16
            NULL, 0x0,
577
16
            NULL, HFILL }
578
16
        },
579
16
        { &hf_shicp_wink_type,
580
16
          { "Wink type", "shicp.winktype",
581
16
            FT_UINT8, BASE_HEX,
582
16
            NULL, 0x0,
583
16
            NULL, HFILL }
584
16
        },
585
16
        { &hf_shicp_restart_mode,
586
16
          { "Restart mode", "shicp.restartmode",
587
16
            FT_UINT8, BASE_HEX,
588
16
            VALS(restart_mode_types), 0x0,
589
16
            NULL, HFILL }
590
16
        }
591
16
    };
592
593
16
    static int *ett[] = {
594
16
        &ett_shicp,
595
16
        &ett_shicp_flags
596
16
    };
597
598
    /* Setup protocol expert items */
599
16
    static ei_register_info ei[] = {
600
16
        { &ei_shicp_error,
601
16
          { "shicp.expert.error", PI_RESPONSE_CODE, PI_NOTE,
602
16
            "Message contains an error code", EXPFILL }
603
16
        },
604
16
        { &ei_shicp_malformed,
605
16
          { "shicp.malformed", PI_MALFORMED, PI_WARN,
606
16
            "Malformed message", EXPFILL }
607
16
        }
608
16
    };
609
610
16
    proto_shicp = proto_register_protocol("Secure Host IP Configuration Protocol", "SHICP", "shicp");
611
612
16
    proto_register_field_array(proto_shicp, hf, array_length(hf));
613
16
    proto_register_subtree_array(ett, array_length(ett));
614
615
16
    expert_shicp = expert_register_protocol(proto_shicp);
616
16
    expert_register_field_array(expert_shicp, ei, array_length(ei));
617
16
}
618
619
void
620
proto_reg_handoff_shicp(void)
621
16
{
622
16
    heur_dissector_add("udp", dissect_shicp_heur_udp, "SHICP over UDP", "shicp_udp", proto_shicp, HEURISTIC_ENABLE);
623
16
}
624
625
/*
626
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
627
 *
628
 * Local variables:
629
 * c-basic-offset: 4
630
 * tab-width: 8
631
 * indent-tabs-mode: nil
632
 * End:
633
 *
634
 * vi: set shiftwidth=4 tabstop=8 expandtab:
635
 * :indentSize=4:tabSize=8:noTabs=true:
636
 */