]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix pure flag state for different redundant types
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 1 Dec 2021 22:28:31 +0000 (16:28 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 1 Dec 2021 22:28:31 +0000 (16:28 -0600)
src/lib/unlang/xlat_builtin.c

index 85e017eea0a9fdb08f942eb26f389d69c6352a34..5565817c4a7448bdd74927834c70ff57ccf5c2b0 100644 (file)
@@ -903,18 +903,29 @@ int xlat_register_redundant(CONF_SECTION *cs)
        char const              *name1, *name2;
        xlat_redundant_type_t   xr_type;
        xlat_redundant_t        *xr;
-       xlat_flags_t            flags = {
-                                       .pure = true    /* Gets removed by the merge function */
-                               };
+       xlat_flags_t            flags = {};
 
        xlat_t const            *xlat;
        CONF_ITEM               *ci = NULL;
 
        name1 = cf_section_name1(cs);
        xr_type = fr_table_value_by_str(xlat_redundant_type_table, name1, XLAT_REDUNDANT_INVALID);
-       if (unlikely(xr_type == XLAT_REDUNDANT_INVALID)) {
+       switch (xr_type) {
+       case XLAT_REDUNDANT_INVALID:
                cf_log_err(cs, "Invalid redundant section verb \"%s\"", name1);
                return -1;
+
+       case XLAT_REDUNDANT:
+               flags.pure = true;      /* Can be pure */
+               break;
+
+       case XLAT_LOAD_BALANCE:
+               flags.pure = false;     /* Can never be pure because of random selection */
+               break;
+
+       case XLAT_REDUNDANT_LOAD_BALANCE:
+               flags.pure = false;     /* Can never be pure because of random selection */
+               break;
        }
 
        name2 = cf_section_name2(cs);