Coverage Report

Created: 2026-09-28 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-kink.c
Line
Count
Source
1
/* packet-kink.c
2
 * Routines for KINK packet disassembly
3
 * It is referenced draft-ietf-kink-kink-jp-04.txt,v 1.14 2003/02/10
4
 *
5
 * Copyright 2004, Takeshi Nakashima <T.Nakashima@jp.yokogawa.com>
6
 *
7
 * Wireshark - Network traffic analyzer
8
 * By Gerald Combs <gerald@wireshark.org>
9
 * Copyright 1998 Gerald Combs
10
 *
11
 * SPDX-License-Identifier: GPL-2.0-or-later
12
 */
13
14
15
#include "config.h"
16
17
#include <epan/packet.h>
18
#include <epan/expert.h>
19
#include <epan/asn1.h>
20
#include "packet-kerberos.h"
21
#include "packet-ike.h"
22
23
void proto_register_kink(void);
24
void proto_reg_handoff_kink(void);
25
26
static dissector_handle_t kink_handle;
27
28
16
#define KINK_PORT       910
29
30
100
#define KINK_ISAKMP_PAYLOAD_BASE 14
31
32
static int proto_kink;
33
34
/* Argument for proto_tree_add_uint() */
35
static int hf_kink_type;
36
static int hf_kink_length;
37
static int hf_kink_transactionId;
38
static int hf_kink_checkSumLength;
39
static int hf_kink_A;
40
static int hf_kink_version;
41
static int hf_kink_domain_of_interpretation;
42
static int hf_kink_qmversion;
43
static int hf_kink_error_code;
44
static int hf_kink_reserved8;
45
static int hf_kink_reserved15;
46
static int hf_kink_reserved16;
47
static int hf_kink_reserved24;
48
static int hf_kink_checkSum;
49
static int hf_kink_next_payload;
50
static int hf_kink_payload_length;
51
static int hf_kink_epoch;
52
static int hf_kink_inner_next_pload;
53
static int hf_kink_realm_name_length;
54
static int hf_kink_realm_name;
55
static int hf_kink_princ_name_length;
56
static int hf_kink_princ_name;
57
static int hf_kink_tgt_length;
58
static int hf_kink_tgt;
59
static int hf_kink_payload;
60
61
/* Argument for making the subtree */
62
static int ett_kink;
63
/*static int ett_kink_version;*/
64
static int ett_kink_payload;
65
static int ett_payload_kink_ap_req;
66
static int ett_payload_kink_ap_rep;
67
static int ett_payload_kink_krb_error;
68
static int ett_payload_kink_tgt_req;
69
static int ett_payload_kink_tgt_rep;
70
static int ett_payload_kink_isakmp;
71
static int ett_payload_kink_encrypt;
72
static int ett_payload_kink_error;
73
static int ett_payload_not_defined;
74
static int ett_decrypt_kink_encrypt;
75
76
static expert_field ei_kink_payload_length_small;
77
static expert_field ei_kink_payload_length_mismatch;
78
79
80
/* Define the kink type value */
81
#define KINK_TYPE_RESERVED 0
82
#define KINK_TYPE_CREATE   1
83
#define KINK_TYPE_DELETE   2
84
#define KINK_TYPE_REPLY    3
85
#define KINK_TYPE_GETTGT   4
86
#define KINK_TYPE_ACK      5
87
#define KINK_TYPE_STATUS   6
88
89
static const value_string kink_type_vals[]={
90
  {KINK_TYPE_RESERVED,"RESERVED"},
91
  {KINK_TYPE_CREATE,"CREATE"},
92
  {KINK_TYPE_DELETE,"DELETE"},
93
  {KINK_TYPE_REPLY,"REPLY"},
94
  {KINK_TYPE_GETTGT,"GETTGT"},
95
  {KINK_TYPE_ACK,"ACK"},
96
  {KINK_TYPE_STATUS,"STATUS"},
97
  {0, NULL},
98
};
99
100
/* Define the kink A value */
101
#define KINK_A_NOT_REQUEST_ACK  0
102
#define KINK_A_REQUEST_ACK      1
103
104
static const value_string kink_A_vals[]={
105
  {KINK_A_NOT_REQUEST_ACK,"Not Request ACK"},
106
  {KINK_A_REQUEST_ACK,"Request ACK"},
107
  {0, NULL},
108
};
109
110
/* Define the kink payload */
111
2
#define KINK_DONE                                0
112
4
#define KINK_AP_REQ     KINK_ISAKMP_PAYLOAD_BASE+0
113
2
#define KINK_AP_REP     KINK_ISAKMP_PAYLOAD_BASE+1
114
3
#define KINK_KRB_ERROR  KINK_ISAKMP_PAYLOAD_BASE+2
115
1
#define KINK_TGT_REQ    KINK_ISAKMP_PAYLOAD_BASE+3
116
1
#define KINK_TGT_REP    KINK_ISAKMP_PAYLOAD_BASE+4
117
24
#define KINK_ISAKMP     KINK_ISAKMP_PAYLOAD_BASE+5
118
1
#define KINK_ENCRYPT    KINK_ISAKMP_PAYLOAD_BASE+6
119
64
#define KINK_ERROR      KINK_ISAKMP_PAYLOAD_BASE+7
120
121
static const value_string kink_next_payload[]={
122
  {KINK_DONE, "KINK_DONE"},
123
  {KINK_AP_REQ, "KINK_AP_REQ"},
124
  {KINK_AP_REP, "KINK_AP_REP"},
125
  {KINK_KRB_ERROR, "KINK_KRB_ERROR"},
126
  {KINK_TGT_REQ, "KINK_TGT_REQ"},
127
  {KINK_TGT_REP, "KINK_TGT_REP"},
128
  {KINK_ISAKMP, "KINK_ISAKMP"},
129
  {KINK_ENCRYPT, "KINK_ENCRYPT"},
130
  {KINK_ERROR, "KINK_ERROR"},
131
  {0, NULL},
132
};
133
134
/* Define the magic number
135
 * Using at the kink error
136
 */
