Allow cast of ifid to integer64
authorAlan T. DeKok <aland@freeradius.org>
Mon, 6 Oct 2014 00:32:42 +0000 (20:32 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 6 Oct 2014 00:41:32 +0000 (20:41 -0400)
src/main/evaluate.c
src/main/parser.c

index 4447d4a..0615b51 100644 (file)
@@ -335,6 +335,13 @@ static int do_cast_copy(VALUE_PAIR *dst, VALUE_PAIR const *src)
                return pairparsevalue(dst, src->vp_strvalue, 0);
        }
 
+       if ((src->da->type == PW_TYPE_IFID) &&
+           (dst->da->type == PW_TYPE_INTEGER64)) {
+               memcpy(&dst->vp_integer64, &src->vp_ifid, sizeof(src->vp_ifid));
+               dst->vp_integer64 = htonll(dst->vp_integer64);
+               return 0;
+       }
+
        if ((src->da->type == PW_TYPE_INTEGER64) &&
            (dst->da->type == PW_TYPE_ETHERNET)) {
                uint8_t array[8];
index b7076d8..3abff1f 100644 (file)
@@ -766,6 +766,14 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, CONF_ITEM *ci, char const *st
                                        }
 
                                        /*
+                                        *      ifid to integer64 is OK
+                                        */
+                                       if ((c->data.map->lhs->tmpl_da->type == PW_TYPE_IFID) &&
+                                           (c->cast->type == PW_TYPE_INTEGER64)) {
+                                               goto cast_ok;
+                                       }
+
+                                       /*
                                         *      ipaddr to ipv4prefix is OK
                                         */
                                        if ((c->data.map->lhs->tmpl_da->type == PW_TYPE_IPV4_ADDR) &&