Ethereal-dev: Re: [Ethereal-dev] Vendor-ID CoSine support for RADIUS

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

Date Prev · Date Next · Thread Prev · Thread Next
From: Motonori Shindo <mshindo@xxxxxxxxxxx>
Date: Mon, 01 Oct 2001 15:16:16 +0900 (JST)
Rick and other committers:

I attached a patch that adds CoSine VSA support along with a libpcap
trace file, which I hope shows that this patch works OK. Please note
that this trace file contains only two types of VSA (CoSine VPI/VCI
and CoSine Address Pool Name) but other VSAs can be properly decoded,
I hope. Any comment will be highly appreciated.

Regards,

From: Richard Sharpe <sharpe@xxxxxxxxxx>
Subject: Re: [Ethereal-dev] Vendor-ID CoSine support for RADIUS
Date: Sun, 30 Sep 2001 23:28:47 +0930

> > BTW, there seems no VSA decoding capability for any Vendor in the
> > current code. Is this a matter of "policy" of Ethereal? If I
> > contribute a code to decode CoSine VSAs, there a chance that such a
> > code will be incorporated into?
> 
> It is probably that no one had any experience with VSA decoding, or 
> whatever.
> 
> If you send us patches, and they look OK, esp if accompanied with a 
> trace showing they work, we will commit them.

=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
 +----+----+     
 |.. .|    |     Motonori Shindo
 |_~__|    |     
 | .. |~~_~|     Sr. Systems Engineer
 | .  |    |     CoSine Communications Inc.
 +----+----+     
 C o S i n e     e-mail:  mshindo@xxxxxxxxxxxxx 
Communications
=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=


Index: packet-radius.c
===================================================================
RCS file: /cvsroot/ethereal/packet-radius.c,v
retrieving revision 1.35
diff -u -r1.35 packet-radius.c
--- packet-radius.c	2001/09/30 13:23:20	1.35
+++ packet-radius.c	2001/10/01 06:04:20
@@ -230,17 +230,48 @@
  *
  * for a list.
  */
+#define VENDOR_ACC 5
+#define VENDOR_CISCO 9
+#define VENDOR_SHIVA 166
+#define VENDOR_LIVINGSTON 307
+#define VENDOR_3COM 429
+#define VENDOR_ASCEND 529
+#define VENDOR_BAY 1584
+#define VENDOR_JUNIPER 2636
+#define VENDOR_COSINE 3085
+#define VENDOR_UNISPHERE 4874
+
 static value_string radius_vendor_specific_vendors[]=
