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