Merge pull request #5403 from lvoegl/luci-app-wireguard-fix-parsing

luci-app-wireguard: fix allowed_ip parsing
pull/5406/head
Florian Eckert 2021-10-01 17:06:33 +02:00 committed by GitHub
commit fc8a0b4d51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 14 deletions

View File

@ -93,28 +93,27 @@ local methods = {
end
)
table.insert(
data[line[1]].peers,
{
name = peer_name,
public_key = line[2],
endpoint = line[4],
allowed_ips = {},
latest_handshake = line[6],
transfer_rx = line[7],
transfer_tx = line[8],
persistent_keepalive = line[9]
}
)
local peer = {
name = peer_name,
public_key = line[2],
endpoint = line[4],
allowed_ips = {},
latest_handshake = line[6],
transfer_rx = line[7],
transfer_tx = line[8],
persistent_keepalive = line[9]
}
if not (line[4] == "(none)") then
local ipkey, ipvalue
for ipkey, ipvalue in pairs(string.split(line[5], ",")) do
if #ipvalue > 0 then
table.insert(data[line[1]].peers[peer_name]["allowed_ips"], ipvalue)
table.insert(peer["allowed_ips"], ipvalue)
end
end
end
table.insert(data[line[1]].peers, peer)
end
end
end