blob: 925f3b07f354cbe20dc40cde7d6d56f022e26621 [file] [log] [blame]
The Android Open Source Project2949f582009-03-03 19:30:46 -08001/*
2 * Redistribution and use in source and binary forms, with or without
3 * modification, are permitted provided that: (1) source code
4 * distributions retain the above copyright notice and this paragraph
5 * in its entirety, and (2) distributions including binary code include
6 * the above copyright notice and this paragraph in its entirety in
7 * the documentation or other materials provided with the distribution.
8 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
9 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
10 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
11 * FOR A PARTICULAR PURPOSE.
12 *
Elliott Hughescec480a2017-12-19 16:54:57 -080013 * Original code by Hannes Gredler (hannes@gredler.at)
14 * Support for LMP service discovery extensions (defined by OIF UNI 1.0)
15 * added by Manu Pathak (mapathak@cisco.com), May 2005
The Android Open Source Project2949f582009-03-03 19:30:46 -080016 */
17
Elliott Hughese2e3bd12017-05-15 10:59:29 -070018/* \summary: Link Management Protocol (LMP) printer */
19
20/* specification: RFC 4204 */
Elliott Hughes820eced2021-08-20 18:00:50 -070021/* OIF UNI 1.0: https://web.archive.org/web/20160401194747/http://www.oiforum.com/public/documents/OIF-UNI-01.0.pdf */
Elliott Hughese2e3bd12017-05-15 10:59:29 -070022
The Android Open Source Project2949f582009-03-03 19:30:46 -080023#ifdef HAVE_CONFIG_H
Elliott Hughes820eced2021-08-20 18:00:50 -070024#include <config.h>
The Android Open Source Project2949f582009-03-03 19:30:46 -080025#endif
26
Elliott Hughes820eced2021-08-20 18:00:50 -070027#include "netdissect-stdinc.h"
The Android Open Source Project2949f582009-03-03 19:30:46 -080028
Elliott Hughes820eced2021-08-20 18:00:50 -070029#define ND_LONGJMP_FROM_TCHECK
Elliott Hughese2e3bd12017-05-15 10:59:29 -070030#include "netdissect.h"
The Android Open Source Project2949f582009-03-03 19:30:46 -080031#include "extract.h"
32#include "addrtoname.h"
33#include "gmpls.h"
34
Elliott Hughes820eced2021-08-20 18:00:50 -070035
The Android Open Source Project2949f582009-03-03 19:30:46 -080036/*
37 * LMP common header
38 *
39 * 0 1 2 3
40 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
41 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42 * | Vers | (Reserved) | Flags | Msg Type |
43 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
44 * | LMP Length | (Reserved) |
45 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
46 */
47
48struct lmp_common_header {
Elliott Hughes820eced2021-08-20 18:00:50 -070049 nd_uint16_t version_res;
50 nd_uint8_t flags;
51 nd_uint8_t msg_type;
52 nd_uint16_t length;
53 nd_byte reserved[2];
The Android Open Source Project2949f582009-03-03 19:30:46 -080054};
55
56#define LMP_VERSION 1
Elliott Hughes820eced2021-08-20 18:00:50 -070057#define LMP_EXTRACT_VERSION(x) (((x)&0xf000)>>12)
The Android Open Source Project2949f582009-03-03 19:30:46 -080058
59static const struct tok lmp_header_flag_values[] = {
60 { 0x01, "Control Channel Down"},
61 { 0x02, "LMP restart"},
62 { 0, NULL}
63};
64
65static const struct tok lmp_obj_te_link_flag_values[] = {
66 { 0x01, "Fault Management Supported"},
67 { 0x02, "Link Verification Supported"},
68 { 0, NULL}
69};
70
71static const struct tok lmp_obj_data_link_flag_values[] = {
72 { 0x01, "Data Link Port"},
73 { 0x02, "Allocated for user traffic"},
74 { 0x04, "Failed link"},
75 { 0, NULL}
76};
77
78static const struct tok lmp_obj_channel_status_values[] = {
79 { 1, "Signal Okay"},
80 { 2, "Signal Degraded"},
81 { 3, "Signal Fail"},
82 { 0, NULL}
83};
84
85static const struct tok lmp_obj_begin_verify_flag_values[] = {
86 { 0x0001, "Verify all links"},
87 { 0x0002, "Data link type"},
88 { 0, NULL}
89};
90
91static const struct tok lmp_obj_begin_verify_error_values[] = {
JP Abgrall53f17a92014-02-12 14:02:41 -080092 { 0x01, "Link Verification Procedure Not supported"},
93 { 0x02, "Unwilling to verify"},
94 { 0x04, "Unsupported verification transport mechanism"},
95 { 0x08, "Link-Id configuration error"},
96 { 0x10, "Unknown object c-type"},
The Android Open Source Project2949f582009-03-03 19:30:46 -080097 { 0, NULL}
98};
99
100static const struct tok lmp_obj_link_summary_error_values[] = {
JP Abgrall53f17a92014-02-12 14:02:41 -0800101 { 0x01, "Unacceptable non-negotiable LINK-SUMMARY parameters"},
102 { 0x02, "Renegotiate LINK-SUMMARY parameters"},
103 { 0x04, "Invalid TE-LINK Object"},
104 { 0x08, "Invalid DATA-LINK Object"},
105 { 0x10, "Unknown TE-LINK Object c-type"},
106 { 0x20, "Unknown DATA-LINK Object c-type"},
The Android Open Source Project2949f582009-03-03 19:30:46 -0800107 { 0, NULL}
108};
109
110/* Service Config Supported Protocols Flags */
111static const struct tok lmp_obj_service_config_sp_flag_values[] = {
112 { 0x01, "RSVP Supported"},
113 { 0x02, "LDP Supported"},
114 { 0, NULL}
115};
116
117/* Service Config Client Port Service Attribute Transparency Flags */
118static const struct tok lmp_obj_service_config_cpsa_tp_flag_values[] = {
119 { 0x01, "Path/VC Overhead Transparency Supported"},
120 { 0x02, "Line/MS Overhead Transparency Supported"},
121 { 0x04, "Section/RS Overhead Transparency Supported"},
122 { 0, NULL}
123};
124
125/* Service Config Client Port Service Attribute Contiguous Concatenation Types Flags */
126static const struct tok lmp_obj_service_config_cpsa_cct_flag_values[] = {
127 { 0x01, "Contiguous Concatenation Types Supported"},
128 { 0, NULL}
129};
130
131/* Service Config Network Service Attributes Transparency Flags */
132static const struct tok lmp_obj_service_config_nsa_transparency_flag_values[] = {
133 { 0x01, "Standard SOH/RSOH Transparency Supported"},
134 { 0x02, "Standard LOH/MSOH Transparency Supported"},
135 { 0, NULL}
136};
137
138/* Service Config Network Service Attributes TCM Monitoring Flags */
139static const struct tok lmp_obj_service_config_nsa_tcm_flag_values[] = {
140 { 0x01, "Transparent Tandem Connection Monitoring Supported"},
141 { 0, NULL}
142};
143
144/* Network Service Attributes Network Diversity Flags */
145static const struct tok lmp_obj_service_config_nsa_network_diversity_flag_values[] = {
146 { 0x01, "Node Diversity Supported"},
147 { 0x02, "Link Diversity Supported"},
148 { 0x04, "SRLG Diversity Supported"},
149 { 0, NULL}
150};
151
152#define LMP_MSGTYPE_CONFIG 1
153#define LMP_MSGTYPE_CONFIG_ACK 2
154#define LMP_MSGTYPE_CONFIG_NACK 3
155#define LMP_MSGTYPE_HELLO 4
156#define LMP_MSGTYPE_VERIFY_BEGIN 5
157#define LMP_MSGTYPE_VERIFY_BEGIN_ACK 6
158#define LMP_MSGTYPE_VERIFY_BEGIN_NACK 7
159#define LMP_MSGTYPE_VERIFY_END 8
160#define LMP_MSGTYPE_VERIFY_END_ACK 9
161#define LMP_MSGTYPE_TEST 10
162#define LMP_MSGTYPE_TEST_STATUS_SUCCESS 11
163#define LMP_MSGTYPE_TEST_STATUS_FAILURE 12
164#define LMP_MSGTYPE_TEST_STATUS_ACK 13
165#define LMP_MSGTYPE_LINK_SUMMARY 14
166#define LMP_MSGTYPE_LINK_SUMMARY_ACK 15
167#define LMP_MSGTYPE_LINK_SUMMARY_NACK 16
168#define LMP_MSGTYPE_CHANNEL_STATUS 17
169#define LMP_MSGTYPE_CHANNEL_STATUS_ACK 18
170#define LMP_MSGTYPE_CHANNEL_STATUS_REQ 19
171#define LMP_MSGTYPE_CHANNEL_STATUS_RESP 20
172/* LMP Service Discovery message types defined by UNI 1.0 */
173#define LMP_MSGTYPE_SERVICE_CONFIG 50
174#define LMP_MSGTYPE_SERVICE_CONFIG_ACK 51
175#define LMP_MSGTYPE_SERVICE_CONFIG_NACK 52
176
177static const struct tok lmp_msg_type_values[] = {
178 { LMP_MSGTYPE_CONFIG, "Config"},
179 { LMP_MSGTYPE_CONFIG_ACK, "Config ACK"},
180 { LMP_MSGTYPE_CONFIG_NACK, "Config NACK"},
181 { LMP_MSGTYPE_HELLO, "Hello"},
182 { LMP_MSGTYPE_VERIFY_BEGIN, "Begin Verify"},
183 { LMP_MSGTYPE_VERIFY_BEGIN_ACK, "Begin Verify ACK"},
184 { LMP_MSGTYPE_VERIFY_BEGIN_NACK, "Begin Verify NACK"},
185 { LMP_MSGTYPE_VERIFY_END, "End Verify"},
186 { LMP_MSGTYPE_VERIFY_END_ACK, "End Verify ACK"},
187 { LMP_MSGTYPE_TEST, "Test"},
188 { LMP_MSGTYPE_TEST_STATUS_SUCCESS, "Test Status Success"},
189 { LMP_MSGTYPE_TEST_STATUS_FAILURE, "Test Status Failure"},
190 { LMP_MSGTYPE_TEST_STATUS_ACK, "Test Status ACK"},
191 { LMP_MSGTYPE_LINK_SUMMARY, "Link Summary"},
192 { LMP_MSGTYPE_LINK_SUMMARY_ACK, "Link Summary ACK"},
193 { LMP_MSGTYPE_LINK_SUMMARY_NACK, "Link Summary NACK"},
194 { LMP_MSGTYPE_CHANNEL_STATUS, "Channel Status"},
195 { LMP_MSGTYPE_CHANNEL_STATUS_ACK, "Channel Status ACK"},
196 { LMP_MSGTYPE_CHANNEL_STATUS_REQ, "Channel Status Request"},
197 { LMP_MSGTYPE_CHANNEL_STATUS_RESP, "Channel Status Response"},
198 { LMP_MSGTYPE_SERVICE_CONFIG, "Service Config"},
199 { LMP_MSGTYPE_SERVICE_CONFIG_ACK, "Service Config ACK"},
200 { LMP_MSGTYPE_SERVICE_CONFIG_NACK, "Service Config NACK"},
201 { 0, NULL}
202};
203
Elliott Hughes892a68b2015-10-19 14:43:53 -0700204/*
The Android Open Source Project2949f582009-03-03 19:30:46 -0800205 * LMP object header
206 *
207 * 0 1 2 3
208 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
209 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
210 * |N| C-Type | Class | Length |
211 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
212 * | |
213 * // (object contents) //
214 * | |
Elliott Hughes892a68b2015-10-19 14:43:53 -0700215 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The Android Open Source Project2949f582009-03-03 19:30:46 -0800216 */
217
218struct lmp_object_header {
Elliott Hughes820eced2021-08-20 18:00:50 -0700219 nd_uint8_t ctype;
220 nd_uint8_t class_num;
221 nd_uint16_t length;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800222};
223
224#define LMP_OBJ_CC_ID 1
225#define LMP_OBJ_NODE_ID 2
226#define LMP_OBJ_LINK_ID 3
227#define LMP_OBJ_INTERFACE_ID 4
Elliott Hughes892a68b2015-10-19 14:43:53 -0700228#define LMP_OBJ_MESSAGE_ID 5
The Android Open Source Project2949f582009-03-03 19:30:46 -0800229#define LMP_OBJ_CONFIG 6
230#define LMP_OBJ_HELLO 7
231#define LMP_OBJ_VERIFY_BEGIN 8
232#define LMP_OBJ_VERIFY_BEGIN_ACK 9
233#define LMP_OBJ_VERIFY_ID 10
234#define LMP_OBJ_TE_LINK 11
235#define LMP_OBJ_DATA_LINK 12
236#define LMP_OBJ_CHANNEL_STATUS 13
237#define LMP_OBJ_CHANNEL_STATUS_REQ 14
238#define LMP_OBJ_ERROR_CODE 20
239
240#define LMP_OBJ_SERVICE_CONFIG 51 /* defined in UNI 1.0 */
241
242static const struct tok lmp_obj_values[] = {
243 { LMP_OBJ_CC_ID, "Control Channel ID" },
244 { LMP_OBJ_NODE_ID, "Node ID" },
245 { LMP_OBJ_LINK_ID, "Link ID" },
246 { LMP_OBJ_INTERFACE_ID, "Interface ID" },
247 { LMP_OBJ_MESSAGE_ID, "Message ID" },
248 { LMP_OBJ_CONFIG, "Configuration" },
249 { LMP_OBJ_HELLO, "Hello" },
250 { LMP_OBJ_VERIFY_BEGIN, "Verify Begin" },
251 { LMP_OBJ_VERIFY_BEGIN_ACK, "Verify Begin ACK" },
252 { LMP_OBJ_VERIFY_ID, "Verify ID" },
253 { LMP_OBJ_TE_LINK, "TE Link" },
254 { LMP_OBJ_DATA_LINK, "Data Link" },
255 { LMP_OBJ_CHANNEL_STATUS, "Channel Status" },
256 { LMP_OBJ_CHANNEL_STATUS_REQ, "Channel Status Request" },
257 { LMP_OBJ_ERROR_CODE, "Error Code" },
258 { LMP_OBJ_SERVICE_CONFIG, "Service Config" },
259
260 { 0, NULL}
261};
262
263#define INT_SWITCHING_TYPE_SUBOBJ 1
264#define WAVELENGTH_SUBOBJ 2
265
266static const struct tok lmp_data_link_subobj[] = {
267 { INT_SWITCHING_TYPE_SUBOBJ, "Interface Switching Type" },
268 { WAVELENGTH_SUBOBJ , "Wavelength" },
269 { 0, NULL}
270};
271
272#define LMP_CTYPE_IPV4 1
273#define LMP_CTYPE_IPV6 2
274
275#define LMP_CTYPE_LOC 1
276#define LMP_CTYPE_RMT 2
277#define LMP_CTYPE_UNMD 3
Elliott Hughes892a68b2015-10-19 14:43:53 -0700278
The Android Open Source Project2949f582009-03-03 19:30:46 -0800279#define LMP_CTYPE_IPV4_LOC 1
280#define LMP_CTYPE_IPV4_RMT 2
281#define LMP_CTYPE_IPV6_LOC 3
282#define LMP_CTYPE_IPV6_RMT 4
Elliott Hughes892a68b2015-10-19 14:43:53 -0700283#define LMP_CTYPE_UNMD_LOC 5
284#define LMP_CTYPE_UNMD_RMT 6
The Android Open Source Project2949f582009-03-03 19:30:46 -0800285
286#define LMP_CTYPE_1 1
287#define LMP_CTYPE_2 2
288
289#define LMP_CTYPE_HELLO_CONFIG 1
290#define LMP_CTYPE_HELLO 1
291
292#define LMP_CTYPE_BEGIN_VERIFY_ERROR 1
293#define LMP_CTYPE_LINK_SUMMARY_ERROR 2
294
295/* C-Types for Service Config Object */
296#define LMP_CTYPE_SERVICE_CONFIG_SP 1
297#define LMP_CTYPE_SERVICE_CONFIG_CPSA 2
298#define LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM 3
299#define LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY 4
300
Elliott Hughes892a68b2015-10-19 14:43:53 -0700301/*
The Android Open Source Project2949f582009-03-03 19:30:46 -0800302 * Different link types allowed in the Client Port Service Attributes
303 * subobject defined for LMP Service Discovery in the UNI 1.0 spec
304 */
305#define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH 5 /* UNI 1.0 Sec 9.4.2 */
306#define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET 6 /* UNI 1.0 Sec 9.4.2 */
307
308/*
309 * the ctypes are not globally unique so for
310 * translating it to strings we build a table based
311 * on objects offsetted by the ctype
312 */
313
314static const struct tok lmp_ctype_values[] = {
315 { 256*LMP_OBJ_CC_ID+LMP_CTYPE_LOC, "Local" },
316 { 256*LMP_OBJ_CC_ID+LMP_CTYPE_RMT, "Remote" },
317 { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_LOC, "Local" },
318 { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_RMT, "Remote" },
319 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
320 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
321 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
322 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
323 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
324 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
325 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
326 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
327 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
328 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
329 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
330 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
331 { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_1, "1" },
332 { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_2, "2" },
333 { 256*LMP_OBJ_CONFIG+LMP_CTYPE_1, "1" },
334 { 256*LMP_OBJ_HELLO+LMP_CTYPE_1, "1" },
335 { 256*LMP_OBJ_VERIFY_BEGIN+LMP_CTYPE_1, "1" },
336 { 256*LMP_OBJ_VERIFY_BEGIN_ACK+LMP_CTYPE_1, "1" },
337 { 256*LMP_OBJ_VERIFY_ID+LMP_CTYPE_1, "1" },
338 { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV4, "IPv4" },
339 { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV6, "IPv6" },
340 { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
341 { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV4, "IPv4" },
342 { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV6, "IPv6" },
343 { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
344 { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV4, "IPv4" },
345 { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV6, "IPv6" },
346 { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_UNMD, "Unnumbered" },
347 { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV4, "IPv4" },
348 { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV6, "IPv6" },
349 { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_UNMD, "Unnumbered" },
350 { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_1, "1" },
351 { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_2, "2" },
352 { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_SP, "1" },
353 { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_CPSA, "2" },
354 { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM, "3" },
355 { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY, "4" },
356 { 0, NULL}
357};
358
Elliott Hughescec480a2017-12-19 16:54:57 -0800359static int
360lmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr,
361 int total_subobj_len, int offset)
362{
363 int hexdump = FALSE;
364 int subobj_type, subobj_len;
365
366 union { /* int to float conversion buffer */
367 float f;
368 uint32_t i;
369 } bw;
370
371 while (total_subobj_len > 0 && hexdump == FALSE ) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700372 subobj_type = GET_U_1(obj_tptr + offset);
373 subobj_len = GET_U_1(obj_tptr + offset + 1);
374 ND_PRINT("\n\t Subobject, Type: %s (%u), Length: %u",
Elliott Hughescec480a2017-12-19 16:54:57 -0800375 tok2str(lmp_data_link_subobj,
376 "Unknown",
377 subobj_type),
378 subobj_type,
Elliott Hughes820eced2021-08-20 18:00:50 -0700379 subobj_len);
Elliott Hughescec480a2017-12-19 16:54:57 -0800380 if (subobj_len < 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700381 ND_PRINT(" (too short)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800382 break;
383 }
384 if ((subobj_len % 4) != 0) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700385 ND_PRINT(" (not a multiple of 4)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800386 break;
387 }
388 if (total_subobj_len < subobj_len) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700389 ND_PRINT(" (goes past the end of the object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800390 break;
391 }
392 switch(subobj_type) {
393 case INT_SWITCHING_TYPE_SUBOBJ:
Elliott Hughes820eced2021-08-20 18:00:50 -0700394 ND_PRINT("\n\t Switching Type: %s (%u)",
Elliott Hughescec480a2017-12-19 16:54:57 -0800395 tok2str(gmpls_switch_cap_values,
396 "Unknown",
Elliott Hughes820eced2021-08-20 18:00:50 -0700397 GET_U_1(obj_tptr + offset + 2)),
398 GET_U_1(obj_tptr + offset + 2));
399 ND_PRINT("\n\t Encoding Type: %s (%u)",
Elliott Hughescec480a2017-12-19 16:54:57 -0800400 tok2str(gmpls_encoding_values,
401 "Unknown",
Elliott Hughes820eced2021-08-20 18:00:50 -0700402 GET_U_1(obj_tptr + offset + 3)),
403 GET_U_1(obj_tptr + offset + 3));
404 bw.i = GET_BE_U_4(obj_tptr + offset + 4);
405 ND_PRINT("\n\t Min Reservable Bandwidth: %.3f Mbps",
406 bw.f*8/1000000);
407 bw.i = GET_BE_U_4(obj_tptr + offset + 8);
408 ND_PRINT("\n\t Max Reservable Bandwidth: %.3f Mbps",
409 bw.f*8/1000000);
Elliott Hughescec480a2017-12-19 16:54:57 -0800410 break;
411 case WAVELENGTH_SUBOBJ:
Elliott Hughes820eced2021-08-20 18:00:50 -0700412 ND_PRINT("\n\t Wavelength: %u",
413 GET_BE_U_4(obj_tptr + offset + 4));
Elliott Hughescec480a2017-12-19 16:54:57 -0800414 break;
415 default:
416 /* Any Unknown Subobject ==> Exit loop */
417 hexdump=TRUE;
418 break;
419 }
420 total_subobj_len-=subobj_len;
421 offset+=subobj_len;
422 }
423 return (hexdump);
424}
425
The Android Open Source Project2949f582009-03-03 19:30:46 -0800426void
Elliott Hughes892a68b2015-10-19 14:43:53 -0700427lmp_print(netdissect_options *ndo,
Elliott Hughes820eced2021-08-20 18:00:50 -0700428 const u_char *pptr, u_int length)
Elliott Hughes892a68b2015-10-19 14:43:53 -0700429{
The Android Open Source Project2949f582009-03-03 19:30:46 -0800430 const struct lmp_common_header *lmp_com_header;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800431 const u_char *tptr,*obj_tptr;
Elliott Hughes820eced2021-08-20 18:00:50 -0700432 u_int version_res, tlen, lmp_obj_len, lmp_obj_ctype, obj_tlen;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800433 int hexdump;
Elliott Hughescec480a2017-12-19 16:54:57 -0800434 u_int offset;
435 u_int link_type;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800436
437 union { /* int to float conversion buffer */
Elliott Hughes892a68b2015-10-19 14:43:53 -0700438 float f;
439 uint32_t i;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800440 } bw;
441
Elliott Hughes820eced2021-08-20 18:00:50 -0700442 ndo->ndo_protocol = "lmp";
The Android Open Source Project2949f582009-03-03 19:30:46 -0800443 tptr=pptr;
444 lmp_com_header = (const struct lmp_common_header *)pptr;
Elliott Hughes820eced2021-08-20 18:00:50 -0700445 ND_TCHECK_SIZE(lmp_com_header);
446
447 version_res = GET_BE_U_2(lmp_com_header->version_res);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800448
449 /*
450 * Sanity checking of the header.
451 */
Elliott Hughes820eced2021-08-20 18:00:50 -0700452 if (LMP_EXTRACT_VERSION(version_res) != LMP_VERSION) {
453 ND_PRINT("LMP version %u packet not supported",
454 LMP_EXTRACT_VERSION(version_res));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800455 return;
456 }
457
458 /* in non-verbose mode just lets print the basic Message Type*/
Elliott Hughes892a68b2015-10-19 14:43:53 -0700459 if (ndo->ndo_vflag < 1) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700460 ND_PRINT("LMPv%u %s Message, length: %u",
461 LMP_EXTRACT_VERSION(version_res),
462 tok2str(lmp_msg_type_values, "unknown (%u)",GET_U_1(lmp_com_header->msg_type)),
463 length);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800464 return;
465 }
466
467 /* ok they seem to want to know everything - lets fully decode it */
468
Elliott Hughes820eced2021-08-20 18:00:50 -0700469 tlen=GET_BE_U_2(lmp_com_header->length);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800470
Elliott Hughes820eced2021-08-20 18:00:50 -0700471 ND_PRINT("\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
472 LMP_EXTRACT_VERSION(version_res),
473 tok2str(lmp_msg_type_values, "unknown, type: %u",GET_U_1(lmp_com_header->msg_type)),
474 bittok2str(lmp_header_flag_values,"none",GET_U_1(lmp_com_header->flags)),
475 tlen);
476 if (tlen < sizeof(struct lmp_common_header)) {
477 ND_PRINT(" (too short)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800478 return;
479 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700480 if (tlen > length) {
481 ND_PRINT(" (too long)");
482 tlen = length;
Elliott Hughescec480a2017-12-19 16:54:57 -0800483 }
The Android Open Source Project2949f582009-03-03 19:30:46 -0800484
Elliott Hughes820eced2021-08-20 18:00:50 -0700485 tptr+=sizeof(struct lmp_common_header);
486 tlen-=sizeof(struct lmp_common_header);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800487
488 while(tlen>0) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700489 const struct lmp_object_header *lmp_obj_header =
490 (const struct lmp_object_header *)tptr;
491 lmp_obj_len=GET_BE_U_2(lmp_obj_header->length);
492 lmp_obj_ctype=GET_U_1(lmp_obj_header->ctype)&0x7f;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800493
Elliott Hughes820eced2021-08-20 18:00:50 -0700494 ND_PRINT("\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800495 tok2str(lmp_obj_values,
496 "Unknown",
Elliott Hughes820eced2021-08-20 18:00:50 -0700497 GET_U_1(lmp_obj_header->class_num)),
498 GET_U_1(lmp_obj_header->class_num),
The Android Open Source Project2949f582009-03-03 19:30:46 -0800499 tok2str(lmp_ctype_values,
500 "Unknown",
Elliott Hughes820eced2021-08-20 18:00:50 -0700501 (GET_U_1(lmp_obj_header->class_num)<<8)+lmp_obj_ctype),
The Android Open Source Project2949f582009-03-03 19:30:46 -0800502 lmp_obj_ctype,
Elliott Hughes820eced2021-08-20 18:00:50 -0700503 GET_U_1(lmp_obj_header->ctype)&0x80 ? "" : "non-",
504 lmp_obj_len);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800505
Elliott Hughescec480a2017-12-19 16:54:57 -0800506 if (lmp_obj_len < 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700507 ND_PRINT(" (too short)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800508 return;
509 }
510 if ((lmp_obj_len % 4) != 0) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700511 ND_PRINT(" (not a multiple of 4)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800512 return;
513 }
514
The Android Open Source Project2949f582009-03-03 19:30:46 -0800515 obj_tptr=tptr+sizeof(struct lmp_object_header);
516 obj_tlen=lmp_obj_len-sizeof(struct lmp_object_header);
517
518 /* did we capture enough for fully decoding the object ? */
Elliott Hughes820eced2021-08-20 18:00:50 -0700519 ND_TCHECK_LEN(tptr, lmp_obj_len);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800520 hexdump=FALSE;
521
Elliott Hughes820eced2021-08-20 18:00:50 -0700522 switch(GET_U_1(lmp_obj_header->class_num)) {
The Android Open Source Project2949f582009-03-03 19:30:46 -0800523
524 case LMP_OBJ_CC_ID:
525 switch(lmp_obj_ctype) {
526 case LMP_CTYPE_LOC:
527 case LMP_CTYPE_RMT:
Elliott Hughescec480a2017-12-19 16:54:57 -0800528 if (obj_tlen != 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700529 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800530 break;
531 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700532 ND_PRINT("\n\t Control Channel ID: %u (0x%08x)",
533 GET_BE_U_4(obj_tptr),
534 GET_BE_U_4(obj_tptr));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800535 break;
536
537 default:
538 hexdump=TRUE;
539 }
540 break;
541
542 case LMP_OBJ_LINK_ID:
543 case LMP_OBJ_INTERFACE_ID:
544 switch(lmp_obj_ctype) {
545 case LMP_CTYPE_IPV4_LOC:
546 case LMP_CTYPE_IPV4_RMT:
Elliott Hughescec480a2017-12-19 16:54:57 -0800547 if (obj_tlen != 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700548 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800549 break;
550 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700551 ND_PRINT("\n\t IPv4 Link ID: %s (0x%08x)",
552 GET_IPADDR_STRING(obj_tptr),
553 GET_BE_U_4(obj_tptr));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800554 break;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800555 case LMP_CTYPE_IPV6_LOC:
556 case LMP_CTYPE_IPV6_RMT:
Elliott Hughescec480a2017-12-19 16:54:57 -0800557 if (obj_tlen != 16) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700558 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800559 break;
560 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700561 ND_PRINT("\n\t IPv6 Link ID: %s (0x%08x)",
562 GET_IP6ADDR_STRING(obj_tptr),
563 GET_BE_U_4(obj_tptr));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800564 break;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800565 case LMP_CTYPE_UNMD_LOC:
566 case LMP_CTYPE_UNMD_RMT:
Elliott Hughescec480a2017-12-19 16:54:57 -0800567 if (obj_tlen != 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700568 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800569 break;
570 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700571 ND_PRINT("\n\t Link ID: %u (0x%08x)",
572 GET_BE_U_4(obj_tptr),
573 GET_BE_U_4(obj_tptr));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800574 break;
575 default:
576 hexdump=TRUE;
577 }
578 break;
579
580 case LMP_OBJ_MESSAGE_ID:
581 switch(lmp_obj_ctype) {
582 case LMP_CTYPE_1:
Elliott Hughescec480a2017-12-19 16:54:57 -0800583 if (obj_tlen != 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700584 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800585 break;
586 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700587 ND_PRINT("\n\t Message ID: %u (0x%08x)",
588 GET_BE_U_4(obj_tptr),
589 GET_BE_U_4(obj_tptr));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800590 break;
591 case LMP_CTYPE_2:
Elliott Hughescec480a2017-12-19 16:54:57 -0800592 if (obj_tlen != 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700593 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800594 break;
595 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700596 ND_PRINT("\n\t Message ID Ack: %u (0x%08x)",
597 GET_BE_U_4(obj_tptr),
598 GET_BE_U_4(obj_tptr));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800599 break;
600 default:
601 hexdump=TRUE;
602 }
603 break;
604
605 case LMP_OBJ_NODE_ID:
606 switch(lmp_obj_ctype) {
607 case LMP_CTYPE_LOC:
608 case LMP_CTYPE_RMT:
Elliott Hughescec480a2017-12-19 16:54:57 -0800609 if (obj_tlen != 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700610 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800611 break;
612 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700613 ND_PRINT("\n\t Node ID: %s (0x%08x)",
614 GET_IPADDR_STRING(obj_tptr),
615 GET_BE_U_4(obj_tptr));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800616 break;
617
618 default:
619 hexdump=TRUE;
620 }
621 break;
622
623 case LMP_OBJ_CONFIG:
624 switch(lmp_obj_ctype) {
625 case LMP_CTYPE_HELLO_CONFIG:
Elliott Hughescec480a2017-12-19 16:54:57 -0800626 if (obj_tlen != 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700627 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800628 break;
629 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700630 ND_PRINT("\n\t Hello Interval: %u\n\t Hello Dead Interval: %u",
631 GET_BE_U_2(obj_tptr),
632 GET_BE_U_2(obj_tptr + 2));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800633 break;
634
635 default:
636 hexdump=TRUE;
637 }
638 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700639
The Android Open Source Project2949f582009-03-03 19:30:46 -0800640 case LMP_OBJ_HELLO:
641 switch(lmp_obj_ctype) {
642 case LMP_CTYPE_HELLO:
Elliott Hughescec480a2017-12-19 16:54:57 -0800643 if (obj_tlen != 8) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700644 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800645 break;
646 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700647 ND_PRINT("\n\t Tx Seq: %u, Rx Seq: %u",
648 GET_BE_U_4(obj_tptr),
649 GET_BE_U_4(obj_tptr + 4));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800650 break;
651
652 default:
653 hexdump=TRUE;
654 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700655 break;
656
The Android Open Source Project2949f582009-03-03 19:30:46 -0800657 case LMP_OBJ_TE_LINK:
The Android Open Source Project2949f582009-03-03 19:30:46 -0800658 switch(lmp_obj_ctype) {
659 case LMP_CTYPE_IPV4:
Elliott Hughescec480a2017-12-19 16:54:57 -0800660 if (obj_tlen != 12) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700661 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800662 break;
663 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700664 ND_PRINT("\n\t Flags: [%s]",
Elliott Hughescec480a2017-12-19 16:54:57 -0800665 bittok2str(lmp_obj_te_link_flag_values,
666 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -0700667 GET_U_1(obj_tptr)));
Elliott Hughescec480a2017-12-19 16:54:57 -0800668
Elliott Hughes820eced2021-08-20 18:00:50 -0700669 ND_PRINT("\n\t Local Link-ID: %s (0x%08x)"
JP Abgrall53f17a92014-02-12 14:02:41 -0800670 "\n\t Remote Link-ID: %s (0x%08x)",
Elliott Hughes820eced2021-08-20 18:00:50 -0700671 GET_IPADDR_STRING(obj_tptr+4),
672 GET_BE_U_4(obj_tptr + 4),
673 GET_IPADDR_STRING(obj_tptr+8),
674 GET_BE_U_4(obj_tptr + 8));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800675 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700676
The Android Open Source Project2949f582009-03-03 19:30:46 -0800677 case LMP_CTYPE_IPV6:
Elliott Hughescec480a2017-12-19 16:54:57 -0800678 if (obj_tlen != 36) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700679 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800680 break;
681 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700682 ND_PRINT("\n\t Flags: [%s]",
Elliott Hughescec480a2017-12-19 16:54:57 -0800683 bittok2str(lmp_obj_te_link_flag_values,
684 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -0700685 GET_U_1(obj_tptr)));
Elliott Hughescec480a2017-12-19 16:54:57 -0800686
Elliott Hughes820eced2021-08-20 18:00:50 -0700687 ND_PRINT("\n\t Local Link-ID: %s (0x%08x)"
Elliott Hughescec480a2017-12-19 16:54:57 -0800688 "\n\t Remote Link-ID: %s (0x%08x)",
Elliott Hughes820eced2021-08-20 18:00:50 -0700689 GET_IP6ADDR_STRING(obj_tptr+4),
690 GET_BE_U_4(obj_tptr + 4),
691 GET_IP6ADDR_STRING(obj_tptr+20),
692 GET_BE_U_4(obj_tptr + 20));
Elliott Hughescec480a2017-12-19 16:54:57 -0800693 break;
694
The Android Open Source Project2949f582009-03-03 19:30:46 -0800695 case LMP_CTYPE_UNMD:
Elliott Hughescec480a2017-12-19 16:54:57 -0800696 if (obj_tlen != 12) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700697 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800698 break;
699 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700700 ND_PRINT("\n\t Flags: [%s]",
Elliott Hughescec480a2017-12-19 16:54:57 -0800701 bittok2str(lmp_obj_te_link_flag_values,
702 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -0700703 GET_U_1(obj_tptr)));
Elliott Hughescec480a2017-12-19 16:54:57 -0800704
Elliott Hughes820eced2021-08-20 18:00:50 -0700705 ND_PRINT("\n\t Local Link-ID: %u (0x%08x)"
Elliott Hughescec480a2017-12-19 16:54:57 -0800706 "\n\t Remote Link-ID: %u (0x%08x)",
Elliott Hughes820eced2021-08-20 18:00:50 -0700707 GET_BE_U_4(obj_tptr + 4),
708 GET_BE_U_4(obj_tptr + 4),
709 GET_BE_U_4(obj_tptr + 8),
710 GET_BE_U_4(obj_tptr + 8));
Elliott Hughescec480a2017-12-19 16:54:57 -0800711 break;
712
The Android Open Source Project2949f582009-03-03 19:30:46 -0800713 default:
714 hexdump=TRUE;
715 }
716 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700717
The Android Open Source Project2949f582009-03-03 19:30:46 -0800718 case LMP_OBJ_DATA_LINK:
The Android Open Source Project2949f582009-03-03 19:30:46 -0800719 switch(lmp_obj_ctype) {
720 case LMP_CTYPE_IPV4:
Elliott Hughescec480a2017-12-19 16:54:57 -0800721 if (obj_tlen < 12) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700722 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800723 break;
724 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700725 ND_PRINT("\n\t Flags: [%s]",
Elliott Hughescec480a2017-12-19 16:54:57 -0800726 bittok2str(lmp_obj_data_link_flag_values,
727 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -0700728 GET_U_1(obj_tptr)));
729 ND_PRINT("\n\t Local Interface ID: %s (0x%08x)"
JP Abgrall53f17a92014-02-12 14:02:41 -0800730 "\n\t Remote Interface ID: %s (0x%08x)",
Elliott Hughes820eced2021-08-20 18:00:50 -0700731 GET_IPADDR_STRING(obj_tptr+4),
732 GET_BE_U_4(obj_tptr + 4),
733 GET_IPADDR_STRING(obj_tptr+8),
734 GET_BE_U_4(obj_tptr + 8));
Elliott Hughes892a68b2015-10-19 14:43:53 -0700735
Elliott Hughescec480a2017-12-19 16:54:57 -0800736 if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12))
737 hexdump=TRUE;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800738 break;
Elliott Hughescec480a2017-12-19 16:54:57 -0800739
The Android Open Source Project2949f582009-03-03 19:30:46 -0800740 case LMP_CTYPE_IPV6:
Elliott Hughescec480a2017-12-19 16:54:57 -0800741 if (obj_tlen < 36) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700742 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800743 break;
744 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700745 ND_PRINT("\n\t Flags: [%s]",
Elliott Hughescec480a2017-12-19 16:54:57 -0800746 bittok2str(lmp_obj_data_link_flag_values,
747 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -0700748 GET_U_1(obj_tptr)));
749 ND_PRINT("\n\t Local Interface ID: %s (0x%08x)"
Elliott Hughescec480a2017-12-19 16:54:57 -0800750 "\n\t Remote Interface ID: %s (0x%08x)",
Elliott Hughes820eced2021-08-20 18:00:50 -0700751 GET_IP6ADDR_STRING(obj_tptr+4),
752 GET_BE_U_4(obj_tptr + 4),
753 GET_IP6ADDR_STRING(obj_tptr+20),
754 GET_BE_U_4(obj_tptr + 20));
Elliott Hughescec480a2017-12-19 16:54:57 -0800755
756 if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 36, 36))
757 hexdump=TRUE;
758 break;
759
760 case LMP_CTYPE_UNMD:
761 if (obj_tlen < 12) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700762 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800763 break;
764 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700765 ND_PRINT("\n\t Flags: [%s]",
Elliott Hughescec480a2017-12-19 16:54:57 -0800766 bittok2str(lmp_obj_data_link_flag_values,
767 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -0700768 GET_U_1(obj_tptr)));
769 ND_PRINT("\n\t Local Interface ID: %u (0x%08x)"
Elliott Hughescec480a2017-12-19 16:54:57 -0800770 "\n\t Remote Interface ID: %u (0x%08x)",
Elliott Hughes820eced2021-08-20 18:00:50 -0700771 GET_BE_U_4(obj_tptr + 4),
772 GET_BE_U_4(obj_tptr + 4),
773 GET_BE_U_4(obj_tptr + 8),
774 GET_BE_U_4(obj_tptr + 8));
Elliott Hughescec480a2017-12-19 16:54:57 -0800775
776 if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12))
777 hexdump=TRUE;
778 break;
779
The Android Open Source Project2949f582009-03-03 19:30:46 -0800780 default:
781 hexdump=TRUE;
782 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700783 break;
784
The Android Open Source Project2949f582009-03-03 19:30:46 -0800785 case LMP_OBJ_VERIFY_BEGIN:
786 switch(lmp_obj_ctype) {
787 case LMP_CTYPE_1:
Elliott Hughescec480a2017-12-19 16:54:57 -0800788 if (obj_tlen != 20) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700789 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800790 break;
791 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700792 ND_PRINT("\n\t Flags: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800793 bittok2str(lmp_obj_begin_verify_flag_values,
794 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -0700795 GET_BE_U_2(obj_tptr)));
796 ND_PRINT("\n\t Verify Interval: %u",
797 GET_BE_U_2(obj_tptr + 2));
798 ND_PRINT("\n\t Data links: %u",
799 GET_BE_U_4(obj_tptr + 4));
800 ND_PRINT("\n\t Encoding type: %s",
801 tok2str(gmpls_encoding_values, "Unknown", GET_U_1((obj_tptr + 8))));
802 ND_PRINT("\n\t Verify Transport Mechanism: %u (0x%x)%s",
803 GET_BE_U_2(obj_tptr + 10),
804 GET_BE_U_2(obj_tptr + 10),
805 GET_BE_U_2(obj_tptr + 10)&8000 ? " (Payload test messages capable)" : "");
806 bw.i = GET_BE_U_4(obj_tptr + 12);
807 ND_PRINT("\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000);
808 ND_PRINT("\n\t Wavelength: %u",
809 GET_BE_U_4(obj_tptr + 16));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800810 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700811
The Android Open Source Project2949f582009-03-03 19:30:46 -0800812 default:
813 hexdump=TRUE;
814 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700815 break;
816
The Android Open Source Project2949f582009-03-03 19:30:46 -0800817 case LMP_OBJ_VERIFY_BEGIN_ACK:
818 switch(lmp_obj_ctype) {
819 case LMP_CTYPE_1:
Elliott Hughescec480a2017-12-19 16:54:57 -0800820 if (obj_tlen != 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700821 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800822 break;
823 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700824 ND_PRINT("\n\t Verify Dead Interval: %u"
JP Abgrall53f17a92014-02-12 14:02:41 -0800825 "\n\t Verify Transport Response: %u",
Elliott Hughes820eced2021-08-20 18:00:50 -0700826 GET_BE_U_2(obj_tptr),
827 GET_BE_U_2(obj_tptr + 2));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800828 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700829
The Android Open Source Project2949f582009-03-03 19:30:46 -0800830 default:
831 hexdump=TRUE;
832 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700833 break;
834
The Android Open Source Project2949f582009-03-03 19:30:46 -0800835 case LMP_OBJ_VERIFY_ID:
836 switch(lmp_obj_ctype) {
837 case LMP_CTYPE_1:
Elliott Hughescec480a2017-12-19 16:54:57 -0800838 if (obj_tlen != 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700839 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800840 break;
841 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700842 ND_PRINT("\n\t Verify ID: %u",
843 GET_BE_U_4(obj_tptr));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800844 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700845
The Android Open Source Project2949f582009-03-03 19:30:46 -0800846 default:
847 hexdump=TRUE;
848 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700849 break;
850
The Android Open Source Project2949f582009-03-03 19:30:46 -0800851 case LMP_OBJ_CHANNEL_STATUS:
852 switch(lmp_obj_ctype) {
853 case LMP_CTYPE_IPV4:
The Android Open Source Project2949f582009-03-03 19:30:46 -0800854 offset = 0;
855 /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
Elliott Hughescec480a2017-12-19 16:54:57 -0800856 while (offset+8 <= obj_tlen) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700857 ND_PRINT("\n\t Interface ID: %s (0x%08x)",
858 GET_IPADDR_STRING(obj_tptr+offset),
859 GET_BE_U_4(obj_tptr + offset));
Elliott Hughes892a68b2015-10-19 14:43:53 -0700860
Elliott Hughes820eced2021-08-20 18:00:50 -0700861 ND_PRINT("\n\t\t Active: %s (%u)",
862 (GET_BE_U_4(obj_tptr + offset + 4)>>31) ?
863 "Allocated" : "Non-allocated",
864 (GET_BE_U_4(obj_tptr + offset + 4)>>31));
Elliott Hughes892a68b2015-10-19 14:43:53 -0700865
Elliott Hughes820eced2021-08-20 18:00:50 -0700866 ND_PRINT("\n\t\t Direction: %s (%u)",
867 (GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ?
868 "Transmit" : "Receive",
869 (GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1);
Elliott Hughes892a68b2015-10-19 14:43:53 -0700870
Elliott Hughes820eced2021-08-20 18:00:50 -0700871 ND_PRINT("\n\t\t Channel Status: %s (%u)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800872 tok2str(lmp_obj_channel_status_values,
Elliott Hughes820eced2021-08-20 18:00:50 -0700873 "Unknown",
874 GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF),
875 GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800876 offset+=8;
877 }
878 break;
Elliott Hughescec480a2017-12-19 16:54:57 -0800879
The Android Open Source Project2949f582009-03-03 19:30:46 -0800880 case LMP_CTYPE_IPV6:
Elliott Hughescec480a2017-12-19 16:54:57 -0800881 offset = 0;
882 /* Decode pairs: <Interface_ID (16 bytes), Channel_status (4 bytes)> */
883 while (offset+20 <= obj_tlen) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700884 ND_PRINT("\n\t Interface ID: %s (0x%08x)",
885 GET_IP6ADDR_STRING(obj_tptr+offset),
886 GET_BE_U_4(obj_tptr + offset));
Elliott Hughescec480a2017-12-19 16:54:57 -0800887
Elliott Hughes820eced2021-08-20 18:00:50 -0700888 ND_PRINT("\n\t\t Active: %s (%u)",
889 (GET_BE_U_4(obj_tptr + offset + 16)>>31) ?
890 "Allocated" : "Non-allocated",
891 (GET_BE_U_4(obj_tptr + offset + 16)>>31));
Elliott Hughescec480a2017-12-19 16:54:57 -0800892
Elliott Hughes820eced2021-08-20 18:00:50 -0700893 ND_PRINT("\n\t\t Direction: %s (%u)",
894 (GET_BE_U_4(obj_tptr + offset + 16)>>30)&0x1 ?
895 "Transmit" : "Receive",
896 (GET_BE_U_4(obj_tptr + offset + 16)>>30)&0x1);
Elliott Hughescec480a2017-12-19 16:54:57 -0800897
Elliott Hughes820eced2021-08-20 18:00:50 -0700898 ND_PRINT("\n\t\t Channel Status: %s (%u)",
Elliott Hughescec480a2017-12-19 16:54:57 -0800899 tok2str(lmp_obj_channel_status_values,
900 "Unknown",
Elliott Hughes820eced2021-08-20 18:00:50 -0700901 GET_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF),
902 GET_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF);
Elliott Hughescec480a2017-12-19 16:54:57 -0800903 offset+=20;
904 }
905 break;
906
907 case LMP_CTYPE_UNMD:
908 offset = 0;
909 /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
910 while (offset+8 <= obj_tlen) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700911 ND_PRINT("\n\t Interface ID: %u (0x%08x)",
912 GET_BE_U_4(obj_tptr + offset),
913 GET_BE_U_4(obj_tptr + offset));
Elliott Hughescec480a2017-12-19 16:54:57 -0800914
Elliott Hughes820eced2021-08-20 18:00:50 -0700915 ND_PRINT("\n\t\t Active: %s (%u)",
916 (GET_BE_U_4(obj_tptr + offset + 4)>>31) ?
917 "Allocated" : "Non-allocated",
918 (GET_BE_U_4(obj_tptr + offset + 4)>>31));
Elliott Hughescec480a2017-12-19 16:54:57 -0800919
Elliott Hughes820eced2021-08-20 18:00:50 -0700920 ND_PRINT("\n\t\t Direction: %s (%u)",
921 (GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ?
922 "Transmit" : "Receive",
923 (GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1);
Elliott Hughescec480a2017-12-19 16:54:57 -0800924
Elliott Hughes820eced2021-08-20 18:00:50 -0700925 ND_PRINT("\n\t\t Channel Status: %s (%u)",
Elliott Hughescec480a2017-12-19 16:54:57 -0800926 tok2str(lmp_obj_channel_status_values,
927 "Unknown",
Elliott Hughes820eced2021-08-20 18:00:50 -0700928 GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF),
929 GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF);
Elliott Hughescec480a2017-12-19 16:54:57 -0800930 offset+=8;
931 }
932 break;
933
The Android Open Source Project2949f582009-03-03 19:30:46 -0800934 default:
935 hexdump=TRUE;
936 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700937 break;
938
The Android Open Source Project2949f582009-03-03 19:30:46 -0800939 case LMP_OBJ_CHANNEL_STATUS_REQ:
940 switch(lmp_obj_ctype) {
941 case LMP_CTYPE_IPV4:
The Android Open Source Project2949f582009-03-03 19:30:46 -0800942 offset = 0;
Elliott Hughescec480a2017-12-19 16:54:57 -0800943 while (offset+4 <= obj_tlen) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700944 ND_PRINT("\n\t Interface ID: %s (0x%08x)",
945 GET_IPADDR_STRING(obj_tptr+offset),
946 GET_BE_U_4(obj_tptr + offset));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800947 offset+=4;
948 }
949 break;
Elliott Hughescec480a2017-12-19 16:54:57 -0800950
The Android Open Source Project2949f582009-03-03 19:30:46 -0800951 case LMP_CTYPE_IPV6:
Elliott Hughescec480a2017-12-19 16:54:57 -0800952 offset = 0;
953 while (offset+16 <= obj_tlen) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700954 ND_PRINT("\n\t Interface ID: %s (0x%08x)",
955 GET_IP6ADDR_STRING(obj_tptr+offset),
956 GET_BE_U_4(obj_tptr + offset));
Elliott Hughescec480a2017-12-19 16:54:57 -0800957 offset+=16;
958 }
959 break;
960
961 case LMP_CTYPE_UNMD:
962 offset = 0;
963 while (offset+4 <= obj_tlen) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700964 ND_PRINT("\n\t Interface ID: %u (0x%08x)",
965 GET_BE_U_4(obj_tptr + offset),
966 GET_BE_U_4(obj_tptr + offset));
Elliott Hughescec480a2017-12-19 16:54:57 -0800967 offset+=4;
968 }
969 break;
970
The Android Open Source Project2949f582009-03-03 19:30:46 -0800971 default:
972 hexdump=TRUE;
973 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700974 break;
975
The Android Open Source Project2949f582009-03-03 19:30:46 -0800976 case LMP_OBJ_ERROR_CODE:
977 switch(lmp_obj_ctype) {
978 case LMP_CTYPE_BEGIN_VERIFY_ERROR:
Elliott Hughescec480a2017-12-19 16:54:57 -0800979 if (obj_tlen != 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700980 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800981 break;
982 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700983 ND_PRINT("\n\t Error Code: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800984 bittok2str(lmp_obj_begin_verify_error_values,
985 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -0700986 GET_BE_U_4(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800987 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700988
The Android Open Source Project2949f582009-03-03 19:30:46 -0800989 case LMP_CTYPE_LINK_SUMMARY_ERROR:
Elliott Hughescec480a2017-12-19 16:54:57 -0800990 if (obj_tlen != 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700991 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -0800992 break;
993 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700994 ND_PRINT("\n\t Error Code: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800995 bittok2str(lmp_obj_link_summary_error_values,
996 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -0700997 GET_BE_U_4(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800998 break;
999 default:
1000 hexdump=TRUE;
1001 }
Elliott Hughes892a68b2015-10-19 14:43:53 -07001002 break;
The Android Open Source Project2949f582009-03-03 19:30:46 -08001003
1004 case LMP_OBJ_SERVICE_CONFIG:
1005 switch (lmp_obj_ctype) {
1006 case LMP_CTYPE_SERVICE_CONFIG_SP:
Elliott Hughescec480a2017-12-19 16:54:57 -08001007 if (obj_tlen != 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -07001008 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -08001009 break;
1010 }
Elliott Hughes820eced2021-08-20 18:00:50 -07001011 ND_PRINT("\n\t Flags: %s",
Elliott Hughes892a68b2015-10-19 14:43:53 -07001012 bittok2str(lmp_obj_service_config_sp_flag_values,
1013 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -07001014 GET_U_1(obj_tptr)));
Elliott Hughes892a68b2015-10-19 14:43:53 -07001015
Elliott Hughes820eced2021-08-20 18:00:50 -07001016 ND_PRINT("\n\t UNI Version: %u",
1017 GET_U_1(obj_tptr + 1));
The Android Open Source Project2949f582009-03-03 19:30:46 -08001018
1019 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -07001020
The Android Open Source Project2949f582009-03-03 19:30:46 -08001021 case LMP_CTYPE_SERVICE_CONFIG_CPSA:
Elliott Hughescec480a2017-12-19 16:54:57 -08001022 if (obj_tlen != 16) {
Elliott Hughes820eced2021-08-20 18:00:50 -07001023 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -08001024 break;
1025 }
Elliott Hughes892a68b2015-10-19 14:43:53 -07001026
Elliott Hughes820eced2021-08-20 18:00:50 -07001027 link_type = GET_U_1(obj_tptr);
Elliott Hughes892a68b2015-10-19 14:43:53 -07001028
Elliott Hughes820eced2021-08-20 18:00:50 -07001029 ND_PRINT("\n\t Link Type: %s (%u)",
The Android Open Source Project2949f582009-03-03 19:30:46 -08001030 tok2str(lmp_sd_service_config_cpsa_link_type_values,
1031 "Unknown", link_type),
Elliott Hughes820eced2021-08-20 18:00:50 -07001032 link_type);
Elliott Hughes892a68b2015-10-19 14:43:53 -07001033
Elliott Hughescec480a2017-12-19 16:54:57 -08001034 switch (link_type) {
1035 case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH:
Elliott Hughes820eced2021-08-20 18:00:50 -07001036 ND_PRINT("\n\t Signal Type: %s (%u)",
The Android Open Source Project2949f582009-03-03 19:30:46 -08001037 tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values,
1038 "Unknown",
Elliott Hughes820eced2021-08-20 18:00:50 -07001039 GET_U_1(obj_tptr + 1)),
1040 GET_U_1(obj_tptr + 1));
Elliott Hughescec480a2017-12-19 16:54:57 -08001041 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -07001042
Elliott Hughescec480a2017-12-19 16:54:57 -08001043 case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET:
Elliott Hughes820eced2021-08-20 18:00:50 -07001044 ND_PRINT("\n\t Signal Type: %s (%u)",
The Android Open Source Project2949f582009-03-03 19:30:46 -08001045 tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values,
1046 "Unknown",
Elliott Hughes820eced2021-08-20 18:00:50 -07001047 GET_U_1(obj_tptr + 1)),
1048 GET_U_1(obj_tptr + 1));
Elliott Hughescec480a2017-12-19 16:54:57 -08001049 break;
The Android Open Source Project2949f582009-03-03 19:30:46 -08001050 }
Elliott Hughes892a68b2015-10-19 14:43:53 -07001051
Elliott Hughes820eced2021-08-20 18:00:50 -07001052 ND_PRINT("\n\t Transparency: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -08001053 bittok2str(lmp_obj_service_config_cpsa_tp_flag_values,
1054 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -07001055 GET_U_1(obj_tptr + 2)));
Elliott Hughes892a68b2015-10-19 14:43:53 -07001056
Elliott Hughes820eced2021-08-20 18:00:50 -07001057 ND_PRINT("\n\t Contiguous Concatenation Types: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -08001058 bittok2str(lmp_obj_service_config_cpsa_cct_flag_values,
1059 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -07001060 GET_U_1(obj_tptr + 3)));
Elliott Hughes892a68b2015-10-19 14:43:53 -07001061
Elliott Hughes820eced2021-08-20 18:00:50 -07001062 ND_PRINT("\n\t Minimum NCC: %u",
1063 GET_BE_U_2(obj_tptr + 4));
Elliott Hughes892a68b2015-10-19 14:43:53 -07001064
Elliott Hughes820eced2021-08-20 18:00:50 -07001065 ND_PRINT("\n\t Maximum NCC: %u",
1066 GET_BE_U_2(obj_tptr + 6));
Elliott Hughes892a68b2015-10-19 14:43:53 -07001067
Elliott Hughes820eced2021-08-20 18:00:50 -07001068 ND_PRINT("\n\t Minimum NVC:%u",
1069 GET_BE_U_2(obj_tptr + 8));
Elliott Hughes892a68b2015-10-19 14:43:53 -07001070
Elliott Hughes820eced2021-08-20 18:00:50 -07001071 ND_PRINT("\n\t Maximum NVC:%u",
1072 GET_BE_U_2(obj_tptr + 10));
Elliott Hughes892a68b2015-10-19 14:43:53 -07001073
Elliott Hughes820eced2021-08-20 18:00:50 -07001074 ND_PRINT("\n\t Local Interface ID: %s (0x%08x)",
1075 GET_IPADDR_STRING(obj_tptr+12),
1076 GET_BE_U_4(obj_tptr + 12));
Elliott Hughes892a68b2015-10-19 14:43:53 -07001077
The Android Open Source Project2949f582009-03-03 19:30:46 -08001078 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -07001079
The Android Open Source Project2949f582009-03-03 19:30:46 -08001080 case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM:
Elliott Hughescec480a2017-12-19 16:54:57 -08001081 if (obj_tlen != 8) {
Elliott Hughes820eced2021-08-20 18:00:50 -07001082 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -08001083 break;
1084 }
Elliott Hughes892a68b2015-10-19 14:43:53 -07001085
Elliott Hughes820eced2021-08-20 18:00:50 -07001086 ND_PRINT("\n\t Transparency Flags: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -08001087 bittok2str(
1088 lmp_obj_service_config_nsa_transparency_flag_values,
1089 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -07001090 GET_BE_U_4(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -08001091
Elliott Hughes820eced2021-08-20 18:00:50 -07001092 ND_PRINT("\n\t TCM Monitoring Flags: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -08001093 bittok2str(
1094 lmp_obj_service_config_nsa_tcm_flag_values,
1095 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -07001096 GET_U_1(obj_tptr + 7)));
Elliott Hughes892a68b2015-10-19 14:43:53 -07001097
The Android Open Source Project2949f582009-03-03 19:30:46 -08001098 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -07001099
The Android Open Source Project2949f582009-03-03 19:30:46 -08001100 case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY:
Elliott Hughescec480a2017-12-19 16:54:57 -08001101 if (obj_tlen != 4) {
Elliott Hughes820eced2021-08-20 18:00:50 -07001102 ND_PRINT(" (not correct for object)");
Elliott Hughescec480a2017-12-19 16:54:57 -08001103 break;
1104 }
Elliott Hughes892a68b2015-10-19 14:43:53 -07001105
Elliott Hughes820eced2021-08-20 18:00:50 -07001106 ND_PRINT("\n\t Diversity: Flags: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -08001107 bittok2str(
1108 lmp_obj_service_config_nsa_network_diversity_flag_values,
1109 "none",
Elliott Hughes820eced2021-08-20 18:00:50 -07001110 GET_U_1(obj_tptr + 3)));
The Android Open Source Project2949f582009-03-03 19:30:46 -08001111 break;
1112
1113 default:
1114 hexdump = TRUE;
Elliott Hughese2e3bd12017-05-15 10:59:29 -07001115 }
The Android Open Source Project2949f582009-03-03 19:30:46 -08001116
1117 break;
1118
1119 default:
Elliott Hughes892a68b2015-10-19 14:43:53 -07001120 if (ndo->ndo_vflag <= 1)
1121 print_unknown_data(ndo,obj_tptr,"\n\t ",obj_tlen);
The Android Open Source Project2949f582009-03-03 19:30:46 -08001122 break;
1123 }
1124 /* do we want to see an additionally hexdump ? */
Elliott Hughes892a68b2015-10-19 14:43:53 -07001125 if (ndo->ndo_vflag > 1 || hexdump==TRUE)
1126 print_unknown_data(ndo,tptr+sizeof(struct lmp_object_header),"\n\t ",
The Android Open Source Project2949f582009-03-03 19:30:46 -08001127 lmp_obj_len-sizeof(struct lmp_object_header));
1128
Elliott Hughes820eced2021-08-20 18:00:50 -07001129 if (tlen < lmp_obj_len) {
1130 ND_PRINT(" [remaining objects length %u < %u]", tlen, lmp_obj_len);
1131 nd_print_invalid(ndo);
1132 break;
1133 }
The Android Open Source Project2949f582009-03-03 19:30:46 -08001134 tptr+=lmp_obj_len;
1135 tlen-=lmp_obj_len;
1136 }
The Android Open Source Project2949f582009-03-03 19:30:46 -08001137}