print-lmp.c revision 1.10 1 1.1 christos /*
2 1.1 christos * Redistribution and use in source and binary forms, with or without
3 1.1 christos * modification, are permitted provided that: (1) source code
4 1.1 christos * distributions retain the above copyright notice and this paragraph
5 1.1 christos * in its entirety, and (2) distributions including binary code include
6 1.1 christos * the above copyright notice and this paragraph in its entirety in
7 1.1 christos * the documentation or other materials provided with the distribution.
8 1.1 christos * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
9 1.1 christos * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
10 1.1 christos * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
11 1.1 christos * FOR A PARTICULAR PURPOSE.
12 1.1 christos *
13 1.10 christos * Original code by Hannes Gredler (hannes (at) gredler.at)
14 1.10 christos * Support for LMP service discovery extensions (defined by OIF UNI 1.0)
15 1.10 christos * added by Manu Pathak (mapathak (at) cisco.com), May 2005
16 1.1 christos */
17 1.1 christos
18 1.9 spz /* \summary: Link Management Protocol (LMP) printer */
19 1.9 spz
20 1.9 spz /* specification: RFC 4204 */
21 1.10 christos /* OIF UNI 1.0: http://www.oiforum.com/public/documents/OIF-UNI-01.0.pdf */
22 1.9 spz
23 1.2 christos #include <sys/cdefs.h>
24 1.1 christos #ifndef lint
25 1.10 christos __RCSID("$NetBSD: print-lmp.c,v 1.10 2017/09/08 14:01:13 christos Exp $");
26 1.1 christos #endif
27 1.1 christos
28 1.1 christos #ifdef HAVE_CONFIG_H
29 1.1 christos #include "config.h"
30 1.1 christos #endif
31 1.1 christos
32 1.8 christos #include <netdissect-stdinc.h>
33 1.1 christos
34 1.8 christos #include "netdissect.h"
35 1.1 christos #include "extract.h"
36 1.1 christos #include "addrtoname.h"
37 1.1 christos #include "gmpls.h"
38 1.1 christos
39 1.1 christos /*
40 1.1 christos * LMP common header
41 1.1 christos *
42 1.1 christos * 0 1 2 3
43 1.1 christos * 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
44 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
45 1.1 christos * | Vers | (Reserved) | Flags | Msg Type |
46 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
47 1.1 christos * | LMP Length | (Reserved) |
48 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
49 1.1 christos */
50 1.1 christos
51 1.1 christos struct lmp_common_header {
52 1.6 christos uint8_t version_res[2];
53 1.6 christos uint8_t flags;
54 1.6 christos uint8_t msg_type;
55 1.6 christos uint8_t length[2];
56 1.6 christos uint8_t reserved[2];
57 1.1 christos };
58 1.1 christos
59 1.1 christos #define LMP_VERSION 1
60 1.6 christos #define LMP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
61 1.1 christos
62 1.1 christos static const struct tok lmp_header_flag_values[] = {
63 1.1 christos { 0x01, "Control Channel Down"},
64 1.1 christos { 0x02, "LMP restart"},
65 1.1 christos { 0, NULL}
66 1.1 christos };
67 1.1 christos
68 1.1 christos static const struct tok lmp_obj_te_link_flag_values[] = {
69 1.1 christos { 0x01, "Fault Management Supported"},
70 1.1 christos { 0x02, "Link Verification Supported"},
71 1.1 christos { 0, NULL}
72 1.1 christos };
73 1.1 christos
74 1.1 christos static const struct tok lmp_obj_data_link_flag_values[] = {
75 1.1 christos { 0x01, "Data Link Port"},
76 1.1 christos { 0x02, "Allocated for user traffic"},
77 1.1 christos { 0x04, "Failed link"},
78 1.1 christos { 0, NULL}
79 1.1 christos };
80 1.1 christos
81 1.1 christos static const struct tok lmp_obj_channel_status_values[] = {
82 1.1 christos { 1, "Signal Okay"},
83 1.1 christos { 2, "Signal Degraded"},
84 1.1 christos { 3, "Signal Fail"},
85 1.1 christos { 0, NULL}
86 1.1 christos };
87 1.1 christos
88 1.1 christos static const struct tok lmp_obj_begin_verify_flag_values[] = {
89 1.1 christos { 0x0001, "Verify all links"},
90 1.1 christos { 0x0002, "Data link type"},
91 1.1 christos { 0, NULL}
92 1.1 christos };
93 1.1 christos
94 1.1 christos static const struct tok lmp_obj_begin_verify_error_values[] = {
95 1.1 christos { 0x01, "Link Verification Procedure Not supported"},
96 1.1 christos { 0x02, "Unwilling to verify"},
97 1.1 christos { 0x04, "Unsupported verification transport mechanism"},
98 1.1 christos { 0x08, "Link-Id configuration error"},
99 1.1 christos { 0x10, "Unknown object c-type"},
100 1.1 christos { 0, NULL}
101 1.1 christos };
102 1.1 christos
103 1.1 christos static const struct tok lmp_obj_link_summary_error_values[] = {
104 1.1 christos { 0x01, "Unacceptable non-negotiable LINK-SUMMARY parameters"},
105 1.1 christos { 0x02, "Renegotiate LINK-SUMMARY parameters"},
106 1.1 christos { 0x04, "Invalid TE-LINK Object"},
107 1.1 christos { 0x08, "Invalid DATA-LINK Object"},
108 1.1 christos { 0x10, "Unknown TE-LINK Object c-type"},
109 1.1 christos { 0x20, "Unknown DATA-LINK Object c-type"},
110 1.1 christos { 0, NULL}
111 1.1 christos };
112 1.1 christos
113 1.1 christos /* Service Config Supported Protocols Flags */
114 1.1 christos static const struct tok lmp_obj_service_config_sp_flag_values[] = {
115 1.1 christos { 0x01, "RSVP Supported"},
116 1.1 christos { 0x02, "LDP Supported"},
117 1.1 christos { 0, NULL}
118 1.1 christos };
119 1.1 christos
120 1.1 christos /* Service Config Client Port Service Attribute Transparency Flags */
121 1.1 christos static const struct tok lmp_obj_service_config_cpsa_tp_flag_values[] = {
122 1.1 christos { 0x01, "Path/VC Overhead Transparency Supported"},
123 1.1 christos { 0x02, "Line/MS Overhead Transparency Supported"},
124 1.1 christos { 0x04, "Section/RS Overhead Transparency Supported"},
125 1.1 christos { 0, NULL}
126 1.1 christos };
127 1.1 christos
128 1.1 christos /* Service Config Client Port Service Attribute Contiguous Concatenation Types Flags */
129 1.1 christos static const struct tok lmp_obj_service_config_cpsa_cct_flag_values[] = {
130 1.1 christos { 0x01, "Contiguous Concatenation Types Supported"},
131 1.1 christos { 0, NULL}
132 1.1 christos };
133 1.1 christos
134 1.1 christos /* Service Config Network Service Attributes Transparency Flags */
135 1.1 christos static const struct tok lmp_obj_service_config_nsa_transparency_flag_values[] = {
136 1.1 christos { 0x01, "Standard SOH/RSOH Transparency Supported"},
137 1.1 christos { 0x02, "Standard LOH/MSOH Transparency Supported"},
138 1.1 christos { 0, NULL}
139 1.1 christos };
140 1.1 christos
141 1.1 christos /* Service Config Network Service Attributes TCM Monitoring Flags */
142 1.1 christos static const struct tok lmp_obj_service_config_nsa_tcm_flag_values[] = {
143 1.1 christos { 0x01, "Transparent Tandem Connection Monitoring Supported"},
144 1.1 christos { 0, NULL}
145 1.1 christos };
146 1.1 christos
147 1.1 christos /* Network Service Attributes Network Diversity Flags */
148 1.1 christos static const struct tok lmp_obj_service_config_nsa_network_diversity_flag_values[] = {
149 1.1 christos { 0x01, "Node Diversity Supported"},
150 1.1 christos { 0x02, "Link Diversity Supported"},
151 1.1 christos { 0x04, "SRLG Diversity Supported"},
152 1.1 christos { 0, NULL}
153 1.1 christos };
154 1.1 christos
155 1.1 christos #define LMP_MSGTYPE_CONFIG 1
156 1.1 christos #define LMP_MSGTYPE_CONFIG_ACK 2
157 1.1 christos #define LMP_MSGTYPE_CONFIG_NACK 3
158 1.1 christos #define LMP_MSGTYPE_HELLO 4
159 1.1 christos #define LMP_MSGTYPE_VERIFY_BEGIN 5
160 1.1 christos #define LMP_MSGTYPE_VERIFY_BEGIN_ACK 6
161 1.1 christos #define LMP_MSGTYPE_VERIFY_BEGIN_NACK 7
162 1.1 christos #define LMP_MSGTYPE_VERIFY_END 8
163 1.1 christos #define LMP_MSGTYPE_VERIFY_END_ACK 9
164 1.1 christos #define LMP_MSGTYPE_TEST 10
165 1.1 christos #define LMP_MSGTYPE_TEST_STATUS_SUCCESS 11
166 1.1 christos #define LMP_MSGTYPE_TEST_STATUS_FAILURE 12
167 1.1 christos #define LMP_MSGTYPE_TEST_STATUS_ACK 13
168 1.1 christos #define LMP_MSGTYPE_LINK_SUMMARY 14
169 1.1 christos #define LMP_MSGTYPE_LINK_SUMMARY_ACK 15
170 1.1 christos #define LMP_MSGTYPE_LINK_SUMMARY_NACK 16
171 1.1 christos #define LMP_MSGTYPE_CHANNEL_STATUS 17
172 1.1 christos #define LMP_MSGTYPE_CHANNEL_STATUS_ACK 18
173 1.1 christos #define LMP_MSGTYPE_CHANNEL_STATUS_REQ 19
174 1.1 christos #define LMP_MSGTYPE_CHANNEL_STATUS_RESP 20
175 1.1 christos /* LMP Service Discovery message types defined by UNI 1.0 */
176 1.1 christos #define LMP_MSGTYPE_SERVICE_CONFIG 50
177 1.1 christos #define LMP_MSGTYPE_SERVICE_CONFIG_ACK 51
178 1.1 christos #define LMP_MSGTYPE_SERVICE_CONFIG_NACK 52
179 1.1 christos
180 1.1 christos static const struct tok lmp_msg_type_values[] = {
181 1.1 christos { LMP_MSGTYPE_CONFIG, "Config"},
182 1.1 christos { LMP_MSGTYPE_CONFIG_ACK, "Config ACK"},
183 1.1 christos { LMP_MSGTYPE_CONFIG_NACK, "Config NACK"},
184 1.1 christos { LMP_MSGTYPE_HELLO, "Hello"},
185 1.1 christos { LMP_MSGTYPE_VERIFY_BEGIN, "Begin Verify"},
186 1.1 christos { LMP_MSGTYPE_VERIFY_BEGIN_ACK, "Begin Verify ACK"},
187 1.1 christos { LMP_MSGTYPE_VERIFY_BEGIN_NACK, "Begin Verify NACK"},
188 1.1 christos { LMP_MSGTYPE_VERIFY_END, "End Verify"},
189 1.1 christos { LMP_MSGTYPE_VERIFY_END_ACK, "End Verify ACK"},
190 1.1 christos { LMP_MSGTYPE_TEST, "Test"},
191 1.1 christos { LMP_MSGTYPE_TEST_STATUS_SUCCESS, "Test Status Success"},
192 1.1 christos { LMP_MSGTYPE_TEST_STATUS_FAILURE, "Test Status Failure"},
193 1.1 christos { LMP_MSGTYPE_TEST_STATUS_ACK, "Test Status ACK"},
194 1.1 christos { LMP_MSGTYPE_LINK_SUMMARY, "Link Summary"},
195 1.1 christos { LMP_MSGTYPE_LINK_SUMMARY_ACK, "Link Summary ACK"},
196 1.1 christos { LMP_MSGTYPE_LINK_SUMMARY_NACK, "Link Summary NACK"},
197 1.1 christos { LMP_MSGTYPE_CHANNEL_STATUS, "Channel Status"},
198 1.1 christos { LMP_MSGTYPE_CHANNEL_STATUS_ACK, "Channel Status ACK"},
199 1.1 christos { LMP_MSGTYPE_CHANNEL_STATUS_REQ, "Channel Status Request"},
200 1.1 christos { LMP_MSGTYPE_CHANNEL_STATUS_RESP, "Channel Status Response"},
201 1.1 christos { LMP_MSGTYPE_SERVICE_CONFIG, "Service Config"},
202 1.1 christos { LMP_MSGTYPE_SERVICE_CONFIG_ACK, "Service Config ACK"},
203 1.1 christos { LMP_MSGTYPE_SERVICE_CONFIG_NACK, "Service Config NACK"},
204 1.1 christos { 0, NULL}
205 1.1 christos };
206 1.1 christos
207 1.6 christos /*
208 1.1 christos * LMP object header
209 1.1 christos *
210 1.1 christos * 0 1 2 3
211 1.1 christos * 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
212 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
213 1.1 christos * |N| C-Type | Class | Length |
214 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
215 1.1 christos * | |
216 1.1 christos * // (object contents) //
217 1.1 christos * | |
218 1.6 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
219 1.1 christos */
220 1.1 christos
221 1.1 christos struct lmp_object_header {
222 1.6 christos uint8_t ctype;
223 1.6 christos uint8_t class_num;
224 1.6 christos uint8_t length[2];
225 1.1 christos };
226 1.1 christos
227 1.1 christos #define LMP_OBJ_CC_ID 1
228 1.1 christos #define LMP_OBJ_NODE_ID 2
229 1.1 christos #define LMP_OBJ_LINK_ID 3
230 1.1 christos #define LMP_OBJ_INTERFACE_ID 4
231 1.6 christos #define LMP_OBJ_MESSAGE_ID 5
232 1.1 christos #define LMP_OBJ_CONFIG 6
233 1.1 christos #define LMP_OBJ_HELLO 7
234 1.1 christos #define LMP_OBJ_VERIFY_BEGIN 8
235 1.1 christos #define LMP_OBJ_VERIFY_BEGIN_ACK 9
236 1.1 christos #define LMP_OBJ_VERIFY_ID 10
237 1.1 christos #define LMP_OBJ_TE_LINK 11
238 1.1 christos #define LMP_OBJ_DATA_LINK 12
239 1.1 christos #define LMP_OBJ_CHANNEL_STATUS 13
240 1.1 christos #define LMP_OBJ_CHANNEL_STATUS_REQ 14
241 1.1 christos #define LMP_OBJ_ERROR_CODE 20
242 1.1 christos
243 1.1 christos #define LMP_OBJ_SERVICE_CONFIG 51 /* defined in UNI 1.0 */
244 1.1 christos
245 1.1 christos static const struct tok lmp_obj_values[] = {
246 1.1 christos { LMP_OBJ_CC_ID, "Control Channel ID" },
247 1.1 christos { LMP_OBJ_NODE_ID, "Node ID" },
248 1.1 christos { LMP_OBJ_LINK_ID, "Link ID" },
249 1.1 christos { LMP_OBJ_INTERFACE_ID, "Interface ID" },
250 1.1 christos { LMP_OBJ_MESSAGE_ID, "Message ID" },
251 1.1 christos { LMP_OBJ_CONFIG, "Configuration" },
252 1.1 christos { LMP_OBJ_HELLO, "Hello" },
253 1.1 christos { LMP_OBJ_VERIFY_BEGIN, "Verify Begin" },
254 1.1 christos { LMP_OBJ_VERIFY_BEGIN_ACK, "Verify Begin ACK" },
255 1.1 christos { LMP_OBJ_VERIFY_ID, "Verify ID" },
256 1.1 christos { LMP_OBJ_TE_LINK, "TE Link" },
257 1.1 christos { LMP_OBJ_DATA_LINK, "Data Link" },
258 1.1 christos { LMP_OBJ_CHANNEL_STATUS, "Channel Status" },
259 1.1 christos { LMP_OBJ_CHANNEL_STATUS_REQ, "Channel Status Request" },
260 1.1 christos { LMP_OBJ_ERROR_CODE, "Error Code" },
261 1.1 christos { LMP_OBJ_SERVICE_CONFIG, "Service Config" },
262 1.1 christos
263 1.1 christos { 0, NULL}
264 1.1 christos };
265 1.1 christos
266 1.1 christos #define INT_SWITCHING_TYPE_SUBOBJ 1
267 1.1 christos #define WAVELENGTH_SUBOBJ 2
268 1.1 christos
269 1.1 christos static const struct tok lmp_data_link_subobj[] = {
270 1.1 christos { INT_SWITCHING_TYPE_SUBOBJ, "Interface Switching Type" },
271 1.1 christos { WAVELENGTH_SUBOBJ , "Wavelength" },
272 1.1 christos { 0, NULL}
273 1.1 christos };
274 1.1 christos
275 1.1 christos #define LMP_CTYPE_IPV4 1
276 1.1 christos #define LMP_CTYPE_IPV6 2
277 1.1 christos
278 1.1 christos #define LMP_CTYPE_LOC 1
279 1.1 christos #define LMP_CTYPE_RMT 2
280 1.1 christos #define LMP_CTYPE_UNMD 3
281 1.6 christos
282 1.1 christos #define LMP_CTYPE_IPV4_LOC 1
283 1.1 christos #define LMP_CTYPE_IPV4_RMT 2
284 1.1 christos #define LMP_CTYPE_IPV6_LOC 3
285 1.1 christos #define LMP_CTYPE_IPV6_RMT 4
286 1.6 christos #define LMP_CTYPE_UNMD_LOC 5
287 1.6 christos #define LMP_CTYPE_UNMD_RMT 6
288 1.1 christos
289 1.1 christos #define LMP_CTYPE_1 1
290 1.1 christos #define LMP_CTYPE_2 2
291 1.1 christos
292 1.1 christos #define LMP_CTYPE_HELLO_CONFIG 1
293 1.1 christos #define LMP_CTYPE_HELLO 1
294 1.1 christos
295 1.1 christos #define LMP_CTYPE_BEGIN_VERIFY_ERROR 1
296 1.1 christos #define LMP_CTYPE_LINK_SUMMARY_ERROR 2
297 1.1 christos
298 1.1 christos /* C-Types for Service Config Object */
299 1.1 christos #define LMP_CTYPE_SERVICE_CONFIG_SP 1
300 1.1 christos #define LMP_CTYPE_SERVICE_CONFIG_CPSA 2
301 1.1 christos #define LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM 3
302 1.1 christos #define LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY 4
303 1.1 christos
304 1.6 christos /*
305 1.1 christos * Different link types allowed in the Client Port Service Attributes
306 1.1 christos * subobject defined for LMP Service Discovery in the UNI 1.0 spec
307 1.1 christos */
308 1.1 christos #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH 5 /* UNI 1.0 Sec 9.4.2 */
309 1.1 christos #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET 6 /* UNI 1.0 Sec 9.4.2 */
310 1.1 christos
311 1.1 christos /*
312 1.1 christos * the ctypes are not globally unique so for
313 1.1 christos * translating it to strings we build a table based
314 1.1 christos * on objects offsetted by the ctype
315 1.1 christos */
316 1.1 christos
317 1.1 christos static const struct tok lmp_ctype_values[] = {
318 1.1 christos { 256*LMP_OBJ_CC_ID+LMP_CTYPE_LOC, "Local" },
319 1.1 christos { 256*LMP_OBJ_CC_ID+LMP_CTYPE_RMT, "Remote" },
320 1.1 christos { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_LOC, "Local" },
321 1.1 christos { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_RMT, "Remote" },
322 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
323 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
324 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
325 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
326 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
327 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
328 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
329 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
330 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
331 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
332 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
333 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
334 1.1 christos { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_1, "1" },
335 1.1 christos { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_2, "2" },
336 1.1 christos { 256*LMP_OBJ_CONFIG+LMP_CTYPE_1, "1" },
337 1.1 christos { 256*LMP_OBJ_HELLO+LMP_CTYPE_1, "1" },
338 1.1 christos { 256*LMP_OBJ_VERIFY_BEGIN+LMP_CTYPE_1, "1" },
339 1.1 christos { 256*LMP_OBJ_VERIFY_BEGIN_ACK+LMP_CTYPE_1, "1" },
340 1.1 christos { 256*LMP_OBJ_VERIFY_ID+LMP_CTYPE_1, "1" },
341 1.1 christos { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV4, "IPv4" },
342 1.1 christos { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV6, "IPv6" },
343 1.1 christos { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
344 1.1 christos { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV4, "IPv4" },
345 1.1 christos { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV6, "IPv6" },
346 1.1 christos { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
347 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV4, "IPv4" },
348 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV6, "IPv6" },
349 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_UNMD, "Unnumbered" },
350 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV4, "IPv4" },
351 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV6, "IPv6" },
352 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_UNMD, "Unnumbered" },
353 1.1 christos { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_1, "1" },
354 1.1 christos { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_2, "2" },
355 1.1 christos { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_SP, "1" },
356 1.1 christos { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_CPSA, "2" },
357 1.1 christos { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM, "3" },
358 1.1 christos { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY, "4" },
359 1.1 christos { 0, NULL}
360 1.1 christos };
361 1.1 christos
362 1.10 christos static int
363 1.10 christos lmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr,
364 1.10 christos int total_subobj_len, int offset)
365 1.10 christos {
366 1.10 christos int hexdump = FALSE;
367 1.10 christos int subobj_type, subobj_len;
368 1.10 christos
369 1.10 christos union { /* int to float conversion buffer */
370 1.10 christos float f;
371 1.10 christos uint32_t i;
372 1.10 christos } bw;
373 1.10 christos
374 1.10 christos while (total_subobj_len > 0 && hexdump == FALSE ) {
375 1.10 christos subobj_type = EXTRACT_8BITS(obj_tptr+offset);
376 1.10 christos subobj_len = EXTRACT_8BITS(obj_tptr+offset+1);
377 1.10 christos ND_PRINT((ndo, "\n\t Subobject, Type: %s (%u), Length: %u",
378 1.10 christos tok2str(lmp_data_link_subobj,
379 1.10 christos "Unknown",
380 1.10 christos subobj_type),
381 1.10 christos subobj_type,
382 1.10 christos subobj_len));
383 1.10 christos if (subobj_len < 4) {
384 1.10 christos ND_PRINT((ndo, " (too short)"));
385 1.10 christos break;
386 1.10 christos }
387 1.10 christos if ((subobj_len % 4) != 0) {
388 1.10 christos ND_PRINT((ndo, " (not a multiple of 4)"));
389 1.10 christos break;
390 1.10 christos }
391 1.10 christos if (total_subobj_len < subobj_len) {
392 1.10 christos ND_PRINT((ndo, " (goes past the end of the object)"));
393 1.10 christos break;
394 1.10 christos }
395 1.10 christos switch(subobj_type) {
396 1.10 christos case INT_SWITCHING_TYPE_SUBOBJ:
397 1.10 christos ND_PRINT((ndo, "\n\t Switching Type: %s (%u)",
398 1.10 christos tok2str(gmpls_switch_cap_values,
399 1.10 christos "Unknown",
400 1.10 christos EXTRACT_8BITS(obj_tptr+offset+2)),
401 1.10 christos EXTRACT_8BITS(obj_tptr+offset+2)));
402 1.10 christos ND_PRINT((ndo, "\n\t Encoding Type: %s (%u)",
403 1.10 christos tok2str(gmpls_encoding_values,
404 1.10 christos "Unknown",
405 1.10 christos EXTRACT_8BITS(obj_tptr+offset+3)),
406 1.10 christos EXTRACT_8BITS(obj_tptr+offset+3)));
407 1.10 christos bw.i = EXTRACT_32BITS(obj_tptr+offset+4);
408 1.10 christos ND_PRINT((ndo, "\n\t Min Reservable Bandwidth: %.3f Mbps",
409 1.10 christos bw.f*8/1000000));
410 1.10 christos bw.i = EXTRACT_32BITS(obj_tptr+offset+8);
411 1.10 christos ND_PRINT((ndo, "\n\t Max Reservable Bandwidth: %.3f Mbps",
412 1.10 christos bw.f*8/1000000));
413 1.10 christos break;
414 1.10 christos case WAVELENGTH_SUBOBJ:
415 1.10 christos ND_PRINT((ndo, "\n\t Wavelength: %u",
416 1.10 christos EXTRACT_32BITS(obj_tptr+offset+4)));
417 1.10 christos break;
418 1.10 christos default:
419 1.10 christos /* Any Unknown Subobject ==> Exit loop */
420 1.10 christos hexdump=TRUE;
421 1.10 christos break;
422 1.10 christos }
423 1.10 christos total_subobj_len-=subobj_len;
424 1.10 christos offset+=subobj_len;
425 1.10 christos }
426 1.10 christos return (hexdump);
427 1.10 christos }
428 1.10 christos
429 1.1 christos void
430 1.6 christos lmp_print(netdissect_options *ndo,
431 1.7 christos register const u_char *pptr, register u_int len)
432 1.7 christos {
433 1.1 christos const struct lmp_common_header *lmp_com_header;
434 1.1 christos const struct lmp_object_header *lmp_obj_header;
435 1.1 christos const u_char *tptr,*obj_tptr;
436 1.10 christos u_int tlen,lmp_obj_len,lmp_obj_ctype,obj_tlen;
437 1.1 christos int hexdump;
438 1.10 christos u_int offset;
439 1.10 christos u_int link_type;
440 1.1 christos
441 1.1 christos union { /* int to float conversion buffer */
442 1.6 christos float f;
443 1.6 christos uint32_t i;
444 1.1 christos } bw;
445 1.1 christos
446 1.1 christos tptr=pptr;
447 1.1 christos lmp_com_header = (const struct lmp_common_header *)pptr;
448 1.6 christos ND_TCHECK(*lmp_com_header);
449 1.1 christos
450 1.1 christos /*
451 1.1 christos * Sanity checking of the header.
452 1.1 christos */
453 1.1 christos if (LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]) != LMP_VERSION) {
454 1.6 christos ND_PRINT((ndo, "LMP version %u packet not supported",
455 1.6 christos LMP_EXTRACT_VERSION(lmp_com_header->version_res[0])));
456 1.1 christos return;
457 1.1 christos }
458 1.1 christos
459 1.1 christos /* in non-verbose mode just lets print the basic Message Type*/
460 1.6 christos if (ndo->ndo_vflag < 1) {
461 1.6 christos ND_PRINT((ndo, "LMPv%u %s Message, length: %u",
462 1.1 christos LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
463 1.1 christos tok2str(lmp_msg_type_values, "unknown (%u)",lmp_com_header->msg_type),
464 1.6 christos len));
465 1.1 christos return;
466 1.1 christos }
467 1.1 christos
468 1.1 christos /* ok they seem to want to know everything - lets fully decode it */
469 1.1 christos
470 1.1 christos tlen=EXTRACT_16BITS(lmp_com_header->length);
471 1.1 christos
472 1.6 christos ND_PRINT((ndo, "\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
473 1.1 christos LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
474 1.1 christos tok2str(lmp_msg_type_values, "unknown, type: %u",lmp_com_header->msg_type),
475 1.1 christos bittok2str(lmp_header_flag_values,"none",lmp_com_header->flags),
476 1.6 christos tlen));
477 1.10 christos if (tlen < sizeof(const struct lmp_common_header)) {
478 1.10 christos ND_PRINT((ndo, " (too short)"));
479 1.10 christos return;
480 1.10 christos }
481 1.10 christos if (tlen > len) {
482 1.10 christos ND_PRINT((ndo, " (too long)"));
483 1.10 christos tlen = len;
484 1.10 christos }
485 1.1 christos
486 1.1 christos tptr+=sizeof(const struct lmp_common_header);
487 1.1 christos tlen-=sizeof(const struct lmp_common_header);
488 1.1 christos
489 1.1 christos while(tlen>0) {
490 1.1 christos /* did we capture enough for fully decoding the object header ? */
491 1.6 christos ND_TCHECK2(*tptr, sizeof(struct lmp_object_header));
492 1.1 christos
493 1.1 christos lmp_obj_header = (const struct lmp_object_header *)tptr;
494 1.1 christos lmp_obj_len=EXTRACT_16BITS(lmp_obj_header->length);
495 1.1 christos lmp_obj_ctype=(lmp_obj_header->ctype)&0x7f;
496 1.1 christos
497 1.6 christos ND_PRINT((ndo, "\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u",
498 1.1 christos tok2str(lmp_obj_values,
499 1.1 christos "Unknown",
500 1.1 christos lmp_obj_header->class_num),
501 1.1 christos lmp_obj_header->class_num,
502 1.1 christos tok2str(lmp_ctype_values,
503 1.1 christos "Unknown",
504 1.1 christos ((lmp_obj_header->class_num)<<8)+lmp_obj_ctype),
505 1.1 christos lmp_obj_ctype,
506 1.1 christos (lmp_obj_header->ctype)&0x80 ? "" : "non-",
507 1.6 christos lmp_obj_len));
508 1.1 christos
509 1.10 christos if (lmp_obj_len < 4) {
510 1.10 christos ND_PRINT((ndo, " (too short)"));
511 1.10 christos return;
512 1.10 christos }
513 1.10 christos if ((lmp_obj_len % 4) != 0) {
514 1.10 christos ND_PRINT((ndo, " (not a multiple of 4)"));
515 1.10 christos return;
516 1.10 christos }
517 1.10 christos
518 1.1 christos obj_tptr=tptr+sizeof(struct lmp_object_header);
519 1.1 christos obj_tlen=lmp_obj_len-sizeof(struct lmp_object_header);
520 1.1 christos
521 1.1 christos /* did we capture enough for fully decoding the object ? */
522 1.6 christos ND_TCHECK2(*tptr, lmp_obj_len);
523 1.1 christos hexdump=FALSE;
524 1.1 christos
525 1.1 christos switch(lmp_obj_header->class_num) {
526 1.1 christos
527 1.1 christos case LMP_OBJ_CC_ID:
528 1.1 christos switch(lmp_obj_ctype) {
529 1.1 christos case LMP_CTYPE_LOC:
530 1.1 christos case LMP_CTYPE_RMT:
531 1.10 christos if (obj_tlen != 4) {
532 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
533 1.10 christos break;
534 1.10 christos }
535 1.6 christos ND_PRINT((ndo, "\n\t Control Channel ID: %u (0x%08x)",
536 1.1 christos EXTRACT_32BITS(obj_tptr),
537 1.6 christos EXTRACT_32BITS(obj_tptr)));
538 1.1 christos break;
539 1.1 christos
540 1.1 christos default:
541 1.1 christos hexdump=TRUE;
542 1.1 christos }
543 1.1 christos break;
544 1.1 christos
545 1.1 christos case LMP_OBJ_LINK_ID:
546 1.1 christos case LMP_OBJ_INTERFACE_ID:
547 1.1 christos switch(lmp_obj_ctype) {
548 1.1 christos case LMP_CTYPE_IPV4_LOC:
549 1.1 christos case LMP_CTYPE_IPV4_RMT:
550 1.10 christos if (obj_tlen != 4) {
551 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
552 1.10 christos break;
553 1.10 christos }
554 1.6 christos ND_PRINT((ndo, "\n\t IPv4 Link ID: %s (0x%08x)",
555 1.6 christos ipaddr_string(ndo, obj_tptr),
556 1.6 christos EXTRACT_32BITS(obj_tptr)));
557 1.1 christos break;
558 1.1 christos case LMP_CTYPE_IPV6_LOC:
559 1.1 christos case LMP_CTYPE_IPV6_RMT:
560 1.10 christos if (obj_tlen != 16) {
561 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
562 1.10 christos break;
563 1.10 christos }
564 1.6 christos ND_PRINT((ndo, "\n\t IPv6 Link ID: %s (0x%08x)",
565 1.6 christos ip6addr_string(ndo, obj_tptr),
566 1.6 christos EXTRACT_32BITS(obj_tptr)));
567 1.1 christos break;
568 1.1 christos case LMP_CTYPE_UNMD_LOC:
569 1.1 christos case LMP_CTYPE_UNMD_RMT:
570 1.10 christos if (obj_tlen != 4) {
571 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
572 1.10 christos break;
573 1.10 christos }
574 1.6 christos ND_PRINT((ndo, "\n\t Link ID: %u (0x%08x)",
575 1.1 christos EXTRACT_32BITS(obj_tptr),
576 1.6 christos EXTRACT_32BITS(obj_tptr)));
577 1.1 christos break;
578 1.1 christos default:
579 1.1 christos hexdump=TRUE;
580 1.1 christos }
581 1.1 christos break;
582 1.1 christos
583 1.1 christos case LMP_OBJ_MESSAGE_ID:
584 1.1 christos switch(lmp_obj_ctype) {
585 1.1 christos case LMP_CTYPE_1:
586 1.10 christos if (obj_tlen != 4) {
587 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
588 1.10 christos break;
589 1.10 christos }
590 1.6 christos ND_PRINT((ndo, "\n\t Message ID: %u (0x%08x)",
591 1.1 christos EXTRACT_32BITS(obj_tptr),
592 1.6 christos EXTRACT_32BITS(obj_tptr)));
593 1.1 christos break;
594 1.1 christos case LMP_CTYPE_2:
595 1.10 christos if (obj_tlen != 4) {
596 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
597 1.10 christos break;
598 1.10 christos }
599 1.6 christos ND_PRINT((ndo, "\n\t Message ID Ack: %u (0x%08x)",
600 1.1 christos EXTRACT_32BITS(obj_tptr),
601 1.6 christos EXTRACT_32BITS(obj_tptr)));
602 1.1 christos break;
603 1.1 christos default:
604 1.1 christos hexdump=TRUE;
605 1.1 christos }
606 1.1 christos break;
607 1.1 christos
608 1.1 christos case LMP_OBJ_NODE_ID:
609 1.1 christos switch(lmp_obj_ctype) {
610 1.1 christos case LMP_CTYPE_LOC:
611 1.1 christos case LMP_CTYPE_RMT:
612 1.10 christos if (obj_tlen != 4) {
613 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
614 1.10 christos break;
615 1.10 christos }
616 1.6 christos ND_PRINT((ndo, "\n\t Node ID: %s (0x%08x)",
617 1.6 christos ipaddr_string(ndo, obj_tptr),
618 1.6 christos EXTRACT_32BITS(obj_tptr)));
619 1.1 christos break;
620 1.1 christos
621 1.1 christos default:
622 1.1 christos hexdump=TRUE;
623 1.1 christos }
624 1.1 christos break;
625 1.1 christos
626 1.1 christos case LMP_OBJ_CONFIG:
627 1.1 christos switch(lmp_obj_ctype) {
628 1.1 christos case LMP_CTYPE_HELLO_CONFIG:
629 1.10 christos if (obj_tlen != 4) {
630 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
631 1.10 christos break;
632 1.10 christos }
633 1.6 christos ND_PRINT((ndo, "\n\t Hello Interval: %u\n\t Hello Dead Interval: %u",
634 1.1 christos EXTRACT_16BITS(obj_tptr),
635 1.6 christos EXTRACT_16BITS(obj_tptr+2)));
636 1.1 christos break;
637 1.1 christos
638 1.1 christos default:
639 1.1 christos hexdump=TRUE;
640 1.1 christos }
641 1.1 christos break;
642 1.6 christos
643 1.1 christos case LMP_OBJ_HELLO:
644 1.1 christos switch(lmp_obj_ctype) {
645 1.1 christos case LMP_CTYPE_HELLO:
646 1.10 christos if (obj_tlen != 8) {
647 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
648 1.10 christos break;
649 1.10 christos }
650 1.6 christos ND_PRINT((ndo, "\n\t Tx Seq: %u, Rx Seq: %u",
651 1.1 christos EXTRACT_32BITS(obj_tptr),
652 1.6 christos EXTRACT_32BITS(obj_tptr+4)));
653 1.1 christos break;
654 1.1 christos
655 1.1 christos default:
656 1.1 christos hexdump=TRUE;
657 1.1 christos }
658 1.6 christos break;
659 1.6 christos
660 1.1 christos case LMP_OBJ_TE_LINK:
661 1.10 christos switch(lmp_obj_ctype) {
662 1.10 christos case LMP_CTYPE_IPV4:
663 1.10 christos if (obj_tlen != 12) {
664 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
665 1.10 christos break;
666 1.10 christos }
667 1.6 christos ND_PRINT((ndo, "\n\t Flags: [%s]",
668 1.10 christos bittok2str(lmp_obj_te_link_flag_values,
669 1.1 christos "none",
670 1.10 christos EXTRACT_8BITS(obj_tptr))));
671 1.6 christos
672 1.6 christos ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)"
673 1.5 christos "\n\t Remote Link-ID: %s (0x%08x)",
674 1.6 christos ipaddr_string(ndo, obj_tptr+4),
675 1.1 christos EXTRACT_32BITS(obj_tptr+4),
676 1.6 christos ipaddr_string(ndo, obj_tptr+8),
677 1.6 christos EXTRACT_32BITS(obj_tptr+8)));
678 1.1 christos break;
679 1.6 christos
680 1.1 christos case LMP_CTYPE_IPV6:
681 1.10 christos if (obj_tlen != 36) {
682 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
683 1.10 christos break;
684 1.10 christos }
685 1.10 christos ND_PRINT((ndo, "\n\t Flags: [%s]",
686 1.10 christos bittok2str(lmp_obj_te_link_flag_values,
687 1.10 christos "none",
688 1.10 christos EXTRACT_8BITS(obj_tptr))));
689 1.10 christos
690 1.10 christos ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)"
691 1.10 christos "\n\t Remote Link-ID: %s (0x%08x)",
692 1.10 christos ip6addr_string(ndo, obj_tptr+4),
693 1.10 christos EXTRACT_32BITS(obj_tptr+4),
694 1.10 christos ip6addr_string(ndo, obj_tptr+20),
695 1.10 christos EXTRACT_32BITS(obj_tptr+20)));
696 1.10 christos break;
697 1.10 christos
698 1.1 christos case LMP_CTYPE_UNMD:
699 1.10 christos if (obj_tlen != 12) {
700 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
701 1.10 christos break;
702 1.10 christos }
703 1.10 christos ND_PRINT((ndo, "\n\t Flags: [%s]",
704 1.10 christos bittok2str(lmp_obj_te_link_flag_values,
705 1.10 christos "none",
706 1.10 christos EXTRACT_8BITS(obj_tptr))));
707 1.10 christos
708 1.10 christos ND_PRINT((ndo, "\n\t Local Link-ID: %u (0x%08x)"
709 1.10 christos "\n\t Remote Link-ID: %u (0x%08x)",
710 1.10 christos EXTRACT_32BITS(obj_tptr+4),
711 1.10 christos EXTRACT_32BITS(obj_tptr+4),
712 1.10 christos EXTRACT_32BITS(obj_tptr+8),
713 1.10 christos EXTRACT_32BITS(obj_tptr+8)));
714 1.10 christos break;
715 1.10 christos
716 1.1 christos default:
717 1.1 christos hexdump=TRUE;
718 1.1 christos }
719 1.1 christos break;
720 1.6 christos
721 1.1 christos case LMP_OBJ_DATA_LINK:
722 1.1 christos switch(lmp_obj_ctype) {
723 1.1 christos case LMP_CTYPE_IPV4:
724 1.10 christos if (obj_tlen < 12) {
725 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
726 1.10 christos break;
727 1.10 christos }
728 1.10 christos ND_PRINT((ndo, "\n\t Flags: [%s]",
729 1.10 christos bittok2str(lmp_obj_data_link_flag_values,
730 1.10 christos "none",
731 1.10 christos EXTRACT_8BITS(obj_tptr))));
732 1.6 christos ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)"
733 1.5 christos "\n\t Remote Interface ID: %s (0x%08x)",
734 1.6 christos ipaddr_string(ndo, obj_tptr+4),
735 1.1 christos EXTRACT_32BITS(obj_tptr+4),
736 1.6 christos ipaddr_string(ndo, obj_tptr+8),
737 1.6 christos EXTRACT_32BITS(obj_tptr+8)));
738 1.6 christos
739 1.10 christos if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12))
740 1.10 christos hexdump=TRUE;
741 1.10 christos break;
742 1.10 christos
743 1.10 christos case LMP_CTYPE_IPV6:
744 1.10 christos if (obj_tlen < 36) {
745 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
746 1.10 christos break;
747 1.10 christos }
748 1.10 christos ND_PRINT((ndo, "\n\t Flags: [%s]",
749 1.10 christos bittok2str(lmp_obj_data_link_flag_values,
750 1.10 christos "none",
751 1.10 christos EXTRACT_8BITS(obj_tptr))));
752 1.10 christos ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)"
753 1.10 christos "\n\t Remote Interface ID: %s (0x%08x)",
754 1.10 christos ip6addr_string(ndo, obj_tptr+4),
755 1.10 christos EXTRACT_32BITS(obj_tptr+4),
756 1.10 christos ip6addr_string(ndo, obj_tptr+20),
757 1.10 christos EXTRACT_32BITS(obj_tptr+20)));
758 1.10 christos
759 1.10 christos if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 36, 36))
760 1.10 christos hexdump=TRUE;
761 1.10 christos break;
762 1.10 christos
763 1.10 christos case LMP_CTYPE_UNMD:
764 1.10 christos if (obj_tlen < 12) {
765 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
766 1.10 christos break;
767 1.10 christos }
768 1.10 christos ND_PRINT((ndo, "\n\t Flags: [%s]",
769 1.10 christos bittok2str(lmp_obj_data_link_flag_values,
770 1.10 christos "none",
771 1.10 christos EXTRACT_8BITS(obj_tptr))));
772 1.10 christos ND_PRINT((ndo, "\n\t Local Interface ID: %u (0x%08x)"
773 1.10 christos "\n\t Remote Interface ID: %u (0x%08x)",
774 1.10 christos EXTRACT_32BITS(obj_tptr+4),
775 1.10 christos EXTRACT_32BITS(obj_tptr+4),
776 1.10 christos EXTRACT_32BITS(obj_tptr+8),
777 1.10 christos EXTRACT_32BITS(obj_tptr+8)));
778 1.6 christos
779 1.10 christos if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12))
780 1.10 christos hexdump=TRUE;
781 1.1 christos break;
782 1.10 christos
783 1.1 christos default:
784 1.1 christos hexdump=TRUE;
785 1.1 christos }
786 1.6 christos break;
787 1.6 christos
788 1.1 christos case LMP_OBJ_VERIFY_BEGIN:
789 1.1 christos switch(lmp_obj_ctype) {
790 1.1 christos case LMP_CTYPE_1:
791 1.10 christos if (obj_tlen != 20) {
792 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
793 1.10 christos break;
794 1.10 christos }
795 1.6 christos ND_PRINT((ndo, "\n\t Flags: %s",
796 1.1 christos bittok2str(lmp_obj_begin_verify_flag_values,
797 1.1 christos "none",
798 1.6 christos EXTRACT_16BITS(obj_tptr))));
799 1.6 christos ND_PRINT((ndo, "\n\t Verify Interval: %u",
800 1.6 christos EXTRACT_16BITS(obj_tptr+2)));
801 1.6 christos ND_PRINT((ndo, "\n\t Data links: %u",
802 1.6 christos EXTRACT_32BITS(obj_tptr+4)));
803 1.6 christos ND_PRINT((ndo, "\n\t Encoding type: %s",
804 1.6 christos tok2str(gmpls_encoding_values, "Unknown", *(obj_tptr+8))));
805 1.6 christos ND_PRINT((ndo, "\n\t Verify Transport Mechanism: %u (0x%x)%s",
806 1.1 christos EXTRACT_16BITS(obj_tptr+10),
807 1.1 christos EXTRACT_16BITS(obj_tptr+10),
808 1.6 christos EXTRACT_16BITS(obj_tptr+10)&8000 ? " (Payload test messages capable)" : ""));
809 1.1 christos bw.i = EXTRACT_32BITS(obj_tptr+12);
810 1.6 christos ND_PRINT((ndo, "\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000));
811 1.6 christos ND_PRINT((ndo, "\n\t Wavelength: %u",
812 1.6 christos EXTRACT_32BITS(obj_tptr+16)));
813 1.1 christos break;
814 1.6 christos
815 1.1 christos default:
816 1.1 christos hexdump=TRUE;
817 1.1 christos }
818 1.6 christos break;
819 1.6 christos
820 1.1 christos case LMP_OBJ_VERIFY_BEGIN_ACK:
821 1.1 christos switch(lmp_obj_ctype) {
822 1.1 christos case LMP_CTYPE_1:
823 1.10 christos if (obj_tlen != 4) {
824 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
825 1.10 christos break;
826 1.10 christos }
827 1.6 christos ND_PRINT((ndo, "\n\t Verify Dead Interval: %u"
828 1.5 christos "\n\t Verify Transport Response: %u",
829 1.1 christos EXTRACT_16BITS(obj_tptr),
830 1.6 christos EXTRACT_16BITS(obj_tptr+2)));
831 1.1 christos break;
832 1.6 christos
833 1.1 christos default:
834 1.1 christos hexdump=TRUE;
835 1.1 christos }
836 1.6 christos break;
837 1.6 christos
838 1.1 christos case LMP_OBJ_VERIFY_ID:
839 1.1 christos switch(lmp_obj_ctype) {
840 1.1 christos case LMP_CTYPE_1:
841 1.10 christos if (obj_tlen != 4) {
842 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
843 1.10 christos break;
844 1.10 christos }
845 1.6 christos ND_PRINT((ndo, "\n\t Verify ID: %u",
846 1.6 christos EXTRACT_32BITS(obj_tptr)));
847 1.1 christos break;
848 1.6 christos
849 1.1 christos default:
850 1.1 christos hexdump=TRUE;
851 1.1 christos }
852 1.6 christos break;
853 1.6 christos
854 1.1 christos case LMP_OBJ_CHANNEL_STATUS:
855 1.1 christos switch(lmp_obj_ctype) {
856 1.1 christos case LMP_CTYPE_IPV4:
857 1.1 christos offset = 0;
858 1.1 christos /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
859 1.10 christos while (offset+8 <= obj_tlen) {
860 1.6 christos ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
861 1.6 christos ipaddr_string(ndo, obj_tptr+offset),
862 1.6 christos EXTRACT_32BITS(obj_tptr+offset)));
863 1.6 christos
864 1.10 christos ND_PRINT((ndo, "\n\t\t Active: %s (%u)",
865 1.10 christos (EXTRACT_32BITS(obj_tptr+offset+4)>>31) ?
866 1.1 christos "Allocated" : "Non-allocated",
867 1.6 christos (EXTRACT_32BITS(obj_tptr+offset+4)>>31)));
868 1.6 christos
869 1.10 christos ND_PRINT((ndo, "\n\t\t Direction: %s (%u)",
870 1.10 christos (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ?
871 1.1 christos "Transmit" : "Receive",
872 1.6 christos (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1));
873 1.6 christos
874 1.6 christos ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
875 1.1 christos tok2str(lmp_obj_channel_status_values,
876 1.1 christos "Unknown",
877 1.1 christos EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF),
878 1.6 christos EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF));
879 1.1 christos offset+=8;
880 1.1 christos }
881 1.1 christos break;
882 1.10 christos
883 1.1 christos case LMP_CTYPE_IPV6:
884 1.10 christos offset = 0;
885 1.10 christos /* Decode pairs: <Interface_ID (16 bytes), Channel_status (4 bytes)> */
886 1.10 christos while (offset+20 <= obj_tlen) {
887 1.10 christos ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
888 1.10 christos ip6addr_string(ndo, obj_tptr+offset),
889 1.10 christos EXTRACT_32BITS(obj_tptr+offset)));
890 1.10 christos
891 1.10 christos ND_PRINT((ndo, "\n\t\t Active: %s (%u)",
892 1.10 christos (EXTRACT_32BITS(obj_tptr+offset+16)>>31) ?
893 1.10 christos "Allocated" : "Non-allocated",
894 1.10 christos (EXTRACT_32BITS(obj_tptr+offset+16)>>31)));
895 1.10 christos
896 1.10 christos ND_PRINT((ndo, "\n\t\t Direction: %s (%u)",
897 1.10 christos (EXTRACT_32BITS(obj_tptr+offset+16)>>30)&0x1 ?
898 1.10 christos "Transmit" : "Receive",
899 1.10 christos (EXTRACT_32BITS(obj_tptr+offset+16)>>30)&0x1));
900 1.10 christos
901 1.10 christos ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
902 1.10 christos tok2str(lmp_obj_channel_status_values,
903 1.10 christos "Unknown",
904 1.10 christos EXTRACT_32BITS(obj_tptr+offset+16)&0x3FFFFFF),
905 1.10 christos EXTRACT_32BITS(obj_tptr+offset+16)&0x3FFFFFF));
906 1.10 christos offset+=20;
907 1.10 christos }
908 1.10 christos break;
909 1.10 christos
910 1.10 christos case LMP_CTYPE_UNMD:
911 1.10 christos offset = 0;
912 1.10 christos /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
913 1.10 christos while (offset+8 <= obj_tlen) {
914 1.10 christos ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)",
915 1.10 christos EXTRACT_32BITS(obj_tptr+offset),
916 1.10 christos EXTRACT_32BITS(obj_tptr+offset)));
917 1.10 christos
918 1.10 christos ND_PRINT((ndo, "\n\t\t Active: %s (%u)",
919 1.10 christos (EXTRACT_32BITS(obj_tptr+offset+4)>>31) ?
920 1.10 christos "Allocated" : "Non-allocated",
921 1.10 christos (EXTRACT_32BITS(obj_tptr+offset+4)>>31)));
922 1.10 christos
923 1.10 christos ND_PRINT((ndo, "\n\t\t Direction: %s (%u)",
924 1.10 christos (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ?
925 1.10 christos "Transmit" : "Receive",
926 1.10 christos (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1));
927 1.10 christos
928 1.10 christos ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
929 1.10 christos tok2str(lmp_obj_channel_status_values,
930 1.10 christos "Unknown",
931 1.10 christos EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF),
932 1.10 christos EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF));
933 1.10 christos offset+=8;
934 1.10 christos }
935 1.10 christos break;
936 1.10 christos
937 1.1 christos default:
938 1.1 christos hexdump=TRUE;
939 1.1 christos }
940 1.6 christos break;
941 1.6 christos
942 1.1 christos case LMP_OBJ_CHANNEL_STATUS_REQ:
943 1.1 christos switch(lmp_obj_ctype) {
944 1.1 christos case LMP_CTYPE_IPV4:
945 1.1 christos offset = 0;
946 1.10 christos while (offset+4 <= obj_tlen) {
947 1.6 christos ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
948 1.6 christos ipaddr_string(ndo, obj_tptr+offset),
949 1.6 christos EXTRACT_32BITS(obj_tptr+offset)));
950 1.1 christos offset+=4;
951 1.1 christos }
952 1.1 christos break;
953 1.10 christos
954 1.1 christos case LMP_CTYPE_IPV6:
955 1.10 christos offset = 0;
956 1.10 christos while (offset+16 <= obj_tlen) {
957 1.10 christos ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
958 1.10 christos ip6addr_string(ndo, obj_tptr+offset),
959 1.10 christos EXTRACT_32BITS(obj_tptr+offset)));
960 1.10 christos offset+=16;
961 1.10 christos }
962 1.10 christos break;
963 1.10 christos
964 1.10 christos case LMP_CTYPE_UNMD:
965 1.10 christos offset = 0;
966 1.10 christos while (offset+4 <= obj_tlen) {
967 1.10 christos ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)",
968 1.10 christos EXTRACT_32BITS(obj_tptr+offset),
969 1.10 christos EXTRACT_32BITS(obj_tptr+offset)));
970 1.10 christos offset+=4;
971 1.10 christos }
972 1.10 christos break;
973 1.10 christos
974 1.1 christos default:
975 1.1 christos hexdump=TRUE;
976 1.1 christos }
977 1.6 christos break;
978 1.6 christos
979 1.1 christos case LMP_OBJ_ERROR_CODE:
980 1.1 christos switch(lmp_obj_ctype) {
981 1.1 christos case LMP_CTYPE_BEGIN_VERIFY_ERROR:
982 1.10 christos if (obj_tlen != 4) {
983 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
984 1.10 christos break;
985 1.10 christos }
986 1.6 christos ND_PRINT((ndo, "\n\t Error Code: %s",
987 1.1 christos bittok2str(lmp_obj_begin_verify_error_values,
988 1.1 christos "none",
989 1.6 christos EXTRACT_32BITS(obj_tptr))));
990 1.1 christos break;
991 1.6 christos
992 1.1 christos case LMP_CTYPE_LINK_SUMMARY_ERROR:
993 1.10 christos if (obj_tlen != 4) {
994 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
995 1.10 christos break;
996 1.10 christos }
997 1.6 christos ND_PRINT((ndo, "\n\t Error Code: %s",
998 1.1 christos bittok2str(lmp_obj_link_summary_error_values,
999 1.1 christos "none",
1000 1.6 christos EXTRACT_32BITS(obj_tptr))));
1001 1.1 christos break;
1002 1.1 christos default:
1003 1.1 christos hexdump=TRUE;
1004 1.1 christos }
1005 1.6 christos break;
1006 1.1 christos
1007 1.1 christos case LMP_OBJ_SERVICE_CONFIG:
1008 1.1 christos switch (lmp_obj_ctype) {
1009 1.1 christos case LMP_CTYPE_SERVICE_CONFIG_SP:
1010 1.10 christos if (obj_tlen != 4) {
1011 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
1012 1.10 christos break;
1013 1.10 christos }
1014 1.6 christos ND_PRINT((ndo, "\n\t Flags: %s",
1015 1.1 christos bittok2str(lmp_obj_service_config_sp_flag_values,
1016 1.6 christos "none",
1017 1.10 christos EXTRACT_8BITS(obj_tptr))));
1018 1.1 christos
1019 1.6 christos ND_PRINT((ndo, "\n\t UNI Version: %u",
1020 1.10 christos EXTRACT_8BITS(obj_tptr+1)));
1021 1.1 christos
1022 1.1 christos break;
1023 1.6 christos
1024 1.1 christos case LMP_CTYPE_SERVICE_CONFIG_CPSA:
1025 1.10 christos if (obj_tlen != 16) {
1026 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
1027 1.10 christos break;
1028 1.10 christos }
1029 1.6 christos
1030 1.10 christos link_type = EXTRACT_8BITS(obj_tptr);
1031 1.6 christos
1032 1.6 christos ND_PRINT((ndo, "\n\t Link Type: %s (%u)",
1033 1.1 christos tok2str(lmp_sd_service_config_cpsa_link_type_values,
1034 1.1 christos "Unknown", link_type),
1035 1.6 christos link_type));
1036 1.6 christos
1037 1.10 christos switch (link_type) {
1038 1.10 christos case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH:
1039 1.6 christos ND_PRINT((ndo, "\n\t Signal Type: %s (%u)",
1040 1.1 christos tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values,
1041 1.1 christos "Unknown",
1042 1.10 christos EXTRACT_8BITS(obj_tptr+1)),
1043 1.10 christos EXTRACT_8BITS(obj_tptr+1)));
1044 1.10 christos break;
1045 1.6 christos
1046 1.10 christos case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET:
1047 1.6 christos ND_PRINT((ndo, "\n\t Signal Type: %s (%u)",
1048 1.1 christos tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values,
1049 1.1 christos "Unknown",
1050 1.10 christos EXTRACT_8BITS(obj_tptr+1)),
1051 1.10 christos EXTRACT_8BITS(obj_tptr+1)));
1052 1.10 christos break;
1053 1.1 christos }
1054 1.6 christos
1055 1.6 christos ND_PRINT((ndo, "\n\t Transparency: %s",
1056 1.1 christos bittok2str(lmp_obj_service_config_cpsa_tp_flag_values,
1057 1.1 christos "none",
1058 1.10 christos EXTRACT_8BITS(obj_tptr+2))));
1059 1.6 christos
1060 1.6 christos ND_PRINT((ndo, "\n\t Contiguous Concatenation Types: %s",
1061 1.1 christos bittok2str(lmp_obj_service_config_cpsa_cct_flag_values,
1062 1.1 christos "none",
1063 1.10 christos EXTRACT_8BITS(obj_tptr+3))));
1064 1.6 christos
1065 1.6 christos ND_PRINT((ndo, "\n\t Minimum NCC: %u",
1066 1.6 christos EXTRACT_16BITS(obj_tptr+4)));
1067 1.6 christos
1068 1.6 christos ND_PRINT((ndo, "\n\t Maximum NCC: %u",
1069 1.6 christos EXTRACT_16BITS(obj_tptr+6)));
1070 1.6 christos
1071 1.6 christos ND_PRINT((ndo, "\n\t Minimum NVC:%u",
1072 1.6 christos EXTRACT_16BITS(obj_tptr+8)));
1073 1.6 christos
1074 1.6 christos ND_PRINT((ndo, "\n\t Maximum NVC:%u",
1075 1.6 christos EXTRACT_16BITS(obj_tptr+10)));
1076 1.6 christos
1077 1.6 christos ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)",
1078 1.6 christos ipaddr_string(ndo, obj_tptr+12),
1079 1.6 christos EXTRACT_32BITS(obj_tptr+12)));
1080 1.6 christos
1081 1.1 christos break;
1082 1.6 christos
1083 1.1 christos case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM:
1084 1.10 christos if (obj_tlen != 8) {
1085 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
1086 1.10 christos break;
1087 1.10 christos }
1088 1.6 christos
1089 1.6 christos ND_PRINT((ndo, "\n\t Transparency Flags: %s",
1090 1.1 christos bittok2str(
1091 1.1 christos lmp_obj_service_config_nsa_transparency_flag_values,
1092 1.1 christos "none",
1093 1.6 christos EXTRACT_32BITS(obj_tptr))));
1094 1.1 christos
1095 1.6 christos ND_PRINT((ndo, "\n\t TCM Monitoring Flags: %s",
1096 1.1 christos bittok2str(
1097 1.1 christos lmp_obj_service_config_nsa_tcm_flag_values,
1098 1.1 christos "none",
1099 1.10 christos EXTRACT_8BITS(obj_tptr+7))));
1100 1.6 christos
1101 1.1 christos break;
1102 1.6 christos
1103 1.1 christos case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY:
1104 1.10 christos if (obj_tlen != 4) {
1105 1.10 christos ND_PRINT((ndo, " (not correct for object)"));
1106 1.10 christos break;
1107 1.10 christos }
1108 1.6 christos
1109 1.6 christos ND_PRINT((ndo, "\n\t Diversity: Flags: %s",
1110 1.1 christos bittok2str(
1111 1.1 christos lmp_obj_service_config_nsa_network_diversity_flag_values,
1112 1.1 christos "none",
1113 1.10 christos EXTRACT_8BITS(obj_tptr+3))));
1114 1.1 christos break;
1115 1.1 christos
1116 1.1 christos default:
1117 1.1 christos hexdump = TRUE;
1118 1.9 spz }
1119 1.1 christos
1120 1.1 christos break;
1121 1.1 christos
1122 1.1 christos default:
1123 1.6 christos if (ndo->ndo_vflag <= 1)
1124 1.6 christos print_unknown_data(ndo,obj_tptr,"\n\t ",obj_tlen);
1125 1.1 christos break;
1126 1.1 christos }
1127 1.1 christos /* do we want to see an additionally hexdump ? */
1128 1.6 christos if (ndo->ndo_vflag > 1 || hexdump==TRUE)
1129 1.6 christos print_unknown_data(ndo,tptr+sizeof(struct lmp_object_header),"\n\t ",
1130 1.1 christos lmp_obj_len-sizeof(struct lmp_object_header));
1131 1.1 christos
1132 1.1 christos tptr+=lmp_obj_len;
1133 1.1 christos tlen-=lmp_obj_len;
1134 1.1 christos }
1135 1.1 christos return;
1136 1.1 christos trunc:
1137 1.6 christos ND_PRINT((ndo, "\n\t\t packet exceeded snapshot"));
1138 1.1 christos }
1139 1.6 christos /*
1140 1.6 christos * Local Variables:
1141 1.6 christos * c-style: whitesmith
1142 1.6 christos * c-basic-offset: 8
1143 1.6 christos * End:
1144 1.6 christos */
1145