]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix that https is set up as enabled when the port is listed in
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 2 Oct 2025 08:16:06 +0000 (10:16 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 2 Oct 2025 08:16:06 +0000 (10:16 +0200)
  interface-automatic-ports. Also for the set up of quic it is
  enabled when listed there.

doc/Changelog
util/config_file.c
util/config_file.h

index 67f54b02e1fdf391f7fdce21a39352dd5858a8e1..d027c8ba1f4b18fe04ca8be8616bac0e8d4b7150 100644 (file)
@@ -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
index f611a96e4871423637bdd23483d6d87946a50b54..3db956262f2bf45831adc93467cd1962f0906e04 100644 (file)
@@ -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;
index dd32f0d9f3e0e232ccec77d58796843ca97c6899..209d71247c144459da1da89a9c301355ac90664e 100644 (file)
@@ -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 */