epan/dissectors/pidl/samr/samr.cnf cnf_dissect_lsa_BinaryString => lsarpc_dissect_str...
[wireshark-sm.git] / epan / dissectors / packet-eigrp.c
blobc097fd1931c2f32a6ee0fd5f2fcbfadaf0efe1a3
1 /* packet-eigrp.c
2 * Routines for EIGRP dissection
3 * Copyright 2011, Donnie V Savage <dsavage@cisco.com>
5 * Complete re-write and replaces previous file of same name authored by:
6 * Copyright 2009, Jochen Bartl <jochen.bartl@gmail.co
7 * Copyright 2000, Paul Ionescu <paul@acorp.ro>
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
13 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include "config.h"
17 #include <epan/packet.h>
18 #include <epan/addr_resolv.h>
19 #include <epan/ipproto.h>
20 #include <epan/expert.h>
21 #include <epan/tfs.h>
23 #include "packet-eigrp.h"
24 #include "packet-ipx.h"
25 #include "packet-atalk.h"
28 * Originally Cisco proprietary; now the subject of RFC 7868.
31 /**
32 * EIGRP Header size in bytes
34 #define EIGRP_HEADER_LENGTH 20
36 /**
37 * EIGRP Packet Opcodes
39 #define EIGRP_OPC_UPDATE 1 /*!< packet containing routing information */
40 #define EIGRP_OPC_REQUEST 2 /*!< sent to request one or more routes */
41 #define EIGRP_OPC_QUERY 3 /*!< sent when a routing is in active start */
42 #define EIGRP_OPC_REPLY 4 /*!< sent in response to a query */
43 #define EIGRP_OPC_HELLO 5 /*!< sent to maintain a peering session */
44 #define EIGRP_OPC_IPXSAP 6 /*!< IPX SAP information */
45 #define EIGRP_OPC_PROBE 7 /*!< for test purposes */
46 #define EIGRP_OPC_ACK 8 /*!< acknowledge */
47 #define EIGRP_OPC_STUB 9 /*!< peering operating in restricted mode */
48 #define EIGRP_OPC_SIAQUERY 10 /*!< QUERY - with relaxed restrictions */
49 #define EIGRP_OPC_SIAREPLY 11 /*!< REPLY - may contain old routing information */
51 /**
52 * EIGRP TLV Range definitions
53 * PDM TLV Range
54 * General 0x0000
55 * IPv4 0x0100 ** TLVs for one and all
56 * ATALK 0x0200 ** legacy
57 * IPX 0x0300 ** discontinued
58 * IPv6 0x0400 ** legacy
59 * Multiprotocol 0x0600 ** wide metrics
60 * MultiTopology 0x00f0 ** deprecated
62 #define EIGRP_TLV_RANGEMASK 0xfff0 /*!< should be 0xff00 - opps */
63 #define EIGRP_TLV_GENERAL 0x0000
65 /**
66 * 1.2 TLV Definitions ** legacy
67 * These have been deprecated and should not be used for future packets
69 #define EIGRP_TLV_IPv4 0x0100 /*!< Classic IPv4 TLV encoding */
70 #define EIGRP_TLV_ATALK 0x0200 /*!< Classic Appletalk TLV encoding*/
71 #define EIGRP_TLV_IPX 0x0300 /*!< Classic IPX TLV encoding */
72 #define EIGRP_TLV_IPv6 0x0400 /*!< Classic IPv6 TLV encoding */
74 /**
75 * 2.0 Multi-Protocol TLV Definitions
76 * These have been deprecated and should not be used for future packets
78 #define EIGRP_TLV_MP 0x0600 /*!< Non-PDM specific encoding */
80 /**
81 * 3.0 TLV Definitions ** deprecated
82 * These have been deprecated and should not be used for future packets
84 #define EIGRP_TLV_MTR 0x00f0 /*!< MTR TLV encoding */
86 /**
87 * TLV type definitions. Generic (protocol-independent) TLV types are
88 * defined here. Protocol-specific ones are defined elsewhere.
90 #define EIGRP_TLV_PARAMETER (EIGRP_TLV_GENERAL | 0x0001) /*!< eigrp parameters */
91 #define EIGRP_TLV_AUTH (EIGRP_TLV_GENERAL | 0x0002) /*!< authentication */
92 #define EIGRP_TLV_SEQ (EIGRP_TLV_GENERAL | 0x0003) /*!< sequenced packet */
93 #define EIGRP_TLV_SW_VERSION (EIGRP_TLV_GENERAL | 0x0004) /*!< software version */
94 #define EIGRP_TLV_NEXT_MCAST_SEQ (EIGRP_TLV_GENERAL | 0x0005) /*!< */
95 #define EIGRP_TLV_PEER_STUBINFO (EIGRP_TLV_GENERAL | 0x0006) /*!< stub information */
96 #define EIGRP_TLV_PEER_TERMINATION (EIGRP_TLV_GENERAL | 0x0007) /*!< peer termination */
97 #define EIGRP_TLV_PEER_TIDLIST (EIGRP_TLV_GENERAL | 0x0008) /*!< peer sub-topology list */
99 /**
100 * Route Based TLVs
102 #define EIGRP_TLV_TYPEMASK 0x000f
103 #define EIGRP_TLV_REQUEST 0x0001
104 #define EIGRP_TLV_INTERNAL 0x0002
105 #define EIGRP_TLV_EXTERNAL 0x0003
106 #define EIGRP_TLV_COMMUNITY 0x0004
108 /* Legacy TLV formats */
109 #define EIGRP_TLV_IPv4_REQ (EIGRP_TLV_IPv4 | EIGRP_TLV_REQUEST)
110 #define EIGRP_TLV_IPv4_INT (EIGRP_TLV_IPv4 | EIGRP_TLV_INTERNAL)
111 #define EIGRP_TLV_IPv4_EXT (EIGRP_TLV_IPv4 | EIGRP_TLV_EXTERNAL)
112 #define EIGRP_TLV_IPv4_COM (EIGRP_TLV_IPv4 | EIGRP_TLV_COMMUNITY)
113 #define EIGRP_TLV_IPX_INT (EIGRP_TLV_IPX | EIGRP_TLV_INTERNAL)
114 #define EIGRP_TLV_IPX_EXT (EIGRP_TLV_IPX | EIGRP_TLV_EXTERNAL)
115 #define EIGRP_TLV_IPX_COM (EIGRP_TLV_IPX | EIGRP_TLV_COMMUNITY)
116 #define EIGRP_TLV_IPv6_INT (EIGRP_TLV_IPv6 | EIGRP_TLV_INTERNAL)
117 #define EIGRP_TLV_IPv6_EXT (EIGRP_TLV_IPv6 | EIGRP_TLV_EXTERNAL)
118 #define EIGRP_TLV_IPv6_COM (EIGRP_TLV_IPv6 | EIGRP_TLV_COMMUNITY)
120 /* Deprecated TLV formats */
121 #define EIGRP_TLV_AT_INT (EIGRP_TLV_ATALK | EIGRP_TLV_INTERNAL)
122 #define EIGRP_TLV_AT_EXT (EIGRP_TLV_ATALK | EIGRP_TLV_EXTERNAL)
123 #define EIGRP_TLV_AT_CBL (EIGRP_TLV_ATALK | 0x04)
124 #define EIGRP_TLV_MTR_REQ (EIGRP_TLV_MTR | EIGRP_TLV_REQUEST)
125 #define EIGRP_TLV_MTR_INT (EIGRP_TLV_MTR | EIGRP_TLV_INTERNAL)
126 #define EIGRP_TLV_MTR_EXT (EIGRP_TLV_MTR | EIGRP_TLV_EXTERNAL)
127 #define EIGRP_TLV_MTR_COM (EIGRP_TLV_MTR | EIGRP_TLV_COMMUNITY)
128 #define EIGRP_TLV_MTR_TIDLIST (EIGRP_TLV_MTR | 0x0005)
130 /* Current "Wide Metric" TLV formats */
131 #define EIGRP_TLV_MP_REQ (EIGRP_TLV_MP | EIGRP_TLV_REQUEST)
132 #define EIGRP_TLV_MP_INT (EIGRP_TLV_MP | EIGRP_TLV_INTERNAL)
133 #define EIGRP_TLV_MP_EXT (EIGRP_TLV_MP | EIGRP_TLV_EXTERNAL)
134 #define EIGRP_TLV_MP_COM (EIGRP_TLV_MP | EIGRP_TLV_COMMUNITY)
137 * External routes originate from some other protocol - these are them
139 #define NULL_PROTID 0 /*!< unknown protocol */
140 #define IGRP1_PROTID 1 /*!< IGRP.. who's your daddy! */
141 #define IGRP2_PROTID 2 /*!< EIGRP - Just flat out the best */
142 #define STATIC_PROTID 3 /*!< Statically configured source */
143 #define RIP_PROTID 4 /*!< Routing Information Protocol */
144 #define HELLO_PROTID 5 /*!< Hello? RFC-891 you there? */
145 #define OSPF_PROTID 6 /*!< OSPF - Open Shortest Path First */
146 #define ISIS_PROTID 7 /*!< Intermediate System To Intermediate System */
147 #define EGP_PROTID 8 /*!< Exterior Gateway Protocol */
148 #define BGP_PROTID 9 /*!< Border Gateway Protocol */
149 #define IDRP_PROTID 10 /*!< InterDomain Routing Protocol */
150 #define CONN_PROTID 11 /*!< Connected source */
154 * extdata flag field definitions
156 #define EIGRP_OPAQUE_EXT 0x01 /*!< Route is external */
157 #define EIGRP_OPAQUE_CD 0x02 /*!< Candidate default route */
160 * Address-Family types are taken from:
161 * http://www.iana.org/assignments/address-family-numbers
162 * to provide a standards based exchange of AFI information between
163 * EIGRP routers.
165 #define EIGRP_AF_IPv4 1 /*!< IPv4 (IP version 4) */
166 #define EIGRP_AF_IPv6 2 /*!< IPv6 (IP version 6) */
167 #define EIGRP_AF_IPX 11 /*!< IPX */
168 #define EIGRP_AF_ATALK 12 /*!< Appletalk */
169 #define EIGRP_SF_COMMON 16384 /*!< Cisco Service Family */
170 #define EIGRP_SF_IPv4 16385 /*!< Cisco IPv4 Service Family */
171 #define EIGRP_SF_IPv6 16386 /*!< Cisco IPv6 Service Family */
174 * Authentication types supported by EIGRP
176 #define EIGRP_AUTH_TYPE_NONE 0
177 #define EIGRP_AUTH_TYPE_TEXT 1
178 #define EIGRP_AUTH_TYPE_MD5 2
179 #define EIGRP_AUTH_TYPE_MD5_LEN 16
180 #define EIGRP_AUTH_TYPE_SHA256 3
181 #define EIGRP_AUTH_TYPE_SHA256_LEN 32
184 * opaque flag field definitions
186 #define EIGRP_OPAQUE_SRCWD 0x01 /*!< Route Source Withdraw */
187 #define EIGRP_OPAQUE_CD 0x02 /*!< Candidate Default */
188 #define EIGRP_OPAQUE_ACTIVE 0x04 /*!< Route is currently in active state */
189 #define EIGRP_OPAQUE_REPL 0x08 /*!< Route is replicated from different tableid */
192 * pak flag bit field definitions - 0 (none)-7 source priority
194 #define EIGRP_PRIV_DEFAULT 0x00 /* 0 (none)-7 source priority */
195 #define EIGRP_PRIV_LOW 0x01
196 #define EIGRP_PRIV_MEDIUM 0x04
197 #define EIGRP_PRIV_HIGH 0x07
200 * stub bit definitions
202 #define EIGRP_PEER_ALLOWS_CONNECTED 0x0001
203 #define EIGRP_PEER_ALLOWS_STATIC 0x0002
204 #define EIGRP_PEER_ALLOWS_SUMMARY 0x0004
205 #define EIGRP_PEER_ALLOWS_REDIST 0x0008
206 #define EIGRP_PEER_ALLOWS_LEAKING 0x0010
207 #define EIGRP_PEER_ALLOWS_RCVONLY 0x0020
210 * Init bit definition. First unicast transmitted Update has this
211 * bit set in the flags field of the fixed header. It tells the neighbor
212 * to down-load his topology table.
214 #define EIGRP_INIT_FLAG 0x00000001
217 * CR bit (Conditionally Received) definition in flags field on header. Any
218 * packets with the CR-bit set can be accepted by an EIGRP speaker if and
219 * only if a previous Hello was received with the SEQUENCE_TYPE TLV present.
221 * This allows multicasts to be transmitted in order and reliably at the
222 * same time as unicasts are transmitted.
224 #define EIGRP_CR_FLAG 0x00000002
227 * RS bit. The Restart flag is set in the hello and the init
228 * update packets during the nsf signaling period. A nsf-aware
229 * router looks at the RS flag to detect if a peer is restarting
230 * and maintain the adjacency. A restarting router looks at
231 * this flag to determine if the peer is helping out with the restart.
233 #define EIGRP_RS_FLAG 0x00000004
236 * EOT bit. The End-of-Table flag marks the end of the start-up updates
237 * sent to a new peer. A nsf restarting router looks at this flag to
238 * determine if it has finished receiving the start-up updates from all
239 * peers. A nsf-aware router waits for this flag before cleaning up
240 * the stale routes from the restarting peer.
242 #define EIGRP_EOT_FLAG 0x00000008
245 * EIGRP Virtual Router ID
247 * Define values to deal with EIGRP virtual router ids. Virtual
248 * router IDs are stored in the upper short of the EIGRP fixed packet
249 * header. The lower short of the packet header continues to be used
250 * as asystem number.
252 * Virtual Router IDs are PDM-independent. All PDMs will use
253 * VRID_BASE to indicate the 'base' or 'legacy' EIGRP instance.
254 * All PDMs need to initialize their vrid to VRID_BASE for compatibility
255 * with legacy routers.
256 * Once IPv6 supports 'MTR Multicast', it will use the same VRID as
257 * IPv4. No current plans to support VRIDs on IPX. :)
258 * Initial usage of VRID is to signal usage of Multicast topology for
259 * MTR.
261 * VRID_MCAST is a well known constant, other VRIDs will be determined
262 * programmatic...
264 * With the addition of SAF the VRID space has been divided into two
265 * segments 0x0000-0x7fff is for EIGRP and vNets, 0x8000-0xffff is
266 * for saf and its associated vNets.
268 #define EIGRP_VRID_MASK 0x8001
269 #define EIGRP_VRID_AF_BASE 0x0000
270 #define EIGRP_VRID_MCAST_BASE 0x0001
271 #define EIGRP_VRID_SF_BASE 0x8000
273 /* Extended Attributes for a destination */
274 #define EIGRP_ATTR_HDRLEN (2)
275 #define EIGRP_ATTR_MAXDATA (512)
277 #define EIGRP_ATTR_NOOP 0 /*!< No-Op used as offset padding */
278 #define EIGRP_ATTR_SCALED 1 /*!< Scaled metric values */
279 #define EIGRP_ATTR_TAG 2 /*!< Tag assigned by Admin for dest */
280 #define EIGRP_ATTR_COMM 3 /*!< Community attribute for dest */
281 #define EIGRP_ATTR_JITTER 4 /*!< Variation in path delay */
282 #define EIGRP_ATTR_QENERGY 5 /*!< Non-Active energy usage along path */
283 #define EIGRP_ATTR_ENERGY 6 /*!< Active energy usage along path */
286 * Begin EIGRP-BGP interoperability communities
288 #define EIGRP_EXTCOMM_SOO_ASFMT 0x0003 /* Site-of-Origin, BGP AS format */
289 #define EIGRP_EXTCOMM_SOO_ADRFMT 0x0103 /* Site-of-Origin, BGP/EIGRP addr format */
292 * EIGRP Specific communities
294 #define EIGRP_EXTCOMM_EIGRP 0x8800 /* EIGRP route information appended*/
295 #define EIGRP_EXTCOMM_DAD 0x8801 /* EIGRP AS + Delay */
296 #define EIGRP_EXTCOMM_VRHB 0x8802 /* EIGRP Vector: Reliability + Hop + BW */
297 #define EIGRP_EXTCOMM_SRLM 0x8803 /* EIGRP System: Reserve +Load + MTU */
298 #define EIGRP_EXTCOMM_SAR 0x8804 /* EIGRP System: Remote AS + Remote ID */
299 #define EIGRP_EXTCOMM_RPM 0x8805 /* EIGRP Remote: Protocol + Metric */
300 #define EIGRP_EXTCOMM_VRR 0x8806 /* EIGRP Vecmet: Rsvd + (internal) Routerid */
302 /* SAF types */
303 #define EIGRP_SVCDATA_COMPLETE 0x01 /*!< Data is attached */
304 #define EIGRP_SVCDATA_TRIMMED 0x02 /*!< Data was trimmed from service */
306 /* SAF Defined Numbers */
307 #define SAF_SERVICE_ID_CAPMAN 100 /*!< Capabilities Manager */
308 #define SAF_SERVICE_ID_UC 101 /*!< Unified Communications */
309 #define SAF_SERVICE_ID_PFR 102 /*!< Performance Routing */
311 /* Forward declaration we need below (if using proto_reg_handoff...
312 as a prefs callback) */
313 void proto_reg_handoff_eigrp(void);
314 void proto_register_eigrp(void);
316 /* Initialize the protocol and registered fields */
317 static int proto_eigrp;
319 /* header */
320 static int hf_eigrp_version;
321 static int hf_eigrp_opcode;
322 static int hf_eigrp_flags;
323 static int hf_eigrp_sequence;
324 static int hf_eigrp_acknowledge;
325 static int hf_eigrp_vrid;
326 static int hf_eigrp_as;
327 static int ett_eigrp;
329 /* packet header flags */
330 static int hf_eigrp_flags_init;
331 static int hf_eigrp_flags_restart;
332 static int hf_eigrp_flags_eot;
333 static int hf_eigrp_flags_condrecv;
335 static int ett_eigrp_flags;
336 static int * const eigrp_flag_fields[] = {
337 &hf_eigrp_flags_init,
338 &hf_eigrp_flags_condrecv,
339 &hf_eigrp_flags_restart,
340 &hf_eigrp_flags_eot,
341 NULL
344 /* tlv */
345 static int hf_eigrp_tlv_type;
346 static int hf_eigrp_tlv_len;
347 static int hf_eigrp_tid;
348 static int hf_eigrp_afi;
349 static int hf_eigrp_nullpad;
351 static int ett_eigrp_tlv;
352 static int ett_eigrp_tlv_metric;
353 static int ett_eigrp_tlv_attr;
354 static int ett_eigrp_tlv_extdata;
356 /* param */
357 static int hf_eigrp_par_k1;
358 static int hf_eigrp_par_k2;
359 static int hf_eigrp_par_k3;
360 static int hf_eigrp_par_k4;
361 static int hf_eigrp_par_k5;
362 static int hf_eigrp_par_k6;
363 static int hf_eigrp_par_holdtime;
365 /* auth */
366 static int hf_eigrp_auth_type;
367 static int hf_eigrp_auth_len;
368 static int hf_eigrp_auth_keyid;
369 static int hf_eigrp_auth_keyseq;
370 static int hf_eigrp_auth_digest;
372 /* seq */
373 static int hf_eigrp_seq_addrlen;
374 static int hf_eigrp_seq_ipv4addr;
375 static int hf_eigrp_seq_ipv6addr;
377 /* multicast seq */
378 static int hf_eigrp_next_mcast_seq;
380 /* stub flags */
381 static int hf_eigrp_stub_flags;
382 static int hf_eigrp_stub_flags_connected;
383 static int hf_eigrp_stub_flags_static;
384 static int hf_eigrp_stub_flags_summary;
385 static int hf_eigrp_stub_flags_recvonly;
386 static int hf_eigrp_stub_flags_redist;
387 static int hf_eigrp_stub_flags_leakmap;
389 static int ett_eigrp_stub_flags;
390 static int * const eigrp_stub_flag_fields[] = {
391 &hf_eigrp_stub_flags_connected,
392 &hf_eigrp_stub_flags_static,
393 &hf_eigrp_stub_flags_summary,
394 &hf_eigrp_stub_flags_redist,
395 &hf_eigrp_stub_flags_leakmap,
396 &hf_eigrp_stub_flags_recvonly,
397 NULL
400 /* tid */
401 static int hf_eigrp_tidlist_tid;
402 static int hf_eigrp_tidlist_flags;
403 static int hf_eigrp_tidlist_len;
404 static int ett_eigrp_tidlist;
406 /* 1.2 and 3.0 metric */
407 static int hf_eigrp_legacy_metric_delay;
408 static int hf_eigrp_legacy_metric_bw;
409 static int hf_eigrp_legacy_metric_mtu;
410 static int hf_eigrp_legacy_metric_hopcount;
411 static int hf_eigrp_legacy_metric_rel;
412 static int hf_eigrp_legacy_metric_load;
413 static int hf_eigrp_legacy_metric_intag;
415 /* 3.0 metric */
416 static int hf_eigrp_legacy_metric_tag;
418 /* 2.0 metric */
419 static int hf_eigrp_metric_offset;
420 static int hf_eigrp_metric_priority;
421 static int hf_eigrp_metric_rel;
422 static int hf_eigrp_metric_load;
423 static int hf_eigrp_metric_mtu;
424 static int hf_eigrp_metric_hopcount;
425 static int hf_eigrp_metric_reserved;
427 /* router id*/
428 static int hf_eigrp_routerid;
430 /* protocol dependent module route flags */
431 static int hf_eigrp_metric_flags_srcwd;
432 static int hf_eigrp_metric_flags_cd;
433 static int hf_eigrp_metric_flags_active;
434 static int hf_eigrp_metric_flags_repl;
435 static int ett_eigrp_metric_flags;
437 /* extended metrics */
438 static int hf_eigrp_attr_opcode;
439 static int hf_eigrp_attr_offset;
440 static int hf_eigrp_attr_scaled;
441 static int hf_eigrp_attr_tag;
442 static int hf_eigrp_attr_jitter;
443 static int hf_eigrp_attr_qenergy;
444 static int hf_eigrp_attr_energy;
446 /* route external data */
447 static int hf_eigrp_extdata_origrid;
448 static int hf_eigrp_extdata_as;
449 static int hf_eigrp_extdata_tag;
450 static int hf_eigrp_extdata_metric;
451 static int hf_eigrp_extdata_reserved;
452 static int hf_eigrp_extdata_proto;
454 static int hf_eigrp_extdata_flag_ext;
455 static int hf_eigrp_extdata_flag_cd;
456 static int ett_eigrp_extdata_flags;
458 /* ipv4 address */
459 static int hf_eigrp_ipv4_nexthop;
460 static int hf_eigrp_ipv4_prefixlen;
462 /* ipv6 address */
463 static int hf_eigrp_ipv6_nexthop;
464 static int hf_eigrp_ipv6_prefixlen;
466 /* ipx address */
467 static int hf_eigrp_ipx_nexthop_net;
468 static int hf_eigrp_ipx_nexthop_host;
469 static int hf_eigrp_ipx_extdata_routerid;
470 static int hf_eigrp_ipx_extdata_delay;
471 static int hf_eigrp_ipx_extdata_metric;
472 static int hf_eigrp_ipx_dest;
474 /* appletalk address */
475 static int hf_eigrp_atalk_routerid;
477 /* SAF services */
478 static int hf_eigrp_saf_service;
479 static int hf_eigrp_saf_subservice;
480 static int hf_eigrp_saf_guid;
482 static int hf_eigrp_saf_reachability_afi;
483 static int hf_eigrp_saf_reachability_port;
484 static int hf_eigrp_saf_reachability_protocol;
485 static int hf_eigrp_saf_reachability_addr_ipv4;
486 static int hf_eigrp_saf_reachability_addr_ipv6;
487 static int hf_eigrp_saf_reachability_addr_hex;
488 static int ett_eigrp_saf_reachability;
490 static int hf_eigrp_saf_data_length;
491 static int hf_eigrp_saf_data_sequence;
492 static int hf_eigrp_saf_data_type;
494 /* Generated from convert_proto_tree_add_text.pl */
495 static int hf_eigrp_ipx_address;
496 static int hf_eigrp_release;
497 static int hf_eigrp_tlv_version;
498 static int hf_eigrp_ipv4_destination;
499 static int hf_eigrp_ipv6_destination;
500 static int hf_eigrp_appletalk_cable_range;
501 static int hf_eigrp_nexthop_address;
502 static int hf_eigrp_cable_range;
503 static int hf_eigrp_metric_delay;
504 static int hf_eigrp_metric_bandwidth;
505 static int hf_eigrp_checksum;
506 static int hf_eigrp_checksum_status;
507 static int hf_eigrp_metric_comm_type;
508 static int ett_metric_comm_type;
509 static int hf_eigrp_extcomm_eigrp_flag;
510 static int hf_eigrp_extcomm_eigrp_tag;
511 static int hf_eigrp_extcomm_eigrp_res;
512 static int hf_eigrp_extcomm_eigrp_rid;
513 static int hf_eigrp_extcomm_eigrp_as;
514 static int hf_eigrp_extcomm_eigrp_sdly;
515 static int hf_eigrp_extcomm_eigrp_rel;
516 static int hf_eigrp_extcomm_eigrp_hop;
517 static int hf_eigrp_extcomm_eigrp_sbw;
518 static int hf_eigrp_extcomm_eigrp_load;
519 static int hf_eigrp_extcomm_eigrp_mtu;
520 static int hf_eigrp_extcomm_eigrp_xas;
521 static int hf_eigrp_extcomm_eigrp_xrid;
522 static int hf_eigrp_extcomm_eigrp_xproto;
523 static int hf_eigrp_extcomm_eigrp_xmetric;
527 static expert_field ei_eigrp_checksum_bad;
528 static expert_field ei_eigrp_unreachable;
529 static expert_field ei_eigrp_seq_addrlen;
530 static expert_field ei_eigrp_peer_termination;
531 static expert_field ei_eigrp_tlv_type;
532 static expert_field ei_eigrp_auth_type;
533 static expert_field ei_eigrp_peer_termination_graceful;
534 static expert_field ei_eigrp_auth_len;
535 static expert_field ei_eigrp_tlv_len;
536 static expert_field ei_eigrp_afi;
537 static expert_field ei_eigrp_prefixlen;
538 static expert_field ei_eigrp_tlv_trunc;
540 /* some extra handle that might be needed */
541 static dissector_handle_t ipxsap_handle;
542 static dissector_table_t media_type_table;
544 static const value_string eigrp_opcode2string[] = {
545 { EIGRP_OPC_UPDATE, "Update" },
546 { EIGRP_OPC_REQUEST, "Request" },
547 { EIGRP_OPC_QUERY, "Query" },
548 { EIGRP_OPC_REPLY, "Reply" },
549 { EIGRP_OPC_HELLO, "Hello" },
550 { EIGRP_OPC_IPXSAP, "IPX/SAP Update" },
551 { EIGRP_OPC_PROBE, "Route Probe" },
552 { EIGRP_OPC_ACK, "Hello (Ack)" },
553 { EIGRP_OPC_STUB, "Stub-Info" },
554 { EIGRP_OPC_SIAQUERY, "SIA-Query" },
555 { EIGRP_OPC_SIAREPLY, "SIA-Reply" },
556 { 0, NULL }
559 static const value_string eigrp_tlv2string[] = {
560 /* General TLV formats */
561 { EIGRP_TLV_PARAMETER, "Parameters"},
562 { EIGRP_TLV_AUTH, "Authentication"},
563 { EIGRP_TLV_SEQ, "Sequence"},
564 { EIGRP_TLV_SW_VERSION, "Software Version"},
565 { EIGRP_TLV_NEXT_MCAST_SEQ, "Next multicast sequence"},
566 { EIGRP_TLV_PEER_STUBINFO, "Peer Stub Information"},
567 { EIGRP_TLV_PEER_TERMINATION, "Peer Termination"},
568 { EIGRP_TLV_PEER_TIDLIST, "Peer Topology ID List"},
570 /* Legacy TLV formats */
571 { EIGRP_TLV_IPv4_INT, "Internal Route(IPv4)"},
572 { EIGRP_TLV_IPv4_EXT, "External Route(IPv4)"},
573 { EIGRP_TLV_IPv4_COM, "Ext-Community(IPv4)"},
574 { EIGRP_TLV_IPv6_INT, "Internal Route(IPv6)"},
575 { EIGRP_TLV_IPv6_EXT, "External Route(IPv6)"},
576 { EIGRP_TLV_IPv6_COM, "Ext-Community(IPv6)"},
577 { EIGRP_TLV_IPX_INT, "IPX Internal Route(IPX)"},
578 { EIGRP_TLV_IPX_EXT, "IPX External Route(IPX)"},
580 /* Deprecated TLV formats */
581 { EIGRP_TLV_AT_INT, "Internal Route(ATALK)"},
582 { EIGRP_TLV_AT_EXT, "External Route(ATALK)"},
583 { EIGRP_TLV_AT_CBL, "Cable Configuration(ATALK)"},
584 { EIGRP_TLV_MTR_REQ, "Request(MTR)"},
585 { EIGRP_TLV_MTR_INT, "Internal Route(MTR)"},
586 { EIGRP_TLV_MTR_EXT, "External Route(MTR)"},
587 { EIGRP_TLV_MTR_COM, "Ext-Community(MTR)"},
588 { EIGRP_TLV_MTR_TIDLIST, "TopologyID List"},
590 /* Current "Wide Metric" TLV formats */
591 { EIGRP_TLV_MP_REQ, "Request"},
592 { EIGRP_TLV_MP_INT, "Internal Route"},
593 { EIGRP_TLV_MP_EXT, "External Route"},
594 { EIGRP_TLV_MP_COM, "Ext-Community"},
596 { 0, NULL}
599 const value_string eigrp_proto2string[] = {
600 { IGRP1_PROTID, "IGRP"},
601 { IGRP2_PROTID, "EIGRP"},
602 { STATIC_PROTID, "Static Route"},
603 { RIP_PROTID, "RIP"},
604 { HELLO_PROTID, "Hello"},
605 { OSPF_PROTID, "OSPF"},
606 { ISIS_PROTID, "IS-IS"},
607 { EGP_PROTID, "EGP"},
608 { BGP_PROTID, "BGP"},
609 { IDRP_PROTID, "IDRP"},
610 { CONN_PROTID, "Connected Route"},
611 { 0, NULL}
614 static const value_string eigrp_auth2string[] = {
615 { EIGRP_AUTH_TYPE_TEXT, "TEXT"},
616 { EIGRP_AUTH_TYPE_MD5, "MD5"},
617 { EIGRP_AUTH_TYPE_SHA256, "SHA256"},
618 { 0, NULL},
621 static const value_string eigrp_vrid2string[] = {
622 { EIGRP_VRID_AF_BASE, "(Address-Family)"},
623 { EIGRP_VRID_SF_BASE, "(Service-Family)"},
624 { EIGRP_VRID_MCAST_BASE, "(Multi-Cast)"},
625 { 0, NULL}
628 static const value_string eigrp_afi2string[] = {
629 { EIGRP_AF_IPv4, "IPv4"},
630 { EIGRP_AF_IPv6, "IPv6"},
631 { EIGRP_AF_IPX, "IPX"},
632 { EIGRP_AF_ATALK, "Appletalk"},
633 { EIGRP_SF_COMMON, "Service Family"},
634 { EIGRP_SF_IPv4, "IPv4 Service Family"},
635 { EIGRP_SF_IPv6, "IPv6 Service Family"},
636 { 0, NULL}
639 static const value_string eigrp_attr_opcode2string[] = {
640 { EIGRP_ATTR_NOOP, "NO-OP for padding"},
641 { EIGRP_ATTR_SCALED, "Scaled Metric"},
642 { EIGRP_ATTR_TAG, "Admin Tag"},
643 { EIGRP_ATTR_COMM, "Community"},
644 { EIGRP_ATTR_JITTER, "Jitter"},
645 { EIGRP_ATTR_QENERGY, "Non-Active energy"},
646 { EIGRP_ATTR_ENERGY, "Active energy"},
647 { 0, NULL}
650 static const value_string eigrp_saf_type2string[] = {
651 { EIGRP_SVCDATA_COMPLETE, "Attached Service Data"},
652 { EIGRP_SVCDATA_TRIMMED, "Trimmed Service Data"},
653 { 0, NULL}
656 static const value_string eigrp_saf_srv2string[] = {
657 { SAF_SERVICE_ID_CAPMAN, "Capabilities Manager"},
658 { SAF_SERVICE_ID_UC, "Unified Communications"},
659 { SAF_SERVICE_ID_PFR, "Performance Routing"},
660 { 0, NULL}
663 static const value_string eigrp_metric_comm_type_vals[] = {
664 { EIGRP_EXTCOMM_EIGRP, "EIGRP_EXTCOMM_EIGRP"},
665 { EIGRP_EXTCOMM_VRR, "EIGRP_EXTCOMM_VRR"},
666 { EIGRP_EXTCOMM_DAD, "EIGRP_EXTCOMM_DAD"},
667 { EIGRP_EXTCOMM_VRHB, "EIGRP_EXTCOMM_VRHB"},
668 { EIGRP_EXTCOMM_SRLM, "EIGRP_EXTCOMM_SRLM"},
669 { EIGRP_EXTCOMM_SAR, "EIGRP_EXTCOMM_SAR"},
670 { EIGRP_EXTCOMM_RPM, "EIGRP_EXTCOMM_RPM"},
671 { EIGRP_EXTCOMM_SOO_ASFMT, "EIGRP_EXTCOMM_SOO_ASFMT"},
672 { EIGRP_EXTCOMM_SOO_ADRFMT, "EIGRP_EXTCOMM_SOO_ADRFMT"},
673 { 0, NULL}
678 *@fn void dissect_eigrp_parameter (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, proto_item *ti)
681 * @param[in,out] tree detail dissection result
682 * @param[in] tvb packet data
683 * @param[in] pinfo general data about the protocol
684 * @param[in] ti protocol item
686 * @par
687 * Dissect the Parameter TLV, which is used to convey metric weights and the
688 * hold time.
690 * @brief
691 * Note the addition of K6 for the new extended metrics, and does not apply to
692 * older TLV packet formats.
694 static void
695 dissect_eigrp_parameter (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
696 proto_item *ti)
698 int offset = 0;
699 uint8_t k1, k2, k3, k4, k5;
701 k1 = tvb_get_uint8(tvb, offset);
702 proto_tree_add_item(tree, hf_eigrp_par_k1, tvb, offset, 1, ENC_BIG_ENDIAN);
704 offset += 1;
705 k2 = tvb_get_uint8(tvb, offset);
706 proto_tree_add_item(tree, hf_eigrp_par_k2, tvb, offset, 1, ENC_BIG_ENDIAN);
708 offset += 1;
709 k3 = tvb_get_uint8(tvb, offset);
710 proto_tree_add_item(tree, hf_eigrp_par_k3, tvb, offset, 1, ENC_BIG_ENDIAN);
712 offset += 1;
713 k4 = tvb_get_uint8(tvb, offset);
714 proto_tree_add_item(tree, hf_eigrp_par_k4, tvb, offset, 1, ENC_BIG_ENDIAN);
716 offset += 1;
717 k5 = tvb_get_uint8(tvb, offset);
718 proto_tree_add_item(tree, hf_eigrp_par_k5, tvb, offset, 1, ENC_BIG_ENDIAN);
720 offset += 1;
721 proto_tree_add_item(tree, hf_eigrp_par_k6, tvb, offset, 1, ENC_BIG_ENDIAN);
723 offset += 1;
724 proto_tree_add_item(tree, hf_eigrp_par_holdtime, tvb, offset, 2, ENC_BIG_ENDIAN);
726 if (k1 == 255 && k2 == 255 && k3 == 255 && k4 == 255 && k5 == 255) {
727 proto_item_append_text(ti, ": Peer Termination");
728 expert_add_info(pinfo, ti, &ei_eigrp_peer_termination);
733 *@fn void dissect_eigrp_auth_tlv (proto_tree *tree, tvbuff_t *tvb,
734 * packet_info *pinfo, proto_item *ti)
736 * @param[in,out] tree detail dissection result
737 * @param[in] tvb packet data
738 * @param[in] pinfo general data about the protocol
739 * @param[in] ti protocol item
741 * @par
742 * Dissect the Authentication TLV and display digest. Currently MD5 and SHA256
743 * HMAC is supported. For SHA256, a "secret key" with the HMAC-SHA-256
744 * password, the source address from which the packet is sent. This combined
745 * string is used as the key for hash calculation.
747 static void
748 dissect_eigrp_auth_tlv (proto_tree *tree, tvbuff_t *tvb,
749 packet_info *pinfo, proto_item *ti)
751 proto_item *ti_auth_type, *ti_auth_len;
752 int offset = 0;
753 uint16_t auth_type, auth_len;
755 /* print out what family we dealing with... */
757 auth_type = tvb_get_ntohs(tvb, 0);
758 auth_len = tvb_get_ntohs(tvb, 2);
760 proto_item_append_text(ti, " %s", val_to_str_const(auth_type, eigrp_auth2string, ""));
762 ti_auth_type = proto_tree_add_item(tree, hf_eigrp_auth_type, tvb, offset, 2, ENC_BIG_ENDIAN);
763 offset += 2;
764 ti_auth_len = proto_tree_add_item(tree, hf_eigrp_auth_len, tvb, offset, 2, ENC_BIG_ENDIAN);
765 offset += 2;
766 proto_tree_add_item(tree, hf_eigrp_auth_keyid, tvb, offset, 4, ENC_BIG_ENDIAN);
767 offset += 4;
768 proto_tree_add_item(tree, hf_eigrp_auth_keyseq, tvb, offset, 4, ENC_BIG_ENDIAN);
769 offset += 4;
770 proto_tree_add_item(tree, hf_eigrp_nullpad, tvb, offset, 8, ENC_NA);
771 offset += 8;
773 switch (auth_type) {
774 case EIGRP_AUTH_TYPE_MD5:
775 if (EIGRP_AUTH_TYPE_MD5_LEN != auth_len) {
776 expert_add_info_format(pinfo, ti_auth_len, &ei_eigrp_auth_len, "Invalid auth len %u", auth_len);
777 } else {
778 proto_tree_add_item(tree, hf_eigrp_auth_digest, tvb, offset,
779 EIGRP_AUTH_TYPE_MD5_LEN, ENC_NA);
781 break;
783 case EIGRP_AUTH_TYPE_SHA256:
784 if (EIGRP_AUTH_TYPE_SHA256_LEN != auth_len) {
785 expert_add_info_format(pinfo, ti_auth_len, &ei_eigrp_auth_len, "Invalid auth len %u", auth_len);
787 } else {
788 proto_tree_add_item(tree, hf_eigrp_auth_digest, tvb, offset,
789 EIGRP_AUTH_TYPE_SHA256_LEN, ENC_NA);
791 break;
793 case EIGRP_AUTH_TYPE_NONE:
794 case EIGRP_AUTH_TYPE_TEXT:
795 default:
796 expert_add_info_format(pinfo, ti_auth_type, &ei_eigrp_auth_type, "Invalid auth type %u", auth_type);
797 break;
802 *@fn void dissect_eigrp_seq_tlv (proto_tree *tree, tvbuff_t *tvb,
803 * packet_info *pinfo, proto_item *ti)
805 * @param[in,out] tree detail dissection result
806 * @param[in] tvb packet data
807 * @param[in] pinfo general data about the protocol
808 * @param[in] ti protocol item
810 * @par
811 * Dissect the Sequence TLV which consists of the addresses of peers that must
812 * not receive the next multicast packet transmitted.
814 static void
815 dissect_eigrp_seq_tlv (proto_tree *tree, tvbuff_t *tvb,
816 packet_info *pinfo, proto_item *ti)
818 proto_item *ti_addrlen;
819 int offset = 0;
820 uint8_t addr_len;
822 while (tvb_reported_length_remaining(tvb, offset) > 0) {
823 addr_len = tvb_get_uint8(tvb, offset);
824 ti_addrlen = proto_tree_add_item(tree, hf_eigrp_seq_addrlen, tvb, offset, 1, ENC_BIG_ENDIAN);
825 offset += 1;
827 if (tvb_reported_length_remaining(tvb, offset) < addr_len) {
828 /* The remaining part of the TLV is shorter than the address it should contain */
829 expert_add_info(pinfo, ti, &ei_eigrp_tlv_trunc);
830 break;
833 switch (addr_len) {
834 case 4:
835 /* IPv4 */
836 proto_tree_add_item(tree, hf_eigrp_seq_ipv4addr, tvb, offset, addr_len, ENC_BIG_ENDIAN);
837 break;
838 case 10:
839 /* IPX */
840 proto_tree_add_bytes_format_value(tree, hf_eigrp_ipx_address, tvb, offset, addr_len, NULL,
841 "IPX Address: %s", tvb_address_to_str(pinfo->pool, tvb, AT_IPX, 1));
842 break;
843 case 16:
844 /* IPv6 */
845 proto_tree_add_item(tree, hf_eigrp_seq_ipv6addr, tvb, offset, addr_len,
846 ENC_NA);
847 break;
848 default:
849 expert_add_info(pinfo, ti_addrlen, &ei_eigrp_seq_addrlen);
852 offset += addr_len;
857 *@fn void dissect_eigrp_sw_version (tvbuff_t *tvb, proto_tree *tree,
858 * proto_item *ti)
860 * @param[in,out] tree detail dissection result
861 * @param[in] tvb packet data
862 * @param[in] ti protocol item
864 * @par
865 * Dissect Software Version TLV. The older versions of EIGRP sent the IOS
866 * version along with the TLV Version. When EIGRP "plugins" were created,
867 * this as change to send the "Release" of EIGRP to better identify where fixes
868 * are present(missing)
870 static void
871 dissect_eigrp_sw_version (tvbuff_t *tvb, proto_tree *tree,
872 proto_item *ti)
874 int offset = 0;
875 uint8_t ios_rel_major, ios_rel_minor;
876 uint8_t eigrp_rel_major, eigrp_rel_minor;
878 ios_rel_major = tvb_get_uint8(tvb, 0);
879 ios_rel_minor = tvb_get_uint8(tvb, 1);
880 proto_tree_add_item(tree, hf_eigrp_release, tvb, offset, 2, ENC_BIG_ENDIAN);
881 offset += 2;
882 proto_item_append_text(ti, ": EIGRP=%u.%u", ios_rel_major, ios_rel_minor);
884 eigrp_rel_major = tvb_get_uint8(tvb, 2);
885 eigrp_rel_minor = tvb_get_uint8(tvb, 3);
886 proto_tree_add_item(tree, hf_eigrp_tlv_version, tvb, offset, 2, ENC_BIG_ENDIAN);
887 proto_item_append_text(ti, ", TLV=%u.%u",
888 eigrp_rel_major, eigrp_rel_minor);
892 *@fn void dissect_eigrp_next_mcast_seq (tvbuff_t *tvb, proto_tree *tree,
893 * proto_item *ti)
895 * @param[in,out] tree detail dissection result
896 * @param[in] tvb packet data
897 * @param[in] ti protocol item
899 * @par
900 * Dissect Next Multicast Sequence TLV, which is part of the Hello with a
901 * Sequence TLV; this gives a two-way binding between the packets and plugs a
902 * hole where a multicast could be received by the wrong peers (due to a
903 * string of lost packets).
905 static void
906 dissect_eigrp_next_mcast_seq (tvbuff_t *tvb, proto_tree *tree,
907 proto_item *ti)
909 proto_tree_add_item(tree, hf_eigrp_next_mcast_seq, tvb, 0, 4,
910 ENC_BIG_ENDIAN);
911 proto_item_append_text(ti, ": %u", tvb_get_ntohl(tvb, 0));
915 *@fn void dissect_eigrp_peer_stubinfo (tvbuff_t *tvb, proto_tree *tree)
918 * @param[in,out] tree detail dissection result
919 * @param[in] tvb packet data
921 * @par
922 * Dissect the PEER STUB TLV which contains the route types which the Peer will
923 * advertise. This is used to suppress QUERYs from being sent to the Peer
925 static void
926 dissect_eigrp_peer_stubinfo (tvbuff_t *tvb, proto_tree *tree)
928 proto_tree_add_bitmask(tree, tvb, 0, hf_eigrp_stub_flags, ett_eigrp_stub_flags,
929 eigrp_stub_flag_fields, ENC_BIG_ENDIAN);
933 *@fn void dissect_eigrp_peer_termination (packet_info *pinfo, proto_item *ti)
935 * @param[in] pinfo general data about the protocol
936 * @param[in] ti protocol item
938 * @par
939 * Dissect Peer Termination TLV. This TLV has no parameters and is used to
940 * signal an adjacency should be tore down
942 static void
943 dissect_eigrp_peer_termination (packet_info *pinfo, proto_item *ti)
945 expert_add_info(pinfo, ti, &ei_eigrp_peer_termination_graceful);
949 *@fn void dissect_eigrp_peer_tidlist (proto_tree *tree, tvbuff_t *tvb)
951 * @param[in,out] tree detail dissection result
952 * @param[in] tvb packet data
954 * @par
955 * Dissect the Topology Identifier List TLV. This TLV was introduced as part
956 * of the "MTR (Multi-Topology Routing) Project to support sub topologies
957 * within a given Autonomous System. The following represents the format of
958 * the TID list
960 * 0 1 2 3
961 * 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
962 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
963 * | Flags | Length |
964 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
965 * | Variable Length TID (two bytes) list |
966 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
968 static void
969 dissect_eigrp_peer_tidlist (proto_tree *tree, tvbuff_t *tvb)
971 proto_tree *sub_tree;
972 int offset = 0;
973 uint16_t size;
975 proto_tree_add_item(tree, hf_eigrp_tidlist_flags, tvb, offset, 2,
976 ENC_BIG_ENDIAN);
977 offset += 2;
979 size = tvb_get_ntohs(tvb, offset) / 2;
980 proto_tree_add_item(tree, hf_eigrp_tidlist_len, tvb, offset, 2,
981 ENC_BIG_ENDIAN);
982 offset += 2;
984 sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, (size*2), ett_eigrp_tidlist, NULL, "%d TIDs", size);
985 for (; size ; size--) {
986 proto_tree_add_item(sub_tree, hf_eigrp_tidlist_tid, tvb, offset, 2,
987 ENC_BIG_ENDIAN);
988 offset += 2;
993 *@fn int dissect_eigrp_extdata_flags (proto_tree *tree, tvbuff_t *tvb, int offset)
995 * @param[in,out] tree detail dissection result
996 * @param[in] tvb packet data
997 * @param[in] offset current byte offset in packet being processed
999 * @return int number of bytes process
1001 * @par
1002 * Dissect the Flags field in the external data section of an external
1003 * route.The following represents the format of the bit field
1005 * 7 6 5 4 3 2 1 0
1006 * +-+-+-+-+-+-+-+-+
1007 * | Flags |
1008 * +-+-+-+-+-+-+-+-+
1009 * | |
1010 * | +- Route is External *not used*
1011 * +--- Route is Candidate Default
1013 static int
1014 dissect_eigrp_extdata_flags (proto_tree *tree, tvbuff_t *tvb, int offset)
1016 proto_tree *sub_tree;
1017 tvbuff_t *sub_tvb;
1019 /* Decode the route flags field */
1020 sub_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_eigrp_extdata_flags, NULL, "External Flags");
1021 sub_tvb = tvb_new_subset_remaining(tvb, offset);
1023 proto_tree_add_item(sub_tree, hf_eigrp_extdata_flag_ext, sub_tvb, 0, 1,
1024 ENC_BIG_ENDIAN);
1025 proto_tree_add_item(sub_tree, hf_eigrp_extdata_flag_cd, sub_tvb, 0, 1,
1026 ENC_BIG_ENDIAN);
1028 offset += 1;
1029 return offset;
1033 *@fn int dissect_eigrp_metric_flags (proto_tree *tree, tvbuff_t *tvb, int offset, int limit)
1035 * @param[in,out] tree detail dissection result
1036 * @param[in] tvb packet data
1037 * @param[in] offset current byte offset in packet being processed
1038 * @param[in] limit maximum number of bytes which can be process
1040 * @return int number of bytes process
1042 * @par
1043 * Dissect Protocol Dependent Module (PDM) Flags field in the route metric
1044 * section of an internal and external route. The following represents the
1045 * format of the bit field
1047 * MSB LSB
1048 * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
1049 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1050 * | Flags | MP Flags |
1051 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1052 * | | |
1053 * | | +- Route is Replicated
1054 * | +--- Route is Active
1055 * +----- Source Withdraw
1057 static int
1058 dissect_eigrp_metric_flags (proto_tree *tree, tvbuff_t *tvb, int offset, int limit)
1060 proto_tree *sub_tree;
1061 tvbuff_t *sub_tvb;
1063 /* Decode the route flags field */
1064 sub_tree = proto_tree_add_subtree(tree, tvb, offset, limit, ett_eigrp_metric_flags, NULL, "Flags");
1065 sub_tvb = tvb_new_subset_length_caplen(tvb, offset, limit, -1);
1067 /* just care about 'flags' byte, there are no MP flags for now */
1068 proto_tree_add_item(sub_tree, hf_eigrp_metric_flags_srcwd, sub_tvb, 0, 1,
1069 ENC_BIG_ENDIAN);
1070 proto_tree_add_item(sub_tree, hf_eigrp_metric_flags_cd, sub_tvb, 0, 1,
1071 ENC_BIG_ENDIAN);
1072 proto_tree_add_item(sub_tree, hf_eigrp_metric_flags_active, sub_tvb, 0, 1,
1073 ENC_BIG_ENDIAN);
1074 proto_tree_add_item(sub_tree, hf_eigrp_metric_flags_repl, sub_tvb, 0, 1,
1075 ENC_BIG_ENDIAN);
1077 offset += limit;
1078 return offset;
1082 *@fn void dissect_eigrp_ipv4_addrs (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1083 * packet_info *pinfo, int offset, int unreachable)
1085 * @param[in,out] tree detail dissection result
1086 * @param[in] tvb packet data
1087 * @param[in] pinfo general data about the protocol
1088 * @param[in] offset current byte offset in packet being processed
1090 * @par
1091 * Dissect all IPv4 address from offset though the end of the packet
1093 static void
1094 dissect_eigrp_ipv4_addrs (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1095 packet_info *pinfo, int offset, int unreachable)
1097 uint8_t length;
1098 ws_in4_addr ip_addr;
1099 int addr_len;
1100 proto_item *ti_prefixlen, *ti_dst;
1101 bool first = true;
1103 for (; tvb_reported_length_remaining(tvb, offset) > 0; offset += (1 + addr_len)) {
1104 length = tvb_get_uint8(tvb, offset);
1105 addr_len = tvb_get_ipv4_addr_with_prefix_len(tvb, offset + 1, &ip_addr, length);
1107 if (addr_len < 0) {
1108 /* Invalid prefix length, more than 32 bits */
1109 ti_prefixlen = proto_tree_add_item(tree, hf_eigrp_ipv4_prefixlen,
1110 tvb, offset, 1, ENC_BIG_ENDIAN);
1111 expert_add_info_format(pinfo, ti_prefixlen, &ei_eigrp_prefixlen, "Invalid prefix length %u, must be <= 32", length);
1112 break; /* We don't know how long this address is */
1113 } else {
1114 address addr;
1116 proto_tree_add_item(tree, hf_eigrp_ipv4_prefixlen, tvb, offset, 1,
1117 ENC_BIG_ENDIAN);
1118 offset += 1;
1119 set_address(&addr, AT_IPv4, 4, &ip_addr);
1120 ti_dst = proto_tree_add_ipv4(tree, hf_eigrp_ipv4_destination, tvb, offset, addr_len, ip_addr);
1122 /* add it to the top level line */
1123 proto_item_append_text(ti," %c %s/%u", first ? '=':',',
1124 address_to_str(pinfo->pool, &addr), length);
1126 if (unreachable) {
1127 expert_add_info(pinfo, ti_dst, &ei_eigrp_unreachable);
1130 first = false;
1135 *@fn void dissect_eigrp_ipv6_addrs (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1136 * packet_info *pinfo, int offset, int unreachable)
1138 * @param[in,out] tree detail dissection result
1139 * @param[in] tvb packet data
1140 * @param[in] pinfo general data about the protocol
1141 * @param[in] offset current byte offset in packet being processed
1143 * @par
1144 * Dissect all IPv6 address from offset though the end of the packet
1146 static void
1147 dissect_eigrp_ipv6_addrs (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1148 packet_info *pinfo, int offset, int unreachable)
1150 uint8_t length;
1151 int addr_len;
1152 ws_in6_addr addr;
1153 address addr_str;
1154 proto_item *ti_prefixlen, *ti_dst;
1155 bool first = true;
1157 for (; tvb_reported_length_remaining(tvb, offset) > 0; offset += (1 + addr_len)) {
1158 length = tvb_get_uint8(tvb, offset);
1159 addr_len = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 1, &addr, length);
1161 if (addr_len < 0) {
1162 /* Invalid prefix length, more than 128 bits */
1163 ti_prefixlen = proto_tree_add_item(tree, hf_eigrp_ipv6_prefixlen,
1164 tvb, offset, 1, ENC_BIG_ENDIAN);
1165 expert_add_info_format(pinfo, ti_prefixlen, &ei_eigrp_prefixlen, "Invalid prefix length %u, must be <= 128", length);
1166 break; /* We don't know how long this address is */
1167 } else {
1168 proto_tree_add_item(tree, hf_eigrp_ipv6_prefixlen, tvb, offset, 1,
1169 ENC_BIG_ENDIAN);
1170 offset += 1;
1172 if ((length < 128) && (length % 8 == 0)) {
1173 addr_len++;
1176 set_address(&addr_str, AT_IPv6, 16, addr.bytes);
1177 ti_dst = proto_tree_add_ipv6(tree, hf_eigrp_ipv6_destination, tvb, offset, addr_len, &addr);
1179 /* add it to the top level line */
1180 proto_item_append_text(ti," %c %s/%u", first ? '=':',',
1181 address_to_str(pinfo->pool, &addr_str), length);
1183 if (unreachable) {
1184 expert_add_info(pinfo, ti_dst, &ei_eigrp_unreachable);
1187 first = false;
1192 *@fn int dissect_eigrp_ipx_addrs (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1193 * packet_info *pinfo, int offset, int unreachable)
1195 * @param[in,out] tree detail dissection result
1196 * @param[in] tvb packet data
1197 * @param[in] pinfo general data about the protocol
1198 * @param[in] offset current byte offset in packet being processed
1200 * @return int number of bytes process
1202 * @par
1203 * Dissect all IPX address from offset though the end of the packet
1205 static int
1206 dissect_eigrp_ipx_addrs (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1207 packet_info *pinfo, int offset, int unreachable)
1209 proto_item *ti_dst;
1211 ti_dst = proto_tree_add_item(tree, hf_eigrp_ipx_dest, tvb, offset, 4,
1212 ENC_NA);
1214 /* add it to the top level line */
1215 proto_item_append_text(ti," = %s", ipxnet_to_str_punct(pinfo->pool, tvb_get_ntohl(tvb, offset), ' '));
1217 if (unreachable) {
1218 expert_add_info(pinfo, ti_dst, &ei_eigrp_unreachable);
1221 offset +=4;
1222 return offset;
1226 *@fn void dissect_eigrp_services (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1227 * packet_info *pinfo, int offset)
1229 * @param[in,out] tree detail dissection result
1230 * @param[in] tvb packet data
1231 * @param[in] pinfo general data about the protocol
1232 * @param[in] ti protocol item
1233 * @param[in] offset current byte offset in packet being processed
1235 * @par
1236 * Dissect all SAF Services from offset though the end of the packet. The
1237 * following represents the format of a SAF Service:
1239 * 0 1 2 3
1240 * 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
1241 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1242 * | Service | SubService |
1243 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1244 * | GUID |
1245 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1246 * | GUID(cont) |
1247 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1248 * | GUID(cont) |
1249 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1250 * | GUID(cont) |
1251 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1252 * | Type | Length |
1253 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1254 * | Reachability AFI | Reachability Port |
1255 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1256 * | Reachability Protocol | Reachability Addr |
1257 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1258 * | Reachability Addr(cont) |
1259 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1260 * | Reachability Addr(cont) |
1261 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1262 * | Reachability Addr(cont) |
1263 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1264 * | Reachability Addr(cont) | Sequence |
1265 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1266 * | Sequence(cont) |\/\/\/ Service Data \/\/\/|
1267 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1270 static void
1271 dissect_eigrp_services (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1272 packet_info *pinfo, int offset)
1274 int afi, length, remaining;
1275 int sub_offset;
1276 proto_item *sub_ti;
1277 proto_tree *sub_tree, *reach_tree;
1278 tvbuff_t *sub_tvb, *reach_tvb;
1279 uint16_t service, sub_service;
1281 remaining = tvb_captured_length_remaining(tvb, offset);
1282 sub_tree = proto_tree_add_subtree(tree, tvb, offset, remaining, ett_eigrp_tlv_metric, &sub_ti, "SAF Service ");
1283 sub_tvb = tvb_new_subset_length_caplen(tvb, offset, remaining, -1);
1284 sub_offset = 0;
1286 for (; tvb_reported_length_remaining(sub_tvb, sub_offset) > 0; ) {
1287 service = tvb_get_ntohs(sub_tvb, sub_offset);
1288 proto_item_append_text(sub_ti, "%c %s", (sub_offset == 0 ? '=':','),
1289 val_to_str_const(service, eigrp_saf_srv2string, ""));
1291 sub_service = tvb_get_ntohs(sub_tvb, sub_offset+2);
1292 proto_item_append_text(ti, "%c %u:%u", (sub_offset == 0 ? '=':','),
1293 service, sub_service);
1295 proto_tree_add_item(sub_tree, hf_eigrp_saf_service, sub_tvb,
1296 sub_offset, 2, ENC_BIG_ENDIAN);
1297 sub_offset += 2;
1298 proto_tree_add_item(sub_tree, hf_eigrp_saf_subservice, sub_tvb,
1299 sub_offset, 2, ENC_BIG_ENDIAN);
1300 sub_offset += 2;
1301 proto_tree_add_item(sub_tree, hf_eigrp_saf_guid, sub_tvb,
1302 sub_offset, GUID_LEN, ENC_BIG_ENDIAN);
1303 sub_offset += GUID_LEN;
1305 proto_tree_add_item(sub_tree, hf_eigrp_saf_data_type, sub_tvb,
1306 sub_offset, 2, ENC_BIG_ENDIAN);
1307 sub_offset += 2;
1308 length = tvb_get_ntohs(sub_tvb, sub_offset);
1309 proto_tree_add_item(sub_tree, hf_eigrp_saf_data_length, sub_tvb,
1310 sub_offset, 2, ENC_BIG_ENDIAN);
1311 sub_offset += 2;
1314 * Reachability information
1316 reach_tree = proto_tree_add_subtree(sub_tree, sub_tvb, sub_offset, 22,
1317 ett_eigrp_saf_reachability, NULL, "Reachability");
1318 reach_tvb = tvb_new_subset_length_caplen(sub_tvb, sub_offset, 22, -1);
1320 afi = tvb_get_ntohs(reach_tvb, 0);
1321 proto_tree_add_item(reach_tree, hf_eigrp_saf_reachability_afi,
1322 reach_tvb, 0, 2, ENC_BIG_ENDIAN);
1323 proto_tree_add_item(reach_tree, hf_eigrp_saf_reachability_port,
1324 reach_tvb, 2, 2, ENC_BIG_ENDIAN);
1325 proto_tree_add_item(reach_tree, hf_eigrp_saf_reachability_protocol,
1326 reach_tvb, 4, 2, ENC_BIG_ENDIAN);
1328 switch (afi) {
1329 case EIGRP_AF_IPv4:
1330 proto_tree_add_item(reach_tree, hf_eigrp_saf_reachability_addr_ipv4,
1331 reach_tvb, 6, 4, ENC_BIG_ENDIAN);
1332 proto_tree_add_item(reach_tree, hf_eigrp_nullpad, reach_tvb, 10, 12,
1333 ENC_NA);
1334 break;
1336 case EIGRP_AF_IPv6:
1337 proto_tree_add_item(reach_tree, hf_eigrp_saf_reachability_addr_ipv6,
1338 reach_tvb, 6, 16, ENC_NA);
1339 break;
1340 default:
1341 /* just print zeros... */
1342 proto_tree_add_item(reach_tree, hf_eigrp_saf_reachability_addr_hex,
1343 reach_tvb, 6, 16, ENC_NA);
1344 break;
1346 sub_offset += 22;
1348 proto_tree_add_item(sub_tree, hf_eigrp_saf_data_sequence, sub_tvb,
1349 sub_offset, 4, ENC_BIG_ENDIAN);
1350 sub_offset += 4;
1352 if (length > 0) {
1353 tvbuff_t *xml_tvb;
1354 uint8_t *test_string, *tok;
1357 * Service-Data is usually (but not always) plain text, specifically
1358 * XML. If it "looks like" XML (begins with optional white-space
1359 * followed by a '<'), try XML. Otherwise, try plain-text.
1361 xml_tvb = tvb_new_subset_length(sub_tvb, sub_offset, length);
1362 test_string = tvb_get_string_enc(pinfo->pool, xml_tvb, 0, (length < 32 ?
1363 length : 32), ENC_ASCII);
1364 tok = strtok(test_string, " \t\r\n");
1366 if (tok && tok[0] == '<') {
1367 /* Looks like XML */
1368 dissector_try_string(media_type_table, "application/xml",
1369 xml_tvb, pinfo, sub_tree, NULL);
1370 } else {
1371 /* Try plain text */
1372 dissector_try_string(media_type_table, "text/plain",
1373 xml_tvb, pinfo, sub_tree, NULL);
1376 sub_offset += length;
1381 *@fn int dissect_eigrp_legacy_metric (proto_tree *tree, tvbuff_t *tvb, int offset)
1383 * @param[in,out] tree detail dissection result
1384 * @param[in] tvb packet data
1385 * @param[in] offset current byte offset in packet being processed
1387 * @return int number of bytes process
1389 * @par
1390 * Dissect the TLV Versions 1.2 (legacy) and 3.0 (deprecated) metric
1391 * sections. The following represents the format
1393 * 0 1 2 3
1394 * 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
1395 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1396 * | Scaled Delay |
1397 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1398 * | Scaled Bandwidth |
1399 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1400 * | MTU | Hopcount |
1401 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1402 * | Reliability | Load | Internal Tag | Flag |
1403 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1406 static int
1407 dissect_eigrp_legacy_metric (proto_tree *tree, tvbuff_t *tvb, int offset)
1409 proto_tree *sub_tree;
1410 tvbuff_t *sub_tvb;
1412 sub_tree = proto_tree_add_subtree(tree, tvb, offset, 16, ett_eigrp_tlv_metric, NULL, "Legacy Metric");
1413 sub_tvb = tvb_new_subset_length_caplen(tvb, offset, 16, -1);
1415 proto_tree_add_item(sub_tree, hf_eigrp_legacy_metric_delay, sub_tvb,
1416 0, 4, ENC_BIG_ENDIAN);
1417 proto_tree_add_item(sub_tree, hf_eigrp_legacy_metric_bw, sub_tvb,
1418 4, 4, ENC_BIG_ENDIAN);
1419 proto_tree_add_item(sub_tree, hf_eigrp_legacy_metric_mtu, sub_tvb,
1420 8, 3, ENC_BIG_ENDIAN);
1421 proto_tree_add_item(sub_tree, hf_eigrp_legacy_metric_hopcount, sub_tvb,
1422 11, 1, ENC_BIG_ENDIAN);
1423 proto_tree_add_item(sub_tree, hf_eigrp_legacy_metric_rel, sub_tvb,
1424 12, 1, ENC_BIG_ENDIAN);
1425 proto_tree_add_item(sub_tree, hf_eigrp_legacy_metric_load, sub_tvb,
1426 13, 1, ENC_BIG_ENDIAN);
1427 proto_tree_add_item(sub_tree, hf_eigrp_legacy_metric_intag, sub_tvb,
1428 14, 1, ENC_BIG_ENDIAN);
1430 /* Decode the route flags field */
1431 dissect_eigrp_metric_flags(sub_tree, sub_tvb, 15, 1);
1433 offset += 16;
1434 return offset;
1438 *@fn int dissect_eigrp_ipx_extdata (proto_tree *tree, tvbuff_t *tvb, int offset)
1440 * @param[in,out] tree detail dissection result
1441 * @param[in] tvb packet data
1442 * @param[in] offset current byte offset in packet being processed
1444 * @return int number of bytes process
1446 * @par
1447 * Dissect the IPX External data for the TLV versions 1.2 and 3.0.
1448 * The following represents the format
1450 * 0 1 2 3
1451 * 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
1452 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1453 * | Ext RouterID |
1454 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1455 * | Ext Router ID |
1456 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1457 * | Ext Autonomous System Number |
1458 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1459 * | Route Tag |
1460 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1461 * | Ext Protocol | Ext Flags | External Metric |
1462 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1463 * | External Delay |
1464 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1466 static int
1467 dissect_eigrp_ipx_extdata (proto_tree *tree, tvbuff_t *tvb, int offset)
1469 proto_tree *sub_tree;
1470 tvbuff_t *sub_tvb;
1471 int sub_offset = 0;
1473 sub_tree = proto_tree_add_subtree(tree, tvb, offset, 20, ett_eigrp_tlv_extdata, NULL, "External Data");
1474 sub_tvb = tvb_new_subset_length_caplen(tvb, offset, 20, -1);
1476 /* Decode the external route source info */
1477 proto_tree_add_item(sub_tree, hf_eigrp_ipx_extdata_routerid, sub_tvb,
1478 sub_offset, 6, ENC_NA);
1479 sub_offset += 6;
1480 proto_tree_add_item(sub_tree, hf_eigrp_extdata_as, sub_tvb,
1481 sub_offset, 4, ENC_BIG_ENDIAN);
1482 sub_offset += 4;
1483 proto_tree_add_item(sub_tree, hf_eigrp_extdata_tag, sub_tvb,
1484 sub_offset, 4, ENC_BIG_ENDIAN);
1485 sub_offset += 4;
1486 proto_tree_add_item(sub_tree, hf_eigrp_extdata_proto, sub_tvb,
1487 sub_offset, 1, ENC_BIG_ENDIAN);
1488 sub_offset += 1;
1490 /* Decode the external route flags */
1491 dissect_eigrp_extdata_flags(sub_tree, sub_tvb, sub_offset);
1492 sub_offset += 1;
1494 /* and the rest of it... */
1495 proto_tree_add_item(sub_tree, hf_eigrp_ipx_extdata_metric,
1496 sub_tvb, sub_offset, 2, ENC_BIG_ENDIAN);
1497 sub_offset += 2;
1498 proto_tree_add_item(sub_tree, hf_eigrp_ipx_extdata_delay,
1499 sub_tvb, sub_offset, 2, ENC_BIG_ENDIAN);
1500 sub_offset += 2;
1502 offset += sub_offset;
1503 return offset;
1507 *@fn int dissect_eigrp_extdata (proto_tree *tree, tvbuff_t *tvb, int offset)
1509 * @param[in,out] tree detail dissection result
1510 * @param[in] tvb packet data
1511 * @param[in] offset current byte offset in packet being processed
1513 * @return int number of bytes process
1515 * @par
1516 * Dissect the external route data for TLV versions 1.2 and 3.0 for all
1517 * protocols except IPX. The following represents the format
1519 * 0 1 2 3
1520 * 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
1521 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1522 * | Ext Router ID |
1523 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1524 * | Ext Autonomous System Number |
1525 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1526 * | Route Tag |
1527 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1528 * | External Metric |
1529 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1530 * | Reserved | Ext Protocol | Ext Flags |
1531 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1533 static int
1534 dissect_eigrp_extdata (proto_tree *tree, tvbuff_t *tvb, int offset)
1536 proto_tree *sub_tree;
1537 tvbuff_t *sub_tvb;
1538 int sub_offset = 0;
1540 sub_tree = proto_tree_add_subtree(tree, tvb, offset, 20, ett_eigrp_tlv_extdata, NULL, "External Data");
1541 sub_tvb = tvb_new_subset_length_caplen(tvb, offset, 20, -1);
1543 /* Decode the external route source info */
1544 proto_tree_add_item(sub_tree, hf_eigrp_extdata_origrid, sub_tvb,
1545 sub_offset, 4, ENC_BIG_ENDIAN);
1546 sub_offset += 4;
1547 proto_tree_add_item(sub_tree, hf_eigrp_extdata_as, sub_tvb,
1548 sub_offset, 4, ENC_BIG_ENDIAN);
1549 sub_offset += 4;
1550 proto_tree_add_item(sub_tree, hf_eigrp_extdata_tag, sub_tvb,
1551 sub_offset, 4, ENC_BIG_ENDIAN);
1552 sub_offset += 4;
1553 proto_tree_add_item(sub_tree, hf_eigrp_extdata_metric, sub_tvb,
1554 sub_offset, 4, ENC_BIG_ENDIAN);
1555 sub_offset += 4;
1556 proto_tree_add_item(sub_tree, hf_eigrp_extdata_reserved, sub_tvb,
1557 sub_offset, 2, ENC_BIG_ENDIAN);
1558 sub_offset += 2;
1559 proto_tree_add_item(sub_tree, hf_eigrp_extdata_proto, sub_tvb,
1560 sub_offset, 1, ENC_BIG_ENDIAN);
1561 sub_offset += 1;
1563 /* Decode the external route flags */
1564 dissect_eigrp_extdata_flags(sub_tree, sub_tvb, sub_offset);
1565 sub_offset += 1;
1567 offset += sub_offset;
1568 return offset;
1572 *@fn int dissect_eigrp_nexthop (proto_tree *tree, tvbuff_t *tvb, uint16_t afi, int offset)
1574 * @param[in,out] tree detail dissection result
1575 * @param[in] tvb packet data
1576 * @param[in] afi IANA address family indicator
1577 * @param[in] offset current byte offset in packet being processed
1579 * @return int number of bytes process
1581 * @par
1582 * Dissect the next hop field which is in the "route TLVs". This function will
1583 * handle all the various protocol AFIs and return the appropriate number of
1584 * bytes processed
1586 static int
1587 dissect_eigrp_nexthop (proto_tree *tree, tvbuff_t *tvb, uint16_t afi, int offset)
1589 /* dissect dest information */
1590 switch (afi) {
1591 case EIGRP_SF_IPv4:
1592 case EIGRP_AF_IPv4:
1593 proto_tree_add_item(tree, hf_eigrp_ipv4_nexthop, tvb, offset, 4,
1594 ENC_BIG_ENDIAN);
1595 offset += 4;
1596 break;
1598 case EIGRP_SF_IPv6:
1599 case EIGRP_AF_IPv6:
1600 proto_tree_add_item(tree, hf_eigrp_ipv6_nexthop, tvb, offset, 16,
1601 ENC_NA);
1602 offset += 16;
1603 break;
1605 case EIGRP_AF_IPX:
1606 proto_tree_add_item(tree, hf_eigrp_ipx_nexthop_net, tvb, offset, 4,
1607 ENC_NA);
1608 offset += 4;
1609 proto_tree_add_item(tree, hf_eigrp_ipx_nexthop_host, tvb, offset, 6,
1610 ENC_NA);
1611 offset += 6;
1612 break;
1614 case EIGRP_SF_COMMON:
1615 break;
1617 default:
1618 break;
1621 return offset;
1625 *@fn void dissect_eigrp_general_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1626 * packet_info *pinfo, uint16_t tlv)
1628 * @param[in,out] tree detail dissection result
1629 * @param[in] tvb packet data
1630 * @param[in] pinfo general data about the protocol
1631 * @param[in] ti protocol item
1632 * @param[in] tlv Specific TLV in to be dissected
1634 * @par
1635 * General EIGRP parameters carry EIGRP management information and are not
1636 * specific to any one routed protocol.
1639 static void
1640 dissect_eigrp_general_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1641 packet_info *pinfo, uint16_t tlv)
1643 switch (tlv) {
1644 case EIGRP_TLV_PARAMETER:
1645 dissect_eigrp_parameter(tree, tvb, pinfo, ti);
1646 break;
1647 case EIGRP_TLV_AUTH:
1648 dissect_eigrp_auth_tlv(tree, tvb, pinfo, ti);
1649 break;
1650 case EIGRP_TLV_SEQ:
1651 dissect_eigrp_seq_tlv(tree, tvb, pinfo, ti);
1652 break;
1653 case EIGRP_TLV_SW_VERSION:
1654 dissect_eigrp_sw_version(tvb, tree, ti);
1655 break;
1656 case EIGRP_TLV_NEXT_MCAST_SEQ:
1657 dissect_eigrp_next_mcast_seq(tvb, tree, ti);
1658 break;
1659 case EIGRP_TLV_PEER_STUBINFO:
1660 dissect_eigrp_peer_stubinfo(tvb, tree);
1661 break;
1662 case EIGRP_TLV_PEER_TERMINATION:
1663 dissect_eigrp_peer_termination(pinfo, ti);
1664 break;
1665 case EIGRP_TLV_PEER_TIDLIST:
1666 dissect_eigrp_peer_tidlist(tree, tvb);
1667 break;
1668 default:
1669 expert_add_info_format(pinfo, ti, &ei_eigrp_tlv_type, "Unknown Generic TLV (0x%04x)", tlv);
1670 break;
1675 *@fn void dissect_eigrp_ipv4_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1676 * packet_info *pinfo, uint16_t tlv)
1678 * @param[in,out] tree detail dissection result
1679 * @param[in] tvb packet data
1680 * @param[in] pinfo general data about the protocol
1681 * @param[in] tlv Specific TLV in to be dissected
1683 * @par
1684 * Dissect the Legacy IPv4 route TLV; handles both the internal and external
1685 * TLV types; This packet format is being deprecated and replaced with the
1686 * Multi-Protocol packet formats as of EIGRP Release-8. This TLV format is used
1687 * to maintain backward compatibility between older version so EIGRP, "MTR"
1688 * EIGRP, and current shipping code.
1690 * 0 1 2 3
1691 * 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
1692 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1693 * | IPv4 Nexthop |
1694 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1695 * | Scaled Delay |
1696 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1697 * | Scaled Bandwidth |
1698 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1699 * | MTU | Hopcount |
1700 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1701 * | Reliability | Load | Internal Tag | Flag |
1702 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1704 static void
1705 dissect_eigrp_ipv4_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1706 packet_info *pinfo, uint16_t tlv)
1708 int offset = 0;
1709 bool unreachable = false;
1711 proto_tree_add_item(tree, hf_eigrp_ipv4_nexthop, tvb, offset, 4,
1712 ENC_BIG_ENDIAN);
1713 offset += 4;
1715 /* dissect external data if needed */
1716 if ((tlv & EIGRP_TLV_TYPEMASK) == EIGRP_TLV_EXTERNAL) {
1717 offset = dissect_eigrp_extdata(tree, tvb, offset);
1720 /* dissect the metric */
1721 offset = dissect_eigrp_legacy_metric(tree, tvb, offset);
1723 /* dissect addresses */
1724 dissect_eigrp_ipv4_addrs(ti, tree, tvb, pinfo, offset, unreachable);
1728 *@fn void dissect_eigrp_atalk_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1729 * proto_item *ti, uint16_t tlv)
1731 * @param[in,out] tree detail dissection result
1732 * @param[in] tvb packet data
1733 * @param[in] tlv Specific TLV in to be dissected
1735 * @par
1736 * Dissect the legacy AppleTalk route TLV; handles both the internal and external
1737 * TLV type. The following represents the format
1739 static void
1740 dissect_eigrp_atalk_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1741 uint16_t tlv)
1743 int offset = 0;
1745 /* cable tlv? */
1746 if (EIGRP_TLV_AT_CBL == tlv) {
1747 proto_tree_add_item(tree, hf_eigrp_appletalk_cable_range, tvb, 0, 4, ENC_BIG_ENDIAN);
1748 proto_tree_add_item(tree, hf_eigrp_atalk_routerid, tvb, 4, 4,
1749 ENC_BIG_ENDIAN);
1750 proto_item_append_text(ti, ": Cable range= %u-%u, Router ID= %u",
1751 tvb_get_ntohs(tvb, 0), tvb_get_ntohs(tvb, 2),
1752 tvb_get_ntohl(tvb, 4));
1754 } else {
1755 proto_tree_add_item(tree, hf_eigrp_nexthop_address, tvb, offset, 4, ENC_BIG_ENDIAN);
1756 offset += 4;
1758 /* dissect external data if needed */
1759 if ((tlv & EIGRP_TLV_TYPEMASK) == EIGRP_TLV_EXTERNAL) {
1760 offset = dissect_eigrp_extdata(tree, tvb,offset);
1763 /* dissect the metric */
1764 offset = dissect_eigrp_legacy_metric(tree, tvb, offset);
1766 /* dissect cable range */
1767 proto_tree_add_item(tree, hf_eigrp_cable_range, tvb, offset, 4, ENC_BIG_ENDIAN);
1768 proto_item_append_text(ti, ": %u-%u",
1769 tvb_get_ntohs(tvb, 36), tvb_get_ntohs(tvb, 38));
1774 *@fn void dissect_eigrp_ipv6_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1775 * packet_info *pinfo, uint16_t tlv)
1777 * @param[in,out] tree detail dissection result
1778 * @param[in] tvb packet data
1779 * @param[in] pinfo general data about the protocol
1780 * @param[in] tlv Specific TLV in to be dissected
1782 * @par
1783 * Dissect the Legacy IPv6 route TLV; handles both the internal and external
1784 * TLV types; This packet format is being deprecated and replaced with the
1785 * Multi-Protocol packet formats as of EIGRP Release-8. This TLV format is used
1786 * to maintain backward compatibility between older version so EIGRP, "MTR"
1787 * EIGRP, and current shipping code.
1789 static void
1790 dissect_eigrp_ipv6_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1791 packet_info *pinfo, uint16_t tlv)
1793 int offset = 0;
1794 bool unreachable = false;
1796 proto_tree_add_item(tree, hf_eigrp_ipv6_nexthop, tvb, offset, 16,
1797 ENC_NA);
1798 offset += 16;
1800 /* dissect external data if needed */
1801 if ((tlv & EIGRP_TLV_TYPEMASK) == EIGRP_TLV_EXTERNAL) {
1802 offset = dissect_eigrp_extdata(tree, tvb, offset);
1805 /* dissect the metric */
1806 offset = dissect_eigrp_legacy_metric(tree, tvb, offset);
1808 /* dissect addresses */
1809 dissect_eigrp_ipv6_addrs(ti, tree, tvb, pinfo, offset, unreachable);
1813 *@fn void dissect_eigrp_ipx_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1814 * packet_info *pinfo, uint16_t tlv)
1816 * @param[in,out] tree detail dissection result
1817 * @param[in] tvb packet data
1818 * @param[in] pinfo general data about the protocol
1819 * @param[in] tlv Specific TLV in to be dissected
1821 * @par
1822 * Dissect the legacy IPX route TLV; handles both the internal and external
1823 * TLV type. The following represents the format
1825 * 0 1 2 3
1826 * 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
1827 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1828 * | Nexthop Net |
1829 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1830 * | Nexthop Host |
1831 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1832 * | Nexthop Host(cont) |
1833 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1835 * Optional External Data:
1836 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1837 * | Ext RouterID |
1838 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1839 * | Ext Router ID |
1840 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1841 * | Ext Autonomous System Number |
1842 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1843 * | Route Tag |
1844 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1845 * | Ext Protocol | Ext Flags | External Metric |
1846 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1847 * | External Delay |
1848 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1850 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1851 * | Scaled Delay |
1852 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1853 * | Scaled Delay | Scaled Bandwidth |
1854 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1855 * | Scaled Bandwidth | MTU |
1856 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1857 * | MTU(cont) | Hopcount | Reliability | Load |
1858 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1859 * | Internal Tag | Flag |
1860 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1864 static void
1865 dissect_eigrp_ipx_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1866 packet_info *pinfo, uint16_t tlv)
1868 int offset = 0;
1869 bool unreachable = false;
1871 /* nexthop for route... */
1872 offset = dissect_eigrp_nexthop(tree, tvb, EIGRP_AF_IPX, offset);
1874 /* dissect external data if needed */
1875 if ((tlv & EIGRP_TLV_TYPEMASK) == EIGRP_TLV_EXTERNAL) {
1876 offset = dissect_eigrp_ipx_extdata(tree, tvb, offset);
1879 /* dissect the metric */
1880 offset = dissect_eigrp_legacy_metric(tree, tvb, offset);
1882 /* dissect addresses */
1883 dissect_eigrp_ipx_addrs(ti, tree, tvb, pinfo, offset, unreachable);
1887 *@fn void dissect_eigrp_multi_topology_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1888 * packet_info *pinfo, proto_item *ti, uint16_t tlv)
1890 * @param[in,out] tree detail dissection result
1891 * @param[in] tvb packet data
1892 * @param[in] pinfo general data about the protocol
1893 * @param[in] ti protocol item
1894 * @param[in] tlv Specific TLV in to be dissected
1896 * @par
1897 * Dissect the Multi-Topology route TLV; This packet format has been deprecated
1898 * and replaced with the Multi-Protocol packet formats as of EIGRP Release-8. Of
1899 * course this means it will be around for a long long while. The following
1900 * represents the format
1902 * 1 2 3 0 1 1
1903 * 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
1904 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1905 * | Reserved |
1906 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1907 * | Topology Identifier | Family Identifier |
1908 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1909 * | Router ID |
1910 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1911 * | Route Tag |
1912 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1913 * | Scaled Delay |
1914 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1915 * | Scaled Bandwidth |
1916 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1917 * | MTU | Hopcount |
1918 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1919 * | Reliability | Load | Internal Tag | Flag |
1920 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1921 * |\/\/\/ NextHop (Family Specific Length) \/\/\/|
1922 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1923 * |\/\/\/ External Route Data (Optional) \/\/\/|
1924 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1925 * |\/\/\/ Destination (Family Specific Length) \/\/\/|
1926 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1929 static void
1930 dissect_eigrp_multi_topology_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
1931 packet_info *pinfo, uint16_t tlv)
1933 uint16_t afi;
1934 int offset = 2;
1935 bool unreachable = false;
1937 /* tid for you */
1938 proto_tree_add_item(tree, hf_eigrp_tid, tvb, offset, 2, ENC_BIG_ENDIAN);
1939 offset += 2;
1941 /* now it's all about the family */
1942 afi = tvb_get_ntohs(tvb, offset);
1943 proto_tree_add_item(tree, hf_eigrp_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
1944 offset += 2;
1946 /* gota have an id... */
1947 proto_tree_add_item(tree, hf_eigrp_routerid, tvb, offset, 4, ENC_BIG_ENDIAN);
1948 offset += 4;
1950 /* tag.. your it! */
1951 proto_tree_add_item(tree, hf_eigrp_legacy_metric_tag, tvb, offset, 4, ENC_BIG_ENDIAN);
1952 offset += 4;
1954 /* dissect the metric */
1955 offset = dissect_eigrp_legacy_metric(tree, tvb, offset);
1957 /* dissect nexthop */
1958 offset = dissect_eigrp_nexthop(tree, tvb, afi, offset);
1960 /* dissect external data if needed */
1961 if ((tlv & EIGRP_TLV_TYPEMASK) == EIGRP_TLV_EXTERNAL) {
1962 if (afi == EIGRP_AF_IPX) {
1963 offset = dissect_eigrp_ipx_extdata(tree, tvb, offset);
1964 } else {
1965 offset = dissect_eigrp_extdata(tree, tvb, offset);
1969 /* dissect dest information */
1970 switch (afi) {
1971 case EIGRP_AF_IPv4:
1972 dissect_eigrp_ipv4_addrs(ti, tree, tvb, pinfo, offset, unreachable);
1973 break;
1974 case EIGRP_AF_IPv6:
1975 dissect_eigrp_ipv6_addrs(ti, tree, tvb, pinfo, offset, unreachable);
1976 break;
1977 case EIGRP_AF_IPX:
1978 dissect_eigrp_ipx_addrs(ti, tree, tvb, pinfo, offset, unreachable);
1979 break;
1981 case EIGRP_SF_COMMON:
1982 case EIGRP_SF_IPv4:
1983 case EIGRP_SF_IPv6:
1984 dissect_eigrp_services(ti, tree, tvb, pinfo, offset);
1985 break;
1987 default:
1988 proto_tree_add_expert(tree, pinfo, &ei_eigrp_afi, tvb, offset, -1);
1993 *@fn int dissect_eigrp_metric_comm (proto_tree *tree, tvbuff_t *tvb, int offset, int limit)
1995 * @param[in,out] tree detail dissection result
1996 * @param[in] tvb packet data
1997 * @param[in] offset current byte offset in packet being processed
1998 * @param[in] limit maximum number of bytes which can be process
2000 * @return int number of bytes process
2002 * @par
2003 * Dissect extended community attached to metric TLVs to support VPNv4
2004 * deployments, The following represents the format
2006 * 0 1 2 3
2007 * 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
2008 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2009 * | Type high | Type low(*) | |
2010 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Value |
2011 * | |
2012 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2014 static int
2015 dissect_eigrp_metric_comm (proto_tree *tree, tvbuff_t *tvb, int offset, int limit)
2017 int comm_type;
2018 proto_item* ti;
2019 proto_tree* type_tree;
2021 while (limit > 0) {
2022 comm_type = tvb_get_ntohs(tvb, offset);
2023 ti = proto_tree_add_uint(tree, hf_eigrp_metric_comm_type, tvb, offset, 2, comm_type);
2024 type_tree = proto_item_add_subtree(ti, ett_metric_comm_type);
2026 offset += 2;
2028 switch (comm_type) {
2030 * Tag for this route. It is present for all EIGRP VPNv4
2031 * routes, internal and external
2033 case EIGRP_EXTCOMM_EIGRP:
2034 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_flag, tvb, offset, 2, ENC_BIG_ENDIAN);
2035 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_tag, tvb, offset+2, 4, ENC_BIG_ENDIAN);
2036 break;
2038 case EIGRP_EXTCOMM_VRR:
2039 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_res, tvb, offset, 2, ENC_BIG_ENDIAN);
2040 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_rid, tvb, offset+2, 4, ENC_BIG_ENDIAN);
2041 break;
2044 * Vecmetric information for given EIGRP VPNv4 route,
2045 * applies to both internal and external
2047 case EIGRP_EXTCOMM_DAD:
2048 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_as, tvb, offset, 2, ENC_BIG_ENDIAN);
2049 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_sdly, tvb, offset+2, 4, ENC_BIG_ENDIAN);
2050 break;
2052 case EIGRP_EXTCOMM_VRHB:
2053 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_rel, tvb, offset, 1, ENC_BIG_ENDIAN);
2054 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_hop, tvb, offset+1, 1, ENC_BIG_ENDIAN);
2055 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_sbw, tvb, offset+2, 4, ENC_BIG_ENDIAN);
2056 break;
2058 case EIGRP_EXTCOMM_SRLM:
2059 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_res, tvb, offset, 1, ENC_BIG_ENDIAN);
2060 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_load, tvb, offset+1, 1, ENC_BIG_ENDIAN);
2061 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_mtu, tvb, offset+2, 4, ENC_BIG_ENDIAN);
2062 break;
2065 * External information for given EIGRP VPNv4 route,
2066 * applies to only to external routes
2068 case EIGRP_EXTCOMM_SAR:
2069 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_xas, tvb, offset, 2, ENC_BIG_ENDIAN);
2070 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_xrid, tvb, offset+2, 4, ENC_BIG_ENDIAN);
2071 break;
2073 case EIGRP_EXTCOMM_RPM:
2074 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_xproto, tvb, offset, 2, ENC_BIG_ENDIAN);
2075 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_xmetric, tvb, offset+2, 4, ENC_BIG_ENDIAN);
2076 break;
2078 case EIGRP_EXTCOMM_SOO_ASFMT:
2079 case EIGRP_EXTCOMM_SOO_ADRFMT:
2080 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_as, tvb, offset, 2, ENC_BIG_ENDIAN);
2081 proto_tree_add_item(type_tree, hf_eigrp_extcomm_eigrp_tag, tvb, offset+2, 4, ENC_BIG_ENDIAN);
2082 break;
2085 proto_item_set_len(ti, 8);
2087 /*on to the next */
2088 offset += 6;
2089 limit -= 8;
2091 if (0 != limit%8) {
2092 break;
2097 return offset;
2101 *@fn int dissect_eigrp_wide_metric_attr (proto_tree *tree, tvbuff_t *tvb,
2102 * int offset, int limit)
2104 * @param[in,out] tree detail dissection result
2105 * @param[in] tvb packet data
2106 * @param[in] offset current byte offset in packet being processed
2107 * @param[in] limit maximum number of words which should be process
2109 * @return int number of bytes process
2111 * @par
2112 * Dissect the Metric Attributes which (optionally) are part of the wide-metric
2113 * route TLV. Some of the attributes which effect the metric are controlled by
2114 * K6 which is now part of the Parameter TLV. Also, eh extended community TLV is
2115 * no longer used, as it's now appended to the route
2117 static int
2118 dissect_eigrp_wide_metric_attr (proto_tree *tree, tvbuff_t *tvb,
2119 int offset, int limit)
2121 proto_tree *sub_tree;
2122 tvbuff_t *sub_tvb;
2123 int sub_offset;
2125 uint16_t attr_offset = 0;
2126 uint8_t attr_opcode = 0;
2128 limit *= 2; /* words to bytes */
2130 sub_tree = proto_tree_add_subtree(tree, tvb, offset, limit, ett_eigrp_tlv_attr, NULL, "Attributes");
2131 sub_tvb = tvb_new_subset_length_caplen(tvb, offset, limit, -1);
2132 sub_offset = 0;
2134 while (limit > 0) {
2135 attr_opcode = tvb_get_uint8(sub_tvb, sub_offset);
2136 proto_tree_add_item(sub_tree, hf_eigrp_attr_opcode, sub_tvb,
2137 sub_offset, 1, ENC_BIG_ENDIAN);
2138 sub_offset += 1;
2140 attr_offset = tvb_get_uint8(sub_tvb, sub_offset) * 2;
2141 proto_tree_add_item(sub_tree, hf_eigrp_attr_offset, sub_tvb,
2142 sub_offset, 1, ENC_BIG_ENDIAN);
2143 sub_offset += 1;
2145 switch (attr_opcode) {
2146 case EIGRP_ATTR_NOOP:
2147 break;
2149 case EIGRP_ATTR_SCALED:
2150 /* TODO: if this corresponds to RFC 7868, 6.9.3.2, should be scaled bandwidth
2151 followed by scaled delay (both 32 bits) ? */
2152 proto_tree_add_item(sub_tree, hf_eigrp_attr_scaled, sub_tvb,
2153 sub_offset, 4, ENC_BIG_ENDIAN);
2154 break;
2156 case EIGRP_ATTR_TAG:
2157 proto_tree_add_item(sub_tree, hf_eigrp_attr_tag, sub_tvb,
2158 sub_offset, 4, ENC_BIG_ENDIAN);
2159 break;
2161 case EIGRP_ATTR_COMM:
2162 dissect_eigrp_metric_comm(sub_tree,
2163 tvb_new_subset_length_caplen(sub_tvb, sub_offset, 8, -1),
2164 sub_offset, limit);
2165 break;
2167 case EIGRP_ATTR_JITTER:
2168 /* TODO: RFC 7868 6.9.3.5 suggests this value should be 6 bytes */
2169 proto_tree_add_item(sub_tree, hf_eigrp_attr_jitter, sub_tvb,
2170 sub_offset, 4, ENC_BIG_ENDIAN);
2171 break;
2173 case EIGRP_ATTR_QENERGY:
2174 /* TODO: RFC 7868 6.9.3.6 splits this into separate high and low 16-bit values */
2175 proto_tree_add_item(sub_tree, hf_eigrp_attr_qenergy, sub_tvb,
2176 sub_offset, 4, ENC_BIG_ENDIAN);
2177 break;
2179 case EIGRP_ATTR_ENERGY:
2180 /* TODO: RFC 7868 6.9.3.7 splits this into separate high and low 16-bit values */
2181 proto_tree_add_item(sub_tree, hf_eigrp_attr_energy, sub_tvb,
2182 sub_offset, 4, ENC_BIG_ENDIAN);
2183 break;
2185 default:
2186 break;
2188 sub_offset += attr_offset;
2189 limit -= (EIGRP_ATTR_HDRLEN + attr_offset);
2192 offset += sub_offset;
2193 return offset;
2197 *@fn int dissect_eigrp_wide_metric (proto_tree *tree, tvbuff_t *tvb, int offset)
2199 * @param[in,out] tree detail dissection result
2200 * @param[in] tvb packet data
2201 * @param[in] offset current byte offset in packet being processed
2203 * @return int number of bytes process
2205 * @par
2206 * Dissect the latest-n-greatest "Wide"Metric" definition for EIGRP. This
2207 * definition was created to address the higher speed links and should handle
2208 * things until we break the speed of light *wink*
2210 * 0 1 2 3
2211 * 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
2212 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2213 * | Offset | Priority | Reliability | Load |
2214 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2215 * | MTU | Hopcount |
2216 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2217 * | Delay |
2218 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2219 * | Delay | Bandwidth |
2220 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2221 * | Bandwidth |
2222 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2223 * | Reserved | Flags |
2224 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2225 * |\/\/\/ Extended Metrics (Variable Length) \/\/\/|
2226 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2229 static int
2230 dissect_eigrp_wide_metric (proto_tree *tree, tvbuff_t *tvb, int offset)
2232 proto_tree *sub_tree;
2233 tvbuff_t *sub_tvb;
2234 int8_t attr_size = 0;
2235 uint64_t big_num;
2237 sub_tree = proto_tree_add_subtree(tree, tvb, offset, 24, ett_eigrp_tlv_metric, NULL, "Wide Metric");
2238 sub_tvb = tvb_new_subset_length_caplen(tvb, offset, 24, -1);
2240 attr_size = tvb_get_uint8(sub_tvb, 0);
2242 proto_tree_add_item(sub_tree, hf_eigrp_metric_offset,
2243 sub_tvb, 0, 1, ENC_BIG_ENDIAN);
2244 proto_tree_add_item(sub_tree, hf_eigrp_metric_priority,
2245 sub_tvb, 1, 1, ENC_BIG_ENDIAN);
2246 proto_tree_add_item(sub_tree, hf_eigrp_metric_rel,
2247 sub_tvb, 2, 1, ENC_BIG_ENDIAN);
2248 proto_tree_add_item(sub_tree, hf_eigrp_metric_load,
2249 sub_tvb, 3, 1, ENC_BIG_ENDIAN);
2250 proto_tree_add_item(sub_tree, hf_eigrp_metric_mtu,
2251 sub_tvb, 4, 3, ENC_BIG_ENDIAN);
2252 proto_tree_add_item(sub_tree, hf_eigrp_metric_hopcount,
2253 sub_tvb, 7, 1, ENC_BIG_ENDIAN);
2255 /* The one-way latency along an unloaded path to the destination
2256 * expressed in units of nanoseconds per kilobyte. This number is not
2257 * scaled, as is the case with scaled delay. A delay of 0xFFFFFFFFFFFF
2258 * indicates an unreachable route. */
2259 big_num = tvb_get_ntoh64(sub_tvb, 8);
2260 big_num >>= 16;
2261 if (big_num == UINT64_C(0x0000ffffffffffff)) {
2262 proto_tree_add_uint64_format_value(sub_tree, hf_eigrp_metric_delay, sub_tvb, 8, 6, big_num, "Infinity");
2263 } else {
2264 proto_tree_add_uint64(sub_tree, hf_eigrp_metric_delay, sub_tvb, 8, 6, big_num);
2267 /* The path bandwidth measured in kilobyte per second as presented by
2268 * the interface. This number is not scaled, as is the case with scaled
2269 * bandwidth. A bandwidth of 0xFFFFFFFFFFFF indicates an unreachable
2270 * route.
2272 big_num = tvb_get_ntoh64(sub_tvb, 14);
2273 big_num >>= 16;
2274 if (big_num == UINT64_C(0x0000ffffffffffff)) {
2275 proto_tree_add_uint64_format_value(sub_tree, hf_eigrp_metric_bandwidth, sub_tvb, 14, 6, big_num, "Infinity");
2276 } else {
2277 proto_tree_add_uint64(sub_tree, hf_eigrp_metric_bandwidth, sub_tvb, 14, 6, big_num);
2279 proto_tree_add_item(sub_tree, hf_eigrp_metric_reserved, sub_tvb, 20, 2,
2280 ENC_BIG_ENDIAN);
2282 /* Decode the route flags field */
2283 dissect_eigrp_metric_flags(sub_tree, sub_tvb, 22, 2);
2284 offset += 24;
2286 /* any extended metric attributes? */
2287 if (attr_size > 0) {
2288 offset = dissect_eigrp_wide_metric_attr(tree, tvb, offset, attr_size);
2291 return offset;
2295 *@fn void dissect_eigrp_multi_protocol_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
2296 * packet_info *pinfo, uint16_t tlv)
2299 * @param[in,out] tree detail dissection result
2300 * @param[in] tvb packet data
2301 * @param[in] ti protocol item
2302 * @param[in] pinfo general data about the protocol
2304 * @par
2305 * Dissect the Multi-Protocol (TLV Version 2.0) TLV format definition. The following
2306 * represents the format
2308 * 0 1 2 3
2309 * 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
2310 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2311 * | Topology Identifier | Family Identifier |
2312 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2313 * | Router ID |
2314 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2315 * | Wide Metric |
2316 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2317 * |\/\/\/ Extended Metrics (Variable Length) \/\/\/|
2318 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2319 * |\/\/\/ NextHop (Family Specific Length) \/\/\/|
2320 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2321 * |\/\/\/ External Route Data (Optional) \/\/\/|
2322 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2323 * |\/\/\/ Destination (Family Specific Length) \/\/\/|
2324 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2326 static void
2327 dissect_eigrp_multi_protocol_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
2328 packet_info *pinfo, uint16_t tlv)
2330 int offset = 0;
2331 uint16_t afi;
2332 bool unreachable = false;
2334 /* tid for you */
2335 proto_tree_add_item(tree, hf_eigrp_tid, tvb, offset, 2, ENC_BIG_ENDIAN);
2336 offset += 2;
2338 /* now it's all about the family */
2339 afi = tvb_get_ntohs(tvb, offset);
2340 proto_tree_add_item(tree, hf_eigrp_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
2341 offset += 2;
2343 /* gota have an id... */
2344 proto_tree_add_item(tree, hf_eigrp_routerid, tvb, offset, 4, ENC_BIG_ENDIAN);
2345 offset += 4;
2347 /* decode the wide metric */
2348 offset = dissect_eigrp_wide_metric(tree, tvb, offset);
2350 /* dissect nexthop */
2351 offset = dissect_eigrp_nexthop(tree, tvb, afi, offset);
2353 /* dissect external data if needed */
2354 if ((tlv & EIGRP_TLV_TYPEMASK) == EIGRP_TLV_EXTERNAL) {
2355 if (afi == EIGRP_AF_IPX) {
2356 offset = dissect_eigrp_ipx_extdata(tree, tvb, offset);
2357 } else {
2358 offset = dissect_eigrp_extdata(tree, tvb, offset);
2362 /* dissect dest information */
2363 switch (afi) {
2364 case EIGRP_AF_IPv4:
2365 dissect_eigrp_ipv4_addrs(ti, tree, tvb, pinfo, offset, unreachable);
2366 break;
2368 case EIGRP_AF_IPv6:
2369 dissect_eigrp_ipv6_addrs(ti, tree, tvb, pinfo, offset, unreachable);
2370 break;
2372 case EIGRP_AF_IPX:
2373 dissect_eigrp_ipx_addrs(ti, tree, tvb, pinfo, offset, unreachable);
2374 break;
2376 case EIGRP_SF_COMMON:
2377 case EIGRP_SF_IPv4:
2378 case EIGRP_SF_IPv6:
2379 dissect_eigrp_services(ti, tree, tvb, pinfo, offset);
2380 break;
2382 default:
2383 proto_tree_add_expert(tree, pinfo, &ei_eigrp_afi, tvb, offset, -1);
2388 *@fn int dissect_eigrp (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, void *data)
2390 * @param[in] tvb packet data
2391 * @param[in] pinfo general data about the protocol
2392 * @param[in,out] tree detail dissection result
2394 * @return int 0 if packet is not for this decoder
2396 * @par
2397 * This function is called to dissect the packets presented to it. The packet
2398 * data is held in a special buffer referenced here as tvb. The packet info
2399 * structure contains general data about the protocol, and can update
2400 * information here. The tree parameter is where the detail dissection takes
2401 * place.
2403 #include <epan/in_cksum.h>
2405 static int
2406 dissect_eigrp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2408 proto_item *ti;
2409 proto_tree *eigrp_tree, *tlv_tree;
2410 unsigned opcode, vrid;
2411 uint16_t tlv;
2412 uint32_t ack, size, offset = EIGRP_HEADER_LENGTH;
2414 /* Make entries in Protocol column and Info column on summary display */
2415 col_set_str(pinfo->cinfo, COL_PROTOCOL, "EIGRP");
2417 /* This field shows up as the "Info" column in the display; you should use
2418 * it, if possible, to summarize what's in the packet, so that a user
2419 * looking at the list of packets can tell what type of packet it is. See
2420 * section 1.5 for more information.
2422 col_clear(pinfo->cinfo, COL_INFO);
2424 opcode = tvb_get_uint8(tvb, 1);
2425 ack = tvb_get_ntohl(tvb, 12);
2426 if ((opcode == EIGRP_OPC_HELLO) && (0 != ack)) {
2427 opcode = EIGRP_OPC_ACK;
2430 col_add_str(pinfo->cinfo, COL_INFO,
2431 val_to_str(opcode, eigrp_opcode2string, "Unknown OpCode (0x%04x)"));
2433 /* A protocol dissector may be called in 2 different ways - with, or
2434 * without a non-null "tree" argument.
2435 * Note also that there is no guarantee, the first time the dissector is
2436 * called, whether "tree" will be null or not; your dissector must work
2437 * correctly, building or updating whatever state information is necessary,
2438 * in either case.
2440 /* NOTE: The offset and length values in the call to
2441 * "proto_tree_add_item()" define what data bytes to highlight in the
2442 * hex display window when the line in the protocol tree display
2443 * corresponding to that item is selected.
2446 /* create display subtree for the protocol */
2447 ti = proto_tree_add_protocol_format(tree, proto_eigrp, tvb, 0, -1,
2448 "Cisco EIGRP");
2449 eigrp_tree = proto_item_add_subtree(ti, ett_eigrp);
2450 proto_tree_add_item(eigrp_tree, hf_eigrp_version, tvb, 0, 1,
2451 ENC_BIG_ENDIAN);
2452 proto_tree_add_item(eigrp_tree, hf_eigrp_opcode, tvb, 1, 1,
2453 ENC_BIG_ENDIAN);
2455 size = tvb_captured_length(tvb);
2456 proto_tree_add_checksum(eigrp_tree, tvb, 2, hf_eigrp_checksum, hf_eigrp_checksum_status, &ei_eigrp_checksum_bad,
2457 pinfo, ip_checksum_tvb(tvb, 0, size), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
2459 /* Decode the EIGRP Flags Field */
2460 proto_tree_add_bitmask(eigrp_tree, tvb, 4, hf_eigrp_flags, ett_eigrp_flags,
2461 eigrp_flag_fields, ENC_BIG_ENDIAN);
2463 proto_tree_add_item(eigrp_tree, hf_eigrp_sequence, tvb, 8, 4,
2464 ENC_BIG_ENDIAN);
2465 proto_tree_add_item(eigrp_tree, hf_eigrp_acknowledge, tvb, 12, 4,
2466 ENC_BIG_ENDIAN);
2468 /* print out what family we dealing with... */
2469 ti = proto_tree_add_item(eigrp_tree, hf_eigrp_vrid, tvb, 16, 2,
2470 ENC_BIG_ENDIAN);
2471 vrid = (tvb_get_ntohs(tvb, 16) & EIGRP_VRID_MASK);
2472 proto_item_append_text(ti, " %s", val_to_str_const(vrid, eigrp_vrid2string, ""));
2474 /* print autonomous-system */
2475 proto_tree_add_item(eigrp_tree, hf_eigrp_as, tvb, 18, 2,
2476 ENC_BIG_ENDIAN);
2478 switch (opcode) {
2479 case EIGRP_OPC_IPXSAP:
2480 call_dissector(ipxsap_handle,
2481 tvb_new_subset_remaining(tvb, EIGRP_HEADER_LENGTH), pinfo,
2482 eigrp_tree);
2483 break;
2485 default:
2486 while (tvb_reported_length_remaining(tvb, offset) > 0) {
2487 tlv = tvb_get_ntohs(tvb, offset);
2489 /* it's a rose by the wrong name... */
2490 if (tlv == EIGRP_TLV_MTR_TIDLIST) {
2491 tlv = EIGRP_TLV_PEER_TIDLIST;
2494 size = tvb_get_ntohs(tvb, offset + 2);
2495 if (size < 4) {
2497 * As the draft says, in section 6.6.2 "Length Field Encoding",
2498 * "The value does includes[sic] the Type and Length fields".
2500 * Therefore, it must be at least 4.
2502 proto_tree_add_expert(eigrp_tree, pinfo, &ei_eigrp_tlv_len, tvb, offset, -1);
2503 return tvb_captured_length(tvb);
2506 tlv_tree = proto_tree_add_subtree(eigrp_tree, tvb, offset, size, ett_eigrp_tlv, &ti,
2507 val_to_str(tlv, eigrp_tlv2string, "Unknown TLV (0x%04x)"));
2509 proto_tree_add_item(tlv_tree, hf_eigrp_tlv_type, tvb,
2510 offset, 2, ENC_BIG_ENDIAN);
2511 proto_tree_add_item(tlv_tree, hf_eigrp_tlv_len, tvb,
2512 (offset + 2), 2, ENC_BIG_ENDIAN);
2514 switch (tlv & EIGRP_TLV_RANGEMASK) {
2515 case EIGRP_TLV_GENERAL:
2516 dissect_eigrp_general_tlv(ti, tlv_tree, tvb_new_subset_length(tvb, (offset + 4), (size - 4)), pinfo, tlv);
2517 break;
2519 case EIGRP_TLV_IPv4:
2520 dissect_eigrp_ipv4_tlv(ti, tlv_tree, tvb_new_subset_length(tvb, (offset + 4), (size - 4)), pinfo, tlv);
2521 break;
2523 case EIGRP_TLV_ATALK:
2524 dissect_eigrp_atalk_tlv(ti, tlv_tree, tvb_new_subset_length(tvb, (offset + 4), (size - 4)), tlv);
2525 break;
2527 case EIGRP_TLV_IPX:
2528 dissect_eigrp_ipx_tlv(ti, tlv_tree, tvb_new_subset_length(tvb, (offset + 4), (size - 4)), pinfo, tlv);
2529 break;
2531 case EIGRP_TLV_IPv6:
2532 dissect_eigrp_ipv6_tlv(ti, tlv_tree, tvb_new_subset_length(tvb, (offset + 4), (size - 4)), pinfo, tlv);
2533 break;
2535 case EIGRP_TLV_MP:
2536 dissect_eigrp_multi_protocol_tlv(ti, tlv_tree, tvb_new_subset_length(tvb, (offset + 4), (size - 4)),
2537 pinfo, tlv);
2538 break;
2540 case EIGRP_TLV_MTR:
2541 dissect_eigrp_multi_topology_tlv(ti, tlv_tree, tvb_new_subset_length(tvb, (offset + 4), (size - 4)),
2542 pinfo, tlv);
2543 break;
2545 default:
2546 expert_add_info_format(pinfo, ti, &ei_eigrp_tlv_type, "Unknown TLV Group (0x%04x)", tlv);
2549 offset += size;
2551 break;
2554 /* Return the amount of data this dissector was able to dissect */
2555 return tvb_captured_length(tvb);
2558 static void
2559 eigrp_fmt_cable_range(char *result, uint32_t revision )
2561 snprintf( result, ITEM_LABEL_LENGTH, "%u-%u", (uint16_t)(( revision & 0xFFFF0000 ) >> 16), (uint16_t)(revision & 0xFFFF) );
2564 static void
2565 eigrp_fmt_nexthop_address(char *result, uint32_t revision )
2567 snprintf( result, ITEM_LABEL_LENGTH, "%u.%u", (uint16_t)(( revision & 0xFFFF0000 ) >> 16), (uint16_t)(revision & 0xFFFF) );
2570 static void
2571 eigrp_fmt_version(char *result, uint32_t revision )
2573 snprintf( result, ITEM_LABEL_LENGTH, "%d.%02d", (uint8_t)(( revision & 0xFF00 ) >> 8), (uint8_t)(revision & 0xFF) );
2577 *@fn void proto_register_eigrp (void)
2579 * @usage
2580 * you can not have the function name inside a comment or else Wireshark
2581 * will fail with "duplicate protocol" error. Don't you hate it when tools
2582 * try to be to smart :(
2584 * @par
2585 * Register the protocol with Wireshark
2586 * this format is require because a script is used to build the C function
2587 * that calls all the protocol registration.
2589 void
2590 proto_register_eigrp(void)
2592 /* Setup list of header fields See Section 1.6.1 for details
2594 static hf_register_info hf[] = {
2597 * EIGRP Packet Header definitions
2599 * 0 1 2 3
2600 * 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
2601 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2602 * |Ver | Opcode | Checksum |
2603 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2604 * | Flags |
2605 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2606 * | Sequence number |
2607 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2608 * | Acknowledgement number |
2609 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2610 * | Virtual Router ID | Autonomous system number |
2611 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2613 { &hf_eigrp_version,
2614 { "Version", "eigrp.version",
2615 FT_UINT8, BASE_DEC, NULL, 0x0,
2616 "Version - Version of EIGRP packet format", HFILL }
2618 { &hf_eigrp_opcode,
2619 { "Opcode", "eigrp.opcode",
2620 FT_UINT8, BASE_DEC, VALS(eigrp_opcode2string), 0x0,
2621 "Opcode - Operation code indicating the message type", HFILL }
2623 { &hf_eigrp_flags,
2624 { "Flags", "eigrp.flags",
2625 FT_UINT32, BASE_HEX, NULL, 0x0,
2626 "Flag - Initialization bit and is used in establishing "
2627 "a new neighbor relationship", HFILL }
2629 { &hf_eigrp_sequence,
2630 { "Sequence", "eigrp.seq",
2631 FT_UINT32, BASE_DEC, NULL, 0x0,
2632 "Sequence number -- used to send messages reliably", HFILL }
2634 { &hf_eigrp_acknowledge,
2635 { "Acknowledge", "eigrp.ack",
2636 FT_UINT32, BASE_DEC, NULL, 0x0,
2637 "Acknowledge number -- used to send messages reliably", HFILL }
2639 { &hf_eigrp_vrid,
2640 { "Virtual Router ID", "eigrp.vrid",
2641 FT_UINT16, BASE_DEC, NULL, 0,
2642 "Virtual Router ID - For each Virtual Router, there is a separate topology "
2643 "table and routing/service table; even for matching AS. "
2644 "This field allows the gateway to select which set router to use.", HFILL }
2646 { &hf_eigrp_as,
2647 { "Autonomous System", "eigrp.as",
2648 FT_UINT16, BASE_DEC, NULL, 0x0,
2649 "Autonomous system number - Each AS has a separate topology table "
2650 "which for a give routing/service table. A gateway can participate "
2651 "in more than one AS. This field allows the gateway to"
2652 "select which set of topology tables to use.", HFILL }
2656 * Define eigrp_flags bits here
2658 * Init bit definition. First unicast transmitted Update has this
2659 * bit set in the flags field of the fixed header. It tells the neighbor
2660 * to send its full topology table.
2662 { &hf_eigrp_flags_init,
2663 { "Init", "eigrp.flags.init",
2664 FT_BOOLEAN, 32, TFS(&tfs_set_notset), EIGRP_INIT_FLAG,
2665 "Init - tells the neighbor to send its full topology table", HFILL }
2669 * Conditionally Received - Any packet with the CR-bit set can
2670 * be accepted by an EIGRP speaker if and only if a previous Hello was
2671 * received with the SEQUENCE_TYPE TLV present.
2672 * This allows multicasts to be transmitted in order and reliably at the
2673 * same time as unicasts are transmitted.
2675 { &hf_eigrp_flags_condrecv,
2676 { "Conditional Receive", "eigrp.flags.condrecv",
2677 FT_BOOLEAN, 32, TFS(&tfs_set_notset), EIGRP_CR_FLAG,
2678 "Conditionally Received the next packet if address was in listed "
2679 "in the previous HELLO", HFILL }
2683 * Restart flag is set in the hello and the init update
2684 * packets during the nsf signaling period. A nsf-aware
2685 * router looks at the RS flag to detect if a peer is restarting
2686 * and maintain the adjacency. A restarting router looks at
2687 * this flag to determine if the peer is helping out with the restart.
2689 { &hf_eigrp_flags_restart,
2690 { "Restart", "eigrp.flags.restart",
2691 FT_BOOLEAN, 32, TFS(&tfs_set_notset), EIGRP_RS_FLAG,
2692 "Restart flag - Set in the HELLO and the initial "
2693 "UPDATE packets during the nsf signaling period.", HFILL },
2697 * EOT bit. The End-of-Table flag marks the end of the start-up updates
2698 * sent to a new peer. A nsf restarting router looks at this flag to
2699 * determine if it has finished receiving the start-up updates from all
2700 * peers. A nsf-aware router waits for this flag before cleaning up
2701 * the stale routes from the restarting peer.
2703 { &hf_eigrp_flags_eot,
2704 { "End Of Table", "eigrp.flags.eot",
2705 FT_BOOLEAN, 32, TFS(&tfs_set_notset), EIGRP_EOT_FLAG,
2706 "End-of-Table - Marks the end of the start-up UPDATES indicating the "
2707 "complete topology database has been sent to a new peer", HFILL }
2711 * TLV type definitions. Generic (protocol-independent) TLV types are
2712 * defined here. Protocol-specific ones are defined later
2714 * +-----+------------------+
2715 * | | | |
2716 * | Type| Len | Vector |
2717 * | | | |
2718 * +-----+------------------+
2720 * TLV type definitions. Generic (protocol-independent) TLV types are
2721 * defined here. Protocol-specific ones are defined elsewhere.
2723 * EIGRP_PARAMETER 0x0001 parameter
2724 * EIGRP_AUTH 0x0002 authentication
2725 * EIGRP_SEQUENCE 0x0003 sequenced packet
2726 * EIGRP_SW_VERSION 0x0004 software version
2727 * EIGRP_NEXT_MCAST_SEQ 0x0005 multicast sequence
2728 * EIGRP_PEER_STUBINFO 0x0006 stub information
2729 * EIGRP_PEER_TERMINATION 0x0007 peer termination
2731 { &hf_eigrp_tlv_type,
2732 { "Type", "eigrp.tlv_type",
2733 FT_UINT16, BASE_HEX, VALS(eigrp_tlv2string), 0x0,
2734 "TLV Type", HFILL }
2736 { &hf_eigrp_tlv_len,
2737 { "Length", "eigrp.tlv.len",
2738 FT_UINT16, BASE_DEC, NULL, 0x0,
2739 "TLV Length", HFILL }
2742 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2743 * Parameters TLV
2745 { &hf_eigrp_par_k1, { "K1", "eigrp.par.k1", FT_UINT8, BASE_DEC, NULL, 0x0,
2746 "Bandwidth/Throughput Coefficient", HFILL }},
2747 { &hf_eigrp_par_k2, { "K2", "eigrp.par.k2", FT_UINT8, BASE_DEC, NULL, 0x0,
2748 "Load Coefficient", HFILL }},
2749 { &hf_eigrp_par_k3, { "K3", "eigrp.par.k3", FT_UINT8, BASE_DEC, NULL, 0x0,
2750 "Delay/Latency Coefficient", HFILL }},
2751 { &hf_eigrp_par_k4, { "K4", "eigrp.par.k4", FT_UINT8, BASE_DEC, NULL, 0x0,
2752 "Reliability Coefficient", HFILL }},
2753 { &hf_eigrp_par_k5, { "K5", "eigrp.par.k5", FT_UINT8, BASE_DEC, NULL, 0x0,
2754 "Reliability Coefficient", HFILL }},
2755 { &hf_eigrp_par_k6, { "K6", "eigrp.par.k6", FT_UINT8, BASE_DEC, NULL, 0x0,
2756 "Extended Metric Coefficient", HFILL }},
2757 { &hf_eigrp_par_holdtime,
2758 { "Hold Time", "eigrp.par.holdtime", FT_UINT16, BASE_DEC, NULL, 0x0,
2759 "How long to ignore lost HELLO's", HFILL }
2762 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2763 * Authentication TLV
2765 { &hf_eigrp_auth_type,
2766 { "Type", "eigrp.auth.type",
2767 FT_UINT16, BASE_DEC, VALS(eigrp_auth2string), 0x0,
2768 NULL, HFILL }
2770 { &hf_eigrp_auth_len,
2771 { "Length", "eigrp.auth.length",
2772 FT_UINT16, BASE_DEC, NULL, 0x0,
2773 NULL, HFILL }
2775 { &hf_eigrp_auth_keyid,
2776 { "Key ID", "eigrp.auth.keyid",
2777 FT_UINT32, BASE_DEC, NULL, 0x0,
2778 NULL, HFILL }
2780 { &hf_eigrp_auth_keyseq,
2781 { "Key Sequence", "eigrp.auth.keyseq",
2782 FT_UINT32, BASE_DEC, NULL, 0x0,
2783 NULL, HFILL }
2785 { &hf_eigrp_auth_digest,
2786 { "Digest", "eigrp.auth.digest",
2787 FT_BYTES, BASE_NONE, NULL, 0x0,
2788 NULL, HFILL }
2791 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2792 * Sequence TLV
2794 { &hf_eigrp_seq_addrlen,
2795 { "Address length", "eigrp.seq.addrlen",
2796 FT_UINT8, BASE_DEC, NULL, 0x0,
2797 NULL, HFILL }
2799 { &hf_eigrp_seq_ipv4addr,
2800 { "IP Address", "eigrp.seq.ipv4addr",
2801 FT_IPv4, BASE_NONE, NULL, 0x0,
2802 NULL, HFILL }
2804 { &hf_eigrp_seq_ipv6addr,
2805 { "IPv6 Address", "eigrp.seq.ipv6addr",
2806 FT_IPv6, BASE_NONE, NULL, 0x0,
2807 NULL, HFILL }
2810 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2811 * Next Multicast Sequence
2814 * This was added to the hello containing the sequence TLV so that the
2815 * hello packet could be more tightly bound to the multicast packet bearing
2816 * the CR bit that follows it. The sequence number of the impending multicast
2817 * is carried herein.
2819 { &hf_eigrp_next_mcast_seq,
2820 { "Multicast Sequence", "eigrp.next_mcast_seq",
2821 FT_UINT32, BASE_DEC, NULL, 0x0,
2822 NULL, HFILL }
2825 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2826 * Peer Stub Information TLV
2828 { &hf_eigrp_stub_flags,
2829 { "Stub Options", "eigrp.stub_options",
2830 FT_UINT16, BASE_HEX, NULL, 0x0,
2831 NULL, HFILL }
2835 * Define eigrp_stub_flags bits here
2837 { &hf_eigrp_stub_flags_connected,
2838 { "Connected", "eigrp.stub_options.connected",
2839 FT_BOOLEAN, 16, TFS(&tfs_set_notset), EIGRP_PEER_ALLOWS_CONNECTED,
2840 NULL, HFILL }
2842 { &hf_eigrp_stub_flags_static,
2843 { "Static", "eigrp.stub_options.static",
2844 FT_BOOLEAN, 16, TFS(&tfs_set_notset), EIGRP_PEER_ALLOWS_STATIC,
2845 NULL, HFILL }
2847 { &hf_eigrp_stub_flags_summary,
2848 { "Summary", "eigrp.stub_options.summary",
2849 FT_BOOLEAN, 16, TFS(&tfs_set_notset), EIGRP_PEER_ALLOWS_SUMMARY,
2850 NULL, HFILL }
2852 { &hf_eigrp_stub_flags_redist,
2853 { "Redistributed", "eigrp.stub_options.redist",
2854 FT_BOOLEAN, 16, TFS(&tfs_set_notset), EIGRP_PEER_ALLOWS_REDIST,
2855 NULL, HFILL }
2857 { &hf_eigrp_stub_flags_leakmap,
2858 { "Leak-Map", "eigrp.stub_options.leakmap",
2859 FT_BOOLEAN, 16, TFS(&tfs_set_notset), EIGRP_PEER_ALLOWS_LEAKING,
2860 NULL, HFILL }
2862 { &hf_eigrp_stub_flags_recvonly,
2863 { "Receive-Only", "eigrp.stub_options.recvonly",
2864 FT_BOOLEAN, 16, TFS(&tfs_set_notset), EIGRP_PEER_ALLOWS_RCVONLY,
2865 NULL, HFILL }
2868 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2869 * Peer Termination TLV
2871 /* Place holder - this TLV has no options */
2873 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2874 * EIGRP 3.0 Vector Header (deprecated)
2877 * common header for all version 3 tlvs
2879 { &hf_eigrp_tid,
2880 { "Topology", "eigrp.tid",
2881 FT_UINT16, BASE_DEC, NULL, 0x0,
2882 NULL, HFILL }
2884 { &hf_eigrp_afi,
2885 { "AFI", "eigrp.afi",
2886 FT_UINT16, BASE_DEC, VALS(eigrp_afi2string), 0x0,
2887 NULL, HFILL }
2890 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2891 * EIGRP TLV 1.2 (legacy) and TLV 3.0 Metric (deprecated) definition
2893 { &hf_eigrp_legacy_metric_delay,
2894 { "Scaled Delay", "eigrp.old_metric.delay",
2895 FT_UINT32, BASE_DEC, NULL, 0x0,
2896 "delay, in 39.1 nanosec interments", HFILL }
2898 { &hf_eigrp_legacy_metric_bw,
2899 { "Scaled BW", "eigrp.old_metric.bw",
2900 FT_UINT32, BASE_DEC, NULL, 0x0,
2901 "bandwidth, in units of 1 Kbit/sec", HFILL }
2903 { &hf_eigrp_legacy_metric_mtu,
2904 { "MTU", "eigrp.old_metric.mtu",
2905 FT_UINT24, BASE_DEC, NULL, 0x0,
2906 "MTU, in octets", HFILL }
2908 { &hf_eigrp_legacy_metric_hopcount,
2909 { "Hop Count", "eigrp.old_metric.hopcount",
2910 FT_UINT8, BASE_DEC, NULL, 0x0,
2911 "Number of hops to destination", HFILL }
2913 { &hf_eigrp_legacy_metric_rel,
2914 { "Reliability", "eigrp.old_metric.rel",
2915 FT_UINT8, BASE_DEC, NULL, 0x0,
2916 "percent packets successfully tx/rx", HFILL }
2918 { &hf_eigrp_legacy_metric_load,
2919 { "Load", "eigrp.old_metric.load",
2920 FT_UINT8, BASE_DEC, NULL, 0x0,
2921 "percent of channel occupied", HFILL }
2923 { &hf_eigrp_legacy_metric_intag,
2924 { "Route Tag", "eigrp.old_metric.intag",
2925 FT_UINT8, BASE_DEC, NULL, 0x0,
2926 "Internal Route Tag", HFILL }
2929 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2930 * EIGRP 3.0 TIDLIST TLV (only survivor in MTR)
2932 { &hf_eigrp_tidlist_tid,
2933 { "TID List", "eigrp.tidlist",
2934 FT_UINT16, BASE_DEC, NULL, 0x0,
2935 NULL, HFILL }
2937 { &hf_eigrp_tidlist_flags,
2938 { "TID List Flags", "eigrp.tidlist.flags",
2939 FT_UINT16, BASE_HEX, NULL, 0x0,
2940 NULL, HFILL }
2942 { &hf_eigrp_tidlist_len,
2943 { "TID List Size", "eigrp.tidlist.len",
2944 FT_UINT16, BASE_DEC, NULL, 0x0,
2945 NULL, HFILL }
2947 { &hf_eigrp_routerid,
2948 { "RouterID", "eigrp.routerid",
2949 FT_IPv4, BASE_NONE, NULL, 0x0,
2950 "Router ID of injecting router", HFILL }
2952 { &hf_eigrp_legacy_metric_tag,
2953 { "Tag", "eigrp.old_metric.tag",
2954 FT_UINT32, BASE_DEC, NULL, 0x0,
2955 "route tag", HFILL }
2958 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2960 * PDM opaque flag field definitions
2962 { &hf_eigrp_metric_flags_srcwd,
2963 { "Source Withdraw", "eigrp.metric.flags.srcwd",
2964 FT_BOOLEAN, 8, NULL, EIGRP_OPAQUE_SRCWD,
2965 "Route Source Withdraw", HFILL }
2967 { &hf_eigrp_metric_flags_cd,
2968 { "Candidate Default", "eigrp.metric.flags.cd",
2969 FT_BOOLEAN, 8, NULL, EIGRP_OPAQUE_CD,
2970 NULL, HFILL }
2972 { &hf_eigrp_metric_flags_active,
2973 { "Route is Active", "eigrp.metric.flags.active",
2974 FT_BOOLEAN, 8, NULL, EIGRP_OPAQUE_ACTIVE,
2975 "Route is currently in active state", HFILL }
2977 { &hf_eigrp_metric_flags_repl,
2978 { "Route is Replicated", "eigrp.metric.flags.repl",
2979 FT_BOOLEAN, 8, NULL, EIGRP_OPAQUE_REPL,
2980 "Route is replicated from different tableid", HFILL }
2983 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2984 * EIGRP TLV 1.2/3.0 ExtData Definitions
2986 { &hf_eigrp_extdata_origrid,
2987 { "Originating RouterID", "eigrp.extdata.origrid",
2988 FT_IPv4, BASE_NONE, NULL, 0x0,
2989 "Router ID of redistributing router", HFILL }
2992 { &hf_eigrp_extdata_as,
2993 { "Originating A.S.", "eigrp.extdata.as",
2994 FT_UINT32, BASE_DEC, NULL, 0x0,
2995 "Autonomous System of redistributing protocol", HFILL }
2998 { &hf_eigrp_extdata_tag,
2999 { "Administrative Tag", "eigrp.extdata.tag",
3000 FT_UINT32, BASE_DEC, NULL, 0x0,
3001 "Administrative Route Tag", HFILL }
3003 { &hf_eigrp_extdata_metric,
3004 { "External Metric", "eigrp.extdata.metric",
3005 FT_UINT32, BASE_DEC, NULL, 0x0,
3006 "Metric reported by redistributing protocol", HFILL }
3008 { &hf_eigrp_extdata_reserved,
3009 { "Reserved", "eigrp.extdata.reserved",
3010 FT_UINT16, BASE_DEC, NULL, 0x0,
3011 NULL, HFILL }
3014 /* IPX ExtData Definitions */
3015 { &hf_eigrp_ipx_extdata_delay,
3016 { "External Delay", "eigrp.extdata.ipx_delay",
3017 FT_UINT16, BASE_DEC, NULL, 0x0,
3018 "Delay reported by redistributing protocol", HFILL }
3020 { &hf_eigrp_ipx_extdata_metric,
3021 { "External Metric", "eigrp.extdata.ipx_metric",
3022 FT_UINT16, BASE_DEC, NULL, 0x0,
3023 "Delay reported by redistributing protocol", HFILL }
3026 { &hf_eigrp_extdata_proto,
3027 { "External Protocol ID", "eigrp.extdata.proto",
3028 FT_UINT8, BASE_DEC, VALS(eigrp_proto2string), 0x0,
3029 NULL, HFILL }
3032 { &hf_eigrp_extdata_flag_ext,
3033 { "Route is External", "eigrp.opaque.flag.ext",
3034 FT_BOOLEAN, 8, NULL, EIGRP_OPAQUE_EXT,
3035 NULL, HFILL }
3037 { &hf_eigrp_extdata_flag_cd,
3038 { "Route is Candidate Default", "eigrp.opaque.flag.cd",
3039 FT_BOOLEAN, 8, NULL, EIGRP_OPAQUE_CD,
3040 NULL, HFILL }
3043 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3044 * EIGRP TLV 2.0 "Wide" Metric format definition
3046 /* Number of 16bit words in the metric section, used to determine the
3047 * start of the destination/attribute information.
3049 { &hf_eigrp_metric_offset,
3050 { "Offset", "eigrp.metric.offset",
3051 FT_UINT8, BASE_DEC, NULL, 0x0,
3052 "Number of 16bit words to reach the start of the"
3053 "destination/attribute information", HFILL }
3056 /* Priority of the prefix when transmitting a group of destination
3057 * addresses to neighboring routers. A priority of zero indicates no
3058 * priority is set.
3060 { &hf_eigrp_metric_priority,
3061 { "Priority", "eigrp.metric.priority",
3062 FT_UINT8, BASE_DEC, NULL, 0x0,
3063 "Priority of the prefix for ordering transmission", HFILL }
3066 /** The current error rate for the path. Measured as an error
3067 * percentage. A value of 255 indicates 100% reliability
3069 { &hf_eigrp_metric_rel,
3070 { "Reliability", "eigrp.metric.reliability",
3071 FT_UINT8, BASE_DEC, NULL, 0x0,
3072 "percent packets successfully tx/rx", HFILL }
3075 /** The load utilization of the path to the destination. Measured as a
3076 * percentage of load. A value of 255 indicates 100% load.
3078 { &hf_eigrp_metric_load,
3079 { "Load", "eigrp.metric.load",
3080 FT_UINT8, BASE_DEC, NULL, 0x0,
3081 "percent of channel occupied", HFILL }
3084 /** The minimum maximum transmission unit size for the path to the
3085 * destination. Not used in metric calculation, but available to
3086 * underlying protocols
3088 { &hf_eigrp_metric_mtu,
3089 { "MTU", "eigrp.metric.mtu",
3090 FT_UINT24, BASE_DEC, NULL, 0x0,
3091 "MTU, in octets", HFILL }
3094 /** number of router traversals to the destination */
3095 { &hf_eigrp_metric_hopcount,
3096 { "Hop Count", "eigrp.metric.hopcount",
3097 FT_UINT8, BASE_DEC, NULL, 0x0,
3098 "Number of hops to destination", HFILL }
3101 /* Reserved - Transmitted as 0x0000 */
3102 { &hf_eigrp_metric_reserved,
3103 { "Reserved", "eigrp.metric.reserved",
3104 FT_UINT16, BASE_HEX, NULL, 0x0,
3105 NULL, HFILL }
3108 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3109 * EIGRP TLV 2.0 Extended Metric Attributes
3111 { &hf_eigrp_attr_opcode,
3112 { "Opcode", "eigrp.attr.opcode",
3113 FT_UINT8, BASE_DEC, VALS(eigrp_attr_opcode2string), 0x0,
3114 "Opcode - Operation code indicating the attribute type", HFILL }
3116 { &hf_eigrp_attr_offset,
3117 { "Offset", "eigrp.attr.offset",
3118 FT_UINT8, BASE_DEC, NULL, 0x0,
3119 "Number of 2 byte words of data", HFILL }
3121 { &hf_eigrp_attr_scaled,
3122 { "Legacy Metric", "eigrp.attr.scaled",
3123 FT_UINT32, BASE_DEC, NULL, 0x0,
3124 "Metric calculated from legacy TLVs", HFILL }
3126 { &hf_eigrp_attr_tag,
3127 { "Tag", "eigrp.attr.tag",
3128 FT_UINT32, BASE_DEC, NULL, 0x0,
3129 "Tag assigned by admin for dest", HFILL }
3131 { &hf_eigrp_attr_jitter,
3132 { "Jitter", "eigrp.attr.jitter",
3133 FT_UINT32, BASE_DEC, NULL, 0x0,
3134 "Variation in path delay", HFILL }
3136 { &hf_eigrp_attr_qenergy,
3137 { "Q-Energy", "eigrp.attr.qenergy",
3138 FT_UINT32, BASE_DEC, NULL, 0x0,
3139 "Non-Active energy usage along path", HFILL }
3141 { &hf_eigrp_attr_energy,
3142 { "Energy", "eigrp.attr.energy",
3143 FT_UINT32, BASE_DEC, NULL, 0x0,
3144 "Active energy usage along path", HFILL }
3147 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3149 * IPv4 specific address definitions
3151 { &hf_eigrp_ipv4_nexthop,
3152 { "NextHop", "eigrp.ipv4.nexthop",
3153 FT_IPv4, BASE_NONE, NULL, 0x0,
3154 NULL, HFILL }
3156 { &hf_eigrp_ipv4_prefixlen,
3157 { "Prefix Length", "eigrp.ipv4.prefixlen",
3158 FT_UINT8, BASE_DEC, NULL, 0x0,
3159 NULL, HFILL }
3162 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3164 * IPv6 specific address definitions
3166 { &hf_eigrp_ipv6_nexthop,
3167 { "NextHop", "eigrp.ipv6.nexthop",
3168 FT_IPv6, BASE_NONE, NULL, 0x0,
3169 NULL, HFILL }
3172 { &hf_eigrp_ipv6_prefixlen,
3173 { "Prefix Length", "eigrp.ipv6.prefixlen",
3174 FT_UINT8, BASE_DEC, NULL, 0x0,
3175 NULL, HFILL }
3178 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3180 * IPX specific address definitions
3182 { &hf_eigrp_ipx_nexthop_net,
3183 { "NextHop Net", "eigrp.ipx.nexthop_net",
3184 FT_IPXNET, BASE_NONE, NULL, 0x0,
3185 NULL, HFILL }
3187 { &hf_eigrp_ipx_nexthop_host,
3188 { "NextHop Host", "eigrp.ipx.nexthop_host",
3189 FT_ETHER, BASE_NONE, NULL, 0x0,
3190 NULL, HFILL }
3192 { &hf_eigrp_ipx_extdata_routerid,
3193 { "External RouterID", "eigrp.ipx.routerid",
3194 FT_ETHER, BASE_NONE, NULL, 0x0,
3195 "Router ID of redistributing router", HFILL }
3197 { &hf_eigrp_ipx_dest,
3198 { "Destination", "eigrp.ipx.dest",
3199 FT_IPXNET, BASE_NONE, NULL, 0x0,
3200 NULL, HFILL }
3203 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3205 * AppleTalk specific address definitions
3207 { &hf_eigrp_atalk_routerid,
3208 { "AppleTalk Router ID", "eigrp.atalk.routerid",
3209 FT_UINT32, BASE_DEC, NULL, 0x0,
3210 NULL, HFILL }
3213 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3214 * Service Advertisement Framework definitions
3216 { &hf_eigrp_saf_service,
3217 { "Service", "eigrp.saf.service",
3218 FT_UINT16, BASE_DEC, VALS(eigrp_saf_srv2string), 0x0,
3219 NULL, HFILL }
3221 { &hf_eigrp_saf_subservice,
3222 { "Sub-Service", "eigrp.saf.subservice",
3223 FT_UINT16, BASE_DEC, NULL, 0x0,
3224 NULL, HFILL }
3226 { &hf_eigrp_saf_guid,
3227 { "GUID", "eigrp.saf.guid",
3228 FT_GUID, BASE_NONE, NULL, 0x0,
3229 NULL, HFILL }
3231 { &hf_eigrp_saf_data_type,
3232 { "Type", "eigrp.saf.data.type",
3233 FT_UINT16, BASE_HEX, VALS(eigrp_saf_type2string), 0x0,
3234 "SAF Message Data Type", HFILL }
3236 { &hf_eigrp_saf_data_length,
3237 { "Length", "eigrp.saf.data.length",
3238 FT_UINT16, BASE_DEC, NULL, 0x0,
3239 NULL, HFILL }
3241 { &hf_eigrp_saf_data_sequence,
3242 { "Sequence", "eigrp.saf.data.sequence",
3243 FT_UINT32, BASE_DEC, NULL, 0x0,
3244 NULL, HFILL }
3246 { &hf_eigrp_saf_reachability_afi,
3247 { "AFI", "eigrp.saf.data.reachability.afi",
3248 FT_UINT16, BASE_DEC, VALS(eigrp_afi2string), 0x0,
3249 NULL, HFILL }
3251 { &hf_eigrp_saf_reachability_port,
3252 { "Port", "eigrp.saf.data.reachability.port",
3253 FT_UINT16, BASE_DEC, NULL, 0x0,
3254 NULL, HFILL }
3256 { &hf_eigrp_saf_reachability_protocol,
3257 { "Protocol", "eigrp.saf.data.reachability.protocol",
3258 FT_UINT16, BASE_DEC, NULL, 0x0,
3259 NULL, HFILL }
3261 { &hf_eigrp_saf_reachability_addr_ipv4,
3262 { "IPv4 Addr", "eigrp.saf.data.reachability.addr_ipv4",
3263 FT_IPv4, BASE_NONE, NULL, 0x0,
3264 NULL, HFILL }
3266 { &hf_eigrp_saf_reachability_addr_ipv6,
3267 { "IPv6 Addr", "eigrp.saf.data.reachability.addr_ipv6",
3268 FT_IPv6, BASE_NONE, NULL, 0x0,
3269 NULL, HFILL }
3271 { &hf_eigrp_saf_reachability_addr_hex,
3272 { "Addr", "eigrp.saf.data.reachability.addr_hex",
3273 FT_BYTES, BASE_NONE, NULL, 0x0,
3274 NULL, HFILL }
3277 /* misc field used in a couple places */
3278 { &hf_eigrp_nullpad,
3279 { "Nullpad", "eigrp.nullpad",
3280 FT_BYTES, BASE_NONE, NULL, 0x0,
3281 NULL, HFILL }
3284 /* Generated from convert_proto_tree_add_text.pl */
3285 { &hf_eigrp_ipx_address, { "IPX Address", "eigrp.ipx_address", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3286 { &hf_eigrp_release, { "EIGRP Release", "eigrp.release_version", FT_UINT16, BASE_CUSTOM, CF_FUNC(eigrp_fmt_version), 0x0, NULL, HFILL }},
3287 { &hf_eigrp_tlv_version, { "EIGRP TLV version", "eigrp.tlv_version", FT_UINT16, BASE_CUSTOM, CF_FUNC(eigrp_fmt_version), 0x0, NULL, HFILL }},
3288 { &hf_eigrp_ipv4_destination, { "Destination", "eigrp.ipv4.destination", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3289 { &hf_eigrp_ipv6_destination, { "Destination", "eigrp.ipv6.destination", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3290 { &hf_eigrp_appletalk_cable_range, { "AppleTalk Cable Range", "eigrp.appletalk_cable_range", FT_UINT32, BASE_CUSTOM, CF_FUNC(eigrp_fmt_cable_range), 0x0, NULL, HFILL }},
3291 { &hf_eigrp_nexthop_address, { "NextHop Address", "eigrp.nexthop_address", FT_UINT32, BASE_CUSTOM, CF_FUNC(eigrp_fmt_nexthop_address), 0x0, NULL, HFILL }},
3292 { &hf_eigrp_cable_range, { "Cable range", "eigrp.cable_range", FT_UINT32, BASE_CUSTOM, CF_FUNC(eigrp_fmt_cable_range), 0x0, NULL, HFILL }},
3293 { &hf_eigrp_metric_delay, { "Delay", "eigrp.metric.delay", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3294 { &hf_eigrp_metric_bandwidth, { "Bandwidth", "eigrp.metric.bandwidth", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3295 { &hf_eigrp_checksum, { "Checksum", "eigrp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3296 { &hf_eigrp_checksum_status, { "Checksum Status", "eigrp.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }},
3297 { &hf_eigrp_metric_comm_type, { "Type", "eigrp.metric.comm_type", FT_UINT16, BASE_DEC, VALS(eigrp_metric_comm_type_vals), 0x0, NULL, HFILL }},
3298 { &hf_eigrp_extcomm_eigrp_flag, { "FLAG", "eigrp.extcomm.flag", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3299 { &hf_eigrp_extcomm_eigrp_tag, { "TAG", "eigrp.extcomm.tag", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3300 { &hf_eigrp_extcomm_eigrp_res, { "RES", "eigrp.extcomm.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3301 { &hf_eigrp_extcomm_eigrp_rid, { "RID", "eigrp.extcomm.rid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3302 { &hf_eigrp_extcomm_eigrp_as, { "AS", "eigrp.extcomm.as", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3303 { &hf_eigrp_extcomm_eigrp_sdly, { "SDLY", "eigrp.extcomm.sdly", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3304 { &hf_eigrp_extcomm_eigrp_rel, { "RID", "eigrp.extcomm.rel", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3305 { &hf_eigrp_extcomm_eigrp_hop, { "AS", "eigrp.extcomm.hop", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3306 { &hf_eigrp_extcomm_eigrp_sbw, { "SDLY", "eigrp.extcomm.sbw", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3307 { &hf_eigrp_extcomm_eigrp_load, { "LOAD", "eigrp.extcomm.load", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3308 { &hf_eigrp_extcomm_eigrp_mtu, { "MTU", "eigrp.extcomm.mtu", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3309 { &hf_eigrp_extcomm_eigrp_xas, { "xAS", "eigrp.extcomm.xas", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3310 { &hf_eigrp_extcomm_eigrp_xrid, { "xRID", "eigrp.extcomm.xrid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3311 { &hf_eigrp_extcomm_eigrp_xproto, { "xProto", "eigrp.extcomm.xproto", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3312 { &hf_eigrp_extcomm_eigrp_xmetric, { "xMETRIC", "eigrp.extcomm.xmetric", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3315 /* Setup protocol subtree array */
3316 static int *ett[] = {
3317 /* header flag */
3318 &ett_eigrp,
3319 &ett_eigrp_flags,
3321 /* tlv specific */
3322 &ett_eigrp_tlv,
3323 &ett_eigrp_tlv_metric,
3324 &ett_eigrp_tlv_attr,
3325 &ett_eigrp_tlv_extdata,
3327 &ett_eigrp_tidlist,
3328 &ett_eigrp_stub_flags,
3329 &ett_eigrp_saf_reachability,
3331 /* metric tlv specific */
3332 &ett_eigrp_metric_flags,
3333 &ett_eigrp_extdata_flags,
3335 &ett_metric_comm_type
3338 static ei_register_info ei[] = {
3339 { &ei_eigrp_peer_termination, { "eigrp.peer_termination", PI_RESPONSE_CODE, PI_NOTE, "Peer Termination", EXPFILL }},
3340 { &ei_eigrp_auth_len, { "eigrp.auth.length.invalid", PI_MALFORMED, PI_WARN, "Invalid auth len", EXPFILL }},
3341 { &ei_eigrp_auth_type, { "eigrp.auth.type.invalid", PI_PROTOCOL, PI_WARN, "Invalid auth type", EXPFILL }},
3342 { &ei_eigrp_seq_addrlen, { "eigrp.seq.addrlen.invalid", PI_MALFORMED, PI_ERROR, "Invalid address length", EXPFILL }},
3343 { &ei_eigrp_peer_termination_graceful, { "eigrp.peer_termination_graceful", PI_RESPONSE_CODE, PI_NOTE, "Peer Termination (Graceful Shutdown)", EXPFILL }},
3344 { &ei_eigrp_prefixlen, { "eigrp.prefixlen.invalid", PI_MALFORMED, PI_WARN, "Invalid prefix length", EXPFILL }},
3345 { &ei_eigrp_unreachable, { "eigrp.unreachable", PI_RESPONSE_CODE, PI_NOTE, "Unreachable", EXPFILL }},
3346 { &ei_eigrp_tlv_type, { "eigrp.tlv_type.unknown", PI_PROTOCOL, PI_WARN, "Unknown TLV", EXPFILL }},
3347 { &ei_eigrp_afi, { "eigrp.afi.unknown", PI_PROTOCOL, PI_WARN, "Unknown AFI", EXPFILL }},
3348 { &ei_eigrp_checksum_bad, { "eigrp.checksum.bad", PI_CHECKSUM, PI_WARN, "Bad Checksum", EXPFILL }},
3349 { &ei_eigrp_tlv_len, { "eigrp.tlv.len.invalid", PI_MALFORMED, PI_ERROR, "Corrupt TLV (Length field less than 4)", EXPFILL }},
3350 { &ei_eigrp_tlv_trunc, { "eigrp.tlv.truncated", PI_MALFORMED, PI_ERROR, "Corrupt TLV (Truncated prematurely)", EXPFILL }},
3353 expert_module_t* expert_eigrp;
3355 /* Register the protocol name and description */
3356 proto_eigrp = proto_register_protocol("Enhanced Interior Gateway Routing Protocol", "EIGRP", "eigrp");
3357 register_dissector("eigrp", dissect_eigrp, proto_eigrp);
3359 /* Required function calls to register the header fields and subtrees used */
3360 proto_register_field_array(proto_eigrp, hf, array_length(hf));
3361 proto_register_subtree_array(ett, array_length(ett));
3362 expert_eigrp = expert_register_protocol(proto_eigrp);
3363 expert_register_field_array(expert_eigrp, ei, array_length(ei));
3367 *@fn void proto_reg_handoff_eigrp(void)
3369 * @usage
3370 * This exact format is required because a script is used to find these
3371 * routines and create the code that calls these routines.
3373 * @par
3374 * If this dissector uses sub-dissector registration add a registration routine.
3376 * This form of the reg_handoff function is used if you perform registration
3377 * functions which are dependent upon prefs. If this function is registered as
3378 * a prefs callback (see prefs_register_protocol above) this function is also
3379 * called by preferences whenever "Apply" is pressed;
3381 * In that case, it should accommodate being called more than once.
3383 void
3384 proto_reg_handoff_eigrp(void)
3386 dissector_handle_t eigrp_handle = find_dissector("eigrp");
3388 ipxsap_handle = find_dissector_add_dependency("ipxsap", proto_eigrp);
3389 media_type_table = find_dissector_table("media_type");
3391 dissector_add_uint("ip.proto", IP_PROTO_EIGRP, eigrp_handle);
3392 dissector_add_uint("ddp.type", DDP_EIGRP, eigrp_handle);
3393 dissector_add_uint("ipx.socket", IPX_SOCKET_EIGRP, eigrp_handle);
3397 * Editor modelines - https://www.wireshark.org/tools/modelines.html
3399 * Local variables:
3400 * c-basic-offset: 4
3401 * tab-width: 8
3402 * indent-tabs-mode: nil
3403 * End:
3405 * vi: set shiftwidth=4 tabstop=8 expandtab:
3406 * :indentSize=4:tabSize=8:noTabs=true: