Ethereal-dev: [ethereal-dev] EIGRP / IGRP patch
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: root <root@xxxxxxxxxxxxxx>
Date: Fri, 29 Oct 1999 14:37:48 -0400 (EDT)
Here's some code to add Cisco (E)IGRP support Don
? dons.patch Index: AUTHORS =================================================================== RCS file: /cvsroot/ethereal/AUTHORS,v retrieving revision 1.47 diff -u -r1.47 AUTHORS --- AUTHORS 1999/10/29 01:04:16 1.47 +++ AUTHORS 1999/10/29 18:50:40 @@ -47,6 +47,7 @@ Don Lafontaine <lafont02@xxxxx> { Banyan Vines support + IGRP/EIGRP support } Guy Harris <guy@xxxxxxxxxx> { Index: packet-ip.c =================================================================== RCS file: /cvsroot/ethereal/packet-ip.c,v retrieving revision 1.58 diff -u -r1.58 packet-ip.c --- packet-ip.c 1999/10/22 07:17:32 1.58 +++ packet-ip.c 1999/10/29 18:50:42 @@ -158,20 +158,51 @@ #define IGMP_MTRC_RESP 0x1e #define IGMP_MTRC 0x1f +/* EIGRP Structs and Definitions. */ + +/* EIGRP Opcodes */ + +#define EIGRP_UPDATE 0x01 +#define EIGRP_REQUEST 0x02 +#define EIGRP_QUERY 0x03 +#define EIGRP_REPLY 0x04 +#define EIGRP_HELLO 0x05 + +typedef struct _e_eigrp + { + guint8 eigrp_version; + guint8 eigrp_opcode; + guint16 eigrp_checksum; + guint16 eigrp_subnets; + guint16 eigrp_networks; + guint32 eigrp_sequence; + guint32 eigrp_asnumber; + guint8 eigrp_type1; + guint8 eigrp_subtype1; + guint16 eigrp_length1; + guint16 eigrp_holdtime; + guint8 eigrp_type2; + guint8 eigrp_subtype2; + guint16 eigrp_length2; + guint8 eigrp_level; + guint16 eigrp_dummy; + } e_eigrp; + /* IP structs and definitions */ -typedef struct _e_ip { - guint8 ip_v_hl; /* combines ip_v and ip_hl */ - guint8 ip_tos; - guint16 ip_len; - guint16 ip_id; - guint16 ip_off; - guint8 ip_ttl; - guint8 ip_p; - guint16 ip_sum; - guint32 ip_src; - guint32 ip_dst; -} e_ip; +typedef struct _e_ip + { + guint8 ip_v_hl; /* combines ip_v and ip_hl */ + guint8 ip_tos; + guint16 ip_len; + guint16 ip_id; + guint16 ip_off; + guint8 ip_ttl; + guint8 ip_p; + guint16 ip_sum; + guint32 ip_src; + guint32 ip_dst; + } e_ip; /* Offsets of fields within an IP header. */ #define IPH_V_HL 0 @@ -651,6 +682,7 @@ static const value_string proto_vals[] = { {IP_PROTO_ICMP, "ICMP"}, {IP_PROTO_IGMP, "IGMP"}, + {IP_PROTO_EIGRP, "IGRP/EIGRP"}, {IP_PROTO_TCP, "TCP" }, {IP_PROTO_UDP, "UDP" }, {IP_PROTO_OSPF, "OSPF"}, @@ -862,18 +894,21 @@ case IP_PROTO_IGMP: dissect_igmp(pd, offset, fd, tree); break; + case IP_PROTO_EIGRP: + dissect_eigrp(pd, offset, fd, tree); + break; case IP_PROTO_TCP: dissect_tcp(pd, offset, fd, tree); - break; + break; case IP_PROTO_UDP: dissect_udp(pd, offset, fd, tree); break; case IP_PROTO_OSPF: dissect_ospf(pd, offset, fd, tree); - break; + break; case IP_PROTO_RSVP: dissect_rsvp(pd, offset, fd, tree); - break; + break; case IP_PROTO_AH: advance = dissect_ah(pd, offset, fd, tree); nxt = pd[offset]; @@ -1325,3 +1360,54 @@ "icmp"); proto_register_field_array(proto_icmp, hf, array_length(hf)); } + +static int proto_eigrp = -1; + +void +dissect_eigrp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + e_eigrp ih; + proto_tree *eigrp_tree; + proto_item *ti; + guint16 cksum; + gchar type_str[64] = ""; + + /* Avoids alignment problems on many architectures. */ +static const value_string eigrp_opcode_vals[] = { + { EIGRP_HELLO, "Hello/Ack" }, + { EIGRP_UPDATE, "Update" }, + { EIGRP_REPLY, "Reply" }, + { EIGRP_QUERY, "Query" }, + { EIGRP_REQUEST, "Request" }, + { 0, NULL } +}; + + memcpy(&ih, &pd[offset], sizeof(e_eigrp)); + /* To do: check for runts, errs, etc. */ + cksum = ntohs(ih.eigrp_checksum); + + if (check_col(fd, COL_PROTOCOL)) + col_add_str(fd, COL_PROTOCOL, "EIGRP"); + if (check_col(fd, COL_INFO)) + col_add_str(fd, COL_INFO, type_str); + if (tree) { + + ti = proto_tree_add_item(tree, proto_eigrp, offset, END_OF_FRAME, NULL); + eigrp_tree = proto_item_add_subtree(ti, ETT_RIP); + + proto_tree_add_text(eigrp_tree, offset, 1, "Version: %d", ih.eigrp_version); + proto_tree_add_text(eigrp_tree, offset + 1, 1, "Opcode: %d (%s)", ih.eigrp_opcode, + val_to_str( ih.eigrp_opcode, eigrp_opcode_vals, "Unknown") ); + proto_tree_add_text(eigrp_tree, offset + 2, 2, "Checksum: 0x%x", cksum); + proto_tree_add_text(eigrp_tree, offset + 4, 2, "Subnets in local net: %d", ih.eigrp_subnets); + proto_tree_add_text(eigrp_tree, offset + 6, 2, "Networks in Autonomous System: %d", ih.eigrp_networks); + proto_tree_add_text(eigrp_tree, offset + 8, 4, "Sequence Number: 0x%x", ih.eigrp_sequence); + proto_tree_add_text(eigrp_tree, offset + 12, 4, "Autonomous System number: %ld", ih.eigrp_asnumber); + } +} + + +void +proto_register_eigrp(void) + { + proto_eigrp = proto_register_protocol("Enhanced Interior Gateway Routing Protocol", "eigrp"); + } Index: packet-ip.h =================================================================== RCS file: /cvsroot/ethereal/packet-ip.h,v retrieving revision 1.6 diff -u -r1.6 packet-ip.h --- packet-ip.h 1999/10/15 05:30:39 1.6 +++ packet-ip.h 1999/10/29 18:50:43 @@ -27,12 +27,6 @@ #ifndef __PACKET_IP_H__ #define __PACKET_IP_H__ -#define IP_PROTO_ICMP 1 -#define IP_PROTO_IGMP 2 -#define IP_PROTO_TCP 6 -#define IP_PROTO_UDP 17 -#define IP_PROTO_OSPF 89 - #define IP_PROTO_IP 0 /* dummy for IP */ #define IP_PROTO_HOPOPTS 0 /* IP6 hop-by-hop options */ #define IP_PROTO_ICMP 1 /* control message protocol */ @@ -57,6 +51,7 @@ #define IP_PROTO_NONE 59 /* IP6 no next header */ #define IP_PROTO_DSTOPTS 60 /* IP6 no next header */ #define IP_PROTO_EON 80 /* ISO cnlp */ +#define IP_PROTO_EIGRP 88 #define IP_PROTO_OSPF 89 #define IP_PROTO_ENCAP 98 /* encapsulation header */ #define IP_PROTO_PIM 103 /* Protocol Independent Mcast */ Index: packet.h =================================================================== RCS file: /cvsroot/ethereal/packet.h,v retrieving revision 1.123 diff -u -r1.123 packet.h --- packet.h 1999/10/29 05:25:59 1.123 +++ packet.h 1999/10/29 18:50:44 @@ -250,6 +250,7 @@ ETT_DNS_QD, ETT_DNS_ANS, ETT_DNS_RR, + ETT_EIGRP, ETT_CL_ICQ, ETT_CL_ICQ_DECODE, ETT_ICQ_SUBTREE, @@ -552,6 +553,7 @@ void dissect_data(const u_char *, int, frame_data *, proto_tree *); void dissect_ddp(const u_char *, int, frame_data *, proto_tree *); void dissect_dns(const u_char *, int, frame_data *, proto_tree *); +void dissect_eigrp(const u_char *, int, frame_data *, proto_tree *); void dissect_esp(const u_char *, int, frame_data *, proto_tree *); void dissect_eth(const u_char *, int, frame_data *, proto_tree *); void dissect_ftp(const u_char *, int, frame_data *, proto_tree *);
- Follow-Ups:
- Re: [ethereal-dev] EIGRP / IGRP patch
- From: Guy Harris
- Re: [ethereal-dev] EIGRP / IGRP patch
- Prev by Date: Re: [ethereal-dev] register.c equivalent for ETT values?
- Next by Date: [ethereal-dev] 0.7.7: Problems filtering ip.addr with < or > operators
- Previous by thread: [ethereal-dev] make-ett-doth - if you want to use it, here's a working one
- Next by thread: Re: [ethereal-dev] EIGRP / IGRP patch
- Index(es):