137
#define KINK_OK                   0
138
#define KINK_PROTOERR             1
139
#define KINK_INVDOI               2
140
#define KINK_INVMAJ               3
141
#define KINK_INVMIN               4
142
#define KINK_INTERR               5
143
#define KINK_BADQMVERS            6
144
#define BOTTOM_RESERVED           7
145
#define TOP_RESERVED           8191
146
#define BOTTOM_PRIVATE_USE     8192
147
#define TOP_PRIVATE_USE       16383
148
149
/* Using at the kink header */
150
47
#define IPSEC                     1
151
0
#define VERSION_BIT_SHIFT         4
152
47
#define A_BIT_SHIFT               7
153
#define FROM_TYPE_TO_RESERVED    16
154
155
/* Using at the payload */
156
123
#define TO_PAYLOAD_LENGTH         2
157
201
#define PADDING                   4
158
8
#define KINK_KRB_ERROR_HEADER     4
159
#define FROM_NP_TO_PL             4
160
1
#define TO_REALM_NAME_LENGTH      4
161
#define KINK_TGT_REQ_HEADER       6
162
2
#define FRONT_TGT_REP_HEADER      6
163
89
#define PAYLOAD_HEADER            8
164
128
#define KINK_ERROR_LENGTH         8
165
166
167
/* define hexadecimal */
168
0
#define FRONT_FOUR_BIT         0xf0
169
0
#define SECOND_FOUR_BIT        0x0f
170
47
#define FRONT_ONE_BIT          0x80
171
16
#define SECOND_FIFTEEN_BIT   0x7fff
172
173
/* decrypt element */
174
static uint32_t keytype;
175
176
static void control_payload(packet_info *pinfo, tvbuff_t *tvb, int offset, uint8_t next_payload, proto_tree *kink_payload_tree);
177
static void dissect_payload_kink_ap_req(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree);
178
static void dissect_payload_kink_ap_rep(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree);
179
static void dissect_payload_kink_krb_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree);
180
static void dissect_payload_kink_tgt_req(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree);
181
static void dissect_payload_kink_tgt_rep(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree);
182
static void dissect_payload_kink_isakmp(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree);
183
static void dissect_payload_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree);
184
static void dissect_payload_kink_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree);
185
static void dissect_payload_kink_not_defined(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree);
186
#ifdef HAVE_KERBEROS
187
static void dissect_decrypt_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, int payload_length);
188
#endif
189
190
/* This function is dissecting the kink header. */
191
static int
192
47
dissect_kink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_){
193
47
  proto_item *ti = NULL;
194
47
  proto_tree *kink_tree = NULL;
195
47
  uint8_t type;
196
47
  uint32_t doi;
197
47
  unsigned chsumlen;
198
47
  uint8_t next_payload;
199
47
  uint8_t value_a_and_front_reserved;
200
47
  uint8_t value_a;
201
47
  int offset=0;
202
203
47
  type = tvb_get_uint8(tvb,offset);
204
205
47
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "KINK");
206
207
  /* It shows kink type by the type value. */
208
47
  col_set_str(pinfo->cinfo, COL_INFO,  val_to_str_const(type, kink_type_vals, "unknown"));
209
210
  /* Make the kink tree */
211
47
  ti = proto_tree_add_item(tree, proto_kink, tvb, offset, -1, ENC_NA);
212
47
  kink_tree = proto_item_add_subtree(ti, ett_kink);
213
214
47
  proto_tree_add_uint(kink_tree, hf_kink_type, tvb, offset, 1, type);
215
47
  offset++;
216
217
47
  proto_tree_add_item(kink_tree, hf_kink_version, tvb, offset, 1, ENC_BIG_ENDIAN);
218
47
  offset++;
219
220
47
  proto_tree_add_item(kink_tree, hf_kink_length, tvb, offset, 2, ENC_BIG_ENDIAN);
221
47
  offset += 2;
222
223
47
  doi = tvb_get_ntohl(tvb, offset);
224
225
47
  if(doi == IPSEC){
226
0
    proto_tree_add_uint_format_value(kink_tree, hf_kink_domain_of_interpretation, tvb, offset, 4, doi, "IPsec (%u)", doi);
227
0
  }
228
47
  else{
229
47
    proto_tree_add_uint_format_value(kink_tree, hf_kink_domain_of_interpretation, tvb, offset, 4, doi, "Not IPsec (%u)", doi);
230
47
  }
231
47
  offset += 4;
232
233
47
  proto_tree_add_item(kink_tree, hf_kink_transactionId, tvb, offset, 4,  ENC_BIG_ENDIAN);
234
47
  offset += 4;
235
236
47
  chsumlen = tvb_get_uint8(tvb, offset);
237
47
  proto_tree_add_item(kink_tree, hf_kink_checkSumLength, tvb, offset, 1, ENC_BIG_ENDIAN);
238
47
  offset ++;
239
240
47
  next_payload = tvb_get_uint8(tvb, offset);
241
47
  proto_tree_add_uint(kink_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
242
47
  offset ++;
243
244
  /* A is 1bit field. The calculation of A is shown below.
245
   * The logical product of 1octet value and 0x80 is performed.
246
   * And It is performed 7bit right shift.
247
   */
248
47
  value_a_and_front_reserved = tvb_get_uint8(tvb, offset);
249
47
  value_a = (value_a_and_front_reserved & FRONT_ONE_BIT) >> A_BIT_SHIFT;
250
47
  proto_tree_add_uint(kink_tree, hf_kink_A, tvb, offset, 1, value_a);
251
252
  /* The reserved field is 15bit.
253
   * The logical product of 2octet value and 0x7fff is performed.
254
   */
255
47
  proto_tree_add_item(kink_tree, hf_kink_reserved15, tvb, offset, 2, ENC_BIG_ENDIAN);
256
47
  offset += 2;
257
258
47
  proto_tree_add_item(kink_tree, hf_kink_checkSum, tvb, offset, chsumlen, ENC_NA);
259
260
  /* This part consider the padding. Chsumlen don't contain the padding. */
261
47
  if((chsumlen % PADDING) != 0){
262
36
    chsumlen += (PADDING - (chsumlen % PADDING));
263
36
    offset += chsumlen;
264
36
  }
265
11
  else{
266
11
    offset += chsumlen;
267
11
  }
268
269
47
  control_payload(pinfo, tvb, offset, next_payload, kink_tree);
270
271
47
  return tvb_captured_length(tvb);
272
47
}
273
274
/* This part call the dissect payload function by next_payload value.
275
 * This function called by the respective function again.
276
 */
