]> The Tcpdump Group git mirrors - tcpdump/blob - print-eigrp.c
Clean up whitespaces/indentation
[tcpdump] / print-eigrp.c
1 /*
2 * Copyright (c) 1998-2004 Hannes Gredler <hannes@gredler.at>
3 * The TCPDUMP project
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code
7 * distributions retain the above copyright notice and this paragraph
8 * in its entirety, and (2) distributions including binary code include
9 * the above copyright notice and this paragraph in its entirety in
10 * the documentation or other materials provided with the distribution.
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
12 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
13 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 * FOR A PARTICULAR PURPOSE.
15 */
16
17 /* \summary: Enhanced Interior Gateway Routing Protocol (EIGRP) printer */
18
19 /*
20 * specification:
21 *
22 * http://www.rhyshaden.com/eigrp.htm
23 * RFC 7868
24 */
25
26 #ifdef HAVE_CONFIG_H
27 #include <config.h>
28 #endif
29
30 #include "netdissect-stdinc.h"
31
32 #include <string.h>
33
34 #include "netdissect.h"
35 #include "extract.h"
36 #include "addrtoname.h"
37
38
39 struct eigrp_common_header {
40 nd_uint8_t version;
41 nd_uint8_t opcode;
42 nd_uint16_t checksum;
43 nd_uint32_t flags;
44 nd_uint32_t seq;
45 nd_uint32_t ack;
46 nd_uint32_t asn;
47 };
48
49 #define EIGRP_VERSION 2
50
51 #define EIGRP_OPCODE_UPDATE 1
52 #define EIGRP_OPCODE_QUERY 3
53 #define EIGRP_OPCODE_REPLY 4
54 #define EIGRP_OPCODE_HELLO 5
55 #define EIGRP_OPCODE_IPXSAP 6
56 #define EIGRP_OPCODE_PROBE 7
57
58 static const struct tok eigrp_opcode_values[] = {
59 { EIGRP_OPCODE_UPDATE, "Update" },
60 { EIGRP_OPCODE_QUERY, "Query" },
61 { EIGRP_OPCODE_REPLY, "Reply" },
62 { EIGRP_OPCODE_HELLO, "Hello" },
63 { EIGRP_OPCODE_IPXSAP, "IPX SAP" },
64 { EIGRP_OPCODE_PROBE, "Probe" },
65 { 0, NULL}
66 };
67
68 static const struct tok eigrp_common_header_flag_values[] = {
69 { 0x01, "Init" },
70 { 0x02, "Conditionally Received" },
71 { 0, NULL}
72 };
73
74 struct eigrp_tlv_header {
75 nd_uint16_t type;
76 nd_uint16_t length;
77 };
78
79 #define EIGRP_TLV_GENERAL_PARM 0x0001
80 #define EIGRP_TLV_AUTH 0x0002
81 #define EIGRP_TLV_SEQ 0x0003
82 #define EIGRP_TLV_SW_VERSION 0x0004
83 #define EIGRP_TLV_MCAST_SEQ 0x0005
84 #define EIGRP_TLV_IP_INT 0x0102
85 #define EIGRP_TLV_IP_EXT 0x0103
86 #define EIGRP_TLV_AT_INT 0x0202
87 #define EIGRP_TLV_AT_EXT 0x0203
88 #define EIGRP_TLV_AT_CABLE_SETUP 0x0204
89 #define EIGRP_TLV_IPX_INT 0x0302
90 #define EIGRP_TLV_IPX_EXT 0x0303
91
92 static const struct tok eigrp_tlv_values[] = {
93 { EIGRP_TLV_GENERAL_PARM, "General Parameters"},
94 { EIGRP_TLV_AUTH, "Authentication"},
95 { EIGRP_TLV_SEQ, "Sequence"},
96 { EIGRP_TLV_SW_VERSION, "Software Version"},
97 { EIGRP_TLV_MCAST_SEQ, "Next Multicast Sequence"},
98 { EIGRP_TLV_IP_INT, "IP Internal routes"},
99 { EIGRP_TLV_IP_EXT, "IP External routes"},
100 { EIGRP_TLV_AT_INT, "AppleTalk Internal routes"},
101 { EIGRP_TLV_AT_EXT, "AppleTalk External routes"},
102 { EIGRP_TLV_AT_CABLE_SETUP, "AppleTalk Cable setup"},
103 { EIGRP_TLV_IPX_INT, "IPX Internal routes"},
104 { EIGRP_TLV_IPX_EXT, "IPX External routes"},
105 { 0, NULL}
106 };
107
108 struct eigrp_tlv_general_parm_t {
109 nd_uint8_t k1;
110 nd_uint8_t k2;
111 nd_uint8_t k3;
112 nd_uint8_t k4;
113 nd_uint8_t k5;
114 nd_uint8_t res;
115 nd_uint16_t holdtime;
116 };
117
118 struct eigrp_tlv_sw_version_t {
119 nd_uint8_t ios_major;
120 nd_uint8_t ios_minor;
121 nd_uint8_t eigrp_major;
122 nd_uint8_t eigrp_minor;
123 };
124
125 struct eigrp_tlv_ip_int_t {
126 nd_ipv4 nexthop;
127 nd_uint32_t delay;
128 nd_uint32_t bandwidth;
129 nd_uint24_t mtu;
130 nd_uint8_t hopcount;
131 nd_uint8_t reliability;
132 nd_uint8_t load;
133 nd_byte reserved[2];
134 nd_uint8_t plen;
135 nd_uint8_t destination; /* variable length [1-4] bytes encoding */
136 };
137
138 struct eigrp_tlv_ip_ext_t {
139 nd_ipv4 nexthop;
140 nd_ipv4 origin_router;
141 nd_uint32_t origin_as;
142 nd_uint32_t tag;
143 nd_uint32_t metric;
144 nd_byte reserved[2];
145 nd_uint8_t proto_id;
146 nd_uint8_t flags;
147 nd_uint32_t delay;
148 nd_uint32_t bandwidth;
149 nd_uint24_t mtu;
150 nd_uint8_t hopcount;
151 nd_uint8_t reliability;
152 nd_uint8_t load;
153 nd_byte reserved2[2];
154 nd_uint8_t plen;
155 nd_uint8_t destination; /* variable length [1-4] bytes encoding */
156 };
157
158 struct eigrp_tlv_at_cable_setup_t {
159 nd_uint16_t cable_start;
160 nd_uint16_t cable_end;
161 nd_uint32_t router_id;
162 };
163
164 struct eigrp_tlv_at_int_t {
165 nd_byte nexthop[4];
166 nd_uint32_t delay;
167 nd_uint32_t bandwidth;
168 nd_uint24_t mtu;
169 nd_uint8_t hopcount;
170 nd_uint8_t reliability;
171 nd_uint8_t load;
172 nd_byte reserved[2];
173 nd_uint16_t cable_start;
174 nd_uint16_t cable_end;
175 };
176
177 struct eigrp_tlv_at_ext_t {
178 nd_byte nexthop[4];
179 nd_uint32_t origin_router;
180 nd_uint32_t origin_as;
181 nd_uint32_t tag;
182 nd_uint8_t proto_id;
183 nd_uint8_t flags;
184 nd_uint16_t metric;
185 nd_uint32_t delay;
186 nd_uint32_t bandwidth;
187 nd_uint24_t mtu;
188 nd_uint8_t hopcount;
189 nd_uint8_t reliability;
190 nd_uint8_t load;
191 nd_byte reserved2[2];
192 nd_uint16_t cable_start;
193 nd_uint16_t cable_end;
194 };
195
196 static const struct tok eigrp_ext_proto_id_values[] = {
197 { 0x01, "IGRP" },
198 { 0x02, "EIGRP" },
199 { 0x03, "Static" },
200 { 0x04, "RIP" },
201 { 0x05, "Hello" },
202 { 0x06, "OSPF" },
203 { 0x07, "IS-IS" },
204 { 0x08, "EGP" },
205 { 0x09, "BGP" },
206 { 0x0a, "IDRP" },
207 { 0x0b, "Connected" },
208 { 0, NULL}
209 };
210
211 void
212 eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len)
213 {
214 const struct eigrp_common_header *eigrp_com_header;
215 const struct eigrp_tlv_header *eigrp_tlv_header;
216 const u_char *tptr,*tlv_tptr;
217 u_int tlen,eigrp_tlv_len,eigrp_tlv_type,tlv_tlen, byte_length, bit_length;
218 uint8_t prefix[4];
219
220 union {
221 const struct eigrp_tlv_general_parm_t *eigrp_tlv_general_parm;
222 const struct eigrp_tlv_sw_version_t *eigrp_tlv_sw_version;
223 const struct eigrp_tlv_ip_int_t *eigrp_tlv_ip_int;
224 const struct eigrp_tlv_ip_ext_t *eigrp_tlv_ip_ext;
225 const struct eigrp_tlv_at_cable_setup_t *eigrp_tlv_at_cable_setup;
226 const struct eigrp_tlv_at_int_t *eigrp_tlv_at_int;
227 const struct eigrp_tlv_at_ext_t *eigrp_tlv_at_ext;
228 } tlv_ptr;
229
230 ndo->ndo_protocol = "eigrp";
231 tptr=pptr;
232 eigrp_com_header = (const struct eigrp_common_header *)pptr;
233 ND_TCHECK_SIZE(eigrp_com_header);
234
235 /*
236 * Sanity checking of the header.
237 */
238 if (EXTRACT_U_1(eigrp_com_header->version) != EIGRP_VERSION) {
239 ND_PRINT("EIGRP version %u packet not supported",EXTRACT_U_1(eigrp_com_header->version));
240 return;
241 }
242
243 /* in non-verbose mode just lets print the basic Message Type*/
244 if (ndo->ndo_vflag < 1) {
245 ND_PRINT("EIGRP %s, length: %u",
246 tok2str(eigrp_opcode_values, "unknown (%u)",EXTRACT_U_1(eigrp_com_header->opcode)),
247 len);
248 return;
249 }
250
251 /* ok they seem to want to know everything - lets fully decode it */
252
253 if (len < sizeof(struct eigrp_common_header)) {
254 ND_PRINT("EIGRP %s, length: %u (too short, < %u)",
255 tok2str(eigrp_opcode_values, "unknown (%u)",EXTRACT_U_1(eigrp_com_header->opcode)),
256 len, (u_int) sizeof(struct eigrp_common_header));
257 return;
258 }
259 tlen=len-sizeof(struct eigrp_common_header);
260
261 /* FIXME print other header info */
262 ND_PRINT("\n\tEIGRP v%u, opcode: %s (%u), chksum: 0x%04x, Flags: [%s]\n\tseq: 0x%08x, ack: 0x%08x, AS: %u, length: %u",
263 EXTRACT_U_1(eigrp_com_header->version),
264 tok2str(eigrp_opcode_values, "unknown, type: %u",EXTRACT_U_1(eigrp_com_header->opcode)),
265 EXTRACT_U_1(eigrp_com_header->opcode),
266 EXTRACT_BE_U_2(eigrp_com_header->checksum),
267 tok2str(eigrp_common_header_flag_values,
268 "none",
269 EXTRACT_BE_U_4(eigrp_com_header->flags)),
270 EXTRACT_BE_U_4(eigrp_com_header->seq),
271 EXTRACT_BE_U_4(eigrp_com_header->ack),
272 EXTRACT_BE_U_4(eigrp_com_header->asn),
273 tlen);
274
275 tptr+=sizeof(struct eigrp_common_header);
276
277 while(tlen>0) {
278 /* did we capture enough for fully decoding the object header ? */
279 ND_TCHECK_LEN(tptr, sizeof(struct eigrp_tlv_header));
280
281 eigrp_tlv_header = (const struct eigrp_tlv_header *)tptr;
282 eigrp_tlv_len=EXTRACT_BE_U_2(eigrp_tlv_header->length);
283 eigrp_tlv_type=EXTRACT_BE_U_2(eigrp_tlv_header->type);
284
285
286 if (eigrp_tlv_len < sizeof(struct eigrp_tlv_header) ||
287 eigrp_tlv_len > tlen) {
288 print_unknown_data(ndo,tptr+sizeof(struct eigrp_tlv_header),"\n\t ",tlen);
289 return;
290 }
291
292 ND_PRINT("\n\t %s TLV (0x%04x), length: %u",
293 tok2str(eigrp_tlv_values,
294 "Unknown",
295 eigrp_tlv_type),
296 eigrp_tlv_type,
297 eigrp_tlv_len);
298
299 if (eigrp_tlv_len < sizeof(struct eigrp_tlv_header)) {
300 ND_PRINT(" (too short, < %u)",
301 (u_int) sizeof(struct eigrp_tlv_header));
302 break;
303 }
304 tlv_tptr=tptr+sizeof(struct eigrp_tlv_header);
305 tlv_tlen=eigrp_tlv_len-sizeof(struct eigrp_tlv_header);
306
307 /* did we capture enough for fully decoding the object ? */
308 ND_TCHECK_LEN(tptr, eigrp_tlv_len);
309
310 switch(eigrp_tlv_type) {
311
312 case EIGRP_TLV_GENERAL_PARM:
313 tlv_ptr.eigrp_tlv_general_parm = (const struct eigrp_tlv_general_parm_t *)tlv_tptr;
314 if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_general_parm)) {
315 ND_PRINT(" (too short, < %u)",
316 (u_int) (sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_general_parm)));
317 break;
318 }
319
320 ND_PRINT("\n\t holdtime: %us, k1 %u, k2 %u, k3 %u, k4 %u, k5 %u",
321 EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_general_parm->holdtime),
322 EXTRACT_U_1(tlv_ptr.eigrp_tlv_general_parm->k1),
323 EXTRACT_U_1(tlv_ptr.eigrp_tlv_general_parm->k2),
324 EXTRACT_U_1(tlv_ptr.eigrp_tlv_general_parm->k3),
325 EXTRACT_U_1(tlv_ptr.eigrp_tlv_general_parm->k4),
326 EXTRACT_U_1(tlv_ptr.eigrp_tlv_general_parm->k5));
327 break;
328
329 case EIGRP_TLV_SW_VERSION:
330 tlv_ptr.eigrp_tlv_sw_version = (const struct eigrp_tlv_sw_version_t *)tlv_tptr;
331 if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_sw_version)) {
332 ND_PRINT(" (too short, < %u)",
333 (u_int) (sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_sw_version)));
334 break;
335 }
336
337 ND_PRINT("\n\t IOS version: %u.%u, EIGRP version %u.%u",
338 EXTRACT_U_1(tlv_ptr.eigrp_tlv_sw_version->ios_major),
339 EXTRACT_U_1(tlv_ptr.eigrp_tlv_sw_version->ios_minor),
340 EXTRACT_U_1(tlv_ptr.eigrp_tlv_sw_version->eigrp_major),
341 EXTRACT_U_1(tlv_ptr.eigrp_tlv_sw_version->eigrp_minor));
342 break;
343
344 case EIGRP_TLV_IP_INT:
345 tlv_ptr.eigrp_tlv_ip_int = (const struct eigrp_tlv_ip_int_t *)tlv_tptr;
346 if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_ip_int)) {
347 ND_PRINT(" (too short, < %u)",
348 (u_int) (sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_ip_int)));
349 break;
350 }
351
352 bit_length = EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_int->plen);
353 if (bit_length > 32) {
354 ND_PRINT("\n\t illegal prefix length %u",bit_length);
355 break;
356 }
357 byte_length = (bit_length + 7) / 8; /* variable length encoding */
358 memset(prefix, 0, 4);
359 memcpy(prefix, tlv_ptr.eigrp_tlv_ip_int->destination, byte_length);
360
361 ND_PRINT("\n\t IPv4 prefix: %15s/%u, nexthop: ",
362 ipaddr_string(ndo, prefix),
363 bit_length);
364 if (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0)
365 ND_PRINT("self");
366 else
367 ND_PRINT("%s",
368 ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_int->nexthop));
369
370 ND_PRINT("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
371 (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_int->delay)/100),
372 EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_int->bandwidth),
373 EXTRACT_BE_U_3(tlv_ptr.eigrp_tlv_ip_int->mtu),
374 EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_int->hopcount),
375 EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_int->reliability),
376 EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_int->load));
377 break;
378
379 case EIGRP_TLV_IP_EXT:
380 tlv_ptr.eigrp_tlv_ip_ext = (const struct eigrp_tlv_ip_ext_t *)tlv_tptr;
381 if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_ip_ext)) {
382 ND_PRINT(" (too short, < %u)",
383 (u_int) (sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_ip_ext)));
384 break;
385 }
386
387 bit_length = EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_ext->plen);
388 if (bit_length > 32) {
389 ND_PRINT("\n\t illegal prefix length %u",bit_length);
390 break;
391 }
392 byte_length = (bit_length + 7) / 8; /* variable length encoding */
393 memset(prefix, 0, 4);
394 memcpy(prefix, tlv_ptr.eigrp_tlv_ip_ext->destination, byte_length);
395
396 ND_PRINT("\n\t IPv4 prefix: %15s/%u, nexthop: ",
397 ipaddr_string(ndo, prefix),
398 bit_length);
399 if (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0)
400 ND_PRINT("self");
401 else
402 ND_PRINT("%s",
403 ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_ext->nexthop));
404
405 ND_PRINT("\n\t origin-router %s, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u",
406 ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_ext->origin_router),
407 EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->origin_as),
408 tok2str(eigrp_ext_proto_id_values,"unknown",EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_ext->proto_id)),
409 EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_ext->flags),
410 EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->tag),
411 EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->metric));
412
413 ND_PRINT("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
414 (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->delay)/100),
415 EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->bandwidth),
416 EXTRACT_BE_U_3(tlv_ptr.eigrp_tlv_ip_ext->mtu),
417 EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_ext->hopcount),
418 EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_ext->reliability),
419 EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_ext->load));
420 break;
421
422 case EIGRP_TLV_AT_CABLE_SETUP:
423 tlv_ptr.eigrp_tlv_at_cable_setup = (const struct eigrp_tlv_at_cable_setup_t *)tlv_tptr;
424 if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_at_cable_setup)) {
425 ND_PRINT(" (too short, < %u)",
426 (u_int) (sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_at_cable_setup)));
427 break;
428 }
429
430 ND_PRINT("\n\t Cable-range: %u-%u, Router-ID %u",
431 EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_at_cable_setup->cable_start),
432 EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_at_cable_setup->cable_end),
433 EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_cable_setup->router_id));
434 break;
435
436 case EIGRP_TLV_AT_INT:
437 tlv_ptr.eigrp_tlv_at_int = (const struct eigrp_tlv_at_int_t *)tlv_tptr;
438 if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_at_int)) {
439 ND_PRINT(" (too short, < %u)",
440 (u_int) (sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_at_int)));
441 break;
442 }
443
444 ND_PRINT("\n\t Cable-Range: %u-%u, nexthop: ",
445 EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_at_int->cable_start),
446 EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_at_int->cable_end));
447
448 if (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_int->nexthop) == 0)
449 ND_PRINT("self");
450 else
451 ND_PRINT("%u.%u",
452 EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_int->nexthop[0]),
453 EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_int->nexthop[2]));
454
455 ND_PRINT("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
456 (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_int->delay)/100),
457 EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_int->bandwidth),
458 EXTRACT_BE_U_3(tlv_ptr.eigrp_tlv_at_int->mtu),
459 EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_int->hopcount),
460 EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_int->reliability),
461 EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_int->load));
462 break;
463
464 case EIGRP_TLV_AT_EXT:
465 tlv_ptr.eigrp_tlv_at_ext = (const struct eigrp_tlv_at_ext_t *)tlv_tptr;
466 if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_at_ext)) {
467 ND_PRINT(" (too short, < %u)",
468 (u_int) (sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_at_ext)));
469 break;
470 }
471
472 ND_PRINT("\n\t Cable-Range: %u-%u, nexthop: ",
473 EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_at_ext->cable_start),
474 EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_at_ext->cable_end));
475
476 if (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->nexthop) == 0)
477 ND_PRINT("self");
478 else
479 ND_PRINT("%u.%u",
480 EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_ext->nexthop[0]),
481 EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_ext->nexthop[2]));
482
483 ND_PRINT("\n\t origin-router %u, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u",
484 EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->origin_router),
485 EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->origin_as),
486 tok2str(eigrp_ext_proto_id_values,"unknown",EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_ext->proto_id)),
487 EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_ext->flags),
488 EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->tag),
489 EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_at_ext->metric));
490
491 ND_PRINT("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
492 (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->delay)/100),
493 EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->bandwidth),
494 EXTRACT_BE_U_3(tlv_ptr.eigrp_tlv_at_ext->mtu),
495 EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_ext->hopcount),
496 EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_ext->reliability),
497 EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_ext->load));
498 break;
499
500 /*
501 * FIXME those are the defined TLVs that lack a decoder
502 * you are welcome to contribute code ;-)
503 */
504
505 case EIGRP_TLV_AUTH:
506 case EIGRP_TLV_SEQ:
507 case EIGRP_TLV_MCAST_SEQ:
508 case EIGRP_TLV_IPX_INT:
509 case EIGRP_TLV_IPX_EXT:
510
511 default:
512 if (ndo->ndo_vflag <= 1)
513 print_unknown_data(ndo,tlv_tptr,"\n\t ",tlv_tlen);
514 break;
515 }
516 /* do we want to see an additionally hexdump ? */
517 if (ndo->ndo_vflag > 1)
518 print_unknown_data(ndo,tptr+sizeof(struct eigrp_tlv_header),"\n\t ",
519 eigrp_tlv_len-sizeof(struct eigrp_tlv_header));
520
521 tptr+=eigrp_tlv_len;
522 tlen-=eigrp_tlv_len;
523 }
524 return;
525 trunc:
526 nd_print_trunc(ndo);
527 }