blob: 1c7710c45d69070b99ca0c8d1fdf3a84eca5cc05 [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 *
13 * Original code by Hannes Gredler (hannes@juniper.net)
14 * Support for LMP service discovery extensions (defined by UNI 1.0) added
15 * by Manu Pathak (mapathak@cisco.com), May 2005
16 */
17
Elliott Hughese2e3bd12017-05-15 10:59:29 -070018/* \summary: Link Management Protocol (LMP) printer */
19
20/* specification: RFC 4204 */
21
The Android Open Source Project2949f582009-03-03 19:30:46 -080022#ifdef HAVE_CONFIG_H
23#include "config.h"
24#endif
25
Elliott Hughese2e3bd12017-05-15 10:59:29 -070026#include <netdissect-stdinc.h>
The Android Open Source Project2949f582009-03-03 19:30:46 -080027
Elliott Hughese2e3bd12017-05-15 10:59:29 -070028#include "netdissect.h"
The Android Open Source Project2949f582009-03-03 19:30:46 -080029#include "extract.h"
30#include "addrtoname.h"
31#include "gmpls.h"
32
33/*
34 * LMP common header
35 *
36 * 0 1 2 3
37 * 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
38 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
39 * | Vers | (Reserved) | Flags | Msg Type |
40 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41 * | LMP Length | (Reserved) |
42 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43 */
44
45struct lmp_common_header {
Elliott Hughes892a68b2015-10-19 14:43:53 -070046 uint8_t version_res[2];
47 uint8_t flags;
48 uint8_t msg_type;
49 uint8_t length[2];
50 uint8_t reserved[2];
The Android Open Source Project2949f582009-03-03 19:30:46 -080051};
52
53#define LMP_VERSION 1
Elliott Hughes892a68b2015-10-19 14:43:53 -070054#define LMP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
The Android Open Source Project2949f582009-03-03 19:30:46 -080055
56static const struct tok lmp_header_flag_values[] = {
57 { 0x01, "Control Channel Down"},
58 { 0x02, "LMP restart"},
59 { 0, NULL}
60};
61
62static const struct tok lmp_obj_te_link_flag_values[] = {
63 { 0x01, "Fault Management Supported"},
64 { 0x02, "Link Verification Supported"},
65 { 0, NULL}
66};
67
68static const struct tok lmp_obj_data_link_flag_values[] = {
69 { 0x01, "Data Link Port"},
70 { 0x02, "Allocated for user traffic"},
71 { 0x04, "Failed link"},
72 { 0, NULL}
73};
74
75static const struct tok lmp_obj_channel_status_values[] = {
76 { 1, "Signal Okay"},
77 { 2, "Signal Degraded"},
78 { 3, "Signal Fail"},
79 { 0, NULL}
80};
81
82static const struct tok lmp_obj_begin_verify_flag_values[] = {
83 { 0x0001, "Verify all links"},
84 { 0x0002, "Data link type"},
85 { 0, NULL}
86};
87
88static const struct tok lmp_obj_begin_verify_error_values[] = {
JP Abgrall53f17a92014-02-12 14:02:41 -080089 { 0x01, "Link Verification Procedure Not supported"},
90 { 0x02, "Unwilling to verify"},
91 { 0x04, "Unsupported verification transport mechanism"},
92 { 0x08, "Link-Id configuration error"},
93 { 0x10, "Unknown object c-type"},
The Android Open Source Project2949f582009-03-03 19:30:46 -080094 { 0, NULL}
95};
96
97static const struct tok lmp_obj_link_summary_error_values[] = {
JP Abgrall53f17a92014-02-12 14:02:41 -080098 { 0x01, "Unacceptable non-negotiable LINK-SUMMARY parameters"},
99 { 0x02, "Renegotiate LINK-SUMMARY parameters"},
100 { 0x04, "Invalid TE-LINK Object"},
101 { 0x08, "Invalid DATA-LINK Object"},
102 { 0x10, "Unknown TE-LINK Object c-type"},
103 { 0x20, "Unknown DATA-LINK Object c-type"},
The Android Open Source Project2949f582009-03-03 19:30:46 -0800104 { 0, NULL}
105};
106
107/* Service Config Supported Protocols Flags */
108static const struct tok lmp_obj_service_config_sp_flag_values[] = {
109 { 0x01, "RSVP Supported"},
110 { 0x02, "LDP Supported"},
111 { 0, NULL}
112};
113
114/* Service Config Client Port Service Attribute Transparency Flags */
115static const struct tok lmp_obj_service_config_cpsa_tp_flag_values[] = {
116 { 0x01, "Path/VC Overhead Transparency Supported"},
117 { 0x02, "Line/MS Overhead Transparency Supported"},
118 { 0x04, "Section/RS Overhead Transparency Supported"},
119 { 0, NULL}
120};
121
122/* Service Config Client Port Service Attribute Contiguous Concatenation Types Flags */
123static const struct tok lmp_obj_service_config_cpsa_cct_flag_values[] = {
124 { 0x01, "Contiguous Concatenation Types Supported"},
125 { 0, NULL}
126};
127
128/* Service Config Network Service Attributes Transparency Flags */
129static const struct tok lmp_obj_service_config_nsa_transparency_flag_values[] = {
130 { 0x01, "Standard SOH/RSOH Transparency Supported"},
131 { 0x02, "Standard LOH/MSOH Transparency Supported"},
132 { 0, NULL}
133};
134
135/* Service Config Network Service Attributes TCM Monitoring Flags */
136static const struct tok lmp_obj_service_config_nsa_tcm_flag_values[] = {
137 { 0x01, "Transparent Tandem Connection Monitoring Supported"},
138 { 0, NULL}
139};
140
141/* Network Service Attributes Network Diversity Flags */
142static const struct tok lmp_obj_service_config_nsa_network_diversity_flag_values[] = {
143 { 0x01, "Node Diversity Supported"},
144 { 0x02, "Link Diversity Supported"},
145 { 0x04, "SRLG Diversity Supported"},
146 { 0, NULL}
147};
148
149#define LMP_MSGTYPE_CONFIG 1
150#define LMP_MSGTYPE_CONFIG_ACK 2
151#define LMP_MSGTYPE_CONFIG_NACK 3
152#define LMP_MSGTYPE_HELLO 4
153#define LMP_MSGTYPE_VERIFY_BEGIN 5
154#define LMP_MSGTYPE_VERIFY_BEGIN_ACK 6
155#define LMP_MSGTYPE_VERIFY_BEGIN_NACK 7
156#define LMP_MSGTYPE_VERIFY_END 8
157#define LMP_MSGTYPE_VERIFY_END_ACK 9
158#define LMP_MSGTYPE_TEST 10
159#define LMP_MSGTYPE_TEST_STATUS_SUCCESS 11
160#define LMP_MSGTYPE_TEST_STATUS_FAILURE 12
161#define LMP_MSGTYPE_TEST_STATUS_ACK 13
162#define LMP_MSGTYPE_LINK_SUMMARY 14
163#define LMP_MSGTYPE_LINK_SUMMARY_ACK 15
164#define LMP_MSGTYPE_LINK_SUMMARY_NACK 16
165#define LMP_MSGTYPE_CHANNEL_STATUS 17
166#define LMP_MSGTYPE_CHANNEL_STATUS_ACK 18
167#define LMP_MSGTYPE_CHANNEL_STATUS_REQ 19
168#define LMP_MSGTYPE_CHANNEL_STATUS_RESP 20
169/* LMP Service Discovery message types defined by UNI 1.0 */
170#define LMP_MSGTYPE_SERVICE_CONFIG 50
171#define LMP_MSGTYPE_SERVICE_CONFIG_ACK 51
172#define LMP_MSGTYPE_SERVICE_CONFIG_NACK 52
173
174static const struct tok lmp_msg_type_values[] = {
175 { LMP_MSGTYPE_CONFIG, "Config"},
176 { LMP_MSGTYPE_CONFIG_ACK, "Config ACK"},
177 { LMP_MSGTYPE_CONFIG_NACK, "Config NACK"},
178 { LMP_MSGTYPE_HELLO, "Hello"},
179 { LMP_MSGTYPE_VERIFY_BEGIN, "Begin Verify"},
180 { LMP_MSGTYPE_VERIFY_BEGIN_ACK, "Begin Verify ACK"},
181 { LMP_MSGTYPE_VERIFY_BEGIN_NACK, "Begin Verify NACK"},
182 { LMP_MSGTYPE_VERIFY_END, "End Verify"},
183 { LMP_MSGTYPE_VERIFY_END_ACK, "End Verify ACK"},
184 { LMP_MSGTYPE_TEST, "Test"},
185 { LMP_MSGTYPE_TEST_STATUS_SUCCESS, "Test Status Success"},
186 { LMP_MSGTYPE_TEST_STATUS_FAILURE, "Test Status Failure"},
187 { LMP_MSGTYPE_TEST_STATUS_ACK, "Test Status ACK"},
188 { LMP_MSGTYPE_LINK_SUMMARY, "Link Summary"},
189 { LMP_MSGTYPE_LINK_SUMMARY_ACK, "Link Summary ACK"},
190 { LMP_MSGTYPE_LINK_SUMMARY_NACK, "Link Summary NACK"},
191 { LMP_MSGTYPE_CHANNEL_STATUS, "Channel Status"},
192 { LMP_MSGTYPE_CHANNEL_STATUS_ACK, "Channel Status ACK"},
193 { LMP_MSGTYPE_CHANNEL_STATUS_REQ, "Channel Status Request"},
194 { LMP_MSGTYPE_CHANNEL_STATUS_RESP, "Channel Status Response"},
195 { LMP_MSGTYPE_SERVICE_CONFIG, "Service Config"},
196 { LMP_MSGTYPE_SERVICE_CONFIG_ACK, "Service Config ACK"},
197 { LMP_MSGTYPE_SERVICE_CONFIG_NACK, "Service Config NACK"},
198 { 0, NULL}
199};
200
Elliott Hughes892a68b2015-10-19 14:43:53 -0700201/*
The Android Open Source Project2949f582009-03-03 19:30:46 -0800202 * LMP object header
203 *
204 * 0 1 2 3
205 * 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
206 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
207 * |N| C-Type | Class | Length |
208 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
209 * | |
210 * // (object contents) //
211 * | |
Elliott Hughes892a68b2015-10-19 14:43:53 -0700212 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The Android Open Source Project2949f582009-03-03 19:30:46 -0800213 */
214
215struct lmp_object_header {
Elliott Hughes892a68b2015-10-19 14:43:53 -0700216 uint8_t ctype;
217 uint8_t class_num;
218 uint8_t length[2];
The Android Open Source Project2949f582009-03-03 19:30:46 -0800219};
220
221#define LMP_OBJ_CC_ID 1
222#define LMP_OBJ_NODE_ID 2
223#define LMP_OBJ_LINK_ID 3
224#define LMP_OBJ_INTERFACE_ID 4
Elliott Hughes892a68b2015-10-19 14:43:53 -0700225#define LMP_OBJ_MESSAGE_ID 5
The Android Open Source Project2949f582009-03-03 19:30:46 -0800226#define LMP_OBJ_CONFIG 6
227#define LMP_OBJ_HELLO 7
228#define LMP_OBJ_VERIFY_BEGIN 8
229#define LMP_OBJ_VERIFY_BEGIN_ACK 9
230#define LMP_OBJ_VERIFY_ID 10
231#define LMP_OBJ_TE_LINK 11
232#define LMP_OBJ_DATA_LINK 12
233#define LMP_OBJ_CHANNEL_STATUS 13
234#define LMP_OBJ_CHANNEL_STATUS_REQ 14
235#define LMP_OBJ_ERROR_CODE 20
236
237#define LMP_OBJ_SERVICE_CONFIG 51 /* defined in UNI 1.0 */
238
239static const struct tok lmp_obj_values[] = {
240 { LMP_OBJ_CC_ID, "Control Channel ID" },
241 { LMP_OBJ_NODE_ID, "Node ID" },
242 { LMP_OBJ_LINK_ID, "Link ID" },
243 { LMP_OBJ_INTERFACE_ID, "Interface ID" },
244 { LMP_OBJ_MESSAGE_ID, "Message ID" },
245 { LMP_OBJ_CONFIG, "Configuration" },
246 { LMP_OBJ_HELLO, "Hello" },
247 { LMP_OBJ_VERIFY_BEGIN, "Verify Begin" },
248 { LMP_OBJ_VERIFY_BEGIN_ACK, "Verify Begin ACK" },
249 { LMP_OBJ_VERIFY_ID, "Verify ID" },
250 { LMP_OBJ_TE_LINK, "TE Link" },
251 { LMP_OBJ_DATA_LINK, "Data Link" },
252 { LMP_OBJ_CHANNEL_STATUS, "Channel Status" },
253 { LMP_OBJ_CHANNEL_STATUS_REQ, "Channel Status Request" },
254 { LMP_OBJ_ERROR_CODE, "Error Code" },
255 { LMP_OBJ_SERVICE_CONFIG, "Service Config" },
256
257 { 0, NULL}
258};
259
260#define INT_SWITCHING_TYPE_SUBOBJ 1
261#define WAVELENGTH_SUBOBJ 2
262
263static const struct tok lmp_data_link_subobj[] = {
264 { INT_SWITCHING_TYPE_SUBOBJ, "Interface Switching Type" },
265 { WAVELENGTH_SUBOBJ , "Wavelength" },
266 { 0, NULL}
267};
268
269#define LMP_CTYPE_IPV4 1
270#define LMP_CTYPE_IPV6 2
271
272#define LMP_CTYPE_LOC 1
273#define LMP_CTYPE_RMT 2
274#define LMP_CTYPE_UNMD 3
Elliott Hughes892a68b2015-10-19 14:43:53 -0700275
The Android Open Source Project2949f582009-03-03 19:30:46 -0800276#define LMP_CTYPE_IPV4_LOC 1
277#define LMP_CTYPE_IPV4_RMT 2
278#define LMP_CTYPE_IPV6_LOC 3
279#define LMP_CTYPE_IPV6_RMT 4
Elliott Hughes892a68b2015-10-19 14:43:53 -0700280#define LMP_CTYPE_UNMD_LOC 5
281#define LMP_CTYPE_UNMD_RMT 6
The Android Open Source Project2949f582009-03-03 19:30:46 -0800282
283#define LMP_CTYPE_1 1
284#define LMP_CTYPE_2 2
285
286#define LMP_CTYPE_HELLO_CONFIG 1
287#define LMP_CTYPE_HELLO 1
288
289#define LMP_CTYPE_BEGIN_VERIFY_ERROR 1
290#define LMP_CTYPE_LINK_SUMMARY_ERROR 2
291
292/* C-Types for Service Config Object */
293#define LMP_CTYPE_SERVICE_CONFIG_SP 1
294#define LMP_CTYPE_SERVICE_CONFIG_CPSA 2
295#define LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM 3
296#define LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY 4
297
Elliott Hughes892a68b2015-10-19 14:43:53 -0700298/*
The Android Open Source Project2949f582009-03-03 19:30:46 -0800299 * Different link types allowed in the Client Port Service Attributes
300 * subobject defined for LMP Service Discovery in the UNI 1.0 spec
301 */
302#define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH 5 /* UNI 1.0 Sec 9.4.2 */
303#define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET 6 /* UNI 1.0 Sec 9.4.2 */
304
305/*
306 * the ctypes are not globally unique so for
307 * translating it to strings we build a table based
308 * on objects offsetted by the ctype
309 */
310
311static const struct tok lmp_ctype_values[] = {
312 { 256*LMP_OBJ_CC_ID+LMP_CTYPE_LOC, "Local" },
313 { 256*LMP_OBJ_CC_ID+LMP_CTYPE_RMT, "Remote" },
314 { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_LOC, "Local" },
315 { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_RMT, "Remote" },
316 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
317 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
318 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
319 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
320 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
321 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
322 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
323 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
324 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
325 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
326 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
327 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
328 { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_1, "1" },
329 { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_2, "2" },
330 { 256*LMP_OBJ_CONFIG+LMP_CTYPE_1, "1" },
331 { 256*LMP_OBJ_HELLO+LMP_CTYPE_1, "1" },
332 { 256*LMP_OBJ_VERIFY_BEGIN+LMP_CTYPE_1, "1" },
333 { 256*LMP_OBJ_VERIFY_BEGIN_ACK+LMP_CTYPE_1, "1" },
334 { 256*LMP_OBJ_VERIFY_ID+LMP_CTYPE_1, "1" },
335 { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV4, "IPv4" },
336 { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV6, "IPv6" },
337 { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
338 { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV4, "IPv4" },
339 { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV6, "IPv6" },
340 { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
341 { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV4, "IPv4" },
342 { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV6, "IPv6" },
343 { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_UNMD, "Unnumbered" },
344 { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV4, "IPv4" },
345 { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV6, "IPv6" },
346 { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_UNMD, "Unnumbered" },
347 { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_1, "1" },
348 { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_2, "2" },
349 { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_SP, "1" },
350 { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_CPSA, "2" },
351 { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM, "3" },
352 { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY, "4" },
353 { 0, NULL}
354};
355
356void
Elliott Hughes892a68b2015-10-19 14:43:53 -0700357lmp_print(netdissect_options *ndo,
358 register const u_char *pptr, register u_int len)
359{
The Android Open Source Project2949f582009-03-03 19:30:46 -0800360 const struct lmp_common_header *lmp_com_header;
361 const struct lmp_object_header *lmp_obj_header;
362 const u_char *tptr,*obj_tptr;
363 int tlen,lmp_obj_len,lmp_obj_ctype,obj_tlen;
364 int hexdump;
365 int offset,subobj_type,subobj_len,total_subobj_len;
366 int link_type;
367
368 union { /* int to float conversion buffer */
Elliott Hughes892a68b2015-10-19 14:43:53 -0700369 float f;
370 uint32_t i;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800371 } bw;
372
373 tptr=pptr;
374 lmp_com_header = (const struct lmp_common_header *)pptr;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700375 ND_TCHECK(*lmp_com_header);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800376
377 /*
378 * Sanity checking of the header.
379 */
380 if (LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]) != LMP_VERSION) {
Elliott Hughes892a68b2015-10-19 14:43:53 -0700381 ND_PRINT((ndo, "LMP version %u packet not supported",
382 LMP_EXTRACT_VERSION(lmp_com_header->version_res[0])));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800383 return;
384 }
385
386 /* in non-verbose mode just lets print the basic Message Type*/
Elliott Hughes892a68b2015-10-19 14:43:53 -0700387 if (ndo->ndo_vflag < 1) {
388 ND_PRINT((ndo, "LMPv%u %s Message, length: %u",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800389 LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
390 tok2str(lmp_msg_type_values, "unknown (%u)",lmp_com_header->msg_type),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700391 len));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800392 return;
393 }
394
395 /* ok they seem to want to know everything - lets fully decode it */
396
397 tlen=EXTRACT_16BITS(lmp_com_header->length);
398
Elliott Hughes892a68b2015-10-19 14:43:53 -0700399 ND_PRINT((ndo, "\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800400 LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
401 tok2str(lmp_msg_type_values, "unknown, type: %u",lmp_com_header->msg_type),
402 bittok2str(lmp_header_flag_values,"none",lmp_com_header->flags),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700403 tlen));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800404
405 tptr+=sizeof(const struct lmp_common_header);
406 tlen-=sizeof(const struct lmp_common_header);
407
408 while(tlen>0) {
409 /* did we capture enough for fully decoding the object header ? */
Elliott Hughes892a68b2015-10-19 14:43:53 -0700410 ND_TCHECK2(*tptr, sizeof(struct lmp_object_header));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800411
412 lmp_obj_header = (const struct lmp_object_header *)tptr;
413 lmp_obj_len=EXTRACT_16BITS(lmp_obj_header->length);
414 lmp_obj_ctype=(lmp_obj_header->ctype)&0x7f;
415
416 if(lmp_obj_len % 4 || lmp_obj_len < 4)
417 return;
418
Elliott Hughes892a68b2015-10-19 14:43:53 -0700419 ND_PRINT((ndo, "\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800420 tok2str(lmp_obj_values,
421 "Unknown",
422 lmp_obj_header->class_num),
423 lmp_obj_header->class_num,
424 tok2str(lmp_ctype_values,
425 "Unknown",
426 ((lmp_obj_header->class_num)<<8)+lmp_obj_ctype),
427 lmp_obj_ctype,
428 (lmp_obj_header->ctype)&0x80 ? "" : "non-",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700429 lmp_obj_len));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800430
431 obj_tptr=tptr+sizeof(struct lmp_object_header);
432 obj_tlen=lmp_obj_len-sizeof(struct lmp_object_header);
433
434 /* did we capture enough for fully decoding the object ? */
Elliott Hughes892a68b2015-10-19 14:43:53 -0700435 ND_TCHECK2(*tptr, lmp_obj_len);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800436 hexdump=FALSE;
437
438 switch(lmp_obj_header->class_num) {
439
440 case LMP_OBJ_CC_ID:
441 switch(lmp_obj_ctype) {
442 case LMP_CTYPE_LOC:
443 case LMP_CTYPE_RMT:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700444 ND_PRINT((ndo, "\n\t Control Channel ID: %u (0x%08x)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800445 EXTRACT_32BITS(obj_tptr),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700446 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800447 break;
448
449 default:
450 hexdump=TRUE;
451 }
452 break;
453
454 case LMP_OBJ_LINK_ID:
455 case LMP_OBJ_INTERFACE_ID:
456 switch(lmp_obj_ctype) {
457 case LMP_CTYPE_IPV4_LOC:
458 case LMP_CTYPE_IPV4_RMT:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700459 ND_PRINT((ndo, "\n\t IPv4 Link ID: %s (0x%08x)",
460 ipaddr_string(ndo, obj_tptr),
461 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800462 break;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800463 case LMP_CTYPE_IPV6_LOC:
464 case LMP_CTYPE_IPV6_RMT:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700465 ND_PRINT((ndo, "\n\t IPv6 Link ID: %s (0x%08x)",
466 ip6addr_string(ndo, obj_tptr),
467 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800468 break;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800469 case LMP_CTYPE_UNMD_LOC:
470 case LMP_CTYPE_UNMD_RMT:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700471 ND_PRINT((ndo, "\n\t Link ID: %u (0x%08x)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800472 EXTRACT_32BITS(obj_tptr),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700473 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800474 break;
475 default:
476 hexdump=TRUE;
477 }
478 break;
479
480 case LMP_OBJ_MESSAGE_ID:
481 switch(lmp_obj_ctype) {
482 case LMP_CTYPE_1:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700483 ND_PRINT((ndo, "\n\t Message ID: %u (0x%08x)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800484 EXTRACT_32BITS(obj_tptr),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700485 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800486 break;
487 case LMP_CTYPE_2:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700488 ND_PRINT((ndo, "\n\t Message ID Ack: %u (0x%08x)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800489 EXTRACT_32BITS(obj_tptr),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700490 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800491 break;
492 default:
493 hexdump=TRUE;
494 }
495 break;
496
497 case LMP_OBJ_NODE_ID:
498 switch(lmp_obj_ctype) {
499 case LMP_CTYPE_LOC:
500 case LMP_CTYPE_RMT:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700501 ND_PRINT((ndo, "\n\t Node ID: %s (0x%08x)",
502 ipaddr_string(ndo, obj_tptr),
503 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800504 break;
505
506 default:
507 hexdump=TRUE;
508 }
509 break;
510
511 case LMP_OBJ_CONFIG:
512 switch(lmp_obj_ctype) {
513 case LMP_CTYPE_HELLO_CONFIG:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700514 ND_PRINT((ndo, "\n\t Hello Interval: %u\n\t Hello Dead Interval: %u",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800515 EXTRACT_16BITS(obj_tptr),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700516 EXTRACT_16BITS(obj_tptr+2)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800517 break;
518
519 default:
520 hexdump=TRUE;
521 }
522 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700523
The Android Open Source Project2949f582009-03-03 19:30:46 -0800524 case LMP_OBJ_HELLO:
525 switch(lmp_obj_ctype) {
526 case LMP_CTYPE_HELLO:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700527 ND_PRINT((ndo, "\n\t Tx Seq: %u, Rx Seq: %u",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800528 EXTRACT_32BITS(obj_tptr),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700529 EXTRACT_32BITS(obj_tptr+4)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800530 break;
531
532 default:
533 hexdump=TRUE;
534 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700535 break;
536
The Android Open Source Project2949f582009-03-03 19:30:46 -0800537 case LMP_OBJ_TE_LINK:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700538 ND_PRINT((ndo, "\n\t Flags: [%s]",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800539 bittok2str(lmp_obj_te_link_flag_values,
540 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700541 EXTRACT_16BITS(obj_tptr)>>8)));
542
The Android Open Source Project2949f582009-03-03 19:30:46 -0800543 switch(lmp_obj_ctype) {
544 case LMP_CTYPE_IPV4:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700545 ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)"
JP Abgrall53f17a92014-02-12 14:02:41 -0800546 "\n\t Remote Link-ID: %s (0x%08x)",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700547 ipaddr_string(ndo, obj_tptr+4),
The Android Open Source Project2949f582009-03-03 19:30:46 -0800548 EXTRACT_32BITS(obj_tptr+4),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700549 ipaddr_string(ndo, obj_tptr+8),
550 EXTRACT_32BITS(obj_tptr+8)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800551 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700552
The Android Open Source Project2949f582009-03-03 19:30:46 -0800553 case LMP_CTYPE_IPV6:
The Android Open Source Project2949f582009-03-03 19:30:46 -0800554 case LMP_CTYPE_UNMD:
555 default:
556 hexdump=TRUE;
557 }
558 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700559
The Android Open Source Project2949f582009-03-03 19:30:46 -0800560 case LMP_OBJ_DATA_LINK:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700561 ND_PRINT((ndo, "\n\t Flags: [%s]",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800562 bittok2str(lmp_obj_data_link_flag_values,
563 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700564 EXTRACT_16BITS(obj_tptr)>>8)));
565
The Android Open Source Project2949f582009-03-03 19:30:46 -0800566 switch(lmp_obj_ctype) {
567 case LMP_CTYPE_IPV4:
568 case LMP_CTYPE_UNMD:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700569 ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)"
JP Abgrall53f17a92014-02-12 14:02:41 -0800570 "\n\t Remote Interface ID: %s (0x%08x)",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700571 ipaddr_string(ndo, obj_tptr+4),
The Android Open Source Project2949f582009-03-03 19:30:46 -0800572 EXTRACT_32BITS(obj_tptr+4),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700573 ipaddr_string(ndo, obj_tptr+8),
574 EXTRACT_32BITS(obj_tptr+8)));
575
576 total_subobj_len = lmp_obj_len - 16;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800577 offset = 12;
578 while (total_subobj_len > 0 && hexdump == FALSE ) {
579 subobj_type = EXTRACT_16BITS(obj_tptr+offset)>>8;
580 subobj_len = EXTRACT_16BITS(obj_tptr+offset)&0x00FF;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700581 ND_PRINT((ndo, "\n\t Subobject, Type: %s (%u), Length: %u",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800582 tok2str(lmp_data_link_subobj,
583 "Unknown",
584 subobj_type),
585 subobj_type,
Elliott Hughes892a68b2015-10-19 14:43:53 -0700586 subobj_len));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800587 switch(subobj_type) {
588 case INT_SWITCHING_TYPE_SUBOBJ:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700589 ND_PRINT((ndo, "\n\t Switching Type: %s (%u)",
590 tok2str(gmpls_switch_cap_values,
591 "Unknown",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800592 EXTRACT_16BITS(obj_tptr+offset+2)>>8),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700593 EXTRACT_16BITS(obj_tptr+offset+2)>>8));
594 ND_PRINT((ndo, "\n\t Encoding Type: %s (%u)",
595 tok2str(gmpls_encoding_values,
596 "Unknown",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800597 EXTRACT_16BITS(obj_tptr+offset+2)&0x00FF),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700598 EXTRACT_16BITS(obj_tptr+offset+2)&0x00FF));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800599 bw.i = EXTRACT_32BITS(obj_tptr+offset+4);
Elliott Hughes892a68b2015-10-19 14:43:53 -0700600 ND_PRINT((ndo, "\n\t Min Reservable Bandwidth: %.3f Mbps",
601 bw.f*8/1000000));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800602 bw.i = EXTRACT_32BITS(obj_tptr+offset+8);
Elliott Hughes892a68b2015-10-19 14:43:53 -0700603 ND_PRINT((ndo, "\n\t Max Reservable Bandwidth: %.3f Mbps",
604 bw.f*8/1000000));
605 break;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800606 case WAVELENGTH_SUBOBJ:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700607 ND_PRINT((ndo, "\n\t Wavelength: %u",
608 EXTRACT_32BITS(obj_tptr+offset+4)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800609 break;
610 default:
611 /* Any Unknown Subobject ==> Exit loop */
612 hexdump=TRUE;
613 break;
614 }
615 total_subobj_len-=subobj_len;
616 offset+=subobj_len;
617 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700618
The Android Open Source Project2949f582009-03-03 19:30:46 -0800619 break;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800620 case LMP_CTYPE_IPV6:
The Android Open Source Project2949f582009-03-03 19:30:46 -0800621 default:
622 hexdump=TRUE;
623 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700624 break;
625
The Android Open Source Project2949f582009-03-03 19:30:46 -0800626 case LMP_OBJ_VERIFY_BEGIN:
627 switch(lmp_obj_ctype) {
628 case LMP_CTYPE_1:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700629 ND_PRINT((ndo, "\n\t Flags: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800630 bittok2str(lmp_obj_begin_verify_flag_values,
631 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700632 EXTRACT_16BITS(obj_tptr))));
633 ND_PRINT((ndo, "\n\t Verify Interval: %u",
634 EXTRACT_16BITS(obj_tptr+2)));
635 ND_PRINT((ndo, "\n\t Data links: %u",
636 EXTRACT_32BITS(obj_tptr+4)));
637 ND_PRINT((ndo, "\n\t Encoding type: %s",
638 tok2str(gmpls_encoding_values, "Unknown", *(obj_tptr+8))));
639 ND_PRINT((ndo, "\n\t Verify Transport Mechanism: %u (0x%x)%s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800640 EXTRACT_16BITS(obj_tptr+10),
641 EXTRACT_16BITS(obj_tptr+10),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700642 EXTRACT_16BITS(obj_tptr+10)&8000 ? " (Payload test messages capable)" : ""));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800643 bw.i = EXTRACT_32BITS(obj_tptr+12);
Elliott Hughes892a68b2015-10-19 14:43:53 -0700644 ND_PRINT((ndo, "\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000));
645 ND_PRINT((ndo, "\n\t Wavelength: %u",
646 EXTRACT_32BITS(obj_tptr+16)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800647 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700648
The Android Open Source Project2949f582009-03-03 19:30:46 -0800649 default:
650 hexdump=TRUE;
651 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700652 break;
653
The Android Open Source Project2949f582009-03-03 19:30:46 -0800654 case LMP_OBJ_VERIFY_BEGIN_ACK:
655 switch(lmp_obj_ctype) {
656 case LMP_CTYPE_1:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700657 ND_PRINT((ndo, "\n\t Verify Dead Interval: %u"
JP Abgrall53f17a92014-02-12 14:02:41 -0800658 "\n\t Verify Transport Response: %u",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800659 EXTRACT_16BITS(obj_tptr),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700660 EXTRACT_16BITS(obj_tptr+2)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800661 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700662
The Android Open Source Project2949f582009-03-03 19:30:46 -0800663 default:
664 hexdump=TRUE;
665 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700666 break;
667
The Android Open Source Project2949f582009-03-03 19:30:46 -0800668 case LMP_OBJ_VERIFY_ID:
669 switch(lmp_obj_ctype) {
670 case LMP_CTYPE_1:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700671 ND_PRINT((ndo, "\n\t Verify ID: %u",
672 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800673 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700674
The Android Open Source Project2949f582009-03-03 19:30:46 -0800675 default:
676 hexdump=TRUE;
677 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700678 break;
679
The Android Open Source Project2949f582009-03-03 19:30:46 -0800680 case LMP_OBJ_CHANNEL_STATUS:
681 switch(lmp_obj_ctype) {
682 case LMP_CTYPE_IPV4:
683 case LMP_CTYPE_UNMD:
684 offset = 0;
685 /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
686 while (offset < (lmp_obj_len-(int)sizeof(struct lmp_object_header)) ) {
Elliott Hughes892a68b2015-10-19 14:43:53 -0700687 ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
688 ipaddr_string(ndo, obj_tptr+offset),
689 EXTRACT_32BITS(obj_tptr+offset)));
690
691 ND_PRINT((ndo, "\n\t\t Active: %s (%u)", (EXTRACT_32BITS(obj_tptr+offset+4)>>31) ?
The Android Open Source Project2949f582009-03-03 19:30:46 -0800692 "Allocated" : "Non-allocated",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700693 (EXTRACT_32BITS(obj_tptr+offset+4)>>31)));
694
695 ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ?
The Android Open Source Project2949f582009-03-03 19:30:46 -0800696 "Transmit" : "Receive",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700697 (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1));
698
699 ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800700 tok2str(lmp_obj_channel_status_values,
701 "Unknown",
702 EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700703 EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800704 offset+=8;
705 }
706 break;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800707 case LMP_CTYPE_IPV6:
The Android Open Source Project2949f582009-03-03 19:30:46 -0800708 default:
709 hexdump=TRUE;
710 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700711 break;
712
The Android Open Source Project2949f582009-03-03 19:30:46 -0800713 case LMP_OBJ_CHANNEL_STATUS_REQ:
714 switch(lmp_obj_ctype) {
715 case LMP_CTYPE_IPV4:
716 case LMP_CTYPE_UNMD:
717 offset = 0;
718 while (offset < (lmp_obj_len-(int)sizeof(struct lmp_object_header)) ) {
Elliott Hughes892a68b2015-10-19 14:43:53 -0700719 ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
720 ipaddr_string(ndo, obj_tptr+offset),
721 EXTRACT_32BITS(obj_tptr+offset)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800722 offset+=4;
723 }
724 break;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800725 case LMP_CTYPE_IPV6:
The Android Open Source Project2949f582009-03-03 19:30:46 -0800726 default:
727 hexdump=TRUE;
728 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700729 break;
730
The Android Open Source Project2949f582009-03-03 19:30:46 -0800731 case LMP_OBJ_ERROR_CODE:
732 switch(lmp_obj_ctype) {
733 case LMP_CTYPE_BEGIN_VERIFY_ERROR:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700734 ND_PRINT((ndo, "\n\t Error Code: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800735 bittok2str(lmp_obj_begin_verify_error_values,
736 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700737 EXTRACT_32BITS(obj_tptr))));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800738 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700739
The Android Open Source Project2949f582009-03-03 19:30:46 -0800740 case LMP_CTYPE_LINK_SUMMARY_ERROR:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700741 ND_PRINT((ndo, "\n\t Error Code: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800742 bittok2str(lmp_obj_link_summary_error_values,
743 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700744 EXTRACT_32BITS(obj_tptr))));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800745 break;
746 default:
747 hexdump=TRUE;
748 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700749 break;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800750
751 case LMP_OBJ_SERVICE_CONFIG:
752 switch (lmp_obj_ctype) {
753 case LMP_CTYPE_SERVICE_CONFIG_SP:
The Android Open Source Project2949f582009-03-03 19:30:46 -0800754
Elliott Hughes892a68b2015-10-19 14:43:53 -0700755 ND_PRINT((ndo, "\n\t Flags: %s",
756 bittok2str(lmp_obj_service_config_sp_flag_values,
757 "none",
758 EXTRACT_16BITS(obj_tptr)>>8)));
759
760 ND_PRINT((ndo, "\n\t UNI Version: %u",
761 EXTRACT_16BITS(obj_tptr) & 0x00FF));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800762
763 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700764
The Android Open Source Project2949f582009-03-03 19:30:46 -0800765 case LMP_CTYPE_SERVICE_CONFIG_CPSA:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700766
The Android Open Source Project2949f582009-03-03 19:30:46 -0800767 link_type = EXTRACT_16BITS(obj_tptr)>>8;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700768
769 ND_PRINT((ndo, "\n\t Link Type: %s (%u)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800770 tok2str(lmp_sd_service_config_cpsa_link_type_values,
771 "Unknown", link_type),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700772 link_type));
773
The Android Open Source Project2949f582009-03-03 19:30:46 -0800774 if (link_type == LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH) {
Elliott Hughes892a68b2015-10-19 14:43:53 -0700775 ND_PRINT((ndo, "\n\t Signal Type: %s (%u)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800776 tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values,
777 "Unknown",
778 EXTRACT_16BITS(obj_tptr) & 0x00FF),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700779 EXTRACT_16BITS(obj_tptr) & 0x00FF));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800780 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700781
The Android Open Source Project2949f582009-03-03 19:30:46 -0800782 if (link_type == LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET) {
Elliott Hughes892a68b2015-10-19 14:43:53 -0700783 ND_PRINT((ndo, "\n\t Signal Type: %s (%u)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800784 tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values,
785 "Unknown",
786 EXTRACT_16BITS(obj_tptr) & 0x00FF),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700787 EXTRACT_16BITS(obj_tptr) & 0x00FF));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800788 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700789
790 ND_PRINT((ndo, "\n\t Transparency: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800791 bittok2str(lmp_obj_service_config_cpsa_tp_flag_values,
792 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700793 EXTRACT_16BITS(obj_tptr+2)>>8)));
794
795 ND_PRINT((ndo, "\n\t Contiguous Concatenation Types: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800796 bittok2str(lmp_obj_service_config_cpsa_cct_flag_values,
797 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700798 EXTRACT_16BITS(obj_tptr+2)>>8 & 0x00FF)));
799
800 ND_PRINT((ndo, "\n\t Minimum NCC: %u",
801 EXTRACT_16BITS(obj_tptr+4)));
802
803 ND_PRINT((ndo, "\n\t Maximum NCC: %u",
804 EXTRACT_16BITS(obj_tptr+6)));
805
806 ND_PRINT((ndo, "\n\t Minimum NVC:%u",
807 EXTRACT_16BITS(obj_tptr+8)));
808
809 ND_PRINT((ndo, "\n\t Maximum NVC:%u",
810 EXTRACT_16BITS(obj_tptr+10)));
811
812 ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)",
813 ipaddr_string(ndo, obj_tptr+12),
814 EXTRACT_32BITS(obj_tptr+12)));
815
The Android Open Source Project2949f582009-03-03 19:30:46 -0800816 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700817
The Android Open Source Project2949f582009-03-03 19:30:46 -0800818 case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700819
820 ND_PRINT((ndo, "\n\t Transparency Flags: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800821 bittok2str(
822 lmp_obj_service_config_nsa_transparency_flag_values,
823 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700824 EXTRACT_32BITS(obj_tptr))));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800825
Elliott Hughes892a68b2015-10-19 14:43:53 -0700826 ND_PRINT((ndo, "\n\t TCM Monitoring Flags: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800827 bittok2str(
828 lmp_obj_service_config_nsa_tcm_flag_values,
829 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700830 EXTRACT_16BITS(obj_tptr+6) & 0x00FF)));
831
The Android Open Source Project2949f582009-03-03 19:30:46 -0800832 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700833
The Android Open Source Project2949f582009-03-03 19:30:46 -0800834 case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700835
836 ND_PRINT((ndo, "\n\t Diversity: Flags: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800837 bittok2str(
838 lmp_obj_service_config_nsa_network_diversity_flag_values,
839 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700840 EXTRACT_16BITS(obj_tptr+2) & 0x00FF)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800841 break;
842
843 default:
844 hexdump = TRUE;
Elliott Hughese2e3bd12017-05-15 10:59:29 -0700845 }
The Android Open Source Project2949f582009-03-03 19:30:46 -0800846
847 break;
848
849 default:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700850 if (ndo->ndo_vflag <= 1)
851 print_unknown_data(ndo,obj_tptr,"\n\t ",obj_tlen);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800852 break;
853 }
854 /* do we want to see an additionally hexdump ? */
Elliott Hughes892a68b2015-10-19 14:43:53 -0700855 if (ndo->ndo_vflag > 1 || hexdump==TRUE)
856 print_unknown_data(ndo,tptr+sizeof(struct lmp_object_header),"\n\t ",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800857 lmp_obj_len-sizeof(struct lmp_object_header));
858
859 tptr+=lmp_obj_len;
860 tlen-=lmp_obj_len;
861 }
862 return;
863trunc:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700864 ND_PRINT((ndo, "\n\t\t packet exceeded snapshot"));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800865}
Elliott Hughes892a68b2015-10-19 14:43:53 -0700866/*
867 * Local Variables:
868 * c-style: whitesmith
869 * c-basic-offset: 8
870 * End:
871 */