Skip to content

Commit

Permalink
set is_default_rule and OD_RULE_POOL_CLIENT_VISIBLE for group_rule
Browse files Browse the repository at this point in the history
  • Loading branch information
aidekqz committed Sep 17, 2024
1 parent a5256c1 commit 95cf470
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions sources/config_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1921,6 +1921,7 @@ static int od_config_reader_route(od_config_reader_t *reader, char *db_name,
}

static int od_config_reader_group(od_config_reader_t *reader, char *db_name,
int db_name_len, int db_is_default,
od_group_t *group, od_extention_t *extentions)
{
/* group name */
Expand All @@ -1936,14 +1937,15 @@ static int od_config_reader_group(od_config_reader_t *reader, char *db_name,
char route_db[strlen(db_name) + 1];
snprintf(route_usr, sizeof route_usr, "%s%s", "group_", group_name);
snprintf(route_db, sizeof route_db, "%s", db_name);
od_rule_t *rule;

od_address_range_t address_range;
if (od_config_reader_address(reader, &address_range)) {
return NOT_OK_RESPONSE;
}

od_rule_t *rule;
rule = od_rules_match(reader->rules, route_db, route_usr,
&address_range, 0, 0, 1);
&address_range, db_is_default, 0, 0);
if (rule) {
od_errorf(reader->error, "route '%s.%s': is redefined",
route_usr, route_usr);
Expand All @@ -1959,11 +1961,11 @@ static int od_config_reader_group(od_config_reader_t *reader, char *db_name,
return NOT_OK_RESPONSE;
}
rule->user_name_len = strlen(rule->user_name);
rule->db_is_default = false;
rule->db_is_default = db_is_default;
rule->db_name = strdup(route_db);
if (rule->db_name == NULL)
return NOT_OK_RESPONSE;
rule->db_name_len = strlen(rule->db_name);
rule->db_name_len = db_name_len;
rule->address_range = address_range;

group->group_name = strdup(group_name);
Expand Down Expand Up @@ -2327,8 +2329,9 @@ static int od_config_reader_database(od_config_reader_t *reader,
if (group == NULL) {
return NOT_OK_RESPONSE;
}
rc = od_config_reader_group(reader, db_name, group,
extentions);
rc = od_config_reader_group(reader, db_name,
db_name_len, db_is_default,
group, extentions);
if (rc == -1)
goto error;
continue;
Expand Down

0 comments on commit 95cf470

Please sign in to comment.