From 3800860f83913a005cad4cf3bad6a4bd346724ab Mon Sep 17 00:00:00 2001 From: NikitaUnisikhin Date: Wed, 20 Mar 2024 09:49:59 +0000 Subject: [PATCH] fix compatibility address_range and group --- sources/config_reader.c | 6 +++++- sources/router.c | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sources/config_reader.c b/sources/config_reader.c index f34b7813a..23bd0de9b 100644 --- a/sources/config_reader.c +++ b/sources/config_reader.c @@ -1899,7 +1899,10 @@ static int od_config_reader_group(od_config_reader_t *reader, char *db_name, snprintf(route_db, sizeof route_db, "%s%s", "group_", group_name); od_rule_t *rule; - rule = od_rules_match(reader->rules, route_db, route_usr, 0, 0, 1); + od_address_range_t default_address_range = + od_address_range_create_default(); + + rule = od_rules_match(reader->rules, route_db, route_usr, &default_address_range, 0, 0, 1); if (rule) { od_errorf(reader->error, "route '%s.%s': is redefined", route_usr, route_usr); @@ -1920,6 +1923,7 @@ static int od_config_reader_group(od_config_reader_t *reader, char *db_name, rule->db_name_len = strlen(rule->db_name); if (rule->db_name == NULL) return NOT_OK_RESPONSE; + rule->address_range = default_address_range; group->group_name = strdup(group_name); group->route_usr = strdup(rule->user_name); diff --git a/sources/router.c b/sources/router.c index 3b1a0b6e9..f1176bb2b 100644 --- a/sources/router.c +++ b/sources/router.c @@ -358,10 +358,12 @@ od_router_status_t od_router_route(od_router_t *router, od_client_t *client) int salen; struct sockaddr *saddr; int rc; + od_address_range_t default_address_range; switch (client->type) { case OD_POOL_CLIENT_INTERNAL: + default_address_range = od_address_range_create_default(); rule = od_rules_forward(&router->rules, startup->database.value, - startup->user.value, NULL, 1); + startup->user.value, &default_address_range, 1); break; case OD_POOL_CLIENT_EXTERNAL: salen = sizeof(sa);