From adaf5dab49e3ed6bc2dbe432eab392126b4692ad Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Thu, 2 Oct 2025 10:16:06 +0200 Subject: [PATCH] - Fix that https is set up as enabled when the port is listed in interface-automatic-ports. Also for the set up of quic it is enabled when listed there. --- doc/Changelog | 5 +++++ util/config_file.c | 27 +++++++++++++++++++++++++++ util/config_file.h | 8 ++++++++ 3 files changed, 40 insertions(+) diff --git a/doc/Changelog b/doc/Changelog index 67f54b02e..d027c8ba1 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,8 @@ +2 October 2025: Wouter + - Fix that https is set up as enabled when the port is listed in + interface-automatic-ports. Also for the set up of quic it is + enabled when listed there. + 30 September 2025: Wouter - Fix for #1344: Fix that respip and dns64 can be enabled at the same time, the client info is copied for attach_sub and add_sub diff --git a/util/config_file.c b/util/config_file.c index f611a96e4..3db956262 100644 --- a/util/config_file.c +++ b/util/config_file.c @@ -2922,6 +2922,29 @@ if_is_quic(const char* ifname, int default_port, int quic_port) #endif } +int +cfg_ports_list_contains(char* ports, int p) +{ + char* now = ports, *after; + int extraport; + while(now && *now) { + while(isspace((unsigned char)*now)) + now++; + if(!now) + break; + after = now; + extraport = (int)strtol(now, &after, 10); + if(extraport < 0 || extraport > 65535) + continue; /* Out of range. */ + if(extraport == 0 && now == after) + return 0; /* Number could not be parsed. */ + now = after; + if(extraport == p) + return 1; + } + return 0; +} + int cfg_has_https(struct config_file* cfg) { @@ -2930,6 +2953,8 @@ cfg_has_https(struct config_file* cfg) if(if_is_https(cfg->ifs[i], cfg->port, cfg->https_port)) return 1; } + if(cfg_ports_list_contains(cfg->if_automatic_ports, cfg->https_port)) + return 1; return 0; } @@ -2942,6 +2967,8 @@ cfg_has_quic(struct config_file* cfg) if(if_is_quic(cfg->ifs[i], cfg->port, cfg->quic_port)) return 1; } + if(cfg_ports_list_contains(cfg->if_automatic_ports, cfg->quic_port)) + return 1; return 0; #else (void)cfg; diff --git a/util/config_file.h b/util/config_file.h index dd32f0d9f..209d71247 100644 --- a/util/config_file.h +++ b/util/config_file.h @@ -1480,4 +1480,12 @@ int cfg_has_quic(struct config_file* cfg); /** get memory for string */ size_t getmem_str(char* str); +/** + * See if the if_automatic_ports list contains the value. + * @param ports: String with port numbers. + * @param p: number looked for. + * @return true if found, false if not found or parse failure. + */ +int cfg_ports_list_contains(char* ports, int p); + #endif /* UTIL_CONFIG_FILE_H */ -- 2.47.3