From 0d0524cb17461e1f248e7a5dc14c114b8f8d391f Mon Sep 17 00:00:00 2001 From: Arran Cudbard-Bell Date: Tue, 29 Oct 2024 19:25:41 +0100 Subject: [PATCH] Search protocol flags first --- src/lib/util/dict_tokenize.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index d215cde02bdc..b777ed29034a 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -603,13 +603,13 @@ static int dict_process_flag_field(dict_tokenize_ctx_t *ctx, char *name, fr_dict } /* - * Search in the main flags table - * then the protocol flags table. + * Search the protocol table, then the main table. + * This allows protocols to overload common flags. */ - if (!fr_dict_attr_flag_to_parser(&parser, dict_common_flags, dict_common_flags_len, key, NULL) && - (!ctx->dict->proto->attr.flags.table || - !fr_dict_attr_flag_to_parser(&parser, ctx->dict->proto->attr.flags.table, - ctx->dict->proto->attr.flags.table_len, key, NULL))) { + if (!((ctx->dict->proto->attr.flags.table && + fr_dict_attr_flag_to_parser(&parser, ctx->dict->proto->attr.flags.table, + ctx->dict->proto->attr.flags.table_len, key, NULL)) || + fr_dict_attr_flag_to_parser(&parser, dict_common_flags, dict_common_flags_len, key, NULL))) { fr_strerror_printf("Unknown flag '%s'", key); return -1; }