diff options
author | Florian Eckert <fe@dev.tdt.de> | 2021-10-01 17:06:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-01 17:06:33 +0200 |
commit | fc8a0b4d51ae97a33ea6e369a8c2a0c4b3a5ba5a (patch) | |
tree | fdca8df99ad84fe4811acd936bf71f44d7b2d268 /protocols/luci-proto-wireguard | |
parent | 7f346e4d428bc920dfb224ce7872faa5a923f23d (diff) | |
parent | 193abe7221dd58f0220b86843cbc89dfa6fb0d56 (diff) |
Merge pull request #5403 from lvoegl/luci-app-wireguard-fix-parsing
luci-app-wireguard: fix allowed_ip parsing
Diffstat (limited to 'protocols/luci-proto-wireguard')
-rwxr-xr-x | protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard b/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard index 94374b07d7..ce21570cce 100755 --- a/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard +++ b/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard @@ -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 |