mirror of https://github.com/aredn/aredn.git
Label wireguard tunnels in LQM (#1068)
This commit is contained in:
parent
fb0f9a4b56
commit
e83af37894
|
@ -136,7 +136,7 @@ end
|
||||||
function update_block(track)
|
function update_block(track)
|
||||||
if should_block(track) then
|
if should_block(track) then
|
||||||
track.blocked = true
|
track.blocked = true
|
||||||
if track.type == "Tunnel" then
|
if track.type == "Tunnel" or track.type == "Wireguard" then
|
||||||
if not nft_handle("input_lqm", "iifname \\\"" .. track.device .. "\\\" udp dport 698 drop") then
|
if not nft_handle("input_lqm", "iifname \\\"" .. track.device .. "\\\" udp dport 698 drop") then
|
||||||
os.execute(NFT .. " insert rule ip fw4 input_lqm iifname \\\"" .. track.device .. "\\\" udp dport 698 drop 2> /dev/null")
|
os.execute(NFT .. " insert rule ip fw4 input_lqm iifname \\\"" .. track.device .. "\\\" udp dport 698 drop 2> /dev/null")
|
||||||
return "blocked"
|
return "blocked"
|
||||||
|
@ -149,7 +149,7 @@ function update_block(track)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
track.blocked = false
|
track.blocked = false
|
||||||
if track.type == "Tunnel" then
|
if track.type == "Tunnel" or track.type == "Wireguard" then
|
||||||
local handle = nft_handle("input_lqm", "iifname \\\"" .. track.device .. "\\\" udp dport 698 drop")
|
local handle = nft_handle("input_lqm", "iifname \\\"" .. track.device .. "\\\" udp dport 698 drop")
|
||||||
if handle then
|
if handle then
|
||||||
os.execute(NFT .. " delete rule ip fw4 input_lqm handle " .. handle)
|
os.execute(NFT .. " delete rule ip fw4 input_lqm handle " .. handle)
|
||||||
|
@ -398,7 +398,7 @@ function lqm()
|
||||||
local a, b, c, d = s.clientip:match("^(%d+)%.(%d+)%.(%d+)%.(%d+):")
|
local a, b, c, d = s.clientip:match("^(%d+)%.(%d+)%.(%d+)%.(%d+):")
|
||||||
d = tonumber(d) + 1
|
d = tonumber(d) + 1
|
||||||
stations[#stations + 1] = {
|
stations[#stations + 1] = {
|
||||||
type = "Tunnel",
|
type = "Wireguard",
|
||||||
device = "wgc" .. wgc,
|
device = "wgc" .. wgc,
|
||||||
signal = nil,
|
signal = nil,
|
||||||
ip = string.format("%d.%d.%d.%d", a, b, c, d),
|
ip = string.format("%d.%d.%d.%d", a, b, c, d),
|
||||||
|
@ -419,7 +419,7 @@ function lqm()
|
||||||
if s.enabled == "1" and s.netip:match(":") then
|
if s.enabled == "1" and s.netip:match(":") then
|
||||||
local a, b, c, d, _ = s.netip:match("^(%d+)%.(%d+)%.(%d+)%.(%d+):(%d+)$")
|
local a, b, c, d, _ = s.netip:match("^(%d+)%.(%d+)%.(%d+)%.(%d+):(%d+)$")
|
||||||
stations[#stations + 1] = {
|
stations[#stations + 1] = {
|
||||||
type = "Tunnel",
|
type = "Wireguard",
|
||||||
device = "wgs" .. wgs,
|
device = "wgs" .. wgs,
|
||||||
signal = nil,
|
signal = nil,
|
||||||
ip = string.format("%d.%d.%d.%d", a, b, c, d),
|
ip = string.format("%d.%d.%d.%d", a, b, c, d),
|
||||||
|
|
Loading…
Reference in New Issue