Now that we have rad_vp2attr, and it's clean, adding support for
authoraland <aland>
Tue, 25 Oct 2005 20:17:42 +0000 (20:17 +0000)
committeraland <aland>
Tue, 25 Oct 2005 20:17:42 +0000 (20:17 +0000)
Starent VSA's is trivial.

We still have to make rad_attr2vp() support Starent VSA's, and
the Juniper encrypted integers & IP's

share/dictionary
src/include/libradius.h
src/lib/dict.c
src/lib/radius.c

index 474ea57..08d99ed 100644 (file)
@@ -127,6 +127,7 @@ $INCLUDE dictionary.shasta
 $INCLUDE dictionary.shiva
 $INCLUDE dictionary.sonicwall
 $INCLUDE dictionary.springtide
+$INCLUDE dictionary.starent
 $INCLUDE dictionary.telebit
 $INCLUDE dictionary.trapeze
 $INCLUDE dictionary.t_systems_nova
index d5aa44e..454c09c 100644 (file)
@@ -79,6 +79,7 @@
 #  define AUTH_HDR_LEN         20
 #  define VENDORPEC_USR                429
 #define VENDORPEC_LUCENT       4846
+#define VENDORPEC_STARENT      8164
 #  define VENDOR(x)            ((x >> 16) & 0xffff)
 #  define DEBUG                        if (librad_debug) printf
 #  define debug_pair(vp)       do { if (librad_debug) { \
index 9475860..0c785cf 100644 (file)
@@ -352,6 +352,7 @@ int dict_addattr(const char *name, int vendor, int type, int value,
                 */
                if ((vendor != VENDORPEC_USR) &&
                    (vendor != VENDORPEC_LUCENT) &&
+                   (vendor != VENDORPEC_STARENT) &&
                    (value > 256)) {
                        librad_log("dict_addattr: ATTRIBUTE has invalid number (larger than 255).");
                        return -1;
index 56f0cb4..f2e49e8 100644 (file)
@@ -577,6 +577,20 @@ int rad_vp2attr(const RADIUS_PACKET *packet, const RADIUS_PACKET *original,
                        *vsa_length_ptr += 3;
                        *ptr++ = 3;
                        total_length += 3;
+
+               } else if (vendorcode == VENDORPEC_STARENT) {
+                       /*
+                        *      16-bit attribute, 16-bit length
+                        *      with the upper 8 bits of the length
+                        *      always zero!
+                        */
+                       *ptr++ = ((vp->attribute >> 8) & 0xFF);
+                       *ptr++ = (vp->attribute & 0xFF);
+                       *ptr++ = 0;
+                       length_ptr = ptr;
+                       *vsa_length_ptr += 4;
+                       *ptr++ = 4;
+                       total_length += 4;
                } else {
                        /*
                         *      All other VSA's are encoded the same