blob: 904dd712986e3d2e7bc7eaaa527091bffc0cc904 [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 *
JP Abgrall53f17a92014-02-12 14:02:41 -080013 * Support for the Link Management Protocol as per rfc 4204.
14 *
The Android Open Source Project2949f582009-03-03 19:30:46 -080015 * Original code by Hannes Gredler (hannes@juniper.net)
16 * Support for LMP service discovery extensions (defined by UNI 1.0) added
17 * by Manu Pathak (mapathak@cisco.com), May 2005
18 */
19
Elliott Hughes892a68b2015-10-19 14:43:53 -070020#define NETDISSECT_REWORKED
The Android Open Source Project2949f582009-03-03 19:30:46 -080021#ifdef HAVE_CONFIG_H
22#include "config.h"
23#endif
24
25#include <tcpdump-stdinc.h>
26
The Android Open Source Project2949f582009-03-03 19:30:46 -080027#include "interface.h"
28#include "extract.h"
29#include "addrtoname.h"
30#include "gmpls.h"
31
32/*
33 * LMP common header
34 *
35 * 0 1 2 3
36 * 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
37 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
38 * | Vers | (Reserved) | Flags | Msg Type |
39 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
40 * | LMP Length | (Reserved) |
41 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42 */
43
44struct lmp_common_header {
Elliott Hughes892a68b2015-10-19 14:43:53 -070045 uint8_t version_res[2];
46 uint8_t flags;
47 uint8_t msg_type;
48 uint8_t length[2];
49 uint8_t reserved[2];
The Android Open Source Project2949f582009-03-03 19:30:46 -080050};
51
52#define LMP_VERSION 1
Elliott Hughes892a68b2015-10-19 14:43:53 -070053#define LMP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
The Android Open Source Project2949f582009-03-03 19:30:46 -080054
55static const struct tok lmp_header_flag_values[] = {
56 { 0x01, "Control Channel Down"},
57 { 0x02, "LMP restart"},
58 { 0, NULL}
59};
60
61static const struct tok lmp_obj_te_link_flag_values[] = {
62 { 0x01, "Fault Management Supported"},
63 { 0x02, "Link Verification Supported"},
64 { 0, NULL}
65};
66
67static const struct tok lmp_obj_data_link_flag_values[] = {
68 { 0x01, "Data Link Port"},
69 { 0x02, "Allocated for user traffic"},
70 { 0x04, "Failed link"},
71 { 0, NULL}
72};
73
74static const struct tok lmp_obj_channel_status_values[] = {
75 { 1, "Signal Okay"},
76 { 2, "Signal Degraded"},
77 { 3, "Signal Fail"},
78 { 0, NULL}
79};
80
81static const struct tok lmp_obj_begin_verify_flag_values[] = {
82 { 0x0001, "Verify all links"},
83 { 0x0002, "Data link type"},
84 { 0, NULL}
85};
86
87static const struct tok lmp_obj_begin_verify_error_values[] = {
JP Abgrall53f17a92014-02-12 14:02:41 -080088 { 0x01, "Link Verification Procedure Not supported"},
89 { 0x02, "Unwilling to verify"},
90 { 0x04, "Unsupported verification transport mechanism"},
91 { 0x08, "Link-Id configuration error"},
92 { 0x10, "Unknown object c-type"},
The Android Open Source Project2949f582009-03-03 19:30:46 -080093 { 0, NULL}
94};
95
96static const struct tok lmp_obj_link_summary_error_values[] = {
JP Abgrall53f17a92014-02-12 14:02:41 -080097 { 0x01, "Unacceptable non-negotiable LINK-SUMMARY parameters"},
98 { 0x02, "Renegotiate LINK-SUMMARY parameters"},
99 { 0x04, "Invalid TE-LINK Object"},
100 { 0x08, "Invalid DATA-LINK Object"},
101 { 0x10, "Unknown TE-LINK Object c-type"},
102 { 0x20, "Unknown DATA-LINK Object c-type"},
The Android Open Source Project2949f582009-03-03 19:30:46 -0800103 { 0, NULL}
104};
105
106/* Service Config Supported Protocols Flags */
107static const struct tok lmp_obj_service_config_sp_flag_values[] = {
108 { 0x01, "RSVP Supported"},
109 { 0x02, "LDP Supported"},
110 { 0, NULL}
111};
112
113/* Service Config Client Port Service Attribute Transparency Flags */
114static const struct tok lmp_obj_service_config_cpsa_tp_flag_values[] = {
115 { 0x01, "Path/VC Overhead Transparency Supported"},
116 { 0x02, "Line/MS Overhead Transparency Supported"},
117 { 0x04, "Section/RS Overhead Transparency Supported"},
118 { 0, NULL}
119};
120
121/* Service Config Client Port Service Attribute Contiguous Concatenation Types Flags */
122static const struct tok lmp_obj_service_config_cpsa_cct_flag_values[] = {
123 { 0x01, "Contiguous Concatenation Types Supported"},
124 { 0, NULL}
125};
126
127/* Service Config Network Service Attributes Transparency Flags */
128static const struct tok lmp_obj_service_config_nsa_transparency_flag_values[] = {
129 { 0x01, "Standard SOH/RSOH Transparency Supported"},
130 { 0x02, "Standard LOH/MSOH Transparency Supported"},
131 { 0, NULL}
132};
133
134/* Service Config Network Service Attributes TCM Monitoring Flags */
135static const struct tok lmp_obj_service_config_nsa_tcm_flag_values[] = {
136 { 0x01, "Transparent Tandem Connection Monitoring Supported"},
137 { 0, NULL}
138};
139
140/* Network Service Attributes Network Diversity Flags */
141static const struct tok lmp_obj_service_config_nsa_network_diversity_flag_values[] = {
142 { 0x01, "Node Diversity Supported"},
143 { 0x02, "Link Diversity Supported"},
144 { 0x04, "SRLG Diversity Supported"},
145 { 0, NULL}
146};
147
148#define LMP_MSGTYPE_CONFIG 1
149#define LMP_MSGTYPE_CONFIG_ACK 2
150#define LMP_MSGTYPE_CONFIG_NACK 3
151#define LMP_MSGTYPE_HELLO 4
152#define LMP_MSGTYPE_VERIFY_BEGIN 5
153#define LMP_MSGTYPE_VERIFY_BEGIN_ACK 6
154#define LMP_MSGTYPE_VERIFY_BEGIN_NACK 7
155#define LMP_MSGTYPE_VERIFY_END 8
156#define LMP_MSGTYPE_VERIFY_END_ACK 9
157#define LMP_MSGTYPE_TEST 10
158#define LMP_MSGTYPE_TEST_STATUS_SUCCESS 11
159#define LMP_MSGTYPE_TEST_STATUS_FAILURE 12
160#define LMP_MSGTYPE_TEST_STATUS_ACK 13
161#define LMP_MSGTYPE_LINK_SUMMARY 14
162#define LMP_MSGTYPE_LINK_SUMMARY_ACK 15
163#define LMP_MSGTYPE_LINK_SUMMARY_NACK 16
164#define LMP_MSGTYPE_CHANNEL_STATUS 17
165#define LMP_MSGTYPE_CHANNEL_STATUS_ACK 18
166#define LMP_MSGTYPE_CHANNEL_STATUS_REQ 19
167#define LMP_MSGTYPE_CHANNEL_STATUS_RESP 20
168/* LMP Service Discovery message types defined by UNI 1.0 */
169#define LMP_MSGTYPE_SERVICE_CONFIG 50
170#define LMP_MSGTYPE_SERVICE_CONFIG_ACK 51
171#define LMP_MSGTYPE_SERVICE_CONFIG_NACK 52
172
173static const struct tok lmp_msg_type_values[] = {
174 { LMP_MSGTYPE_CONFIG, "Config"},
175 { LMP_MSGTYPE_CONFIG_ACK, "Config ACK"},
176 { LMP_MSGTYPE_CONFIG_NACK, "Config NACK"},
177 { LMP_MSGTYPE_HELLO, "Hello"},
178 { LMP_MSGTYPE_VERIFY_BEGIN, "Begin Verify"},
179 { LMP_MSGTYPE_VERIFY_BEGIN_ACK, "Begin Verify ACK"},
180 { LMP_MSGTYPE_VERIFY_BEGIN_NACK, "Begin Verify NACK"},
181 { LMP_MSGTYPE_VERIFY_END, "End Verify"},
182 { LMP_MSGTYPE_VERIFY_END_ACK, "End Verify ACK"},
183 { LMP_MSGTYPE_TEST, "Test"},
184 { LMP_MSGTYPE_TEST_STATUS_SUCCESS, "Test Status Success"},
185 { LMP_MSGTYPE_TEST_STATUS_FAILURE, "Test Status Failure"},
186 { LMP_MSGTYPE_TEST_STATUS_ACK, "Test Status ACK"},
187 { LMP_MSGTYPE_LINK_SUMMARY, "Link Summary"},
188 { LMP_MSGTYPE_LINK_SUMMARY_ACK, "Link Summary ACK"},
189 { LMP_MSGTYPE_LINK_SUMMARY_NACK, "Link Summary NACK"},
190 { LMP_MSGTYPE_CHANNEL_STATUS, "Channel Status"},
191 { LMP_MSGTYPE_CHANNEL_STATUS_ACK, "Channel Status ACK"},
192 { LMP_MSGTYPE_CHANNEL_STATUS_REQ, "Channel Status Request"},
193 { LMP_MSGTYPE_CHANNEL_STATUS_RESP, "Channel Status Response"},
194 { LMP_MSGTYPE_SERVICE_CONFIG, "Service Config"},
195 { LMP_MSGTYPE_SERVICE_CONFIG_ACK, "Service Config ACK"},
196 { LMP_MSGTYPE_SERVICE_CONFIG_NACK, "Service Config NACK"},
197 { 0, NULL}
198};
199
Elliott Hughes892a68b2015-10-19 14:43:53 -0700200/*
The Android Open Source Project2949f582009-03-03 19:30:46 -0800201 * LMP object header
202 *
203 * 0 1 2 3
204 * 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
205 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
206 * |N| C-Type | Class | Length |
207 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
208 * | |
209 * // (object contents) //
210 * | |
Elliott Hughes892a68b2015-10-19 14:43:53 -0700211 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The Android Open Source Project2949f582009-03-03 19:30:46 -0800212 */
213
214struct lmp_object_header {
Elliott Hughes892a68b2015-10-19 14:43:53 -0700215 uint8_t ctype;
216 uint8_t class_num;
217 uint8_t length[2];
The Android Open Source Project2949f582009-03-03 19:30:46 -0800218};
219
220#define LMP_OBJ_CC_ID 1
221#define LMP_OBJ_NODE_ID 2
222#define LMP_OBJ_LINK_ID 3
223#define LMP_OBJ_INTERFACE_ID 4
Elliott Hughes892a68b2015-10-19 14:43:53 -0700224#define LMP_OBJ_MESSAGE_ID 5
The Android Open Source Project2949f582009-03-03 19:30:46 -0800225#define LMP_OBJ_CONFIG 6
226#define LMP_OBJ_HELLO 7
227#define LMP_OBJ_VERIFY_BEGIN 8
228#define LMP_OBJ_VERIFY_BEGIN_ACK 9
229#define LMP_OBJ_VERIFY_ID 10
230#define LMP_OBJ_TE_LINK 11
231#define LMP_OBJ_DATA_LINK 12
232#define LMP_OBJ_CHANNEL_STATUS 13
233#define LMP_OBJ_CHANNEL_STATUS_REQ 14
234#define LMP_OBJ_ERROR_CODE 20
235
236#define LMP_OBJ_SERVICE_CONFIG 51 /* defined in UNI 1.0 */
237
238static const struct tok lmp_obj_values[] = {
239 { LMP_OBJ_CC_ID, "Control Channel ID" },
240 { LMP_OBJ_NODE_ID, "Node ID" },
241 { LMP_OBJ_LINK_ID, "Link ID" },
242 { LMP_OBJ_INTERFACE_ID, "Interface ID" },
243 { LMP_OBJ_MESSAGE_ID, "Message ID" },
244 { LMP_OBJ_CONFIG, "Configuration" },
245 { LMP_OBJ_HELLO, "Hello" },
246 { LMP_OBJ_VERIFY_BEGIN, "Verify Begin" },
247 { LMP_OBJ_VERIFY_BEGIN_ACK, "Verify Begin ACK" },
248 { LMP_OBJ_VERIFY_ID, "Verify ID" },
249 { LMP_OBJ_TE_LINK, "TE Link" },
250 { LMP_OBJ_DATA_LINK, "Data Link" },
251 { LMP_OBJ_CHANNEL_STATUS, "Channel Status" },
252 { LMP_OBJ_CHANNEL_STATUS_REQ, "Channel Status Request" },
253 { LMP_OBJ_ERROR_CODE, "Error Code" },
254 { LMP_OBJ_SERVICE_CONFIG, "Service Config" },
255
256 { 0, NULL}
257};
258
259#define INT_SWITCHING_TYPE_SUBOBJ 1
260#define WAVELENGTH_SUBOBJ 2
261
262static const struct tok lmp_data_link_subobj[] = {
263 { INT_SWITCHING_TYPE_SUBOBJ, "Interface Switching Type" },
264 { WAVELENGTH_SUBOBJ , "Wavelength" },
265 { 0, NULL}
266};
267
268#define LMP_CTYPE_IPV4 1
269#define LMP_CTYPE_IPV6 2
270
271#define LMP_CTYPE_LOC 1
272#define LMP_CTYPE_RMT 2
273#define LMP_CTYPE_UNMD 3
Elliott Hughes892a68b2015-10-19 14:43:53 -0700274
The Android Open Source Project2949f582009-03-03 19:30:46 -0800275#define LMP_CTYPE_IPV4_LOC 1
276#define LMP_CTYPE_IPV4_RMT 2
277#define LMP_CTYPE_IPV6_LOC 3
278#define LMP_CTYPE_IPV6_RMT 4
Elliott Hughes892a68b2015-10-19 14:43:53 -0700279#define LMP_CTYPE_UNMD_LOC 5
280#define LMP_CTYPE_UNMD_RMT 6
The Android Open Source Project2949f582009-03-03 19:30:46 -0800281
282#define LMP_CTYPE_1 1
283#define LMP_CTYPE_2 2
284
285#define LMP_CTYPE_HELLO_CONFIG 1
286#define LMP_CTYPE_HELLO 1
287
288#define LMP_CTYPE_BEGIN_VERIFY_ERROR 1
289#define LMP_CTYPE_LINK_SUMMARY_ERROR 2
290
291/* C-Types for Service Config Object */
292#define LMP_CTYPE_SERVICE_CONFIG_SP 1
293#define LMP_CTYPE_SERVICE_CONFIG_CPSA 2
294#define LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM 3
295#define LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY 4
296
Elliott Hughes892a68b2015-10-19 14:43:53 -0700297/*
The Android Open Source Project2949f582009-03-03 19:30:46 -0800298 * Different link types allowed in the Client Port Service Attributes
299 * subobject defined for LMP Service Discovery in the UNI 1.0 spec
300 */
301#define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH 5 /* UNI 1.0 Sec 9.4.2 */
302#define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET 6 /* UNI 1.0 Sec 9.4.2 */
303
304/*
305 * the ctypes are not globally unique so for
306 * translating it to strings we build a table based
307 * on objects offsetted by the ctype
308 */
309
310static const struct tok lmp_ctype_values[] = {
311 { 256*LMP_OBJ_CC_ID+LMP_CTYPE_LOC, "Local" },
312 { 256*LMP_OBJ_CC_ID+LMP_CTYPE_RMT, "Remote" },
313 { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_LOC, "Local" },
314 { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_RMT, "Remote" },
315 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
316 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
317 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
318 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
319 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
320 { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
321 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
322 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
323 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
324 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
325 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
326 { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
327 { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_1, "1" },
328 { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_2, "2" },
329 { 256*LMP_OBJ_CONFIG+LMP_CTYPE_1, "1" },
330 { 256*LMP_OBJ_HELLO+LMP_CTYPE_1, "1" },
331 { 256*LMP_OBJ_VERIFY_BEGIN+LMP_CTYPE_1, "1" },
332 { 256*LMP_OBJ_VERIFY_BEGIN_ACK+LMP_CTYPE_1, "1" },
333 { 256*LMP_OBJ_VERIFY_ID+LMP_CTYPE_1, "1" },
334 { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV4, "IPv4" },
335 { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV6, "IPv6" },
336 { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
337 { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV4, "IPv4" },
338 { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV6, "IPv6" },
339 { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
340 { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV4, "IPv4" },
341 { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV6, "IPv6" },
342 { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_UNMD, "Unnumbered" },
343 { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV4, "IPv4" },
344 { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV6, "IPv6" },
345 { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_UNMD, "Unnumbered" },
346 { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_1, "1" },
347 { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_2, "2" },
348 { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_SP, "1" },
349 { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_CPSA, "2" },
350 { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM, "3" },
351 { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY, "4" },
352 { 0, NULL}
353};
354
355void
Elliott Hughes892a68b2015-10-19 14:43:53 -0700356lmp_print(netdissect_options *ndo,
357 register const u_char *pptr, register u_int len)
358{
The Android Open Source Project2949f582009-03-03 19:30:46 -0800359 const struct lmp_common_header *lmp_com_header;
360 const struct lmp_object_header *lmp_obj_header;
361 const u_char *tptr,*obj_tptr;
362 int tlen,lmp_obj_len,lmp_obj_ctype,obj_tlen;
363 int hexdump;
364 int offset,subobj_type,subobj_len,total_subobj_len;
365 int link_type;
366
367 union { /* int to float conversion buffer */
Elliott Hughes892a68b2015-10-19 14:43:53 -0700368 float f;
369 uint32_t i;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800370 } bw;
371
372 tptr=pptr;
373 lmp_com_header = (const struct lmp_common_header *)pptr;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700374 ND_TCHECK(*lmp_com_header);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800375
376 /*
377 * Sanity checking of the header.
378 */
379 if (LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]) != LMP_VERSION) {
Elliott Hughes892a68b2015-10-19 14:43:53 -0700380 ND_PRINT((ndo, "LMP version %u packet not supported",
381 LMP_EXTRACT_VERSION(lmp_com_header->version_res[0])));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800382 return;
383 }
384
385 /* in non-verbose mode just lets print the basic Message Type*/
Elliott Hughes892a68b2015-10-19 14:43:53 -0700386 if (ndo->ndo_vflag < 1) {
387 ND_PRINT((ndo, "LMPv%u %s Message, length: %u",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800388 LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
389 tok2str(lmp_msg_type_values, "unknown (%u)",lmp_com_header->msg_type),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700390 len));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800391 return;
392 }
393
394 /* ok they seem to want to know everything - lets fully decode it */
395
396 tlen=EXTRACT_16BITS(lmp_com_header->length);
397
Elliott Hughes892a68b2015-10-19 14:43:53 -0700398 ND_PRINT((ndo, "\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800399 LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
400 tok2str(lmp_msg_type_values, "unknown, type: %u",lmp_com_header->msg_type),
401 bittok2str(lmp_header_flag_values,"none",lmp_com_header->flags),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700402 tlen));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800403
404 tptr+=sizeof(const struct lmp_common_header);
405 tlen-=sizeof(const struct lmp_common_header);
406
407 while(tlen>0) {
408 /* did we capture enough for fully decoding the object header ? */
Elliott Hughes892a68b2015-10-19 14:43:53 -0700409 ND_TCHECK2(*tptr, sizeof(struct lmp_object_header));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800410
411 lmp_obj_header = (const struct lmp_object_header *)tptr;
412 lmp_obj_len=EXTRACT_16BITS(lmp_obj_header->length);
413 lmp_obj_ctype=(lmp_obj_header->ctype)&0x7f;
414
415 if(lmp_obj_len % 4 || lmp_obj_len < 4)
416 return;
417
Elliott Hughes892a68b2015-10-19 14:43:53 -0700418 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 -0800419 tok2str(lmp_obj_values,
420 "Unknown",
421 lmp_obj_header->class_num),
422 lmp_obj_header->class_num,
423 tok2str(lmp_ctype_values,
424 "Unknown",
425 ((lmp_obj_header->class_num)<<8)+lmp_obj_ctype),
426 lmp_obj_ctype,
427 (lmp_obj_header->ctype)&0x80 ? "" : "non-",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700428 lmp_obj_len));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800429
430 obj_tptr=tptr+sizeof(struct lmp_object_header);
431 obj_tlen=lmp_obj_len-sizeof(struct lmp_object_header);
432
433 /* did we capture enough for fully decoding the object ? */
Elliott Hughes892a68b2015-10-19 14:43:53 -0700434 ND_TCHECK2(*tptr, lmp_obj_len);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800435 hexdump=FALSE;
436
437 switch(lmp_obj_header->class_num) {
438
439 case LMP_OBJ_CC_ID:
440 switch(lmp_obj_ctype) {
441 case LMP_CTYPE_LOC:
442 case LMP_CTYPE_RMT:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700443 ND_PRINT((ndo, "\n\t Control Channel ID: %u (0x%08x)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800444 EXTRACT_32BITS(obj_tptr),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700445 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800446 break;
447
448 default:
449 hexdump=TRUE;
450 }
451 break;
452
453 case LMP_OBJ_LINK_ID:
454 case LMP_OBJ_INTERFACE_ID:
455 switch(lmp_obj_ctype) {
456 case LMP_CTYPE_IPV4_LOC:
457 case LMP_CTYPE_IPV4_RMT:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700458 ND_PRINT((ndo, "\n\t IPv4 Link ID: %s (0x%08x)",
459 ipaddr_string(ndo, obj_tptr),
460 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800461 break;
462#ifdef INET6
463 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;
469#endif
470 case LMP_CTYPE_UNMD_LOC:
471 case LMP_CTYPE_UNMD_RMT:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700472 ND_PRINT((ndo, "\n\t Link ID: %u (0x%08x)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800473 EXTRACT_32BITS(obj_tptr),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700474 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800475 break;
476 default:
477 hexdump=TRUE;
478 }
479 break;
480
481 case LMP_OBJ_MESSAGE_ID:
482 switch(lmp_obj_ctype) {
483 case LMP_CTYPE_1:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700484 ND_PRINT((ndo, "\n\t Message ID: %u (0x%08x)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800485 EXTRACT_32BITS(obj_tptr),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700486 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800487 break;
488 case LMP_CTYPE_2:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700489 ND_PRINT((ndo, "\n\t Message ID Ack: %u (0x%08x)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800490 EXTRACT_32BITS(obj_tptr),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700491 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800492 break;
493 default:
494 hexdump=TRUE;
495 }
496 break;
497
498 case LMP_OBJ_NODE_ID:
499 switch(lmp_obj_ctype) {
500 case LMP_CTYPE_LOC:
501 case LMP_CTYPE_RMT:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700502 ND_PRINT((ndo, "\n\t Node ID: %s (0x%08x)",
503 ipaddr_string(ndo, obj_tptr),
504 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800505 break;
506
507 default:
508 hexdump=TRUE;
509 }
510 break;
511
512 case LMP_OBJ_CONFIG:
513 switch(lmp_obj_ctype) {
514 case LMP_CTYPE_HELLO_CONFIG:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700515 ND_PRINT((ndo, "\n\t Hello Interval: %u\n\t Hello Dead Interval: %u",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800516 EXTRACT_16BITS(obj_tptr),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700517 EXTRACT_16BITS(obj_tptr+2)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800518 break;
519
520 default:
521 hexdump=TRUE;
522 }
523 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700524
The Android Open Source Project2949f582009-03-03 19:30:46 -0800525 case LMP_OBJ_HELLO:
526 switch(lmp_obj_ctype) {
527 case LMP_CTYPE_HELLO:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700528 ND_PRINT((ndo, "\n\t Tx Seq: %u, Rx Seq: %u",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800529 EXTRACT_32BITS(obj_tptr),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700530 EXTRACT_32BITS(obj_tptr+4)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800531 break;
532
533 default:
534 hexdump=TRUE;
535 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700536 break;
537
The Android Open Source Project2949f582009-03-03 19:30:46 -0800538 case LMP_OBJ_TE_LINK:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700539 ND_PRINT((ndo, "\n\t Flags: [%s]",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800540 bittok2str(lmp_obj_te_link_flag_values,
541 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700542 EXTRACT_16BITS(obj_tptr)>>8)));
543
The Android Open Source Project2949f582009-03-03 19:30:46 -0800544 switch(lmp_obj_ctype) {
545 case LMP_CTYPE_IPV4:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700546 ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)"
JP Abgrall53f17a92014-02-12 14:02:41 -0800547 "\n\t Remote Link-ID: %s (0x%08x)",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700548 ipaddr_string(ndo, obj_tptr+4),
The Android Open Source Project2949f582009-03-03 19:30:46 -0800549 EXTRACT_32BITS(obj_tptr+4),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700550 ipaddr_string(ndo, obj_tptr+8),
551 EXTRACT_32BITS(obj_tptr+8)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800552 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700553
The Android Open Source Project2949f582009-03-03 19:30:46 -0800554#ifdef INET6
555 case LMP_CTYPE_IPV6:
556#endif
557 case LMP_CTYPE_UNMD:
558 default:
559 hexdump=TRUE;
560 }
561 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700562
The Android Open Source Project2949f582009-03-03 19:30:46 -0800563 case LMP_OBJ_DATA_LINK:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700564 ND_PRINT((ndo, "\n\t Flags: [%s]",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800565 bittok2str(lmp_obj_data_link_flag_values,
566 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700567 EXTRACT_16BITS(obj_tptr)>>8)));
568
The Android Open Source Project2949f582009-03-03 19:30:46 -0800569 switch(lmp_obj_ctype) {
570 case LMP_CTYPE_IPV4:
571 case LMP_CTYPE_UNMD:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700572 ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)"
JP Abgrall53f17a92014-02-12 14:02:41 -0800573 "\n\t Remote Interface ID: %s (0x%08x)",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700574 ipaddr_string(ndo, obj_tptr+4),
The Android Open Source Project2949f582009-03-03 19:30:46 -0800575 EXTRACT_32BITS(obj_tptr+4),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700576 ipaddr_string(ndo, obj_tptr+8),
577 EXTRACT_32BITS(obj_tptr+8)));
578
579 total_subobj_len = lmp_obj_len - 16;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800580 offset = 12;
581 while (total_subobj_len > 0 && hexdump == FALSE ) {
582 subobj_type = EXTRACT_16BITS(obj_tptr+offset)>>8;
583 subobj_len = EXTRACT_16BITS(obj_tptr+offset)&0x00FF;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700584 ND_PRINT((ndo, "\n\t Subobject, Type: %s (%u), Length: %u",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800585 tok2str(lmp_data_link_subobj,
586 "Unknown",
587 subobj_type),
588 subobj_type,
Elliott Hughes892a68b2015-10-19 14:43:53 -0700589 subobj_len));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800590 switch(subobj_type) {
591 case INT_SWITCHING_TYPE_SUBOBJ:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700592 ND_PRINT((ndo, "\n\t Switching Type: %s (%u)",
593 tok2str(gmpls_switch_cap_values,
594 "Unknown",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800595 EXTRACT_16BITS(obj_tptr+offset+2)>>8),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700596 EXTRACT_16BITS(obj_tptr+offset+2)>>8));
597 ND_PRINT((ndo, "\n\t Encoding Type: %s (%u)",
598 tok2str(gmpls_encoding_values,
599 "Unknown",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800600 EXTRACT_16BITS(obj_tptr+offset+2)&0x00FF),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700601 EXTRACT_16BITS(obj_tptr+offset+2)&0x00FF));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800602 bw.i = EXTRACT_32BITS(obj_tptr+offset+4);
Elliott Hughes892a68b2015-10-19 14:43:53 -0700603 ND_PRINT((ndo, "\n\t Min Reservable Bandwidth: %.3f Mbps",
604 bw.f*8/1000000));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800605 bw.i = EXTRACT_32BITS(obj_tptr+offset+8);
Elliott Hughes892a68b2015-10-19 14:43:53 -0700606 ND_PRINT((ndo, "\n\t Max Reservable Bandwidth: %.3f Mbps",
607 bw.f*8/1000000));
608 break;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800609 case WAVELENGTH_SUBOBJ:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700610 ND_PRINT((ndo, "\n\t Wavelength: %u",
611 EXTRACT_32BITS(obj_tptr+offset+4)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800612 break;
613 default:
614 /* Any Unknown Subobject ==> Exit loop */
615 hexdump=TRUE;
616 break;
617 }
618 total_subobj_len-=subobj_len;
619 offset+=subobj_len;
620 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700621
The Android Open Source Project2949f582009-03-03 19:30:46 -0800622 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700623#ifdef INET6
The Android Open Source Project2949f582009-03-03 19:30:46 -0800624 case LMP_CTYPE_IPV6:
625#endif
626 default:
627 hexdump=TRUE;
628 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700629 break;
630
The Android Open Source Project2949f582009-03-03 19:30:46 -0800631 case LMP_OBJ_VERIFY_BEGIN:
632 switch(lmp_obj_ctype) {
633 case LMP_CTYPE_1:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700634 ND_PRINT((ndo, "\n\t Flags: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800635 bittok2str(lmp_obj_begin_verify_flag_values,
636 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700637 EXTRACT_16BITS(obj_tptr))));
638 ND_PRINT((ndo, "\n\t Verify Interval: %u",
639 EXTRACT_16BITS(obj_tptr+2)));
640 ND_PRINT((ndo, "\n\t Data links: %u",
641 EXTRACT_32BITS(obj_tptr+4)));
642 ND_PRINT((ndo, "\n\t Encoding type: %s",
643 tok2str(gmpls_encoding_values, "Unknown", *(obj_tptr+8))));
644 ND_PRINT((ndo, "\n\t Verify Transport Mechanism: %u (0x%x)%s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800645 EXTRACT_16BITS(obj_tptr+10),
646 EXTRACT_16BITS(obj_tptr+10),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700647 EXTRACT_16BITS(obj_tptr+10)&8000 ? " (Payload test messages capable)" : ""));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800648 bw.i = EXTRACT_32BITS(obj_tptr+12);
Elliott Hughes892a68b2015-10-19 14:43:53 -0700649 ND_PRINT((ndo, "\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000));
650 ND_PRINT((ndo, "\n\t Wavelength: %u",
651 EXTRACT_32BITS(obj_tptr+16)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800652 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700653
The Android Open Source Project2949f582009-03-03 19:30:46 -0800654 default:
655 hexdump=TRUE;
656 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700657 break;
658
The Android Open Source Project2949f582009-03-03 19:30:46 -0800659 case LMP_OBJ_VERIFY_BEGIN_ACK:
660 switch(lmp_obj_ctype) {
661 case LMP_CTYPE_1:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700662 ND_PRINT((ndo, "\n\t Verify Dead Interval: %u"
JP Abgrall53f17a92014-02-12 14:02:41 -0800663 "\n\t Verify Transport Response: %u",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800664 EXTRACT_16BITS(obj_tptr),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700665 EXTRACT_16BITS(obj_tptr+2)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800666 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700667
The Android Open Source Project2949f582009-03-03 19:30:46 -0800668 default:
669 hexdump=TRUE;
670 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700671 break;
672
The Android Open Source Project2949f582009-03-03 19:30:46 -0800673 case LMP_OBJ_VERIFY_ID:
674 switch(lmp_obj_ctype) {
675 case LMP_CTYPE_1:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700676 ND_PRINT((ndo, "\n\t Verify ID: %u",
677 EXTRACT_32BITS(obj_tptr)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800678 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700679
The Android Open Source Project2949f582009-03-03 19:30:46 -0800680 default:
681 hexdump=TRUE;
682 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700683 break;
684
The Android Open Source Project2949f582009-03-03 19:30:46 -0800685 case LMP_OBJ_CHANNEL_STATUS:
686 switch(lmp_obj_ctype) {
687 case LMP_CTYPE_IPV4:
688 case LMP_CTYPE_UNMD:
689 offset = 0;
690 /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
691 while (offset < (lmp_obj_len-(int)sizeof(struct lmp_object_header)) ) {
Elliott Hughes892a68b2015-10-19 14:43:53 -0700692 ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
693 ipaddr_string(ndo, obj_tptr+offset),
694 EXTRACT_32BITS(obj_tptr+offset)));
695
696 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 -0800697 "Allocated" : "Non-allocated",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700698 (EXTRACT_32BITS(obj_tptr+offset+4)>>31)));
699
700 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 -0800701 "Transmit" : "Receive",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700702 (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1));
703
704 ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800705 tok2str(lmp_obj_channel_status_values,
706 "Unknown",
707 EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700708 EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800709 offset+=8;
710 }
711 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700712#ifdef INET6
The Android Open Source Project2949f582009-03-03 19:30:46 -0800713 case LMP_CTYPE_IPV6:
714#endif
715 default:
716 hexdump=TRUE;
717 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700718 break;
719
The Android Open Source Project2949f582009-03-03 19:30:46 -0800720 case LMP_OBJ_CHANNEL_STATUS_REQ:
721 switch(lmp_obj_ctype) {
722 case LMP_CTYPE_IPV4:
723 case LMP_CTYPE_UNMD:
724 offset = 0;
725 while (offset < (lmp_obj_len-(int)sizeof(struct lmp_object_header)) ) {
Elliott Hughes892a68b2015-10-19 14:43:53 -0700726 ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
727 ipaddr_string(ndo, obj_tptr+offset),
728 EXTRACT_32BITS(obj_tptr+offset)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800729 offset+=4;
730 }
731 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700732#ifdef INET6
The Android Open Source Project2949f582009-03-03 19:30:46 -0800733 case LMP_CTYPE_IPV6:
734#endif
735 default:
736 hexdump=TRUE;
737 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700738 break;
739
The Android Open Source Project2949f582009-03-03 19:30:46 -0800740 case LMP_OBJ_ERROR_CODE:
741 switch(lmp_obj_ctype) {
742 case LMP_CTYPE_BEGIN_VERIFY_ERROR:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700743 ND_PRINT((ndo, "\n\t Error Code: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800744 bittok2str(lmp_obj_begin_verify_error_values,
745 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700746 EXTRACT_32BITS(obj_tptr))));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800747 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700748
The Android Open Source Project2949f582009-03-03 19:30:46 -0800749 case LMP_CTYPE_LINK_SUMMARY_ERROR:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700750 ND_PRINT((ndo, "\n\t Error Code: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800751 bittok2str(lmp_obj_link_summary_error_values,
752 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700753 EXTRACT_32BITS(obj_tptr))));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800754 break;
755 default:
756 hexdump=TRUE;
757 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700758 break;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800759
760 case LMP_OBJ_SERVICE_CONFIG:
761 switch (lmp_obj_ctype) {
762 case LMP_CTYPE_SERVICE_CONFIG_SP:
The Android Open Source Project2949f582009-03-03 19:30:46 -0800763
Elliott Hughes892a68b2015-10-19 14:43:53 -0700764 ND_PRINT((ndo, "\n\t Flags: %s",
765 bittok2str(lmp_obj_service_config_sp_flag_values,
766 "none",
767 EXTRACT_16BITS(obj_tptr)>>8)));
768
769 ND_PRINT((ndo, "\n\t UNI Version: %u",
770 EXTRACT_16BITS(obj_tptr) & 0x00FF));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800771
772 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700773
The Android Open Source Project2949f582009-03-03 19:30:46 -0800774 case LMP_CTYPE_SERVICE_CONFIG_CPSA:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700775
The Android Open Source Project2949f582009-03-03 19:30:46 -0800776 link_type = EXTRACT_16BITS(obj_tptr)>>8;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700777
778 ND_PRINT((ndo, "\n\t Link Type: %s (%u)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800779 tok2str(lmp_sd_service_config_cpsa_link_type_values,
780 "Unknown", link_type),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700781 link_type));
782
The Android Open Source Project2949f582009-03-03 19:30:46 -0800783 if (link_type == LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH) {
Elliott Hughes892a68b2015-10-19 14:43:53 -0700784 ND_PRINT((ndo, "\n\t Signal Type: %s (%u)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800785 tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values,
786 "Unknown",
787 EXTRACT_16BITS(obj_tptr) & 0x00FF),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700788 EXTRACT_16BITS(obj_tptr) & 0x00FF));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800789 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700790
The Android Open Source Project2949f582009-03-03 19:30:46 -0800791 if (link_type == LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET) {
Elliott Hughes892a68b2015-10-19 14:43:53 -0700792 ND_PRINT((ndo, "\n\t Signal Type: %s (%u)",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800793 tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values,
794 "Unknown",
795 EXTRACT_16BITS(obj_tptr) & 0x00FF),
Elliott Hughes892a68b2015-10-19 14:43:53 -0700796 EXTRACT_16BITS(obj_tptr) & 0x00FF));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800797 }
Elliott Hughes892a68b2015-10-19 14:43:53 -0700798
799 ND_PRINT((ndo, "\n\t Transparency: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800800 bittok2str(lmp_obj_service_config_cpsa_tp_flag_values,
801 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700802 EXTRACT_16BITS(obj_tptr+2)>>8)));
803
804 ND_PRINT((ndo, "\n\t Contiguous Concatenation Types: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800805 bittok2str(lmp_obj_service_config_cpsa_cct_flag_values,
806 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700807 EXTRACT_16BITS(obj_tptr+2)>>8 & 0x00FF)));
808
809 ND_PRINT((ndo, "\n\t Minimum NCC: %u",
810 EXTRACT_16BITS(obj_tptr+4)));
811
812 ND_PRINT((ndo, "\n\t Maximum NCC: %u",
813 EXTRACT_16BITS(obj_tptr+6)));
814
815 ND_PRINT((ndo, "\n\t Minimum NVC:%u",
816 EXTRACT_16BITS(obj_tptr+8)));
817
818 ND_PRINT((ndo, "\n\t Maximum NVC:%u",
819 EXTRACT_16BITS(obj_tptr+10)));
820
821 ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)",
822 ipaddr_string(ndo, obj_tptr+12),
823 EXTRACT_32BITS(obj_tptr+12)));
824
The Android Open Source Project2949f582009-03-03 19:30:46 -0800825 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700826
The Android Open Source Project2949f582009-03-03 19:30:46 -0800827 case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700828
829 ND_PRINT((ndo, "\n\t Transparency Flags: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800830 bittok2str(
831 lmp_obj_service_config_nsa_transparency_flag_values,
832 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700833 EXTRACT_32BITS(obj_tptr))));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800834
Elliott Hughes892a68b2015-10-19 14:43:53 -0700835 ND_PRINT((ndo, "\n\t TCM Monitoring Flags: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800836 bittok2str(
837 lmp_obj_service_config_nsa_tcm_flag_values,
838 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700839 EXTRACT_16BITS(obj_tptr+6) & 0x00FF)));
840
The Android Open Source Project2949f582009-03-03 19:30:46 -0800841 break;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700842
The Android Open Source Project2949f582009-03-03 19:30:46 -0800843 case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700844
845 ND_PRINT((ndo, "\n\t Diversity: Flags: %s",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800846 bittok2str(
847 lmp_obj_service_config_nsa_network_diversity_flag_values,
848 "none",
Elliott Hughes892a68b2015-10-19 14:43:53 -0700849 EXTRACT_16BITS(obj_tptr+2) & 0x00FF)));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800850 break;
851
852 default:
853 hexdump = TRUE;
854 };
855
856 break;
857
858 default:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700859 if (ndo->ndo_vflag <= 1)
860 print_unknown_data(ndo,obj_tptr,"\n\t ",obj_tlen);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800861 break;
862 }
863 /* do we want to see an additionally hexdump ? */
Elliott Hughes892a68b2015-10-19 14:43:53 -0700864 if (ndo->ndo_vflag > 1 || hexdump==TRUE)
865 print_unknown_data(ndo,tptr+sizeof(struct lmp_object_header),"\n\t ",
The Android Open Source Project2949f582009-03-03 19:30:46 -0800866 lmp_obj_len-sizeof(struct lmp_object_header));
867
868 tptr+=lmp_obj_len;
869 tlen-=lmp_obj_len;
870 }
871 return;
872trunc:
Elliott Hughes892a68b2015-10-19 14:43:53 -0700873 ND_PRINT((ndo, "\n\t\t packet exceeded snapshot"));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800874}
Elliott Hughes892a68b2015-10-19 14:43:53 -0700875/*
876 * Local Variables:
877 * c-style: whitesmith
878 * c-basic-offset: 8
879 * End:
880 */