return -1;
}
+ /*
+ * The result has to be data, AND of the correct type.
+ * Which means we no longer need the cast.
+ */
+ fr_assert(tmpl_is_data(vpt));
+ fr_assert((vpt->cast == FR_TYPE_INVALID) || (vpt->cast == tmpl_value_type(vpt)));
+ (void) tmpl_cast_set(vpt, FR_TYPE_INVALID);
return 0;
}
case TMPL_TYPE_DATA:
src_type = tmpl_value_type(vpt);
-
- /*
- * Don't suppress duplicate casts for now, the
- * conditional parser still needs them.
- */
goto check_types;
case TMPL_TYPE_ATTR:
/*
* Suppress casts where they are duplicate.
*/
+ check_types:
if (src_type == dst_type) {
vpt->cast = FR_TYPE_INVALID;
return 0;
}
- check_types:
if (!fr_type_cast(dst_type, src_type)) {
fr_strerror_printf("Cannot cast type '%s' to '%s'",
fr_table_str_by_value(fr_value_box_type_table, src_type, "??"),
match true
condition <ipaddr>127.0.0.1 == "%{md4: 127.0.0.1}"
-match <ipaddr>127.0.0.1 == "%{md4: 127.0.0.1}"
+match 127.0.0.1 == "%{md4: 127.0.0.1}"
#
# Bare %{...} is allowed.
#
condition <ipaddr>127.0.0.1 == %{md4:127.0.0.1}
-match <ipaddr>127.0.0.1 == %{md4:127.0.0.1}
+match 127.0.0.1 == %{md4:127.0.0.1}
condition <ipaddr>127.0.0.1 == %{md4: SELECT user FROM table WHERE user='%{User-Name}'}
-match <ipaddr>127.0.0.1 == %{md4: SELECT user FROM table WHERE user='%{User-Name}'}
+match 127.0.0.1 == %{md4: SELECT user FROM table WHERE user='%{User-Name}'}
condition <ether> 00:11:22:33:44:55 == "00:11:22:33:44:55"
match true
condition <ether> 00:11:22:33:44:55 == "%{md4:00:11:22:33:44:55}"
-match <ether>00:11:22:33:44:55 == "%{md4:00:11:22:33:44:55}"
+match 00:11:22:33:44:55 == "%{md4:00:11:22:33:44:55}"
condition <ether> 00:XX:22:33:44:55 == 00:11:22:33:44:55
match ERROR offset 8: Failed parsing value as type 'ether'