summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--protocols/luci-proto-wireguard/root/usr/share/rpcd/ucode/luci.wireguard3
1 files changed, 2 insertions, 1 deletions
diff --git a/protocols/luci-proto-wireguard/root/usr/share/rpcd/ucode/luci.wireguard b/protocols/luci-proto-wireguard/root/usr/share/rpcd/ucode/luci.wireguard
index c177da4773..5ffcfd85a2 100644
--- a/protocols/luci-proto-wireguard/root/usr/share/rpcd/ucode/luci.wireguard
+++ b/protocols/luci-proto-wireguard/root/usr/share/rpcd/ucode/luci.wireguard
@@ -17,10 +17,11 @@ function command(cmd) {
function checkPeerHost(configHost, configPort, wgHost) {
const ips = popen(`resolveip ${configHost} 2>/dev/null`);
+ const hostIp = replace(wgHost, /\[|\]/g, "");
if (ips) {
for (let line = ips.read('line'); length(line); line = ips.read('line')) {
const ip = rtrim(line, '\n');
- if (ip + ":" + configPort == wgHost) {
+ if (ip + ":" + configPort == hostIp) {
return true;
}
}