277
static void
278
// NOLINTNEXTLINE(misc-no-recursion)
279
125
control_payload(packet_info *pinfo, tvbuff_t *tvb, int offset, uint8_t next_payload, proto_tree *kink_tree){
280
125
  switch(next_payload){
281
2
  case KINK_DONE:
282
2
    break;
283
4
  case KINK_AP_REQ:
284
4
    dissect_payload_kink_ap_req(pinfo, tvb, offset, kink_tree);
285
4
    break;
286
2
  case KINK_AP_REP:
287
2
    dissect_payload_kink_ap_rep(pinfo, tvb, offset, kink_tree);
288
2
    break;
289
3
  case KINK_KRB_ERROR:
290
3
    dissect_payload_kink_krb_error(pinfo, tvb, offset, kink_tree);
291
3
    break;
292
1
  case KINK_TGT_REQ:
293
1
    dissect_payload_kink_tgt_req(pinfo, tvb, offset, kink_tree);
294
1
    break;
295
1
  case KINK_TGT_REP:
296
1
    dissect_payload_kink_tgt_rep(pinfo, tvb, offset, kink_tree);
297
1
    break;
298
24
  case KINK_ISAKMP:
299
24
    dissect_payload_kink_isakmp(pinfo, tvb, offset, kink_tree);
300
24
    break;
301
1
  case KINK_ENCRYPT:
302
1
    dissect_payload_kink_encrypt(pinfo, tvb, offset, kink_tree);
303
1
    break;
304
64
  case KINK_ERROR:
305
64
    dissect_payload_kink_error(pinfo, tvb, offset, kink_tree);
306
64
    break;
307
23
  default:
308
23
    dissect_payload_kink_not_defined(pinfo, tvb, offset, kink_tree);
309
23
    break;
310
125
  }
311
125
}
312
313
static void
314
// NOLINTNEXTLINE(misc-no-recursion)
315
4
dissect_payload_kink_ap_req(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
316
4
  proto_tree *payload_kink_ap_req_tree;
317
4
  proto_item *ti;
318
4
  uint8_t next_payload;
319
4
  unsigned payload_length;
320
4
  uint16_t krb_ap_req_length;
321
4
  int start_payload_offset = 0;  /* Keep beginning of payload offset */
322
323
4
  start_payload_offset = offset;
324
4
  payload_length = tvb_get_ntohs(tvb, offset + TO_PAYLOAD_LENGTH);
325
326
  /* Make the subtree. */
327
4
  payload_kink_ap_req_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
328
4
                        ett_payload_kink_ap_req, NULL, "KINK_AP_REQ");
329
330
4
  next_payload = tvb_get_uint8(tvb, offset);
331
4
  proto_tree_add_uint(payload_kink_ap_req_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
332
4
  offset ++;
333
334
4
  proto_tree_add_item(payload_kink_ap_req_tree, hf_kink_reserved8, tvb, offset, 1, ENC_BIG_ENDIAN);
335
4
  offset ++;
336
337
4
  ti = proto_tree_add_uint(payload_kink_ap_req_tree, hf_kink_payload_length, tvb, offset, 2, payload_length);
338
4
  if(payload_length <= PAYLOAD_HEADER){
339
1
    expert_add_info(pinfo, ti, &ei_kink_payload_length_small);
340
1
  }
341
4
  offset += 2;
342
343
  /* Show time as UTC, not local time. */
344
4
  proto_tree_add_item(payload_kink_ap_req_tree, hf_kink_epoch, tvb, offset, 4, ENC_BIG_ENDIAN);
345
4
  offset += 4;
346
347
4
  if(payload_length > PAYLOAD_HEADER){
348
3
    tvbuff_t *krb_tvb;
349
350
3
    krb_ap_req_length = payload_length - PAYLOAD_HEADER;
351
3
    krb_tvb=tvb_new_subset_length(tvb, offset, krb_ap_req_length);
352
3
    keytype=kerberos_output_keytype();
353
3
    dissect_kerberos_main(krb_tvb, pinfo, payload_kink_ap_req_tree, false, NULL);
354
    /*offset += krb_ap_req_length;*/
355
3
  }
356
357
  /* This part consider padding the padding. Payload_length don't contain the padding. */
358
4
  if(payload_length % PADDING != 0){
359
3
    payload_length += (PADDING - (payload_length % PADDING));
360
3
  }
361
4
  offset = start_payload_offset + payload_length;
362
363
4
  if(payload_length > 0) {
364
4
    control_payload(pinfo, tvb, offset, next_payload, tree); /* Recur control_payload() */
365
4
  }
366
4
}
367
368
369
static void
370
// NOLINTNEXTLINE(misc-no-recursion)
371
2
dissect_payload_kink_ap_rep(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
372
2
  proto_tree *payload_kink_ap_rep_tree;
373
2
  proto_item *ti;
374
2
  uint8_t next_payload;
375
2
  unsigned payload_length;
376
2
  uint16_t krb_ap_rep_length;
377
2
  int start_payload_offset = 0; /* Keep beginning of payload offset */
378
379
2
  payload_length = tvb_get_ntohs(tvb, offset + TO_PAYLOAD_LENGTH);
380
2
  start_payload_offset = offset;
381
382
  /* Make the subtree */
383
2
  payload_kink_ap_rep_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
384
2
                        ett_payload_kink_ap_rep, NULL, "KINK_AP_REP");
385
386
2
  next_payload = tvb_get_uint8(tvb, offset);
