mirror of
https://github.com/openwrt/luci.git
synced 2025-12-21 19:14:34 +04:00
luci-proto-wireguard: fixed incorrect peer name detection
Added the legacy peer name detection algorithm. If the new algorithm fails to find a peer's name (e.g. when the IP address has been changed) then the legacy value will be used. Signed-off-by: Tom Haley <this_username_has_been_taken2@proton.me>
This commit is contained in:
committed by
Paul Donald
parent
04f2d129d7
commit
8bff54dc47
@@ -89,12 +89,17 @@ const methods = {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let peer_name;
|
let peer_name;
|
||||||
|
let peer_name_legacy;
|
||||||
|
|
||||||
uci.foreach('network', `wireguard_${last_device}`, (s) => {
|
uci.foreach('network', `wireguard_${last_device}`, (s) => {
|
||||||
if (!s.disabled && s.public_key == record[1] && (!s.endpoint_host || checkPeerHost(s.endpoint_host, s.endpoint_port, record[3])))
|
if (!s.disabled && s.public_key == record[1] && (!s.endpoint_host || checkPeerHost(s.endpoint_host, s.endpoint_port, record[3])))
|
||||||
peer_name = s.description;
|
peer_name = s.description;
|
||||||
|
if (s.public_key == record[1])
|
||||||
|
peer_name_legacy = s.description;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!peer_name) peer_name = peer_name_legacy;
|
||||||
|
|
||||||
const peer = {
|
const peer = {
|
||||||
name: peer_name,
|
name: peer_name,
|
||||||
public_key: record[1],
|
public_key: record[1],
|
||||||
|
|||||||
Reference in New Issue
Block a user