]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
filter: Allow assigning enums into extended attributes
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Tue, 5 Sep 2017 13:50:00 +0000 (15:50 +0200)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Wed, 20 Sep 2017 13:36:54 +0000 (15:36 +0200)
They are internally ints, but they got refused as a wrong type. This
fixes setting of the BGP origin and is also needed for RA.

filter/filter.c

index f18970e05939d78fa22c8032768b796600280ee0..1e8f7d5ae78c470bc5a96bd7ecdbc250057ca99e 100644 (file)
@@ -1088,7 +1088,8 @@ interpret(struct f_inst *what)
 
       switch (what->aux & EAF_TYPE_MASK) {
       case EAF_TYPE_INT:
-       if (v1.type != T_INT)
+       // Enums are also ints, so allow them in.
+       if (v1.type != T_INT && (v1.type < T_ENUM_LO || v1.type > T_ENUM_HI))
          runtime( "Setting int attribute to non-int value" );
        l->attrs[0].u.data = v1.val.i;
        break;