387
2
  proto_tree_add_uint(payload_kink_ap_rep_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
388
2
  offset ++;
389
390
2
  proto_tree_add_item(payload_kink_ap_rep_tree, hf_kink_reserved8, tvb, offset, 1, ENC_BIG_ENDIAN);
391
2
  offset ++;
392
393
2
  ti = proto_tree_add_uint(payload_kink_ap_rep_tree, hf_kink_payload_length, tvb, offset, 2, payload_length);
394
2
  if(payload_length <= PAYLOAD_HEADER){
395
1
    expert_add_info(pinfo, ti, &ei_kink_payload_length_small);
396
1
  }
397
2
  offset += 2;
398
399
  /* Show time as UTC, not local time. */
400
2
  proto_tree_add_item(payload_kink_ap_rep_tree, hf_kink_epoch, tvb, offset, 4, ENC_BIG_ENDIAN);
401
2
  offset += 4;
402
403
2
  if(payload_length > PAYLOAD_HEADER){
404
1
    tvbuff_t *krb_tvb;
405
406
1
    krb_ap_rep_length = payload_length - PAYLOAD_HEADER;
407
1
    krb_tvb=tvb_new_subset_length(tvb, offset, krb_ap_rep_length);
408
1
    keytype=kerberos_output_keytype();
409
1
    dissect_kerberos_main(krb_tvb, pinfo, payload_kink_ap_rep_tree, false, NULL);
410
411
    /*offset += krb_ap_rep_length;*/
412
1
  }
413
414
  /* This part consider the padding. Payload_length don't contain the padding. */
415
2
  if(payload_length % PADDING != 0){
416
0
    payload_length += (PADDING - (payload_length % PADDING));
417
0
  }
418
2
  offset = start_payload_offset + payload_length;
419
420
2
  if(payload_length > 0) {
421
0
    control_payload(pinfo, tvb, offset, next_payload, tree); /* Recur control_payload() */
422
0
  }
423
2
}
424
425
static void
426
// NOLINTNEXTLINE(misc-no-recursion)
427
3
dissect_payload_kink_krb_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
428
3
  proto_tree *payload_kink_krb_error_tree;
429
3
  proto_item *ti;
430
3
  uint8_t next_payload;
431
3
  unsigned payload_length;
432
3
  uint16_t krb_error_length;
433
3
  int start_payload_offset = 0; /* Keep the beginning of the payload offset  */
434
435
3
  payload_length = tvb_get_ntohs(tvb, offset + TO_PAYLOAD_LENGTH);
436
3
  start_payload_offset = offset;
437
438
  /* Make the subtree */
439
3
  payload_kink_krb_error_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
440
3
                                    ett_payload_kink_krb_error, NULL, "KINK_KRB_ERROR");
441
442
3
  next_payload = tvb_get_uint8(tvb, offset);
443
3
  proto_tree_add_uint(payload_kink_krb_error_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
444
3
  offset ++;
445
446
3
  proto_tree_add_item(payload_kink_krb_error_tree, hf_kink_reserved8, tvb, offset, 1, ENC_BIG_ENDIAN);
447
3
  offset ++;
448
449
3
  ti = proto_tree_add_uint(payload_kink_krb_error_tree, hf_kink_payload_length, tvb, offset, 2, payload_length);
450
3
  if(payload_length <= KINK_KRB_ERROR_HEADER){
451
1
    expert_add_info(pinfo, ti, &ei_kink_payload_length_small);
452
1
  }
453
2
  else {
454
2
    offset += 2;
455
2
  }
456
457
3
  if(payload_length > KINK_KRB_ERROR_HEADER){
458
2
    tvbuff_t *krb_tvb;
459
460
2
    krb_error_length = payload_length - KINK_KRB_ERROR_HEADER;
461
2
    krb_tvb=tvb_new_subset_length(tvb, offset, krb_error_length);
462
463
2
    dissect_kerberos_main(krb_tvb, pinfo, payload_kink_krb_error_tree, false, NULL);
464
    /*offset += krb_error_length;*/
465
2
  }
466
467
  /* This part consider the padding. Payload_length don't contain the padding. */
468
3
  if(payload_length % PADDING != 0){
469
1
    payload_length += (PADDING - (payload_length % PADDING));
470
1
  }
471
3
  offset = start_payload_offset + payload_length;
472
473
3
  if(payload_length > 0) {
474
2
    control_payload(pinfo, tvb, offset, next_payload, tree); /* Recur control_payload() */
475
2
  }
476
3
}
477
478
static void
479
// NOLINTNEXTLINE(misc-no-recursion)
480
1
dissect_payload_kink_tgt_req(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
481
1
  proto_tree *payload_kink_tgt_req_tree;
482
1
  uint8_t next_payload;
483
1
  unsigned payload_length;
484
1
  uint16_t realm_name_length;
485
1
  int start_payload_offset = 0; /* Keep the beginning of the payload offset  */
486
487
1
  payload_length = tvb_get_ntohs(tvb, offset + TO_PAYLOAD_LENGTH);
488
1
  realm_name_length = tvb_get_ntohs(tvb, offset + TO_REALM_NAME_LENGTH);
489
1
  start_payload_offset = offset;
490
491
  /* Make the subtree */
492
1
  payload_kink_tgt_req_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
493
1
                                        ett_payload_kink_tgt_req, NULL, "KINK_TGT_REQ");
494
495
1
  next_payload = tvb_get_uint8(tvb, offset);
496
1
  proto_tree_add_uint(payload_kink_tgt_req_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
497
1
  offset ++;
498
499
1
  proto_tree_add_item(payload_kink_tgt_req_tree, hf_kink_reserved8, tvb, offset, 1, ENC_BIG_ENDIAN);
500
1
  offset ++;
501
502
1
  proto_tree_add_uint(payload_kink_tgt_req_tree, hf_kink_payload_length, tvb, offset, 2, payload_length);
503
1
  offset += 2;
504
505
1
  proto_tree_add_uint(payload_kink_tgt_req_tree, hf_kink_realm_name_length, tvb, offset, 2, realm_name_length);
506
1
  offset += 2;
507
508
1
  proto_tree_add_item(payload_kink_tgt_req_tree, hf_kink_realm_name, tvb, offset, realm_name_length, ENC_ASCII);
509
510
  /* This part consider the padding. Payload_length don't contain the padding. */
511
1
  if(payload_length % PADDING != 0){
512
0
    payload_length += (PADDING - (payload_length % PADDING));
513
0
  }
514
1
  offset = start_payload_offset + payload_length;
515
516
1
  if(payload_length > 0) {
517
1
    control_payload(pinfo, tvb, offset, next_payload, tree); /* Recur control_payload() */
518
1
  }
519
1
}
520
521
static void
522
// NOLINTNEXTLINE(misc-no-recursion)
523
1
dissect_payload_kink_tgt_rep(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
524
1
  proto_tree *payload_kink_tgt_rep_tree;
525
1
  uint8_t next_payload;
526
1
  unsigned payload_length;
527
1
  unsigned princ_name_length;
528
1
  uint16_t tgt_length;
529
1
  int start_payload_offset = 0; /* Keep the beginning of the payload offset  */
530
531
1
  payload_length = tvb_get_ntohs(tvb, offset + TO_PAYLOAD_LENGTH);
532
1
  start_payload_offset = offset;
533
534
  /* Make the subtree */
535
1
  payload_kink_tgt_rep_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
536
1
                                ett_payload_kink_tgt_rep, NULL, "KINK_TGT_REP");
