From 73abcfe3b506df0b7a33b6dc0cf596a95b868d15 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 27 Mar 2023 10:05:55 +0200 Subject: [PATCH] dns/dnscrypt-proxy: fix regex of course We don't need non-capture groups so simplify a bit and fetch the second capture group with the port. --- .../src/etc/inc/plugins.inc.d/dnscryptproxy.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dns/dnscrypt-proxy/src/etc/inc/plugins.inc.d/dnscryptproxy.inc b/dns/dnscrypt-proxy/src/etc/inc/plugins.inc.d/dnscryptproxy.inc index 7e3065bb6..070b46289 100644 --- a/dns/dnscrypt-proxy/src/etc/inc/plugins.inc.d/dnscryptproxy.inc +++ b/dns/dnscrypt-proxy/src/etc/inc/plugins.inc.d/dnscryptproxy.inc @@ -51,8 +51,8 @@ function dnscryptproxy_services() $ports = []; foreach (explode(',', (string)$model->listen_addresses) as $addrport) { - if (preg_match('/^(?:(\[.+\]:)|([\d\.]+:))[\d]+$/', $addrport, $matches)) { - $ports[$matches[1]] = 1; + if (preg_match('/^(\[.+\]|[\d\.]+):([\d]+)$/', $addrport, $matches)) { + $ports[$matches[2]] = 1; } }