}
----
-<keyword>:: One of xref:unlang/case.adoc[case], xref:unlang/else.adoc[else], xref:unlang/elsif.adoc[elsif], xref:unlang/foreach.adoc[foreach], xref:unlang/group.adoc[group], xref:unlang/if.adoc[if] ,xref:unlang/limit.adoc[limit], or xref:unlang/timeout.adoc[timeout]. Local variables are forbidden in all other locations.
+<keyword>:: An `unlang` keywords which does not create create a subrequest. i.e. One of:
+
+* xref:unlang/case.adoc[case]
+* xref:unlang/else.adoc[else]
+* xref:unlang/elsif.adoc[elsif]
+* xref:unlang/foreach.adoc[foreach]
+* xref:unlang/group.adoc[group]
+* xref:unlang/if.adoc[if]
+* xref:unlang/limit.adoc[limit]
+* xref:unlang/load-balance.adoc[load-balance]
+* xref:unlang/redundant.adoc[redundant]
+* xref:unlang/redundant-load-balance.adoc[redundant-load-balance]
+* xref:unlang/timeout.adoc[timeout]
+
+Local variables are forbidden in all other locations.
+
+For the xref:unlang/redundant.adoc[redundant] and unlang/redundant-load-balance.adoc[redundant-load-balance] keyword, local variables are keep their value across the different subsections. This behavior can be used to track state inside of the xref:unlang/redundant.adoc[redundant] section.
<data-type>:: A "leaf" xref:type/all_types.adoc[data type]. Structural types such as `group`, `struct`, `tlv`, etc. are not allowed.
case UNLANG_TYPE_TIMEOUT:
case UNLANG_TYPE_LIMIT:
case UNLANG_TYPE_POLICY:
+ case UNLANG_TYPE_REDUNDANT:
+ case UNLANG_TYPE_LOAD_BALANCE:
+ case UNLANG_TYPE_REDUNDANT_LOAD_BALANCE:
break;
default:
* redundant, load-balance and parallel have limits on what can
* go in them.
*/
-static int validate_limited_subsection(CONF_SECTION *cs, char const *name)
+static bool validate_limited_subsection(CONF_SECTION *cs, char const *name)
{
CONF_ITEM *ci;
(strcmp(name1, "elsif") == 0)) {
cf_log_err(ci, "%s sections cannot contain a \"%s\" statement",
name, name1);
- return 0;
+ return false;
}
continue;
}
if (cf_item_is_pair(ci)) {
CONF_PAIR *cp = cf_item_to_pair(ci);
+
+ if (cf_pair_operator(cp) == T_OP_CMP_TRUE) return true;
+
if (cf_pair_value(cp) != NULL) {
cf_log_err(cp, "Unknown keyword '%s', or invalid location", cf_pair_attr(cp));
- return 0;
+ return false;
}
}
}
- return 1;
+ return true;
}