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