537
538
1
  next_payload = tvb_get_uint8(tvb, offset);
539
1
  proto_tree_add_uint(payload_kink_tgt_rep_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
540
1
  offset ++;
541
542
1
  proto_tree_add_item(payload_kink_tgt_rep_tree, hf_kink_reserved8, tvb, offset, 1, ENC_BIG_ENDIAN);
543
1
  offset ++;
544
545
1
  proto_tree_add_uint(payload_kink_tgt_rep_tree, hf_kink_payload_length, tvb, offset, 2, payload_length);
546
1
  offset += 2;
547
548
1
  princ_name_length = tvb_get_ntohs(tvb, offset);
549
1
  proto_tree_add_uint(payload_kink_tgt_rep_tree, hf_kink_princ_name_length, tvb, offset, 2, princ_name_length);
550
1
  offset += 2;
551
552
1
  proto_tree_add_item(payload_kink_tgt_rep_tree, hf_kink_princ_name, tvb, offset, princ_name_length, ENC_ASCII);
553
554
  /* This part consider the padding. Princ_name_length don't contain the padding. */
555
1
  if((princ_name_length + FRONT_TGT_REP_HEADER) % PADDING != 0){
556
1
    offset += (princ_name_length + PADDING - ((princ_name_length + FRONT_TGT_REP_HEADER) %  PADDING));
557
1
  }
558
0
  else{
559
0
    offset += princ_name_length;
560
0
  }
561
562
1
  tgt_length = tvb_get_ntohs(tvb, offset);
563
1
  proto_tree_add_uint(payload_kink_tgt_rep_tree, hf_kink_tgt_length, tvb, offset, 2, tgt_length);
564
1
  offset += 2;
565
566
1
  proto_tree_add_item(payload_kink_tgt_rep_tree, hf_kink_tgt, tvb, offset, tgt_length, ENC_ASCII);
567
  /*offset += tgt_length;*/
568
569
  /* This part consider the padding. Payload_length don't contain the padding. */
570
1
  if(payload_length % PADDING!=0){
571
0
    payload_length += (PADDING - (payload_length % PADDING));
572
0
  }
573
1
  offset = start_payload_offset + payload_length;
574
575
1
  if(payload_length > 0) {
576
0
    control_payload(pinfo, tvb, offset, next_payload, tree); /* Recur control_payload() */
577
0
  }
578
1
}
579
580
static void
581
// NOLINTNEXTLINE(misc-no-recursion)
582
24
dissect_payload_kink_isakmp(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
583
24
  proto_tree *payload_kink_isakmp_tree;
584
24
  proto_item *ti;
585
24
  uint8_t next_payload;
586
24
  unsigned payload_length,isakmp_length;
587
24
  int reported_length;
588
24
  uint8_t inner_next_pload;
589
24
  int start_payload_offset = 0;      /* Keep the beginning of the payload offset */
590
24
  tvbuff_t *isakmp_tvb;
591
592
24
  payload_length = tvb_get_ntohs(tvb, offset + TO_PAYLOAD_LENGTH);
593
24
  start_payload_offset = offset;
594
595
  /* Make the subtree. */
596
24
  payload_kink_isakmp_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
597
24
                                        ett_payload_kink_isakmp, NULL, "KINK_ISAKMP");
598
599
24
  next_payload = tvb_get_uint8(tvb, offset);
600
24
  proto_tree_add_uint(payload_kink_isakmp_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
601
24
  offset ++;
602
603
24
  proto_tree_add_item(payload_kink_isakmp_tree, hf_kink_reserved8, tvb, offset, 1, ENC_BIG_ENDIAN);
604
24
  offset ++;
605
606
24
  ti = proto_tree_add_uint(payload_kink_isakmp_tree, hf_kink_payload_length, tvb, offset, 2, payload_length);
607
24
  if(payload_length <= PAYLOAD_HEADER){
608
2
    expert_add_info(pinfo, ti, &ei_kink_payload_length_small);
609
2
  }
610
24
  offset += 2;
611
612
24
  inner_next_pload = tvb_get_uint8(tvb, offset);
613
24
  proto_tree_add_uint(payload_kink_isakmp_tree, hf_kink_inner_next_pload, tvb, offset, 1, inner_next_pload);
614
24
  offset += 1;
615
616
24
  proto_tree_add_item(payload_kink_isakmp_tree, hf_kink_qmversion, tvb, offset, 1, ENC_BIG_ENDIAN);
617
24
  offset += 1;
618
619
24
  proto_tree_add_item(payload_kink_isakmp_tree, hf_kink_reserved16, tvb, offset, 2, ENC_BIG_ENDIAN);
620
24
  offset += 2;
621
622
24
  if(payload_length > PAYLOAD_HEADER){
623
22
    isakmp_length = payload_length - PAYLOAD_HEADER;
624
22
    reported_length = tvb_reported_length_remaining(tvb, offset);
625
22
    if (reported_length > (int)isakmp_length)
626
1
      reported_length = isakmp_length;
627
22
    isakmp_tvb = tvb_new_subset_length(tvb, offset, reported_length);
628
22
    isakmp_dissect_payloads(isakmp_tvb, payload_kink_isakmp_tree, 1, inner_next_pload, 0, isakmp_length, pinfo);
629
22
  }
630
631
  /* This part consider the padding. Payload_length don't contain the padding. */
632
24
  if(payload_length % PADDING != 0){
633
0
    payload_length += (PADDING - (payload_length % PADDING));
634
0
  }
635
24
  offset = start_payload_offset + payload_length;
636
637
24
  if(payload_length > 0) {
638
1
    control_payload(pinfo, tvb, offset, next_payload, tree);  /* Recur control_payload() */
639
1
  }
640
24
}
641
642
static void
643
// NOLINTNEXTLINE(misc-no-recursion)
644
1
dissect_payload_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
645
1
  proto_tree *payload_kink_encrypt_tree;
