mirror of
https://github.com/openwrt/luci.git
synced 2025-12-21 19:14:34 +04:00
luci-proto-wireguard: fixed incorrect peer detection if port is not set
Fixed incorrect peer detection if port is not set (default port is used) Signed-off-by: Tom Haley <this_username_has_been_taken2@proton.me>
This commit is contained in:
@@ -21,7 +21,9 @@ function checkPeerHost(configHost, configPort, wgHost) {
|
||||
if (ips) {
|
||||
for (let line = ips.read('line'); length(line); line = ips.read('line')) {
|
||||
const ip = rtrim(line, '\n');
|
||||
if (ip + ":" + configPort == hostIp) {
|
||||
if (configPort && (ip + ":" + configPort == hostIp)) {
|
||||
return true;
|
||||
} else if (ip == substr(hostIp, 0, index(hostIp, ":"))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -29,7 +31,6 @@ function checkPeerHost(configHost, configPort, wgHost) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const methods = {
|
||||
generatePsk: {
|
||||
call: function() {
|
||||
|
||||
Reference in New Issue
Block a user