Don Lafontaine's IGRP/EIGRP dissector.
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 30 Oct 1999 06:10:32 +0000 (06:10 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 30 Oct 1999 06:10:32 +0000 (06:10 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@949 f5534014-38df-0310-8fa8-9805f1628bb7

AUTHORS
packet-ip.c
packet-ip.h
packet.h

diff --git a/AUTHORS b/AUTHORS
index 6319adacc53515aa108257ad73a9efc8187ff604..c1e902a96c3c4a6d0cb3e05029af873d699fa0bc 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -47,6 +47,7 @@ Laurent Deniel       <deniel@worldnet.fr> {
 
 Don Lafontaine       <lafont02@cn.ca> {
     Banyan Vines support
+    IGRP/EIGRP support
 }
 
 Guy Harris           <guy@netapp.com> {
index 91aa23150b6e9a8281f55d289fdc11fc6e3b2b03..15ed0b4804362ff3dd3b8a30a610498a577dac22 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-ip.c
  * Routines for IP and miscellaneous IP protocol packet disassembly
  *
- * $Id: packet-ip.c,v 1.58 1999/10/22 07:17:32 guy Exp $
+ * $Id: packet-ip.c,v 1.59 1999/10/30 06:10:30 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -158,20 +158,51 @@ typedef struct _e_igmp {
 #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 @@ dissect_ip_tcp_options(const u_char *opd, int offset, guint length,
 
 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 @@ again:
     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 @@ proto_register_icmp(void)
                                        "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 2f122624cd755aad365026a61d777eaaea62214e..a4e1aabd59abb9d92045937d619a4ebc5337776c 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-ip.h
  * Definitions for IP packet disassembly structures and routines
  *
- * $Id: packet-ip.h,v 1.6 1999/10/15 05:30:39 itojun Exp $
+ * $Id: packet-ip.h,v 1.7 1999/10/30 06:10:32 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
 #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 c4b7ab854438d64d893aa91891286fe97e37f753..55e531535673f5ea7ac07e86d4a63867170a3f12 100644 (file)
--- a/packet.h
+++ b/packet.h
@@ -1,7 +1,7 @@
 /* packet.h
  * Definitions for packet disassembly structures and routines
  *
- * $Id: packet.h,v 1.123 1999/10/29 05:25:59 guy Exp $
+ * $Id: packet.h,v 1.124 1999/10/30 06:10:32 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -250,6 +250,7 @@ enum {
        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_cotp(const u_char *, int, frame_data *, proto_tree *);
 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 *);