646
1
  proto_item *ti;
647
1
  uint8_t next_payload;
648
1
  unsigned payload_length;
649
#ifdef HAVE_KERBEROS
650
  int encrypt_length;
651
#endif
652
1
  uint8_t inner_next_pload;
653
1
  uint16_t inner_payload_length;
654
1
  int start_payload_offset = 0;    /* Keep the beginning of the payload offset */
655
656
1
  payload_length = tvb_get_ntohs(tvb,offset + TO_PAYLOAD_LENGTH);
657
1
  start_payload_offset = offset;
658
659
#ifdef HAVE_KERBEROS
660
  encrypt_length = payload_length - FROM_NP_TO_PL;
661
#endif
662
  /* Make the subtree */
663
1
  payload_kink_encrypt_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
664
1
                                            ett_payload_kink_encrypt, NULL, "KINK_ENCRYPT");
665
666
1
  next_payload = tvb_get_uint8(tvb, offset);
667
1
  proto_tree_add_uint(payload_kink_encrypt_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
668
1
  offset ++;
669
670
1
  proto_tree_add_item(payload_kink_encrypt_tree, hf_kink_reserved8, tvb, offset, 1, ENC_BIG_ENDIAN);
671
1
  offset ++;
672
673
1
  ti = proto_tree_add_uint(payload_kink_encrypt_tree, hf_kink_payload_length, tvb, offset, 2, payload_length);
674
1
  if(payload_length <= PAYLOAD_HEADER){
675
0
    expert_add_info(pinfo, ti, &ei_kink_payload_length_small);
676
0
  }
677
1
  offset += 2;
678
679
  /* decrypt kink encrypt */
680
681
1
  if(keytype != 0){
682
#ifdef HAVE_KERBEROS
683
    tvbuff_t *next_tvb;
684
    uint8_t *plaintext=NULL;
685
686
    next_tvb=tvb_new_subset_length(tvb, offset, encrypt_length);
687
    plaintext=decrypt_krb5_data(tree, pinfo, 0, next_tvb, keytype, NULL);
688
    if(plaintext){
689
      next_tvb=tvb_new_child_real_data(tvb, plaintext, encrypt_length, encrypt_length);
690
      add_new_data_source(pinfo, next_tvb, "decrypted kink encrypt");
691
      dissect_decrypt_kink_encrypt(pinfo, next_tvb, tree, encrypt_length);
692
    }
693
#endif
694
0
  }
695
1
  else{
696
1
    inner_next_pload = tvb_get_uint8(tvb, offset);
697
1
    proto_tree_add_uint(payload_kink_encrypt_tree, hf_kink_inner_next_pload, tvb, offset, 1, inner_next_pload);
698
1
    offset += 1;
699
700
1
    proto_tree_add_item(payload_kink_encrypt_tree, hf_kink_reserved24, tvb, offset, 3, ENC_BIG_ENDIAN);
701
1
    offset += 3;
702
703
1
    if(payload_length > PAYLOAD_HEADER){
704
1
      inner_payload_length = payload_length - PAYLOAD_HEADER;
705
1
      proto_tree_add_item(payload_kink_encrypt_tree, hf_kink_payload, tvb, offset, inner_payload_length, ENC_NA);
706
      /*offset += inner_payload_length;*/
707
1
    }
708
1
  }
709
  /* This part consider the padding. Payload_length don't contain the padding. */
710
1
  if(payload_length % PADDING !=0){
711
0
    payload_length += (PADDING - (payload_length % PADDING));
712
0
  }
713
1
  offset = start_payload_offset + payload_length;
714
715
1
  if(payload_length > 0) {
716
0
    control_payload(pinfo, tvb, offset, next_payload, tree);  /* Recur control_payload() */
717
0
  }
718
1
}
719
720
#ifdef HAVE_KERBEROS
721
static void
722
// NOLINTNEXTLINE(misc-no-recursion)
723
dissect_decrypt_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, int payload_length){
724
725
  proto_tree *decrypt_kink_encrypt_tree;
726
  int offset=0;
727
  uint8_t next_payload;
728
729
  decrypt_kink_encrypt_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
730
                                    ett_decrypt_kink_encrypt, NULL, "decrypted data");
731
732
  next_payload = tvb_get_uint8(tvb, offset);
733
734
  proto_tree_add_uint(decrypt_kink_encrypt_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
735
  offset ++;
736
737
  proto_tree_add_item(decrypt_kink_encrypt_tree, hf_kink_reserved24, tvb, offset, 3, ENC_BIG_ENDIAN);
738
  offset += 3;
739
740
  control_payload(pinfo, tvb, offset, next_payload, decrypt_kink_encrypt_tree);
741
}
742
#endif
743
744
static const range_string kink_error_rvals[] = {
745
    { 0, 0,  "KINK_OK" },
746
    { 1, 1,  "KINK_PROTOERR" },
747
    { 2, 2,  "KINK_INVDOI" },
748
    { 3, 3,  "KINK_INVMAJ" },
749
    { 4, 4,  "KINK_INVMIN" },
750
    { 5, 5,  "KINK_INTERR" },
751
    { 6, 6,  "KINK_BADQMVERS" },
752
    { BOTTOM_RESERVED, TOP_RESERVED,  "RESERVED" },
753
    { BOTTOM_PRIVATE_USE, TOP_PRIVATE_USE,  "PRIVATE USE" },
754
    { TOP_PRIVATE_USE+1, 0xffffffff,  "This Error Code is not Defined." },
755
    { 0, 0, NULL }
756
};
757
758
static void
759
// NOLINTNEXTLINE(misc-no-recursion)
760
64
dissect_payload_kink_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
761
64
  proto_tree *payload_kink_error_tree;
762
64
  proto_item *ti;
763
64
  uint8_t next_payload;
764
64
  uint16_t payload_length;
765
64
  int start_payload_offset = 0; /* Keep the beginning of the payload offset */
766
767
64
  payload_length = tvb_get_ntohs(tvb,offset + TO_PAYLOAD_LENGTH);
