From 3225004036159d6645be30258f6dccf9bedf81ac Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 22 Dec 2024 19:19:25 +0100 Subject: [PATCH] service: add default group @ to match all nodes Simplifies handling services that should be enabled globally Signed-off-by: Felix Fietkau --- service.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/service.c b/service.c index 73cf5b8..5237915 100644 --- a/service.c +++ b/service.c @@ -54,6 +54,7 @@ __service_parse_members(struct network *net, struct network_service *s, { struct network_group *group; struct network_host *host; + unsigned int count = 0; if (name[0] != '@') { host = avl_find_element(&net->hosts, name, host, node); @@ -68,6 +69,15 @@ __service_parse_members(struct network *net, struct network_service *s, } name++; + if (!name[0]) { + avl_for_each_element(&net->hosts, host, node) { + if (s) + __service_add_member(s->members, &s->n_members, host); + count++; + } + return count; + } + group = avl_find_element(&net->groups, name, group, node); if (!group) return 0; -- 2.30.2