Ethereal-dev: Re: [Ethereal-dev] [patch] packet-radisu

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Adam <adam@xxxxxxxxxxxx>
Date: Fri, 22 Feb 2002 12:48:01 -0500 (EST)
> here's another patch.

there's updated version. cosmetic change -- forgot to include extern
for dissect-eap.

-- 
Adam
http://www.eax.com	The Supreme Headquarters of the 32 bit registers
This is patch against ethereal (http://www.ethereal.com./)
Based on cvs tree as of : Fri Feb 22 11:54:32 EST 2002

This patch adds expansion for EAP protocol from RADIUS packet.

        Adam Sulmicki <adam@xxxxxxxxxxxx>
        Fri Feb 22 11:54:32 EST 2002
        http://www.eax.com/patches/

-------------------------------------------------------------------------------

Index: packet-radius.c
===================================================================
RCS file: /cvsroot/ethereal/packet-radius.c,v
retrieving revision 1.42
diff -u -r1.42 packet-radius.c
--- packet-radius.c	2002/02/22 09:57:04	1.42
+++ packet-radius.c	2002/02/22 17:44:58
@@ -636,6 +636,8 @@
 {0,NULL},
 };
 
+extern void dissect_eap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+
 guint32 match_numval(guint32 val, const value_value_pair *vs)
 {
   guint32 i = 0;
@@ -870,9 +872,8 @@
 }
 
 
-void dissect_attribute_value_pairs(tvbuff_t *tvb, int offset, proto_tree *tree,
-				   int avplength)
-{
+void dissect_attribute_value_pairs(tvbuff_t *tvb, int offset,proto_tree *tree,
+				   int avplength,packet_info *pinfo) {
 /* adds the attribute value pairs to the tree */
   e_avphdr avph;
   gchar *avptpstrval;
@@ -899,10 +900,20 @@
 	   avptpstrval,avph.avp_type,avph.avp_length);
 	break;
      }
+
      valstr=rd_value_to_str(&avph, tvb, offset);
-     proto_tree_add_text(tree, tvb,offset,avph.avp_length,
-        "t:%s(%u) l:%u, %s",
-        avptpstrval,avph.avp_type,avph.avp_length,valstr);
+
+     if (avph.avp_type == RD_TP_EAP_MESSAGE) {
+       tvbuff_t   *next_tvb;
+       proto_tree_add_text(tree, tvb,offset,2,"t:%s(%u) l:%u",
+			   avptpstrval,avph.avp_type,avph.avp_length);
+       next_tvb = tvb_new_subset(tvb, offset+2,avph.avp_length, -1);
+       dissect_eap(next_tvb, pinfo, tree);
+     } else 
+       proto_tree_add_text(tree, tvb,offset,avph.avp_length,
+			   "t:%s(%u) l:%u, %s",
+			   avptpstrval,avph.avp_type,avph.avp_length,valstr);
+
      offset=offset+avph.avp_length;
      avplength=avplength-avph.avp_length;
   }
@@ -973,7 +984,7 @@
                 if (avptree !=NULL)
                 {
                         dissect_attribute_value_pairs(tvb, hdrlength,
-                                avptree,avplength);
+                                avptree,avplength,pinfo);
                 }
         }
   }