summaryrefslogtreecommitdiffhomepage
path: root/protocols
diff options
context:
space:
mode:
authorTom Haley <this_username_has_been_taken2@proton.me>2024-12-02 18:40:32 +0300
committerPaul Donald <newtwen+github@gmail.com>2024-12-02 18:22:15 +0100
commit5c97a89684cbc9eb6cf891f44cfd7f89237c52d4 (patch)
tree3ceb01e5ed8194dc4ecfaa2c868755e1f3042782 /protocols
parent0ca52ebe27e96f01b82250e58a375bac0def9561 (diff)
luci-proto-wireguard: Fix incorrect peer detection for IP v6
This commit fixes incorrect peer detection when using IP v6 by deleting all the square the square brackets from the wgHost variable. Signed-off-by: Tom Haley <this_username_has_been_taken2@proton.me>
Diffstat (limited to 'protocols')
-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;
}
}