From 939cdafcf1fdae22d090c9c9a6b73028640463ce Mon Sep 17 00:00:00 2001 From: ElonH Date: Thu, 27 Feb 2020 00:19:53 +0800 Subject: [PATCH] luci-app-qos_gargoyle: fix get_wan --- .../luasrc/model/cbi/qos_gargoyle/global.lua | 5 +++-- .../luasrc/model/qos_gargoyle.lua | 11 +++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/global.lua b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/global.lua index f718631f6a..0379b4b3bd 100644 --- a/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/global.lua +++ b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/global.lua @@ -104,8 +104,9 @@ o = s:option(Value, "ptarget_ip", translate("Use Non-standard Ping Target"), .. "link will occur in a different segment then you can enter an alternate ping target. Leave " .. "empty to use the default settings.")) o:depends("qos_monenabled", "true") -local wan = qos.get_wan() -if wan then o:value(wan:gwaddr()) end +-- local wan = qos.get_wan() +-- if wan then o:value(wan:gwaddr()) end +-- TODO: get wan address o.datatype = "ipaddr" o = s:option(Value, "pinglimit", translate("Manual Ping Limit"), diff --git a/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/qos_gargoyle.lua b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/qos_gargoyle.lua index b0113f1872..d12af8b1c3 100644 --- a/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/qos_gargoyle.lua +++ b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/qos_gargoyle.lua @@ -26,6 +26,13 @@ function cbi_add_dpi_protocols(field) end function get_wan() - local net = require "luci.model.network".init() - return net:get_wannet() + local network = require "luci.model.network".init() + local bundle = network:get_status_by_route("0.0.0.0", 0) + local net, stat + for k, v in pairs(bundle) do + net = k + stat = v + break + end + return net and network:network(net, stat.proto) end