]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix to allow the control-interface config to use ip@port notation.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Fri, 27 Mar 2026 13:29:15 +0000 (14:29 +0100)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Fri, 27 Mar 2026 13:29:15 +0000 (14:29 +0100)
daemon/remote.c
doc/Changelog
doc/unbound.conf.rst

index dd0e8f29907905dcaf9ee74f5f3a2c5238416819..eb0e96b9c4cb267ce6e8a4ee8bebea3f452ffdd2 100644 (file)
@@ -307,6 +307,26 @@ add_open(const char* ip, int nr, struct listen_port** list, int noproto_is_err,
 #endif
                }
        } else {
+               char* s = strchr(ip, '@');
+               char newif[128];
+               if(s) {
+                       /* override port with ifspec@port */
+                       int portnr;
+                       if((size_t)(s-ip) >= sizeof(newif)) {
+                               log_err("ifname too long: %s", ip);
+                               return -1;
+                       }
+                       portnr = atoi(s+1);
+                       if(portnr < 0 || 0 == portnr || portnr > 65535) {
+                               log_err("invalid portnumber in control-interface: %s", ip);
+                               return -1;
+                       }
+                       (void)strlcpy(newif, ip, sizeof(newif));
+                       newif[s-ip] = 0;
+                       ip = newif;
+                       snprintf(port, sizeof(port), "%d", portnr);
+                       port[sizeof(port)-1]=0;
+               }
                hints.ai_socktype = SOCK_STREAM;
                hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
                if((r = getaddrinfo(ip, port, &hints, &res)) != 0 || !res) {
index 5981ac2fa7fab690644f0bc0280ef074adf64d5a..31216df8c3b0af8030aa61793608c8243c7e4698 100644 (file)
@@ -1,3 +1,6 @@
+27 March 2026: Wouter
+       - Fix to allow the control-interface config to use ip@port notation.
+
 24 March 2026: Wouter
        - Fix to check for invalid http content length and chunk size,
          and to check the RR rdata field lengths when decompressing and
index 8f7b24e83c2f4d63e2d0d8e86aa600c8ee6b2706..09278be1299d4c8750fa88ff665cb24a9c337b25 100644 (file)
@@ -3457,7 +3457,7 @@ To setup the correct self-signed certificates use the
     Default: no
 
 
-@@UAHL@unbound.conf.remote@control-interface@@: *<IP address or interface name or path>*
+@@UAHL@unbound.conf.remote@control-interface@@: *<IP address or interface name[@port] or path>*
     Give IPv4 or IPv6 addresses or local socket path to listen on for control
     commands.
     If an interface name is used instead of an IP address, the list of IP