768
64
  start_payload_offset = offset;
769
770
  /* Make the subtree */
771
64
  payload_kink_error_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
772
64
                                            ett_payload_kink_error, NULL, "KINK_ERROR");
773
774
64
  next_payload = tvb_get_uint8(tvb, offset);
775
64
  proto_tree_add_uint(payload_kink_error_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
776
64
  offset ++;
777
778
64
  proto_tree_add_item(payload_kink_error_tree, hf_kink_reserved8, tvb, offset, 1, ENC_BIG_ENDIAN);
779
64
  offset ++;
780
781
64
  ti = proto_tree_add_uint(payload_kink_error_tree, hf_kink_payload_length, tvb, offset, 2, payload_length);
782
64
  if(payload_length != KINK_ERROR_LENGTH){
783
62
    expert_add_info(pinfo, ti, &ei_kink_payload_length_mismatch);
784
62
  }
785
64
  offset += 2;
786
787
64
  proto_tree_add_item(payload_kink_error_tree, hf_kink_error_code, tvb, offset, 4, ENC_BIG_ENDIAN);
788
789
64
  offset = start_payload_offset + KINK_ERROR_LENGTH;
790
64
  control_payload(pinfo, tvb, offset, next_payload, tree);  /* Recur control_payload() */
791
64
}
792
793
static void
794
// NOLINTNEXTLINE(misc-no-recursion)
795
23
dissect_payload_kink_not_defined(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
796
23
  proto_tree *payload_kink_not_defined_tree;
797
23
  uint8_t next_payload;
798
23
  unsigned payload_length;
799
23
  int start_payload_offset = 0;   /* Keep the beginning of the payload offset */
800
801
23
  start_payload_offset = offset;
802
23
  payload_length = tvb_get_ntohs(tvb, offset + TO_PAYLOAD_LENGTH);
803
804
  /* Make the subtree */
805
23
  payload_kink_not_defined_tree = proto_tree_add_subtree(tree, tvb, offset, payload_length,
806
23
                                    ett_payload_not_defined, NULL, "UNKNOWN PAYLOAD");
807
808
23
  next_payload = tvb_get_uint8(tvb, offset);
809
23
  proto_tree_add_uint(payload_kink_not_defined_tree, hf_kink_next_payload, tvb, offset, 1, next_payload);
810
23
  offset ++;
811
812
23
  proto_tree_add_item(payload_kink_not_defined_tree, hf_kink_reserved8, tvb, offset, 1, ENC_BIG_ENDIAN);
813
23
  offset ++;
814
815
23
  proto_tree_add_uint(payload_kink_not_defined_tree, hf_kink_payload_length, tvb, offset, 2, payload_length);
816
817
  /* This part consider the padding. Payload_length don't contain the padding. */
818
23
  if(payload_length % PADDING != 0){
819
6
    payload_length += (PADDING - (payload_length % PADDING));
820
6
  }
821
23
  offset = start_payload_offset + payload_length;
822
823
  /* XXX - prevent an endless loop if payload_length is 0, don't know the correct way to handle this! */
824
23
  if(payload_length > 0) {
825
12
    control_payload(pinfo, tvb, offset, next_payload, tree);
826
12
  }
827
23
}
828
829
static void
830
kink_fmt_version( char *result, uint32_t version )
831
0
{
832
0
  uint8_t major_version, minor_version;
833
834
  /* This part is the version. Consider less than 1 octet value.
835
   * Major version and minor version is 4bit. Front half of 1octet
836
   * is major version, and second half of 1octet is minor version.
837
   * The calculation of major version is shown below.
838
   * The logical product of the value of 1octet and 0xf0 is performed.
839
   * And It is performed 4bit right shift.
840
   * Secondarily, the calculation of minor version is shown below.
841
   * The logical product of the value of 1octet and 0x0f is performed.
842
   */
843
0
  major_version = (uint8_t)((version & FRONT_FOUR_BIT) >> VERSION_BIT_SHIFT);
844
0
  minor_version = (uint8_t)(version & SECOND_FOUR_BIT);
845
846
0
  snprintf( result, ITEM_LABEL_LENGTH, "%d.%02d", major_version, minor_version);
847
0
}
848
849
/* Output part */
850
void
851
16
proto_register_kink(void) {
852
853
16
  static hf_register_info hf[] = {
854
16
    { &hf_kink_type,
855
16
      { "Type", "kink.type",
856
16
        FT_UINT8,       BASE_DEC,       VALS(kink_type_vals),   0x0,
857
16
        NULL, HFILL }},
858
16
    { &hf_kink_length,
859
16
      { "Length",       "kink.length",
860
16
        FT_UINT16,      BASE_DEC,       NULL,   0x0,
861
16
        NULL, HFILL }},
862
16
    { &hf_kink_transactionId,
863
16
      { "Transaction ID",       "kink.transactionId",
864
16
        FT_UINT32,      BASE_DEC,       NULL,   0x0,
865
16
        NULL, HFILL }},
866
16
    { &hf_kink_checkSumLength,
867
16
      { "Checksum Length",       "kink.checkSumLength",
868
16
        FT_UINT8,       BASE_DEC,       NULL,   0x0,
869
16
        NULL, HFILL }},
870
16
    { &hf_kink_A,
871
16
      { "A",       "kink.A",
872
16
        FT_UINT8,       BASE_DEC,       VALS(kink_A_vals),      0x0,
873
16
        NULL, HFILL }},
874
16
    { &hf_kink_version,
875
16
      { "Version",       "kink.version",
876
16
        FT_UINT8,       BASE_CUSTOM,       CF_FUNC(kink_fmt_version),      0x0,
877
16
        NULL, HFILL }},
878
16
    { &hf_kink_domain_of_interpretation,
879
16
      { "Domain Of Interpretation",       "kink.domain_of_interpretation",
880
16
        FT_UINT32,      BASE_DEC,       NULL,   0x0,
881
16
        NULL, HFILL }},
882
16
    { &hf_kink_qmversion,
883
16
      { "QMVersion",       "kink.qmversion",
884
16
        FT_UINT8,       BASE_CUSTOM,       CF_FUNC(kink_fmt_version),      0x0,
885
16
        NULL, HFILL }},
886
16
    { &hf_kink_error_code,
887
16
      { "ErrorCode",       "kink.error_code",
888
16
        FT_UINT32,      BASE_DEC|BASE_RANGE_STRING,       RVALS(kink_error_rvals),   0x0,
889
16
        NULL, HFILL }},
890
16
    { &hf_kink_reserved8,
891
16
      { "Reserved",       "kink.reserved",
892
16
        FT_UINT8,      BASE_DEC,       NULL,   0x0,
893
16
        NULL, HFILL }},
894
16
    { &hf_kink_reserved15,
895
16
      { "Reserved",       "kink.reserved",
896
16
        FT_UINT16,      BASE_DEC,       NULL,   SECOND_FIFTEEN_BIT,
897
16
        NULL, HFILL }},
898
16
    { &hf_kink_reserved16,
899
16
      { "Reserved",       "kink.reserved",
900
16
        FT_UINT16,      BASE_DEC,       NULL,   0,
901
16
        NULL, HFILL }},
902
16
    { &hf_kink_reserved24,
903
16
      { "Reserved",       "kink.reserved",
904
16
        FT_UINT24,      BASE_DEC,       NULL,   0,
905
16
        NULL, HFILL }},
906
16
    { &hf_kink_checkSum,
907
16
      { "Checksum",       "kink.checkSum",
908
16
        FT_BYTES,       BASE_NONE,      NULL,   0x0,
909
16
        NULL, HFILL }},
910
16
    { &hf_kink_next_payload,
911
16
      { "Next Payload",       "kink.nextPayload",
912
16
        FT_UINT8,       BASE_DEC,       VALS(kink_next_payload),        0x0,
913
16
        NULL, HFILL }},
914
16
    { &hf_kink_payload_length,
915
16
      { "Payload Length",       "kink.payloadLength",
916
16
        FT_UINT16,      BASE_DEC,       NULL,        0x0,
917
16
        NULL, HFILL }},
918
16
    { &hf_kink_epoch,
919
16
      { "EPOCH",       "kink.epoch",
920
16
        FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC,       NULL,        0x0,
921
16
        NULL, HFILL }},
922
16
    { &hf_kink_inner_next_pload,
923
16
      { "InnerNextPload",       "kink.innerNextPload",
924
16
        FT_UINT8,       BASE_DEC,       NULL,        0x0,
925
16
        NULL, HFILL }},
926
16
    { &hf_kink_realm_name_length,
927
16
      { "RealmNameLength",       "kink.realmNameLength",
928
16
        FT_UINT16,      BASE_DEC,       NULL,   0,
929
16
        NULL, HFILL }},
930
16
    { &hf_kink_realm_name,
931
16
      { "RealmName",       "kink.realmName",
932
16
        FT_STRING,      BASE_NONE,       NULL,   0,
933
16
        NULL, HFILL }},
934
16
    { &hf_kink_princ_name_length,
935
16
      { "PrincNameLength",       "kink.princNameLength",
936
16
        FT_UINT16,      BASE_DEC,       NULL,   0,
937
16
        NULL, HFILL }},
938
16
    { &hf_kink_princ_name,
939
16
      { "PrincName",       "kink.princName",
940
16
        FT_STRING,      BASE_NONE,       NULL,   0,
941
16
        NULL, HFILL }},
942
16
    { &hf_kink_tgt_length,
943
16
      { "TGT Length",       "kink.tgtLength",
944
16
        FT_UINT16,      BASE_DEC,       NULL,   0,
945
16
        NULL, HFILL }},
946
16
    { &hf_kink_tgt,
947
16
      { "TGT",       "kink.tgt",
948
16
        FT_STRING,      BASE_NONE,       NULL,   0,
949
16
        NULL, HFILL }},
950
16
    { &hf_kink_payload,
951
16
      { "Payload",       "kink.payload",
952
16
        FT_BYTES,      BASE_NONE,       NULL,   0,
953
16
        NULL, HFILL }},
954
16
  };
955
956
  /* Argument for making the subtree. */
957
16
  static int *ett[] = {
958
16
    &ett_kink,
959
    /*    &ett_kink_version, */
960
16
    &ett_kink_payload,
961
16
    &ett_payload_kink_ap_req,
962
16
    &ett_payload_kink_ap_rep,
963
16
    &ett_payload_kink_krb_error,
964
16
    &ett_payload_kink_tgt_req,
965
16
    &ett_payload_kink_tgt_rep,
966
16
    &ett_payload_kink_isakmp,
967
16
    &ett_payload_kink_encrypt,
968
16
    &ett_payload_kink_error,
969
16
    &ett_payload_not_defined,
970
16
    &ett_decrypt_kink_encrypt,
971
972
16
  };
973
974
16
  static ei_register_info ei[] = {
975
16
     { &ei_kink_payload_length_small, { "kink.payload_length_small", PI_PROTOCOL, PI_WARN, "This Payload Length is too small", EXPFILL }},
976
16
     { &ei_kink_payload_length_mismatch, { "kink.payload_length_mismatch", PI_PROTOCOL, PI_WARN, "This Payload Length is mismatch", EXPFILL }},
977
16
  };
978
979
16
  expert_module_t* expert_kink;
980
981
16
  proto_kink = proto_register_protocol("Kerberized Internet Negotiation of Key", "KINK", "kink");
982
16
  proto_register_field_array(proto_kink, hf, array_length(hf));
983
16
  proto_register_subtree_array(ett, array_length(ett));
984
16
  expert_kink = expert_register_protocol(proto_kink);
985
16
  expert_register_field_array(expert_kink, ei, array_length(ei));
986
987
16
  kink_handle = register_dissector("kink", dissect_kink, proto_kink);
988
16
}
989
990
16
void proto_reg_handoff_kink(void) {
991
  // If this is ever streamed (transported over TCP) we need to add recursion checks.
992
16
  dissector_add_uint_with_preference("udp.port", KINK_PORT, kink_handle);
993
16
}
994
995
/*
996
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
997
 *
998
 * Local Variables:
999
 * c-basic-offset: 2
1000
 * tab-width: 8
1001
 * indent-tabs-mode: nil
1002
 * End:
1003
 *
1004
 * ex: set shiftwidth=2 tabstop=8 expandtab:
1005
 * :indentSize=2:tabSize=8:noTabs=true:
1006
 */