mirror of https://git.openwrt.org/project/luci.git
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:
parent
04f2d129d7
commit
8bff54dc47
|
@ -89,12 +89,17 @@ const methods = {
|
|||
}
|
||||
else {
|
||||
let peer_name;
|
||||
let peer_name_legacy;
|
||||
|
||||
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])))
|
||||
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 = {
|
||||
name: peer_name,
|
||||
public_key: record[1],
|
||||
|
|
Loading…
Reference in New Issue