-{{5, "ACC"},
-{9,"Cisco"},
-{166,"Shiva"},
-{307,"Livingston"},
-{429,"3Com"},
-{529,"Ascend"},
-{1584,"Bay Networks"},
-{2636,"Juniper Networks"},
-{3085,"CoSine Communications"},
-{4874,"Unisphere Networks"},
+{{VENDOR_ACC,"ACC"},
+{VENDOR_CISCO,"Cisco"},
+{VENDOR_SHIVA,"Shiva"},
+{VENDOR_LIVINGSTON,"Livingston"},
+{VENDOR_3COM,"3Com"},
+{VENDOR_ASCEND,"Ascend"},
+{VENDOR_BAY,"Bay Networks"},
+{VENDOR_JUNIPER,"Juniper Networks"},
+{VENDOR_COSINE,"CoSine Communications"},
+{VENDOR_UNISPHERE,"Unisphere Networks"},
+{0,NULL}};
+
+#define VENDOR_COSINE_VSA_CONNECION_PROFILE_NAME 1
+#define VENDOR_COSINE_VSA_ENTERPRISE_ID 2
+#define VENDOR_COSINE_VSA_ADDRESS_POOL_NAME 3
+#define VENDOR_COSINE_VSA_DS_BYTE 4
+#define VENDOR_COSINE_VSA_VPI_VCI 5
+#define VENDOR_COSINE_VSA_DLCI 6
+#define VENDOR_COSINE_VSA_LNS_IP_ADDRESS 7
+#define VENDOR_COSINE_VSA_CLI_USER_PERMISSION_ID 8
+
+static value_string radius_vendor_cosine_types[]=
+{{VENDOR_COSINE_VSA_CONNECION_PROFILE_NAME,"Connection Profile Name"},
+{VENDOR_COSINE_VSA_ENTERPRISE_ID,"Enterprise ID"},
+{VENDOR_COSINE_VSA_ADDRESS_POOL_NAME,"Address Pool Name"},
+{VENDOR_COSINE_VSA_DS_BYTE,"DS Byte"},
+{VENDOR_COSINE_VSA_VPI_VCI,"VPI/VCI"},
+{VENDOR_COSINE_VSA_DLCI,"DLCI"},
+{VENDOR_COSINE_VSA_LNS_IP_ADDRESS,"LNS IP Address"},
+{VENDOR_COSINE_VSA_CLI_USER_PERMISSION_ID,"CLI User Permission ID"},
 {0,NULL}};
 
 static value_string radius_framed_protocol_vals[]=
@@ -606,6 +637,7 @@
   guint32 intval;
   const guint8 *pd;
   guint8 tag;
+  guint8 vtype;
   char *rtimestamp;
   extern char *tzname[2];
 
@@ -710,10 +742,50 @@
                 break;
 	case ( RADIUS_VENDOR_SPECIFIC ):
 		valstrarr=radius_vendor_specific_vendors;
-		sprintf(textbuffer,"Vendor:%s, Value:",
-				rd_match_strval(tvb_get_ntohl(tvb,offset+2),valstrarr));
+		sprintf(textbuffer,"Vendor:%s,",
+			rd_match_strval(tvb_get_ntohl(tvb,offset+2),valstrarr));
 		cont=&textbuffer[strlen(textbuffer)];
-		rdconvertbufftostr(cont,tvb,offset+6,avph->avp_length-6);
+		switch (tvb_get_ntohl(tvb,offset+2)) {
+		case ( VENDOR_COSINE ):
+			vtype = tvb_get_guint8(tvb,offset+6);
+			switch (vtype) {
+			case ( VENDOR_COSINE_VSA_CONNECION_PROFILE_NAME ):
+			case ( VENDOR_COSINE_VSA_ENTERPRISE_ID ):
+			case ( VENDOR_COSINE_VSA_ADDRESS_POOL_NAME ):
+			case ( VENDOR_COSINE_VSA_CLI_USER_PERMISSION_ID ):
+				sprintf(cont," Type:%s, Value:",
+					rd_match_strval(vtype, radius_vendor_cosine_types));
+				cont=&textbuffer[strlen(textbuffer)];
+				rdconvertbufftostr(cont,tvb,offset+8,avph->avp_length-8);
+				break;
+			case ( VENDOR_COSINE_VSA_VPI_VCI ):
+				sprintf(cont," Type:%s, Value:%u/%u",
+					rd_match_strval(vtype, radius_vendor_cosine_types),
+					tvb_get_ntohs(tvb,offset+8),
+					tvb_get_ntohs(tvb,offset+10));
+				break;
+			case ( VENDOR_COSINE_VSA_DS_BYTE ):
+			case ( VENDOR_COSINE_VSA_DLCI ):
+				sprintf(cont," Type:%s, Value:%u",
+					rd_match_strval(vtype, radius_vendor_cosine_types),
+					tvb_get_ntohl(tvb,offset+8));
+				break;
+			case ( VENDOR_COSINE_VSA_LNS_IP_ADDRESS ):
+				sprintf(cont," Type:%s, Value:",
+					rd_match_strval(vtype, radius_vendor_cosine_types));
+				cont=&textbuffer[strlen(textbuffer)];
+				ip_to_str_buf(tvb_get_ptr(tvb,offset+8,4),cont);
+				break;
+			default:
+				sprintf(cont," Unknown Value Type");
+				break;
+			}
+			break;
+		default: 
+			sprintf(cont, " Value:");
+			rdconvertbufftostr(cont,tvb,offset+6,avph->avp_length-6);
+			break;
+		}
 		break;
         case( RADIUS_TIMESTAMP ):
 		intval=tvb_get_ntohl(tvb,offset+2);

Attachment: pppoe_radauth.cap
Description: Binary data