From 7ad4177396917b00224423aa29ff6c16b38f46e7 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 23 Mar 2021 18:25:01 +0800 Subject: [PATCH 01/17] luci-app-qos-gargoyle: import from core This is only available for this branch. Signed-off-by: Tianling Shen --- package/ctcgfw/luci-app-qos-gargoyle/Makefile | 22 ++ .../luasrc/controller/qos_gargoyle.lua | 100 ++++++ .../model/cbi/qos_gargoyle/download.lua | 166 +++++++++ .../model/cbi/qos_gargoyle/download_class.lua | 61 ++++ .../model/cbi/qos_gargoyle/download_rule.lua | 87 +++++ .../luasrc/model/cbi/qos_gargoyle/global.lua | 123 +++++++ .../luasrc/model/cbi/qos_gargoyle/upload.lua | 160 +++++++++ .../model/cbi/qos_gargoyle/upload_class.lua | 52 +++ .../model/cbi/qos_gargoyle/upload_rule.lua | 87 +++++ .../luasrc/model/qos_gargoyle.lua | 31 ++ .../luasrc/view/qos_gargoyle/list_view.htm | 97 +++++ .../view/qos_gargoyle/troubleshooting.htm | 52 +++ .../po/zh-cn/qos-gargoyle.po | 334 ++++++++++++++++++ .../etc/uci-defaults/40_luci-qos_gargoyle | 11 + 14 files changed, 1383 insertions(+) create mode 100644 package/ctcgfw/luci-app-qos-gargoyle/Makefile create mode 100644 package/ctcgfw/luci-app-qos-gargoyle/luasrc/controller/qos_gargoyle.lua create mode 100644 package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/download.lua create mode 100644 package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/download_class.lua create mode 100644 package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/download_rule.lua create mode 100644 package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/global.lua create mode 100644 package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/upload.lua create mode 100644 package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/upload_class.lua create mode 100644 package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/upload_rule.lua create mode 100644 package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/qos_gargoyle.lua create mode 100644 package/ctcgfw/luci-app-qos-gargoyle/luasrc/view/qos_gargoyle/list_view.htm create mode 100644 package/ctcgfw/luci-app-qos-gargoyle/luasrc/view/qos_gargoyle/troubleshooting.htm create mode 100644 package/ctcgfw/luci-app-qos-gargoyle/po/zh-cn/qos-gargoyle.po create mode 100755 package/ctcgfw/luci-app-qos-gargoyle/root/etc/uci-defaults/40_luci-qos_gargoyle diff --git a/package/ctcgfw/luci-app-qos-gargoyle/Makefile b/package/ctcgfw/luci-app-qos-gargoyle/Makefile new file mode 100644 index 0000000000..f0187a81a6 --- /dev/null +++ b/package/ctcgfw/luci-app-qos-gargoyle/Makefile @@ -0,0 +1,22 @@ +# +# Copyright (C) 2017 Xingwang Liao +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-app-qos-gargoyle +PKG_VERSION:=1.3.6 +PKG_RELEASE:=1 + +PKG_LICENSE:=Apache-2.0 +PKG_MAINTAINER:=Xingwang Liao + +LUCI_TITLE:=LuCI Support for Gargoyle QoS +LUCI_DEPENDS:=+qos-gargoyle +LUCI_PKGARCH:=all + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/ctcgfw/luci-app-qos-gargoyle/luasrc/controller/qos_gargoyle.lua b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/controller/qos_gargoyle.lua new file mode 100644 index 0000000000..5b9ca56c5f --- /dev/null +++ b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/controller/qos_gargoyle.lua @@ -0,0 +1,100 @@ +-- Copyright 2017 Xingwang Liao +-- Licensed to the public under the Apache License 2.0. + +module("luci.controller.qos_gargoyle", package.seeall) + +local util = require "luci.util" +local http = require "luci.http" + +function index() + if not nixio.fs.access("/etc/config/qos_gargoyle") then + return + end + + entry({"admin", "network", "qos_gargoyle"}, + firstchild(), _("Gargoyle QoS"), 60) + + entry({"admin", "network", "qos_gargoyle", "global"}, + cbi("qos_gargoyle/global"), _("Global Settings"), 10) + + entry({"admin", "network", "qos_gargoyle", "upload"}, + cbi("qos_gargoyle/upload"), _("Upload Settings"), 20) + + entry({"admin", "network", "qos_gargoyle", "upload", "class"}, + cbi("qos_gargoyle/upload_class")).leaf = true + + entry({"admin", "network", "qos_gargoyle", "upload", "rule"}, + cbi("qos_gargoyle/upload_rule")).leaf = true + + entry({"admin", "network", "qos_gargoyle", "download"}, + cbi("qos_gargoyle/download"), _("Download Settings"), 30) + + entry({"admin", "network", "qos_gargoyle", "download", "class"}, + cbi("qos_gargoyle/download_class")).leaf = true + + entry({"admin", "network", "qos_gargoyle", "download", "rule"}, + cbi("qos_gargoyle/download_rule")).leaf = true + + entry({"admin", "network", "qos_gargoyle", "troubleshooting"}, + template("qos_gargoyle/troubleshooting"), _("Troubleshooting"), 40) + + entry({"admin", "network", "qos_gargoyle", "troubleshooting", "data"}, + call("action_troubleshooting_data")) + + entry({"admin", "network", "qos_gargoyle", "load_data"}, + call("action_load_data")).leaf = true +end + +function action_troubleshooting_data() + local uci = require "luci.model.uci".cursor() + local i18n = require "luci.i18n" + + local data = {} + + local monenabled = uci:get("qos_gargoyle", "download", "qos_monenabled") or "false" + + local show_data = util.trim(util.exec("/etc/init.d/qos_gargoyle show 2>/dev/null")) + if show_data == "" then + show_data = i18n.translate("No data found") + end + + data.show = show_data + + local mon_data + if monenabled == "true" then + mon_data = util.trim(util.exec("cat /tmp/qosmon.status 2>/dev/null")) + + if mon_data == "" then + mon_data = i18n.translate("No data found") + end + else + mon_data = i18n.translate("\"Active Congestion Control\" not enabled") + end + + data.mon = mon_data + + http.prepare_content("application/json") + http.write_json(data) +end + +function action_load_data(type) + local device + if type == "download" then + device = "imq0" + elseif type == "upload" then + local qos = require "luci.model.qos_gargoyle" + local wan = qos.get_wan() + device = wan and wan:ifname() or "" + end + + if device then + local data + if device ~= "" then + data = util.exec("tc -s class show dev %s 2>/dev/null" % device) + end + http.prepare_content("text/plain") + http.write(data or "") + else + http.status(500, "Bad address") + end +end diff --git a/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/download.lua b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/download.lua new file mode 100644 index 0000000000..a165178874 --- /dev/null +++ b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/download.lua @@ -0,0 +1,166 @@ +-- Copyright 2017 Xingwang Liao +-- Licensed to the public under the Apache License 2.0. + +local wa = require "luci.tools.webadmin" +local uci = require "luci.model.uci".cursor() +local dsp = require "luci.dispatcher" +local http = require "luci.http" +local qos = require "luci.model.qos_gargoyle" + +local m, class_s, rule_s, o +local download_classes = {} +local qos_gargoyle = "qos_gargoyle" + +uci:foreach(qos_gargoyle, "download_class", function(s) + local class_alias = s.name + if class_alias then + download_classes[#download_classes + 1] = {name = s[".name"], alias = class_alias} + end +end) + +m = Map(qos_gargoyle, translate("Download Settings")) +m.template = "qos_gargoyle/list_view" + +class_s = m:section(TypedSection, "download_class", translate("Service Classes"), + translate("Each service class is specified by four parameters: percent bandwidth at capacity, " + .. "realtime bandwidth and maximum bandwidth and the minimimze round trip time flag.")) +class_s.anonymous = true +class_s.addremove = true +class_s.template = "cbi/tblsection" +class_s.extedit = dsp.build_url("admin/network/qos_gargoyle/download/class/%s") +class_s.create = function(...) + local sid = TypedSection.create(...) + if sid then + m.uci:save(qos_gargoyle) + http.redirect(class_s.extedit % sid) + return + end +end + +o = class_s:option(DummyValue, "name", translate("Class Name")) +o.cfgvalue = function(...) + return Value.cfgvalue(...) or translate("None") +end + +o = class_s:option(DummyValue, "percent_bandwidth", translate("Percent Bandwidth At Capacity")) +o.cfgvalue = function(...) + local v = tonumber(Value.cfgvalue(...)) + if v and v > 0 then + return "%d %%" % v + end + return translate("Not set") +end + +o = class_s:option(DummyValue, "min_bandwidth", "%s (kbps)" % translate("Minimum Bandwidth")) +o.cfgvalue = function(...) + local v = tonumber(Value.cfgvalue(...)) + return v or translate("Zero") +end + +o = class_s:option(DummyValue, "max_bandwidth", "%s (kbps)" % translate("Maximum Bandwidth")) +o.cfgvalue = function(...) + local v = tonumber(Value.cfgvalue(...)) + return v or translate("Unlimited") +end + +o = class_s:option(DummyValue, "minRTT", translate("Minimize RTT")) +o.cfgvalue = function(...) + local v = Value.cfgvalue(...) + return v and translate(v) or translate("No") +end + +o = class_s:option(DummyValue, "_ld", "%s (kbps)" % translate("Load")) +o.rawhtml = true +o.value = "*" + +rule_s = m:section(TypedSection, "download_rule", translate("Classification Rules"), + translate("Packets are tested against the rules in the order specified -- rules toward the top " + .. "have priority. As soon as a packet matches a rule it is classified, and the rest of the rules " + .. "are ignored. The order of the rules can be altered using the arrow controls.") + ) +rule_s.addremove = true +rule_s.sortable = true +rule_s.anonymous = true +rule_s.template = "cbi/tblsection" +rule_s.extedit = dsp.build_url("admin/network/qos_gargoyle/download/rule/%s") +rule_s.create = function(...) + local sid = TypedSection.create(...) + if sid then + m.uci:save(qos_gargoyle) + http.redirect(rule_s.extedit % sid) + return + end +end + +o = rule_s:option(ListValue, "class", translate("Service Class")) +for _, s in ipairs(download_classes) do o:value(s.name, s.alias) end + +o = rule_s:option(Value, "proto", translate("Transport Protocol")) +o:value("", translate("All")) +o:value("tcp", "TCP") +o:value("udp", "UDP") +o:value("icmp", "ICMP") +o:value("gre", "GRE") +o.size = "10" +o.cfgvalue = function(...) + local v = Value.cfgvalue(...) + return v and v:upper() or "" +end +o.write = function(self, section, value) + Value.write(self, section, value:lower()) +end + +o = rule_s:option(Value, "source", translate("Source IP(s)")) +o:value("", translate("All")) +wa.cbi_add_knownips(o) +o.datatype = "ipmask4" + +o = rule_s:option(Value, "srcport", translate("Source Port(s)")) +o:value("", translate("All")) +o.datatype = "or(port, portrange)" + +o = rule_s:option(Value, "destination", translate("Destination IP(s)")) +o:value("", translate("All")) +wa.cbi_add_knownips(o) +o.datatype = "ipmask4" + +o = rule_s:option(Value, "dstport", translate("Destination Port(s)")) +o:value("", translate("All")) +o.datatype = "or(port, portrange)" + +o = rule_s:option(DummyValue, "min_pkt_size", translate("Minimum Packet Length")) +o.cfgvalue = function(...) + local v = tonumber(Value.cfgvalue(...)) + if v and v > 0 then + return wa.byte_format(v) + end + return translate("Not set") +end + +o = rule_s:option(DummyValue, "max_pkt_size", translate("Maximum Packet Length")) +o.cfgvalue = function(...) + local v = tonumber(Value.cfgvalue(...)) + if v and v > 0 then + return wa.byte_format(v) + end + return translate("Not set") +end + +o = rule_s:option(DummyValue, "connbytes_kb", translate("Connection Bytes Reach")) +o.cfgvalue = function(...) + local v = tonumber(Value.cfgvalue(...)) + if v and v > 0 then + return wa.byte_format(v * 1024) + end + return translate("Not set") +end + +if qos.has_ndpi() then + o = rule_s:option(DummyValue, "ndpi", translate("DPI Protocol")) + o.cfgvalue = function(...) + local v = Value.cfgvalue(...) + return v and v:upper() or translate("All") + end +end + +return m diff --git a/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/download_class.lua b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/download_class.lua new file mode 100644 index 0000000000..c26cb78301 --- /dev/null +++ b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/download_class.lua @@ -0,0 +1,61 @@ +-- Copyright 2017 Xingwang Liao +-- Licensed to the public under the Apache License 2.0. + +local m, s, o +local sid = arg[1] +local qos_gargoyle = "qos_gargoyle" + +m = Map(qos_gargoyle, translate("Edit Download Service Class")) +m.redirect = luci.dispatcher.build_url("admin/network/qos_gargoyle/download") + +if m.uci:get(qos_gargoyle, sid) ~= "download_class" then + luci.http.redirect(m.redirect) + return +end + +s = m:section(NamedSection, sid, "download_class") +s.anonymous = true +s.addremove = false + +o = s:option(Value, "name", translate("Service Class Name")) +o.rmempty = false + +o = s:option(Value, "percent_bandwidth", translate("Percent Bandwidth At Capacity"), + translate("The percentage of the total available bandwidth that should be allocated to this class " + .. "when all available bandwidth is being used. If unused bandwidth is available, more can (and " + .. "will) be allocated. The percentages can be configured to equal more (or less) than 100, but " + .. "when the settings are applied the percentages will be adjusted proportionally so that they " + .. "add to 100. This setting only comes into effect when the WAN link is saturated.")) +o.datatype = "range(1, 100)" +o.rmempty = false + +o = s:option(Value, "min_bandwidth", translate("Minimum Bandwidth"), + translate("The minimum service this class will be allocated when the link is at capacity. Classes " + .. "which specify minimum service are known as realtime classes by the active congestion " + .. "controller. Streaming video, VoIP and interactive online gaming are all examples of " + .. "applications that must have a minimum bandwith to function. To determine what to enter use " + .. "the application on an unloaded LAN and observe how much bandwidth it uses. Then enter a " + .. "number only slightly higher than this into this field. QoS will satisfiy the minimum service " + .. "of all classes first before allocating to other waiting classes so be careful to use minimum " + .. "bandwidths sparingly.")) +o:value("0", translate("Zero")) +o.datatype = "uinteger" +o.default = "0" + +o = s:option(Value, "max_bandwidth", translate("Maximum Bandwidth"), + translate("The maximum amount of bandwidth this class will be allocated in kbit/s. Even if unused " + .. "bandwidth is available, this service class will never be permitted to use more than this " + .. "amount of bandwidth.")) +o:value("", translate("Unlimited")) +o.datatype = "uinteger" + +o = s:option(Flag, "minRTT", translate("Minimize RTT"), + translate("Indicates to the active congestion controller that you wish to minimize round trip " + .. "times (RTT) when this class is active. Use this setting for online gaming or VoIP " + .. "applications that need low round trip times (ping times). Minimizing RTT comes at the expense " + .. "of efficient WAN throughput so while these class are active your WAN throughput will decline " + .. "(usually around 20%).")) +o.enabled = "Yes" +o.disabled = "No" + +return m diff --git a/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/download_rule.lua b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/download_rule.lua new file mode 100644 index 0000000000..cbc970e2f0 --- /dev/null +++ b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/download_rule.lua @@ -0,0 +1,87 @@ +-- Copyright 2017 Xingwang Liao +-- Licensed to the public under the Apache License 2.0. + +local wa = require "luci.tools.webadmin" +local uci = require "luci.model.uci".cursor() +local qos = require "luci.model.qos_gargoyle" + +local m, s, o +local sid = arg[1] +local download_classes = {} +local qos_gargoyle = "qos_gargoyle" + +uci:foreach(qos_gargoyle, "download_class", function(s) + local class_alias = s.name + if class_alias then + download_classes[#download_classes + 1] = {name = s[".name"], alias = class_alias} + end +end) + +m = Map(qos_gargoyle, translate("Edit Download Classification Rule")) +m.redirect = luci.dispatcher.build_url("admin/network/qos_gargoyle/download") + +if m.uci:get(qos_gargoyle, sid) ~= "download_rule" then + luci.http.redirect(m.redirect) + return +end + +s = m:section(NamedSection, sid, "download_rule") +s.anonymous = true +s.addremove = false + +o = s:option(ListValue, "class", translate("Service Class")) +for _, s in ipairs(download_classes) do o:value(s.name, s.alias) end + +o = s:option(Value, "proto", translate("Transport Protocol")) +o:value("", translate("All")) +o:value("tcp", "TCP") +o:value("udp", "UDP") +o:value("icmp", "ICMP") +o:value("gre", "GRE") +o.write = function(self, section, value) + Value.write(self, section, value:lower()) +end + +o = s:option(Value, "source", translate("Source IP(s)"), + translate("Packet's source ip, can optionally have /[mask] after it (see -s option in iptables " + .. "man page).")) +o:value("", translate("All")) +wa.cbi_add_knownips(o) +o.datatype = "ipmask4" + +o = s:option(Value, "srcport", translate("Source Port(s)"), + translate("Packet's source port, can be a range (eg. 80-90).")) +o:value("", translate("All")) +o.datatype = "or(port, portrange)" + +o = s:option(Value, "destination", translate("Destination IP(s)"), + translate("Packet's destination ip, can optionally have /[mask] after it (see -d option in " + .. "iptables man page).")) +o:value("", translate("All")) +wa.cbi_add_knownips(o) +o.datatype = "ipmask4" + +o = s:option(Value, "dstport", translate("Destination Port(s)"), + translate("Packet's destination port, can be a range (eg. 80-90).")) +o:value("", translate("All")) +o.datatype = "or(port, portrange)" + +o = s:option(Value, "min_pkt_size", translate("Minimum Packet Length"), + translate("Packet's minimum size (in bytes).")) +o.datatype = "range(1, 1500)" + +o = s:option(Value, "max_pkt_size", translate("Maximum Packet Length"), + translate("Packet's maximum size (in bytes).")) +o.datatype = "range(1, 1500)" + +o = s:option(Value, "connbytes_kb", translate("Connection Bytes Reach"), + translate("The total size of data transmitted since the establishment of the link (in kBytes).")) +o.datatype = "range(0, 4194303)" + +if qos.has_ndpi() then + o = s:option(ListValue, "ndpi", translate("DPI Protocol")) + o:value("", translate("All")) + qos.cbi_add_dpi_protocols(o) +end + +return m 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 new file mode 100644 index 0000000000..f718631f6a --- /dev/null +++ b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/global.lua @@ -0,0 +1,123 @@ +-- Copyright 2017 Xingwang Liao +-- Licensed to the public under the Apache License 2.0. + +local sys = require "luci.sys" +local uci = require "luci.model.uci".cursor() +local net = require "luci.model.network".init() +local qos = require "luci.model.qos_gargoyle" + +local m, s, o +local upload_classes = {} +local download_classes = {} +local qos_gargoyle = "qos_gargoyle" + +local function qos_enabled() + return sys.init.enabled(qos_gargoyle) +end + +uci:foreach(qos_gargoyle, "upload_class", function(s) + local class_alias = s.name + if class_alias then + upload_classes[#upload_classes + 1] = {name = s[".name"], alias = class_alias} + end +end) + +uci:foreach(qos_gargoyle, "download_class", function(s) + local class_alias = s.name + if class_alias then + download_classes[#download_classes + 1] = {name = s[".name"], alias = class_alias} + end +end) + +m = Map(qos_gargoyle, translate("Gargoyle QoS"), + translate("Quality of Service (QoS) provides a way to control how available bandwidth is " + .. "allocated.")) + +s = m:section(SimpleSection, translate("Global Settings")) +s.anonymous = true + +o = s:option(Button, "_switch", nil, translate("QoS Switch")) +o.render = function(self, section, scope) + if qos_enabled() then + self.title = translate("Disable QoS") + self.inputstyle = "reset" + else + self.title = translate("Enable QoS") + self.inputstyle = "apply" + end + Button.render(self, section, scope) +end +o.write = function(...) + if qos_enabled() then + sys.init.stop(qos_gargoyle) + sys.init.disable(qos_gargoyle) + else + sys.init.enable(qos_gargoyle) + sys.init.start(qos_gargoyle) + end +end + +s = m:section(NamedSection, "upload", "upload", translate("Upload Settings")) +s.anonymous = true + +o = s:option(ListValue, "default_class", translate("Default Service Class"), + translate("Specifie how packets that do not match any rule should be classified.")) +for _, s in ipairs(upload_classes) do o:value(s.name, s.alias) end + +o = s:option(Value, "total_bandwidth", translate("Total Upload Bandwidth"), + translate("Should be set to around 98% of your available upload bandwidth. Entering a number " + .. "which is too high will result in QoS not meeting its class requirements. Entering a number " + .. "which is too low will needlessly penalize your upload speed. You should use a speed test " + .. "program (with QoS off) to determine available upload bandwidth. Note that bandwidth is " + .. "specified in kbps, leave blank to disable update QoS. There are 8 kilobits per kilobyte.")) +o.datatype = "uinteger" + +s = m:section(NamedSection, "download", "download", translate("Download Settings")) +s.anonymous = true + +o = s:option(ListValue, "default_class", translate("Default Service Class"), + translate("Specifie how packets that do not match any rule should be classified.")) +for _, s in ipairs(download_classes) do o:value(s.name, s.alias) end + +o = s:option(Value, "total_bandwidth", translate("Total Download Bandwidth"), + translate("Specifying correctly is crucial to making QoS work. Note that bandwidth is specified " + .. "in kbps, leave blank to disable download QoS. There are 8 kilobits per kilobyte.")) +o.datatype = "uinteger" + +o = s:option(Flag, "qos_monenabled", translate("Enable Active Congestion Control"), + translate("

The active congestion control (ACC) observes your download activity and " + .. "automatically adjusts your download link limit to maintain proper QoS performance. ACC " + .. "automatically compensates for changes in your ISP's download speed and the demand from your " + .. "network adjusting the link speed to the highest speed possible which will maintain proper QoS " + .. "function. The effective range of this control is between 15% and 100% of the total download " + .. "bandwidth you entered above.

") .. + translate("

While ACC does not adjust your upload link speed you must enable and properly " + .. "configure your upload QoS for it to function properly.

") + ) +o.enabled = "true" +o.disabled = "false" + +o = s:option(Value, "ptarget_ip", translate("Use Non-standard Ping Target"), + translate("The segment of network between your router and the ping target is where congestion is " + .. "controlled. By monitoring the round trip ping times to the target congestion is detected. By " + .. "default ACC uses your WAN gateway as the ping target. If you know that congestion on your " + .. "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 +o.datatype = "ipaddr" + +o = s:option(Value, "pinglimit", translate("Manual Ping Limit"), + translate("Round trip ping times are compared against the ping limits. ACC controls the link " + .. "limit to maintain ping times under the appropriate limit. By default ACC attempts to " + .. "automatically select appropriate target ping limits for you based on the link speeds you " + .. "entered and the performance of your link it measures during initialization. You cannot change " + .. "the target ping time for the minRTT mode but by entering a manual time you can control the " + .. "target ping time of the active mode. The time you enter becomes the increase in the target " + .. "ping time between minRTT and active mode. Leave empty to use the default settings.")) +o:depends("qos_monenabled", "true") +o:value("Auto", translate("Auto")) +o.datatype = "or('Auto', range(10, 250))" + +return m diff --git a/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/upload.lua b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/upload.lua new file mode 100644 index 0000000000..a5f86927ef --- /dev/null +++ b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/upload.lua @@ -0,0 +1,160 @@ +-- Copyright 2017 Xingwang Liao +-- Licensed to the public under the Apache License 2.0. + +local wa = require "luci.tools.webadmin" +local uci = require "luci.model.uci".cursor() +local dsp = require "luci.dispatcher" +local http = require "luci.http" +local qos = require "luci.model.qos_gargoyle" + +local m, class_s, rule_s, o +local upload_classes = {} +local qos_gargoyle = "qos_gargoyle" + +uci:foreach(qos_gargoyle, "upload_class", function(s) + local class_alias = s.name + if class_alias then + upload_classes[#upload_classes + 1] = {name = s[".name"], alias = class_alias} + end +end) + +m = Map(qos_gargoyle, translate("Upload Settings")) +m.template = "qos_gargoyle/list_view" + +class_s = m:section(TypedSection, "upload_class", translate("Service Classes"), + translate("Each upload service class is specified by three parameters: percent bandwidth at " + .. "capacity, minimum bandwidth and maximum bandwidth.")) +class_s.anonymous = true +class_s.addremove = true +class_s.template = "cbi/tblsection" +class_s.extedit = dsp.build_url("admin/network/qos_gargoyle/upload/class/%s") +class_s.create = function(...) + local sid = TypedSection.create(...) + if sid then + m.uci:save(qos_gargoyle) + http.redirect(class_s.extedit % sid) + return + end +end + +o = class_s:option(DummyValue, "name", translate("Class Name")) +o.cfgvalue = function(...) + return Value.cfgvalue(...) or translate("None") +end + +o = class_s:option(DummyValue, "percent_bandwidth", translate("Percent Bandwidth At Capacity")) +o.cfgvalue = function(...) + local v = tonumber(Value.cfgvalue(...)) + if v and v > 0 then + return "%d %%" % v + end + return translate("Not set") +end + +o = class_s:option(DummyValue, "min_bandwidth", "%s (kbps)" % translate("Minimum Bandwidth")) +o.cfgvalue = function(...) + local v = tonumber(Value.cfgvalue(...)) + return v or translate("Zero") +end + +o = class_s:option(DummyValue, "max_bandwidth", "%s (kbps)" % translate("Maximum Bandwidth")) +o.cfgvalue = function(...) + local v = tonumber(Value.cfgvalue(...)) + return v or translate("Unlimited") +end + +o = class_s:option(DummyValue, "_ld", "%s (kbps)" % translate("Load")) +o.rawhtml = true +o.value = "*" + +rule_s = m:section(TypedSection, "upload_rule",translate("Classification Rules"), + translate("Packets are tested against the rules in the order specified -- rules toward the top " + .. "have priority. As soon as a packet matches a rule it is classified, and the rest of the rules " + .. "are ignored. The order of the rules can be altered using the arrow controls.") +) +rule_s.addremove = true +rule_s.sortable = true +rule_s.anonymous = true +rule_s.template = "cbi/tblsection" +rule_s.extedit = dsp.build_url("admin/network/qos_gargoyle/upload/rule/%s") +rule_s.create = function(...) + local sid = TypedSection.create(...) + if sid then + m.uci:save(qos_gargoyle) + http.redirect(rule_s.extedit % sid) + return + end +end + +o = rule_s:option(ListValue, "class", translate("Service Class")) +for _, s in ipairs(upload_classes) do o:value(s.name, s.alias) end + +o = rule_s:option(Value, "proto", translate("Transport Protocol")) +o:value("", translate("All")) +o:value("tcp", "TCP") +o:value("udp", "UDP") +o:value("icmp", "ICMP") +o:value("gre", "GRE") +o.size = "10" +o.cfgvalue = function(...) + local v = Value.cfgvalue(...) + return v and v:upper() or "" +end +o.write = function(self, section, value) + Value.write(self, section, value:lower()) +end + +o = rule_s:option(Value, "source", translate("Source IP(s)")) +o:value("", translate("All")) +wa.cbi_add_knownips(o) +o.datatype = "ipmask4" + +o = rule_s:option(Value, "srcport", translate("Source Port(s)")) +o:value("", translate("All")) +o.datatype = "or(port, portrange)" + +o = rule_s:option(Value, "destination", translate("Destination IP(s)")) +o:value("", translate("All")) +wa.cbi_add_knownips(o) +o.datatype = "ipmask4" + +o = rule_s:option(Value, "dstport", translate("Destination Port(s)")) +o:value("", translate("All")) +o.datatype = "or(port, portrange)" + +o = rule_s:option(DummyValue, "min_pkt_size", translate("Minimum Packet Length")) +o.cfgvalue = function(...) + local v = tonumber(Value.cfgvalue(...)) + if v and v > 0 then + return wa.byte_format(v) + end + return translate("Not set") +end + +o = rule_s:option(DummyValue, "max_pkt_size", translate("Maximum Packet Length")) +o.cfgvalue = function(...) + local v = tonumber(Value.cfgvalue(...)) + if v and v > 0 then + return wa.byte_format(v) + end + return translate("Not set") +end + +o = rule_s:option(DummyValue, "connbytes_kb", translate("Connection Bytes Reach")) +o.cfgvalue = function(...) + local v = tonumber(Value.cfgvalue(...)) + if v and v > 0 then + return wa.byte_format(v * 1024) + end + return translate("Not set") +end + +if qos.has_ndpi() then + o = rule_s:option(DummyValue, "ndpi", translate("DPI Protocol")) + o.cfgvalue = function(...) + local v = Value.cfgvalue(...) + return v and v:upper() or translate("All") + end +end + +return m diff --git a/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/upload_class.lua b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/upload_class.lua new file mode 100644 index 0000000000..9739b9794b --- /dev/null +++ b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/upload_class.lua @@ -0,0 +1,52 @@ +-- Copyright 2017 Xingwang Liao +-- Licensed to the public under the Apache License 2.0. + +local m, s, o +local sid = arg[1] +local qos_gargoyle = "qos_gargoyle" + +m = Map(qos_gargoyle, translate("Edit Upload Service Class")) +m.redirect = luci.dispatcher.build_url("admin/network/qos_gargoyle/upload") + +if m.uci:get(qos_gargoyle, sid) ~= "upload_class" then + luci.http.redirect(m.redirect) + return +end + +s = m:section(NamedSection, sid, "upload_class") +s.anonymous = true +s.addremove = false + +o = s:option(Value, "name", translate("Service Class Name")) +o.rmempty = false + +o = s:option(Value, "percent_bandwidth", translate("Percent Bandwidth At Capacity"), + translate("The percentage of the total available bandwidth that should be allocated to this class " + .. "when all available bandwidth is being used. If unused bandwidth is available, more can (and " + .. "will) be allocated. The percentages can be configured to equal more (or less) than 100, but " + .. "when the settings are applied the percentages will be adjusted proportionally so that they " + .. "add to 100. This setting only comes into effect when the WAN link is saturated.")) +o.datatype = "range(1, 100)" +o.rmempty = false + +o = s:option(Value, "min_bandwidth", translate("Minimum Bandwidth"), + translate("The minimum service this class will be allocated when the link is at capacity. Classes " + .. "which specify minimum service are known as realtime classes by the active congestion " + .. "controller. Streaming video, VoIP and interactive online gaming are all examples of " + .. "applications that must have a minimum bandwith to function. To determine what to enter use " + .. "the application on an unloaded LAN and observe how much bandwidth it uses. Then enter a " + .. "number only slightly higher than this into this field. QoS will satisfiy the minimum service " + .. "of all classes first before allocating to other waiting classes so be careful to use minimum " + .. "bandwidths sparingly.")) +o:value("0", translate("Zero")) +o.datatype = "uinteger" +o.default = "0" + +o = s:option(Value, "max_bandwidth", translate("Maximum Bandwidth"), + translate("The maximum amount of bandwidth this class will be allocated in kbit/s. Even if unused " + .. "bandwidth is available, this service class will never be permitted to use more than this " + .. "amount of bandwidth.")) +o:value("", translate("Unlimited")) +o.datatype = "uinteger" + +return m diff --git a/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/upload_rule.lua b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/upload_rule.lua new file mode 100644 index 0000000000..8abcac35d9 --- /dev/null +++ b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/cbi/qos_gargoyle/upload_rule.lua @@ -0,0 +1,87 @@ +-- Copyright 2017 Xingwang Liao +-- Licensed to the public under the Apache License 2.0. + +local wa = require "luci.tools.webadmin" +local uci = require "luci.model.uci".cursor() +local qos = require "luci.model.qos_gargoyle" + +local m, s, o +local sid = arg[1] +local upload_classes = {} +local qos_gargoyle = "qos_gargoyle" + +uci:foreach(qos_gargoyle, "upload_class", function(s) + local class_alias = s.name + if class_alias then + upload_classes[#upload_classes + 1] = {name = s[".name"], alias = class_alias} + end +end) + +m = Map(qos_gargoyle, translate("Edit Upload Classification Rule")) +m.redirect = luci.dispatcher.build_url("admin/network/qos_gargoyle/upload") + +if m.uci:get(qos_gargoyle, sid) ~= "upload_rule" then + luci.http.redirect(m.redirect) + return +end + +s = m:section(NamedSection, sid, "upload_rule") +s.anonymous = true +s.addremove = false + +o = s:option(ListValue, "class", translate("Service Class")) +for _, s in ipairs(upload_classes) do o:value(s.name, s.alias) end + +o = s:option(Value, "proto", translate("Transport Protocol")) +o:value("", translate("All")) +o:value("tcp", "TCP") +o:value("udp", "UDP") +o:value("icmp", "ICMP") +o:value("gre", "GRE") +o.write = function(self, section, value) + Value.write(self, section, value:lower()) +end + +o = s:option(Value, "source", translate("Source IP(s)"), + translate("Packet's source ip, can optionally have /[mask] after it (see -s option in iptables " + .. "man page).")) +o:value("", translate("All")) +wa.cbi_add_knownips(o) +o.datatype = "ipmask4" + +o = s:option(Value, "srcport", translate("Source Port(s)"), + translate("Packet's source port, can be a range (eg. 80-90).")) +o:value("", translate("All")) +o.datatype = "or(port, portrange)" + +o = s:option(Value, "destination", translate("Destination IP(s)"), + translate("Packet's destination ip, can optionally have /[mask] after it (see -d option in " + .. "iptables man page).")) +o:value("", translate("All")) +wa.cbi_add_knownips(o) +o.datatype = "ipmask4" + +o = s:option(Value, "dstport", translate("Destination Port(s)"), + translate("Packet's destination port, can be a range (eg. 80-90).")) +o:value("", translate("All")) +o.datatype = "or(port, portrange)" + +o = s:option(Value, "min_pkt_size", translate("Minimum Packet Length"), + translate("Packet's minimum size (in bytes).")) +o.datatype = "range(1, 1500)" + +o = s:option(Value, "max_pkt_size", translate("Maximum Packet Length"), + translate("Packet's maximum size (in bytes).")) +o.datatype = "range(1, 1500)" + +o = s:option(Value, "connbytes_kb", translate("Connection Bytes Reach"), + translate("The total size of data transmitted since the establishment of the link (in kBytes).")) +o.datatype = "range(0, 4194303)" + +if qos.has_ndpi() then + o = s:option(ListValue, "ndpi", translate("DPI Protocol")) + o:value("", translate("All")) + qos.cbi_add_dpi_protocols(o) +end + +return m 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 new file mode 100644 index 0000000000..b0113f1872 --- /dev/null +++ b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/model/qos_gargoyle.lua @@ -0,0 +1,31 @@ +-- Copyright 2017 Xingwang Liao +-- Licensed to the public under the Apache License 2.0. + +module("luci.model.qos_gargoyle", package.seeall) + +function has_ndpi() + return luci.sys.call("lsmod | cut -d ' ' -f1 | grep -q 'xt_ndpi'") == 0 +end + +function cbi_add_dpi_protocols(field) + local util = require "luci.util" + + local dpi_protocols = {} + + for line in util.execi("iptables -m ndpi --help 2>/dev/null | grep '^--'") do + local _, _, protocol, name = line:find("%-%-([^%s]+) Match for ([^%s]+)") + + if protocol and name then + dpi_protocols[protocol] = name + end + end + + for p, n in util.kspairs(dpi_protocols) do + field:value(p, n) + end +end + +function get_wan() + local net = require "luci.model.network".init() + return net:get_wannet() +end diff --git a/package/ctcgfw/luci-app-qos-gargoyle/luasrc/view/qos_gargoyle/list_view.htm b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/view/qos_gargoyle/list_view.htm new file mode 100644 index 0000000000..87d3994de2 --- /dev/null +++ b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/view/qos_gargoyle/list_view.htm @@ -0,0 +1,97 @@ +<%# + Copyright 2017 Xingwang Liao + Licensed to the public under the Apache License 2.0. +-%> + +<% + local dsp = require "luci.dispatcher" + local request = dsp.context.path + local leaf = request[#request] +-%> + + + +<%+cbi/map%> + + diff --git a/package/ctcgfw/luci-app-qos-gargoyle/luasrc/view/qos_gargoyle/troubleshooting.htm b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/view/qos_gargoyle/troubleshooting.htm new file mode 100644 index 0000000000..17197850e8 --- /dev/null +++ b/package/ctcgfw/luci-app-qos-gargoyle/luasrc/view/qos_gargoyle/troubleshooting.htm @@ -0,0 +1,52 @@ +<%# + Copyright 2017 Xingwang Liao + Licensed to the public under the Apache License 2.0. +-%> + +<% css = [[ + + #troubleshoot_text { + padding: 20px; + text-align: left; + } + #troubleshoot_text pre { + word-break: break-all; + margin: 0; + } + .description { + background-color: #33CCFF; + } + +]] +-%> + +<%+header%> + + + + +
+
+ <%:Troubleshooting Data%> +
<%:Loading%><%:Collecting data...%>
+
+
+ +<%+footer%> diff --git a/package/ctcgfw/luci-app-qos-gargoyle/po/zh-cn/qos-gargoyle.po b/package/ctcgfw/luci-app-qos-gargoyle/po/zh-cn/qos-gargoyle.po new file mode 100644 index 0000000000..4b1d10624a --- /dev/null +++ b/package/ctcgfw/luci-app-qos-gargoyle/po/zh-cn/qos-gargoyle.po @@ -0,0 +1,334 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8\n" + +msgid "\"Active Congestion Control\" not enabled" +msgstr "“主动拥塞控制”未启用" + +msgid "" +"

The active congestion control (ACC) observes your download activity and " +"automatically adjusts your download link limit to maintain proper QoS " +"performance. ACC automatically compensates for changes in your ISP's " +"download speed and the demand from your network adjusting the link speed to " +"the highest speed possible which will maintain proper QoS function. The " +"effective range of this control is between 15% and 100% of the total " +"download bandwidth you entered above.

" +msgstr "" +"

主动拥塞控制系统(ACC)观察你的下载活动并自动调整你的下载链接限制以保持适" +"当的 QoS 性能。ACC 自动调整 QoS 功能以补偿来自你 ISP 的下载速度变化及来自你网" +"络链接速度的调整需求,使速度最大化。这个控制的有效范围在你上面输入的下载总带" +"宽的 15% 至 100% 之间。

" + +msgid "" +"

While ACC does not adjust your upload link speed you must enable and " +"properly configure your upload QoS for it to function properly.

" +msgstr "" +"

虽然 ACC 不调整你的上传链路速度,但你必须启用并正确配置你的上传 QoS 带宽以" +"使该功能正常工作。

" + +msgid "All" +msgstr "全部" + +msgid "Auto" +msgstr "自动" + +msgid "Class Name" +msgstr "类型名称" + +msgid "Classification Rules" +msgstr "分类规则" + +msgid "Collecting data..." +msgstr "正在收集数据..." + +msgid "Connection Bytes Reach" +msgstr "连接流量达到" + +msgid "DPI Protocol" +msgstr "DPI 协议" + +msgid "Default Service Class" +msgstr "默认服务类型" + +msgid "Destination IP(s)" +msgstr "目标 IP" + +msgid "Destination Port(s)" +msgstr "目标端口" + +msgid "Disable QoS" +msgstr "禁用 QoS" + +msgid "Download Settings" +msgstr "下载设置" + +msgid "" +"Each service class is specified by four parameters: percent bandwidth at " +"capacity, realtime bandwidth and maximum bandwidth and the minimimze round " +"trip time flag." +msgstr "" +"每个下载服务类型由四个参数指定:带宽占用百分比、最小保证带宽、最大带宽和最小" +"往返延时标志。" + +msgid "" +"Each upload service class is specified by three parameters: percent " +"bandwidth at capacity, minimum bandwidth and maximum bandwidth." +msgstr "每个上传服务类型由三个参数指定:带宽占用百分比、最小带宽和最大带宽。" + +msgid "Edit Download Classification Rule" +msgstr "编辑下载分类规则" + +msgid "Edit Download Service Class" +msgstr "编辑下载服务类型" + +msgid "Edit Upload Classification Rule" +msgstr "编辑上传分类规则" + +msgid "Edit Upload Service Class" +msgstr "编辑上传服务类型" + +msgid "Enable Active Congestion Control" +msgstr "启用主动拥塞控制" + +msgid "Enable QoS" +msgstr "启用 QoS" + +msgid "Error collecting troubleshooting information" +msgstr "收集故障排查信息失败" + +msgid "Gargoyle QoS" +msgstr "石像鬼 QoS" + +msgid "Global Settings" +msgstr "全局设置" + +msgid "" +"Indicates to the active congestion controller that you wish to minimize " +"round trip times (RTT) when this class is active. Use this setting for " +"online gaming or VoIP applications that need low round trip times (ping " +"times). Minimizing RTT comes at the expense of efficient WAN throughput so " +"while these class are active your WAN throughput will decline (usually " +"around 20%)." +msgstr "" +"告诉主动拥塞控制器你希望该服务类型启用时尽量减少往返延时(RTT)。该设置一般用" +"在 VoIP 或在线游戏这类需要低延时(Ping 值)的应用上。减小往返延时(RTT)会带" +"来WAN有效吞吐量的额外花销,所以当这些服务类型启用时你的 WAN 吞吐量将下降(通" +"常在20%左右)" + +msgid "Load" +msgstr "负载" + +msgid "Loading" +msgstr "正在加载" + +msgid "Manual Ping Limit" +msgstr "手动 Ping 限制" + +msgid "Maximum Bandwidth" +msgstr "最大带宽" + +msgid "Maximum Packet Length" +msgstr "最大数据包长度" + +msgid "Minimize RTT" +msgstr "最小往返延时" + +msgid "Minimum Bandwidth" +msgstr "最小带宽" + +msgid "Minimum Packet Length" +msgstr "最小数据包长度" + +msgid "No" +msgstr "否" + +msgid "No data found" +msgstr "无数据" + +msgid "None" +msgstr "无" + +msgid "Not set" +msgstr "未设置" + +msgid "" +"Packet's destination ip, can optionally have /[mask] after it (see -d option " +"in iptables man page)." +msgstr "" +"数据包的目标 IP,可以在后面加子网掩码(/[mask],请看 iptables 的 -d 参数说" +"明)" + +msgid "Packet's destination port, can be a range (eg. 80-90)." +msgstr "数据包的目标端口,可以是一个范围(例如:80-90)" + +msgid "Packet's maximum size (in bytes)." +msgstr "数据包的最大大小(单位:bytes)" + +msgid "Packet's minimum size (in bytes)." +msgstr "数据包的最小大小(单位:bytes)" + +msgid "" +"Packet's source ip, can optionally have /[mask] after it (see -s option in " +"iptables man page)." +msgstr "" +"数据包的源 IP,可以在后面加子网掩码(/[mask],请看 iptables 的 -s 参数说明)" + +msgid "Packet's source port, can be a range (eg. 80-90)." +msgstr "数据包的源端口,可以是一个范围(例如:80-90)" + +msgid "" +"Packets are tested against the rules in the order specified -- rules toward " +"the top have priority. As soon as a packet matches a rule it is classified, " +"and the rest of the rules are ignored. The order of the rules can be altered " +"using the arrow controls." +msgstr "" +"数据包将按规则中指定的顺序进行匹配 —— 靠上的规则优先进行匹配。一旦数据包匹配" +"一条规则那它将被归类,并且其余的规则将被忽略。使用上下箭头可调整规则的顺序。" + +msgid "Percent Bandwidth At Capacity" +msgstr "带宽占用百分比" + +msgid "QoS Switch" +msgstr "QoS 开关" + +msgid "" +"Quality of Service (QoS) provides a way to control how available bandwidth " +"is allocated." +msgstr "QoS 可以用来分配和控制可用带宽。" + +msgid "" +"Round trip ping times are compared against the ping limits. ACC controls the " +"link limit to maintain ping times under the appropriate limit. By default " +"ACC attempts to automatically select appropriate target ping limits for you " +"based on the link speeds you entered and the performance of your link it " +"measures during initialization. You cannot change the target ping time for " +"the minRTT mode but by entering a manual time you can control the target " +"ping time of the active mode. The time you enter becomes the increase in the " +"target ping time between minRTT and active mode. Leave empty to use the " +"default settings." +msgstr "" +"Ping 延时会与 Ping 限制进行比较。ACC 控制链路限制以保持 Ping 延时在适当范围。" +"默认情况下,ACC 会自动根据你输入的链接适当为你选择适当的 Ping 限制。如果你想" +"尝试不同的 Ping 限制,你可以在这里输入一个时间值。输入高的时间值将导致更高的 " +"Ping 限制,低的时间值会有更低的限制。留空则将由 ACC 自动控制。" + +msgid "Service Class" +msgstr "服务类型" + +msgid "Service Class Name" +msgstr "服务类型名称" + +msgid "Service Classes" +msgstr "服务类型" + +msgid "" +"Should be set to around 98% of your available upload bandwidth. Entering a " +"number which is too high will result in QoS not meeting its class " +"requirements. Entering a number which is too low will needlessly penalize " +"your upload speed. You should use a speed test program (with QoS off) to " +"determine available upload bandwidth. Note that bandwidth is specified in " +"kbps, leave blank to disable update QoS. There are 8 kilobits per kilobyte." +msgstr "" +"应被设置为你可用上传带宽的 98% 左右。输入数值太高将导致 QoS 不能匹配服务类型" +"的要求。输入数值太低将造成不必要的上传速度限制。你应当在 QoS 关闭的情况下使用" +"测速程序以确定可用的上传带宽。带宽以 kbps 为单位,留空以禁用上传 QoS。" +"(1KByte/s=8Kbps)" + +msgid "Source IP(s)" +msgstr "源 IP" + +msgid "Source Port(s)" +msgstr "源端口" + +msgid "Specifie how packets that do not match any rule should be classified." +msgstr "指定当数据包不匹配任何规则时将被如何归类。" + +msgid "" +"Specifying correctly is crucial to making QoS work. Note that bandwidth is " +"specified in kbps, leave blank to disable download QoS. There are 8 kilobits " +"per kilobyte." +msgstr "" +"正确设置对于 QoS 的工作至关重要。带宽以 kbps 为单位,留空以禁用下载 QoS。" +"(1KByte/s=8Kbps)" + +msgid "" +"The maximum amount of bandwidth this class will be allocated in kbit/s. Even " +"if unused bandwidth is available, this service class will never be permitted " +"to use more than this amount of bandwidth." +msgstr "" +"该服务类型可被分配的带宽最大值(以 kbit/s 为单位)。即使存在未使用带宽,该服" +"务类型也将永远不被允许使用超过此量的带宽。" + +msgid "" +"The minimum service this class will be allocated when the link is at " +"capacity. Classes which specify minimum service are known as realtime " +"classes by the active congestion controller. Streaming video, VoIP and " +"interactive online gaming are all examples of applications that must have a " +"minimum bandwith to function. To determine what to enter use the application " +"on an unloaded LAN and observe how much bandwidth it uses. Then enter a " +"number only slightly higher than this into this field. QoS will satisfiy the " +"minimum service of all classes first before allocating to other waiting " +"classes so be careful to use minimum bandwidths sparingly." +msgstr "" +"将被分配用于该服务类型的最低链路带宽容量。指定了最小带宽的服务类型会被主动拥" +"塞控制器看作实时类应用。例如视频流、VoIP 和在线互动游戏都应该设置最小带宽。要" +"确定需要多少最小带宽,可以在一个没有负载的局域网中使用应用程序并观察它使用了" +"多少带宽。然后输入一个略高于这个值的数字到字段中。在分配剩余带宽到其它服务类" +"型前,QoS 将优先满足所有服务类型的最小带宽要求,所以要谨慎地使用最小带宽。" + +msgid "" +"The percentage of the total available bandwidth that should be allocated to " +"this class when all available bandwidth is being used. If unused bandwidth " +"is available, more can (and will) be allocated. The percentages can be " +"configured to equal more (or less) than 100, but when the settings are " +"applied the percentages will be adjusted proportionally so that they add to " +"100. This setting only comes into effect when the WAN link is saturated." +msgstr "" +"当所有可用带宽被占满后该服务类型占据总带宽的百分比。如果带宽未用完,该服务类" +"型会被分配更多带宽。该百分比值可被设置为等于、大于或小于 100,但当设置被应用" +"时,百分比值将会被按比例调整以便使它们加起来等于 100。该设置只在 WAN 端链路饱" +"和时才生效。(PS:WAN 端链路饱和即带宽被占用完)" + +msgid "" +"The segment of network between your router and the ping target is where " +"congestion is controlled. By monitoring the round trip ping times to the " +"target congestion is detected. By default ACC uses your WAN gateway as the " +"ping target. If you know that congestion on your link will occur in a " +"different segment then you can enter an alternate ping target. Leave empty " +"to use the default settings." +msgstr "" +"在路由器和 Ping 目标之间的网络部分是拥塞控制的地方。拥塞通过监视和目标间的 " +"Ping 延时来检测。默认情况下 ACC 使用你的 WAN 网关作为 Ping 的目标。假如你知道" +"拥塞会在你链路的不同段发生,你可用输入一个备用的 Ping 目标。留空则将由ACC 自" +"动控制。" + +msgid "" +"The total size of data transmitted since the establishment of the link (in " +"kBytes)." +msgstr "自连接建立以来,传输的数据总量(单位:kBytes)" + +msgid "Total Download Bandwidth" +msgstr "下载总带宽" + +msgid "Total Upload Bandwidth" +msgstr "上传总带宽" + +msgid "Transport Protocol" +msgstr "协议" + +msgid "Troubleshooting" +msgstr "故障排除" + +msgid "Troubleshooting Data" +msgstr "故障排除数据" + +msgid "Unlimited" +msgstr "不限制" + +msgid "Upload Settings" +msgstr "上传设置" + +msgid "Use Non-standard Ping Target" +msgstr "使用自定义 Ping 目标" + +msgid "Zero" +msgstr "零" diff --git a/package/ctcgfw/luci-app-qos-gargoyle/root/etc/uci-defaults/40_luci-qos_gargoyle b/package/ctcgfw/luci-app-qos-gargoyle/root/etc/uci-defaults/40_luci-qos_gargoyle new file mode 100755 index 0000000000..675fd39fc3 --- /dev/null +++ b/package/ctcgfw/luci-app-qos-gargoyle/root/etc/uci-defaults/40_luci-qos_gargoyle @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@qos_gargoyle[-1] + add ucitrack qos_gargoyle + set ucitrack.@qos_gargoyle[-1].init=qos_gargoyle + commit ucitrack +EOF + +rm -rf /tmp/luci-modulecache /tmp/luci-indexcache +exit 0 From 0a70e73dab23ccf934add0279d47bc0e0b8ca40a Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 23 Mar 2021 22:53:17 +0800 Subject: [PATCH 02/17] luci-app-turboacc: import from LuCI Signed-off-by: Tianling Shen --- package/ctcgfw/luci-app-turboacc/Makefile | 51 +++ .../luasrc/controller/turboacc.lua | 39 +++ .../luasrc/model/cbi/turboacc.lua | 87 ++++++ .../luasrc/view/turboacc/status.htm | 25 ++ .../luci-app-turboacc/po/zh-cn/turboacc.po | 107 +++++++ .../root/etc/config/turboacc | 14 + .../root/etc/init.d/turboacc | 295 ++++++++++++++++++ .../root/etc/uci-defaults/turboacc | 10 + .../root/usr/share/dnscache/dnscache-while.sh | 31 ++ 9 files changed, 659 insertions(+) create mode 100644 package/ctcgfw/luci-app-turboacc/Makefile create mode 100644 package/ctcgfw/luci-app-turboacc/luasrc/controller/turboacc.lua create mode 100644 package/ctcgfw/luci-app-turboacc/luasrc/model/cbi/turboacc.lua create mode 100644 package/ctcgfw/luci-app-turboacc/luasrc/view/turboacc/status.htm create mode 100644 package/ctcgfw/luci-app-turboacc/po/zh-cn/turboacc.po create mode 100644 package/ctcgfw/luci-app-turboacc/root/etc/config/turboacc create mode 100755 package/ctcgfw/luci-app-turboacc/root/etc/init.d/turboacc create mode 100755 package/ctcgfw/luci-app-turboacc/root/etc/uci-defaults/turboacc create mode 100755 package/ctcgfw/luci-app-turboacc/root/usr/share/dnscache/dnscache-while.sh diff --git a/package/ctcgfw/luci-app-turboacc/Makefile b/package/ctcgfw/luci-app-turboacc/Makefile new file mode 100644 index 0000000000..d060bdd05b --- /dev/null +++ b/package/ctcgfw/luci-app-turboacc/Makefile @@ -0,0 +1,51 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-app-turboacc +PKG_VERSION:=1.0 +PKG_RELEASE:=2 + +PKG_LICENSE:=GPLv3.0+ + +LUCI_TITLE:=LuCI support for Flow Offload / Shortcut-FE +LUCI_DEPENDS:=+pdnsd-alt \ + +PACKAGE_$(PKG_NAME)_INCLUDE_shortcut-fe:kmod-fast-classifier \ + +PACKAGE_$(PKG_NAME)_INCLUDE_flow-offload:kmod-ipt-offload \ + +PACKAGE_$(PKG_NAME)_INCLUDE_bbr-cca:kmod-tcp-bbr \ + +PACKAGE_$(PKG_NAME)_INCLUDE_dnsforwarder:dnsforwarder +LUCI_PKGARCH:=all + +define Package/$(PKG_NAME)/config +config PACKAGE_$(PKG_NAME)_INCLUDE_shortcut-fe + bool "Include Shortcut-FE" + depends on PACKAGE_$(PKG_NAME)_INCLUDE_flow-offload=n + default y if LINUX_4_9 + default n + +config PACKAGE_$(PKG_NAME)_INCLUDE_flow-offload + bool "Include Flow Offload" + depends on !LINUX_4_9 + default y + +config PACKAGE_$(PKG_NAME)_INCLUDE_bbr-cca + bool "Include BBR CCA" + default y + +config PACKAGE_$(PKG_NAME)_INCLUDE_dnsforwarder + bool "Include DNSForwarder" + default n +endef + +PKG_CONFIG_DEPENDS:= \ + CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_shortcut-fe \ + CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_flow-offload \ + CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_bbr-cca \ + CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_dnsforwarder + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/ctcgfw/luci-app-turboacc/luasrc/controller/turboacc.lua b/package/ctcgfw/luci-app-turboacc/luasrc/controller/turboacc.lua new file mode 100644 index 0000000000..259859fc1c --- /dev/null +++ b/package/ctcgfw/luci-app-turboacc/luasrc/controller/turboacc.lua @@ -0,0 +1,39 @@ +module("luci.controller.turboacc", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/turboacc") then + return + end + local page + page = entry({"admin", "network", "turboacc"}, cbi("turboacc"), _("Turbo ACC Center"), 101) + page.i18n = "turboacc" + page.dependent = true + + entry({"admin", "network", "turboacc", "status"}, call("action_status")) +end + +local function fastpath_status() + return luci.sys.call("{ [ -e /sys/module/xt_FLOWOFFLOAD/refcnt ] && [ x$(cat /sys/module/xt_FLOWOFFLOAD/refcnt 2>/dev/null) != x0 ]; } || lsmod | grep -q fast_classifier") == 0 +end + +local function bbr_status() + return luci.sys.call("[ x$(cat /proc/sys/net/ipv4/tcp_congestion_control 2>/dev/null) = xbbr ]") == 0 +end + +local function fullconebat_status() + return luci.sys.call("[ -e /sys/module/xt_FULLCONENAT/refcnt ] && [ x$(cat /sys/module/xt_FULLCONENAT/refcnt 2>/dev/null) != x0 ]") == 0 +end + +local function dnscaching_status() + return luci.sys.call("pgrep dnscache >/dev/null") == 0 +end + +function action_status() + luci.http.prepare_content("application/json") + luci.http.write_json({ + fastpath_state = fastpath_status(), + bbr_state = bbr_status(), + fullconenat_state = fullconebat_status(), + dnscaching_state = dnscaching_status() + }) +end diff --git a/package/ctcgfw/luci-app-turboacc/luasrc/model/cbi/turboacc.lua b/package/ctcgfw/luci-app-turboacc/luasrc/model/cbi/turboacc.lua new file mode 100644 index 0000000000..12892733a1 --- /dev/null +++ b/package/ctcgfw/luci-app-turboacc/luasrc/model/cbi/turboacc.lua @@ -0,0 +1,87 @@ +local kernel_version = luci.sys.exec("echo -n $(uname -r)") + +m = Map("turboacc") +m.title = translate("Turbo ACC Acceleration Settings") +m.description = translate("Opensource Flow Offloading driver (Fast Path or Hardware NAT)") + +m:append(Template("turboacc/status")) + +s = m:section(TypedSection, "turboacc", "") +s.addremove = false +s.anonymous = true + +if nixio.fs.access("/lib/modules/" .. kernel_version .. "/xt_FLOWOFFLOAD.ko") then +sw_flow = s:option(Flag, "sw_flow", translate("Software flow offloading")) +sw_flow.default = 0 +sw_flow.description = translate("Software based offloading for routing/NAT") +sw_flow:depends("sfe_flow", 0) +end + +if luci.sys.call("cat /proc/cpuinfo | grep -q MT76") == 0 then +hw_flow = s:option(Flag, "hw_flow", translate("Hardware flow offloading")) +hw_flow.default = 0 +hw_flow.description = translate("Requires hardware NAT support. Implemented at least for mt76xx") +hw_flow:depends("sw_flow", 1) +end + +if nixio.fs.access("/lib/modules/" .. kernel_version .. "/fast-classifier.ko") then +sfe_flow = s:option(Flag, "sfe_flow", translate("Shortcut-FE flow offloading")) +sfe_flow.default = 0 +sfe_flow.description = translate("Shortcut-FE based offloading for routing/NAT") +sfe_flow:depends("sw_flow", 0) +end + +sfe_bridge = s:option(Flag, "sfe_bridge", translate("Bridge Acceleration")) +sfe_bridge.default = 0 +sfe_bridge.description = translate("Enable Bridge Acceleration (may be functional conflict with bridge-mode VPN server)") +sfe_bridge:depends("sfe_flow", 1) + +if nixio.fs.access("/proc/sys/net/ipv6") then +sfe_ipv6 = s:option(Flag, "sfe_ipv6", translate("IPv6 Acceleration")) +sfe_ipv6.default = 0 +sfe_ipv6.description = translate("Enable IPv6 Acceleration") +sfe_ipv6:depends("sfe_flow", 1) +end + +if nixio.fs.access("/lib/modules/" .. kernel_version .. "/tcp_bbr.ko") then +bbr_cca = s:option(Flag, "bbr_cca", translate("BBR CCA")) +bbr_cca.default = 0 +bbr_cca.description = translate("Using BBR CCA can improve TCP network performance effectively") +end + +if nixio.fs.access("/lib/modules/" .. kernel_version .. "/xt_FULLCONENAT.ko") then +fullcone_nat = s:option(Flag, "fullcone_nat", translate("FullCone NAT")) +fullcone_nat.default = 0 +fullcone_nat.description = translate("Using FullCone NAT can improve gaming performance effectively") +end + +dns_acc = s:option(Flag, "dns_acc", translate("DNS Acceleration")) +dns_acc.default = 0 +dns_acc.rmempty = false +dns_acc.description = translate("Using optimized DNS records for GoogleHosts (Don't use under Clash Fake-IP mode)") + +dns_caching = s:option(Flag, "dns_caching", translate("DNS Caching")) +dns_caching.default = 0 +dns_caching.rmempty = false +dns_caching.description = translate("Enable DNS Caching and anti ISP DNS pollution") + +dns_caching_mode = s:option(ListValue, "dns_caching_mode", translate("Resolve DNS Mode"), translate("Only PDNSD and DNSForwarder is supported now")) +dns_caching_mode:value("1", translate("Using PDNSD to query and cache")) +if nixio.fs.access("/usr/bin/dnsforwarder") then +dns_caching_mode:value("2", translate("Using DNSForwarder to query and cache")) +end +dns_caching_mode.default = 1 +dns_caching_mode:depends("dns_caching", 1) + +dns_caching_v4_dns = s:option(Value, "dns_caching_v4_dns", translate("Upsteam IPv4 DNS Server")) +dns_caching_v4_dns.default = "114.114.114.114,114.114.115.115,223.5.5.5,223.6.6.6,180.76.76.76,119.29.29.29,119.28.28.28,1.2.4.8,210.2.4.8" +dns_caching_v4_dns.description = translate("Muitiple IPv4 DNS server can saperate with ','") +dns_caching_v4_dns:depends("dns_caching_mode", 1) +dns_caching_v4_dns:depends("dns_caching_mode", 2) + +dns_caching_v6_dns = s:option(Value, "dns_caching_v6_dns", translate("Upsteam IPv6 DNS Server")) +dns_caching_v6_dns.default = "2001:4860:4860::8888,2001:4860:4860::8844,2001:2001::1111,2001:2001::1001,2400:da00::6666,240C::6666,240C::6644" +dns_caching_v6_dns.description = translate("Muitiple IPv6 DNS server can saperate with ','") +dns_caching_v6_dns:depends("dns_caching_mode", 2) + +return m diff --git a/package/ctcgfw/luci-app-turboacc/luasrc/view/turboacc/status.htm b/package/ctcgfw/luci-app-turboacc/luasrc/view/turboacc/status.htm new file mode 100644 index 0000000000..9a834888d9 --- /dev/null +++ b/package/ctcgfw/luci-app-turboacc/luasrc/view/turboacc/status.htm @@ -0,0 +1,25 @@ +
+ <%:Running Status%> + + + + + +
<%:Flow Offloading%><%:Collecting data...%>
<%:BBR CCA%><%:Collecting data...%>
<%:FullCone NAT%><%:Collecting data...%>
<%:DNS Caching%><%:Collecting data...%>
+
+ + diff --git a/package/ctcgfw/luci-app-turboacc/po/zh-cn/turboacc.po b/package/ctcgfw/luci-app-turboacc/po/zh-cn/turboacc.po new file mode 100644 index 0000000000..2b533be79e --- /dev/null +++ b/package/ctcgfw/luci-app-turboacc/po/zh-cn/turboacc.po @@ -0,0 +1,107 @@ +msgid "Turbo ACC Center" +msgstr "Turbo ACC 网络加速" + +msgid "Turbo ACC Acceleration Settings" +msgstr "Turbo ACC 网络加速设置" + +msgid "Linux Flow Offload Forwarding Engine Settings" +msgstr "Linux Flow Offload Forwarding 转发加速引擎设置" + +msgid "Opensource Flow Offloading driver (Fast Path or Hardware NAT)" +msgstr "开源流量分载驱动 (支持 Fast Path 或者 硬件 NAT)" + +msgid "Software flow offloading" +msgstr "软件流量分载" + +msgid "Software based offloading for routing/NAT" +msgstr "基于软件的 Routing/NAT 分载" + +msgid "Hardware flow offloading" +msgstr "硬件流量分载" + +msgid "Requires hardware NAT support. Implemented at least for mt76xx" +msgstr "需要硬件 NAT 支持。目前 mt76xx 已实现" + +msgid "Shortcut-FE flow offloading" +msgstr "Shortcut-FE 流量分载" + +msgid "Shortcut-FE based offloading for routing/NAT" +msgstr "基于 Shortcut-FE 的 Routing/NAT 分载" + +msgid "Bridge Acceleration" +msgstr "桥接加速" + +msgid "Enable Bridge Acceleration (may be functional conflict with bridge-mode VPN server)" +msgstr "启用桥接加速 (可能会和路由器上桥接模式的VPN服务器冲突)" + +msgid "IPv6 Acceleration" +msgstr "IPv6 加速" + +msgid "Enable IPv6 Acceleration" +msgstr "启用 IPv6 加速" + +msgid "BBR CCA" +msgstr "BBR 拥塞控制算法" + +msgid "Using BBR CCA can improve TCP network performance effectively" +msgstr "使用 BBR 拥塞控制算法可以有效提升 TCP 网络性能" + +msgid "FullCone NAT" +msgstr "全锥形 NAT" + +msgid "Using FullCone NAT can improve gaming performance effectively" +msgstr "使用全锥形 NAT 可以有效提升游戏体验" + +msgid "DNS Acceleration" +msgstr "DNS 加速" + +msgid "Using optimized DNS records for GoogleHosts (Don't use under Clash Fake-IP mode)" +msgstr "使用来自 GoogleHosts 的优质 DNS 记录(请勿在 Clash Fake-IP 模式下使用)" + +msgid "DNS Caching" +msgstr "DNS 缓存" + +msgid "Enable DNS Caching and anti ISP DNS pollution" +msgstr "启用 DNS 多线程查询、缓存,并防止 ISP 的 DNS 广告和域名劫持" + +msgid "Resolve DNS Mode" +msgstr "DNS 解析方式" + +msgid "Only PDNSD and DNSForwarder is supported now" +msgstr "目前仅支持 PDNSD 和 DNSForwarder" + +msgid "Using PDNSD to query and cache" +msgstr "使用 PDNSD 解析" + +msgid "Using DNSForwarder to query and cache" +msgstr "使用 DNSForwarder 解析" + +msgid "Upsteam IPv4 DNS Server" +msgstr "上游 IPv4 DNS 服务器" + +msgid "Muitiple IPv4 DNS server can saperate with ','" +msgstr "多个上游 IPv4 DNS 服务器请用 ',' 分隔(注意用英文逗号)" + +msgid "Upsteam IPv6 DNS Server" +msgstr "上游 IPv6 DNS 服务器" + +msgid "Muitiple IPv6 DNS server can saperate with ','" +msgstr "多个上游 IPv6 DNS 服务器请用 ',' 分隔(注意用英文逗号)" + +msgid "Running Status" +msgstr "运行状态" + +msgid "Flow Offloading" +msgstr "流量分载" + +msgid "BBR CCA" +msgstr "BBR 拥塞控制算法" + +msgid "FullCone NAT" +msgstr "全锥型 NAT" + +msgid "DNS Caching" +msgstr "DNS 缓存" + +msgid "Open Web Interface" +msgstr "打开 Web 界面" diff --git a/package/ctcgfw/luci-app-turboacc/root/etc/config/turboacc b/package/ctcgfw/luci-app-turboacc/root/etc/config/turboacc new file mode 100644 index 0000000000..067aad2763 --- /dev/null +++ b/package/ctcgfw/luci-app-turboacc/root/etc/config/turboacc @@ -0,0 +1,14 @@ + +config turboacc 'config' + option sw_flow '1' + option hw_flow '1' + option sfe_flow '1' + option sfe_bridge '1' + option sfe_ipv6 '0' + option bbr_cca '1' + option fullcone_nat '1' + option dns_acc '0' + option dns_caching '0' + option dns_caching_mode '1' + option dns_caching_v4_dns '114.114.114.114,114.114.115.115,223.5.5.5,223.6.6.6,180.76.76.76,119.29.29.29,119.28.28.28,1.2.4.8,210.2.4.8' + option dns_caching_v6_dns '240c::6666,240c::6644,2001:da8::666,2001:da8:202:10::36,2001:da8:8000:1:202:120:2:100' diff --git a/package/ctcgfw/luci-app-turboacc/root/etc/init.d/turboacc b/package/ctcgfw/luci-app-turboacc/root/etc/init.d/turboacc new file mode 100755 index 0000000000..3064f305cc --- /dev/null +++ b/package/ctcgfw/luci-app-turboacc/root/etc/init.d/turboacc @@ -0,0 +1,295 @@ +#!/bin/sh /etc/rc.common +# Copyright (c) 2011-2015 OpenWrt.org + +START=90 +STOP=10 + +restart_utils="true" + +inital_conf(){ + config_load "turboacc" + config_get "sw_flow" "config" "sw_flow" "0" + config_get "hw_flow" "config" "hw_flow" "0" + config_get "sfe_flow" "config" "sfe_flow" "0" + config_get "sfe_bridge" "config" "sfe_bridge" "0" + config_get "sfe_ipv6" "config" "sfe_ipv6" "0" + config_get "bbr_cca" "config" "bbr_cca" "0" + config_get "fullcone_nat" "config" "fullcone_nat" "0" + config_get "dns_acc" "config" "dns_acc" "0" + config_get "dns_caching" "config" "dns_caching" "0" + config_get "dns_caching_mode" "config" "dns_caching_mode" "0" + config_get "dns_caching_v4_dns" "config" "dns_caching_v4_dns" + config_get "dns_caching_v6_dns" "config" "dns_caching_v6_dns" + + [ ! -e "/lib/modules/$(uname -r)/xt_FLOWOFFLOAD.ko" ] && { sw_flow="0"; hw_flow="0"; } + [ ! -e "/lib/modules/$(uname -r)/fast-classifier.ko" ] && { sfe_flow="0"; sfe_bridge="0"; sfe_ipv6="0"; } + [ ! -e "/lib/modules/$(uname -r)/tcp_bbr.ko" ] && bbr_cca="0" + [ ! -e "/lib/modules/$(uname -r)/xt_FULLCONENAT.ko" ] && fullcone_nat="0" +} + +start_pdnsd() { + [ -d "/var/etc" ] || mkdir -p "/var/etc" + cat > "/var/etc/dnscache.conf" < "/var/dnscache/pdnsd.cache" + chown -R nobody.nogroup "/var/dnscache" + fi + + [ -d "/var/sbin" ] || mkdir -p "/var/sbin" && cp -a "/usr/sbin/pdnsd" "/var/sbin/dnscache" + /var/sbin/dnscache -c "/var/etc/dnscache.conf" & + echo "PDNSD: Start DNS Caching" +} + +start_dnsforwarder() { + mkdir -p "/var/run/dnscache" + cat > "/var/run/dnscache/dnscache.conf" <"/dev/null" + kill -9 $(ps | grep dnscache-while.sh | grep -v "grep" | awk '{print $1}') 2>"/dev/null" + rm -rf "/var/dnscache" "/var/run/dnscache" + echo "Stop DNS Caching" +} + +change_dns() { + uci -q delete dhcp.@dnsmasq[0].server + uci add_list dhcp.@dnsmasq[0].server="127.0.0.1#5333" + uci set dhcp.@dnsmasq[0].noresolv="1" + uci commit dhcp + +} + +revert_dns() { + uci -q del_list dhcp.@dnsmasq[0].server="127.0.0.1#5333" + uci set dhcp.@dnsmasq[0].resolvfile="/tmp/resolv.conf.d/resolv.conf.auto" + uci set dhcp.@dnsmasq[0].noresolv="0" + uci commit dhcp +} + +start(){ + inital_conf + + uci set firewall.@defaults[0].flow_offloading="${sw_flow}" + uci set firewall.@defaults[0].flow_offloading_hw="${hw_flow}" + uci set firewall.@defaults[0].fullcone="${fullcone_nat}" + uci commit firewall + + [ "${sw_flow}" -ne "1" ] && [ "${sfe_flow}" -eq "1" ] && { + lsmod | grep -q fast_classifier || modprobe fast_classifier 2>"/dev/null" + echo "${sfe_bridge}" > "/sys/fast_classifier/skip_to_bridge_ingress" 2>"/dev/null" + if [ "${sfe_ipv6}" -eq "1" ]; then + [ ! -e "/dev/sfe_ipv6" ] && mknod "/dev/sfe_ipv6" "c" "$(cat "/sys/sfe_ipv6/debug_dev")" "0" + else + rm -f "/dev/sfe_ipv6" + fi +} + + if [ "${bbr_cca}" -eq "1" ]; then + sysctl -w net.ipv4.tcp_congestion_control="bbr" + else + sysctl -w net.ipv4.tcp_congestion_control="cubic" + fi + + [ "${dns_acc}" -eq "1" ] && { + mkdir -p "/tmp/dnsmasq.d" + wget-ssl -q -t "20" -T "5" "https://cdn.jsdelivr.net/gh/googlehosts/hosts@master/hosts-files/dnsmasq.conf" -O "/tmp/dnsmasq.d/dnsmasq-googlehosts.conf" & +} + + if [ "${dns_caching}" -eq "1" ]; then + stop_dnscache + sleep 1 + rm -f "/var/log/dnscache.file" + if [ "${dns_caching_mode}" = "1" ]; then + start_pdnsd + elif [ "${dns_caching_mode}" = "2" ]; then + start_dnsforwarder + fi + change_dns + nohup "/usr/share/dnscache/dnscache-while.sh" > "/var/log/dnscache.file" 2>&1 & + else + stop_dnscache + revert_dns + fi + + if [ "${restart_utils}" = "true" ]; then + /etc/init.d/dnsmasq restart >/dev/null 2>&1 && echo "DNSMASQ change" + /etc/init.d/firewall restart >/dev/null 2>&1 + fi +} + +stop(){ + inital_conf + + uci set firewall.@defaults[0].flow_offloading="${sw_flow}" + uci set firewall.@defaults[0].flow_offloading_hw="${hw_flow}" + uci set firewall.@defaults[0].fullcone="${fullcone_nat}" + uci commit firewall + + [ "${sfe_flow}" -ne "1" ] && { + echo "0" > "/sys/fast_classifier/skip_to_bridge_ingress" 2>"/dev/null" + rm -f "/dev/sfe_ipv6" + rmmod "fast_classifier" 2>"/dev/null" +} + + [ "${dns_acc}" -eq "0" ] && rm -f "/tmp/dnsmasq.d/dnsmasq-googlehosts.conf" + + stop_dnscache + revert_dns + + if [ "${restart_utils}" = "true" ]; then + /etc/init.d/dnsmasq restart >/dev/null 2>&1 && echo "DNSMASQ revert" + /etc/init.d/firewall restart >/dev/null 2>&1 + fi +} + +restart(){ + restart_utils="false" + stop + start + /etc/init.d/dnsmasq restart >/dev/null 2>&1 && echo "DNSMASQ restart" + /etc/init.d/firewall restart >/dev/null 2>&1 +} diff --git a/package/ctcgfw/luci-app-turboacc/root/etc/uci-defaults/turboacc b/package/ctcgfw/luci-app-turboacc/root/etc/uci-defaults/turboacc new file mode 100755 index 0000000000..37a556f42f --- /dev/null +++ b/package/ctcgfw/luci-app-turboacc/root/etc/uci-defaults/turboacc @@ -0,0 +1,10 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@turboacc[-1] + add ucitrack turboacc + set ucitrack.@turboacc[-1].init=turboacc + commit ucitrack +EOF + +exit 0 diff --git a/package/ctcgfw/luci-app-turboacc/root/usr/share/dnscache/dnscache-while.sh b/package/ctcgfw/luci-app-turboacc/root/usr/share/dnscache/dnscache-while.sh new file mode 100755 index 0000000000..f8952e834e --- /dev/null +++ b/package/ctcgfw/luci-app-turboacc/root/usr/share/dnscache/dnscache-while.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +sleeptime=60 +logfile="/var/log/dnscache.file" +dns_caching="$(uci -q get turboacc.config.dns_caching)" +dns_caching_mode="$(uci -q get turboacc.config.dns_caching_mode 2>/dev/null)" + +clean_log(){ +logrow="$(grep -c "" "${logfile}")" +if [ "${logrow}" -ge "500" ];then + echo "${curtime} Log条数超限,清空处理!" > "${logfile}" +fi +} + +while [ "${dns_caching}" -eq "1" ]; +do + curtime="$(date "+%H:%M:%S")" + echo "${curtime} online!" + pidof dnscache>/dev/null || { + if [ "${dns_caching_mode}" = "1" ]; then + /var/sbin/dnscache -c "/var/etc/dnscache.conf" & + elif [ "${dns_caching_mode}" = "2" ]; then + /var/sbin/dnscache -f "/var/run/dnscache/dnscache.conf" & + fi + echo "${curtime} 重启服务!" >> ${logfile} +} + + clean_log + sleep "${sleeptime}" + continue +done From e02f8393eb20a04fc26ab0c239188f51cff0cee1 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 23 Mar 2021 22:55:32 +0800 Subject: [PATCH 03/17] brcmfmac4366c0-firmware-vendor: move to firmware Signed-off-by: Tianling Shen --- .../brcmfmac4366c0-firmware-vendor/Makefile | 0 .../files/brcmfmac4366c-pcie.bin | Bin 2 files changed, 0 insertions(+), 0 deletions(-) rename package/{ctcgfw => firmware}/brcmfmac4366c0-firmware-vendor/Makefile (100%) rename package/{ctcgfw => firmware}/brcmfmac4366c0-firmware-vendor/files/brcmfmac4366c-pcie.bin (100%) diff --git a/package/ctcgfw/brcmfmac4366c0-firmware-vendor/Makefile b/package/firmware/brcmfmac4366c0-firmware-vendor/Makefile similarity index 100% rename from package/ctcgfw/brcmfmac4366c0-firmware-vendor/Makefile rename to package/firmware/brcmfmac4366c0-firmware-vendor/Makefile diff --git a/package/ctcgfw/brcmfmac4366c0-firmware-vendor/files/brcmfmac4366c-pcie.bin b/package/firmware/brcmfmac4366c0-firmware-vendor/files/brcmfmac4366c-pcie.bin similarity index 100% rename from package/ctcgfw/brcmfmac4366c0-firmware-vendor/files/brcmfmac4366c-pcie.bin rename to package/firmware/brcmfmac4366c0-firmware-vendor/files/brcmfmac4366c-pcie.bin From 903bd12b2bef797e651b6efbc4cb2941941d78f0 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 23 Mar 2021 23:32:35 +0800 Subject: [PATCH 04/17] scripts/download.pl: add self-hosted mirror Signed-off-by: Tianling Shen --- scripts/download.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/download.pl b/scripts/download.pl index 3e4b7ba244..8d07b810f9 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -281,6 +281,7 @@ foreach my $mirror (@ARGV) { } unshift @mirrors, "http://182.140.223.146/dl"; +unshift @mirrors, "https://mirror01.download.immortalwrt.org/openwrt-18.06"; unshift @mirrors, "https://openwrt.cc/dl/immortalwrt/openwrt-18.06"; push @mirrors, 'https://sources.cdn.openwrt.org'; push @mirrors, 'https://sources.openwrt.org'; From 8ffac602da94b1cfc13c88b4260f34557fb8042b Mon Sep 17 00:00:00 2001 From: xiaorouji <60100640+xiaorouji@users.noreply.github.com> Date: Mon, 22 Mar 2021 18:03:49 +0800 Subject: [PATCH 05/17] luci-app-passwall: sync with upstream source Co-authored-by: badgv <45598380+badgv@users.noreply.github.com> Signed-off-by: Tianling Shen --- .../passwall/node_list/link_share_man.htm | 34 ++++++++++++------- .../luci-app-passwall/po/zh-cn/passwall.po | 4 +-- .../root/usr/share/passwall/iptables.sh | 2 +- .../root/usr/share/passwall/monitor.sh | 16 ++++----- 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm b/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm index ba900f8168..9017abd722 100644 --- a/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm +++ b/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm @@ -274,17 +274,21 @@ local api = require "luci.model.cbi.passwall.api.api" } url += params; } else if ((v_type === "Xray" && opt.get("protocol").value === "trojan") || v_type === "Trojan" || v_type === "Trojan-Plus" || v_type === "Trojan-Go") { + if (v_type === "Xray" && opt.get("protocol").value === "trojan") { + v_type = "trojan"; + } var v_password = opt.get(!opt.client && v_type === "Trojan-Go" ? "passwords" : "password"); var v_server = opt.get("address"); var v_port = opt.get("port"); url = encodeURIComponent(v_password.value) + "@" + v_server.value + ":" + v_port.value + "/?"; + var params = ""; if (opt.get("tls").checked) { - url += opt.query("sni", "tls_serverName"); + params += opt.query("sni", "tls_serverName"); if (v_type !== "Trojan-Go") { - url += "&tls=1" - url += opt.query("allowinsecure", "tls_allowInsecure"); + params += "&tls=1" + params += opt.query("allowinsecure", "tls_allowInsecure"); } } if (v_type === "Trojan-Go") { @@ -296,17 +300,17 @@ local api = require "luci.model.cbi.passwall.api.api" plugin.option = opt.get("plugin_option").value; plugin.arg = opt.getlist("plugin_arg"); } - url += "&plugin=" + encodeURIComponent(JSON.stringify(plugin)); + params += "&plugin=" + encodeURIComponent(JSON.stringify(plugin)); } - url += opt.query("type", "trojan_transport"); + params += opt.query("type", "trojan_transport"); var ws = (opt.get("trojan_transport").value.indexOf("ws") !== -1); var h2 = (opt.get("trojan_transport").value.indexOf("h2") !== -1); if (ws) { - url += opt.query("host", "ws_host"); - url += opt.query("path", "ws_path"); + params += opt.query("host", "ws_host"); + params += opt.query("path", "ws_path"); } else if (h2) { - url += opt.query("host", "h2_host"); - url += opt.query("path", "h2_path"); + params += opt.query("host", "h2_host"); + params += opt.query("path", "h2_path"); } var enc = "none"; if (opt.get("ss_aead").checked === true) { @@ -314,9 +318,13 @@ local api = require "luci.model.cbi.passwall.api.api" opt.get("ss_aead_method").value + ":" + opt.get("ss_aead_pwd").value; } - url += "&encryption=" + encodeURIComponent(enc); + params += "&encryption=" + encodeURIComponent(enc); } - url += "#" + encodeURI(v_alias.value); + params += "#" + encodeURI(v_alias.value); + if (params[0] == "&") { + params = params.substring(1); + } + url += params; } if (url) { url = v_type.toLowerCase() + "://" + url; @@ -327,9 +335,9 @@ local api = require "luci.model.cbi.passwall.api.api" textarea.select(); try { document.execCommand("copy"); // Security exception may be thrown by some browsers. - s.innerHTML = "<%:Share url to clipboard successfully.%>"; + s.innerHTML = "<%:Share URL to clipboard successfully.%>"; } catch (ex) { - s.innerHTML = "<%:Share url to clipboard unable.%>"; + s.innerHTML = "<%:Share URL to clipboard unable.%>"; } finally { document.body.removeChild(textarea); } diff --git a/package/lienol/luci-app-passwall/po/zh-cn/passwall.po b/package/lienol/luci-app-passwall/po/zh-cn/passwall.po index 9fa953c6da..e5e0c9298c 100644 --- a/package/lienol/luci-app-passwall/po/zh-cn/passwall.po +++ b/package/lienol/luci-app-passwall/po/zh-cn/passwall.po @@ -466,10 +466,10 @@ msgstr "无效的分享URL信息" msgid "Paste Share URL Here" msgstr "在此处粘贴分享信息" -msgid "Share url to clipboard unable." +msgid "Share URL to clipboard unable." msgstr "无法分享URL到剪贴板。" -msgid "Share url to clipboard successfully." +msgid "Share URL to clipboard successfully." msgstr "成功复制分享URL到剪贴板。" msgid "Faltal on get option, please help in debug:" diff --git a/package/lienol/luci-app-passwall/root/usr/share/passwall/iptables.sh b/package/lienol/luci-app-passwall/root/usr/share/passwall/iptables.sh index 5ae53147d9..078c37a8a0 100755 --- a/package/lienol/luci-app-passwall/root/usr/share/passwall/iptables.sh +++ b/package/lienol/luci-app-passwall/root/usr/share/passwall/iptables.sh @@ -48,7 +48,7 @@ comment() { destroy_ipset() { for i in "$@"; do - #ipset -q -F $i + ipset -q -F $i ipset -q -X $i done } diff --git a/package/lienol/luci-app-passwall/root/usr/share/passwall/monitor.sh b/package/lienol/luci-app-passwall/root/usr/share/passwall/monitor.sh index db0b07afb3..b9b89c0b71 100755 --- a/package/lienol/luci-app-passwall/root/usr/share/passwall/monitor.sh +++ b/package/lienol/luci-app-passwall/root/usr/share/passwall/monitor.sh @@ -17,7 +17,7 @@ config_t_get() { echo ${ret:=$3} } -if [ "$(top -bn1 | grep -v grep | grep $CONFIG/monitor.sh | wc -l)" -gt 2 ]; then +if [ "$(pgrep -f $CONFIG/monitor.sh | wc -l)" -gt 2 ]; then exit 1 fi @@ -35,13 +35,12 @@ do #kcptun use_kcp=$(config_n_get $TCP_NODE use_kcp 0) if [ $use_kcp -gt 0 ]; then - icount=$(top -bn1 | grep -v grep | grep "$TMP_BIN_PATH/kcptun" | grep -i "tcp" | wc -l) - if [ $icount = 0 ]; then + if ! pgrep -af "$TMP_BIN_PATH/kcptun.*(tcp|TCP)" > /dev/null 2>&1; then /etc/init.d/$CONFIG restart exit 0 fi fi - icount=$(top -bn1 | grep -v -E 'grep|kcptun' | grep "$TMP_BIN_PATH" | grep -i "TCP" | wc -l) + icount=$(pgrep -af "$TMP_BIN_PATH.*(tcp|TCP)" | grep -v kcptun | wc -l) if [ $icount = 0 ]; then /etc/init.d/$CONFIG restart exit 0 @@ -55,8 +54,7 @@ do if [ "$UDP_NODE" != "nil" ]; then [ "$UDP_NODE" == "tcp" ] && continue [ "$UDP_NODE" == "tcp_" ] && UDP_NODE=$TCP_NODE - icount=$(top -bn1 | grep -v grep | grep "$TMP_BIN_PATH" | grep -i "UDP" | wc -l) - if [ $icount = 0 ]; then + if ! pgrep -af "$TMP_BIN_PATH.*(udp|UDP)" > /dev/null 2>&1; then /etc/init.d/$CONFIG restart exit 0 fi @@ -74,8 +72,7 @@ do fi [ -f "$TMP_BIN_PATH/chinadns-ng" ] && { - icount=$(top -bn1 | grep -v grep | grep $TMP_BIN_PATH/chinadns-ng | wc -l) - if [ $icount = 0 ]; then + if ! pgrep -x "$TMP_BIN_PATH/chinadns-ng" > /dev/null 2>&1; then /etc/init.d/$CONFIG restart exit 0 fi @@ -84,8 +81,7 @@ do #haproxy use_haproxy=$(config_t_get global_haproxy balancing_enable 0) if [ $use_haproxy -gt 0 ]; then - icount=$(top -bn1 | grep -v grep | grep "$TMP_BIN_PATH/haproxy" | wc -l) - if [ $icount = 0 ]; then + if ! pgrep -x "$TMP_BIN_PATH/haproxy" > /dev/null 2>&1; then /etc/init.d/$CONFIG restart exit 0 fi From 3118dbb83344f3c79c4c255914354b59b57ce6f7 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 24 Mar 2021 14:13:43 +0000 Subject: [PATCH 06/17] ucode: fix PKG_MIRROR_HASH Signed-off-by: Daniel Golle --- package/utils/ucode/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index 64b6c7bcda..6fb9f73c3d 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -14,7 +14,7 @@ PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git PKG_SOURCE_DATE:=2021-03-19 PKG_SOURCE_VERSION:=4a5b9010ccc56fdf288fe758023af445feb93fad -PKG_MIRROR_HASH:=145a2ce69e14cae9b448de85b94c7a817ba3aea04b1611399186ad36fb88958e +PKG_MIRROR_HASH:=2d15fe2f51ebdeae532a2e8130689400cf2364876e737cfbb1bf9c045719acf1 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From d81d24333a2aa50101f1e93c8f75c1d1b3c2c7fc Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 24 Mar 2021 09:47:12 +0000 Subject: [PATCH 07/17] mwlwifi: add PKG_FLAGS:=nonshared This should fix the problem of mwlwifi-firmware-* not being found when using the ImageBuilder. Signed-off-by: Daniel Golle --- package/kernel/mwlwifi/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile index 642d800836..22b0981d63 100644 --- a/package/kernel/mwlwifi/Makefile +++ b/package/kernel/mwlwifi/Makefile @@ -21,6 +21,7 @@ PKG_MIRROR_HASH:=7bdd05765d8215a9c293cdcb028d63a04c9e55b337eaac9e8d3659bd8621832 PKG_MAINTAINER:=Imre Kaloz PKG_BUILD_PARALLEL:=1 +PKG_FLAGS:=nonshared include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk From 65ca8a8b72976bc8069202cd4a32e27590c4ee63 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Wed, 24 Mar 2021 11:01:46 -1000 Subject: [PATCH 08/17] build,json: fixup missing arch_packages Fix 7f4c2b1 "build,json: fix duplicates in default_packages" which removed duplicate default packages but also removed the package architecture from the profiles.json. If DUMP=1 is set, the `ARCH_PACKAGES` is no longer exported and therefore empty. Fix this by running make twice, once with DUMP=1 and once without. Signed-off-by: Paul Spooren --- scripts/json_overview_image_info.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/json_overview_image_info.py b/scripts/json_overview_image_info.py index 23d8dcb857..e0e1ff08d5 100755 --- a/scripts/json_overview_image_info.py +++ b/scripts/json_overview_image_info.py @@ -33,14 +33,13 @@ for json_file in work_dir.glob("*.json"): ) if output: - default_packages, output["arch_packages"] = run( + output["default_packages"] = run( [ "make", "--no-print-directory", "-C", "target/linux/{}".format(output["target"].split("/")[0]), "val.DEFAULT_PACKAGES", - "val.ARCH_PACKAGES", "DUMP=1", ], stdout=PIPE, @@ -48,9 +47,21 @@ if output: check=True, env=environ.copy().update({"TOPDIR": Path().cwd()}), universal_newlines=True, - ).stdout.splitlines() + ).stdout.split() + + output["arch_packages"] = run( + [ + "make", + "--no-print-directory", + "val.ARCH_PACKAGES", + ], + stdout=PIPE, + stderr=PIPE, + check=True, + env=environ.copy().update({"TOPDIR": Path().cwd()}), + universal_newlines=True, + ).stdout.strip() - output["default_packages"] = default_packages.split() output_path.write_text(json.dumps(output, sort_keys=True, separators=(",", ":"))) else: print("JSON info file script could not find any JSON files for target") From d28cf096e328dc3b72379cd64000fe5897623f7a Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Wed, 24 Mar 2021 18:54:36 -1000 Subject: [PATCH 09/17] build,json: fixup fixup of arch_packages The commit "1bf2b3fe90 build,json: fixup missing arch_packages" fixes the missing package architecture locally but runs $(TOPDIR)/Makefile rather than a target specific one. While this works on local builds just fine, it causes the buildbots to add garbage to the `arch_packages` variable: cd \"/builder/shared-workdir/build\"; git log --format=%h -1 toolchain > /builder/shared-workdir/build/tmp/.ver_check\ncmp -s /builder/shared-workdir/build/tmp/.ver_check /builder/shared-workdir/build/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/stamp/.ver_check || { \\\n\trm -rf /builder/shared-workdir/build/build_dir/target-x86_64_musl /builder/shared-workdir/build/staging_dir/target-x86_64_musl /builder/shared-workdir/build/staging_dir/toolchain-x86_64_gcc-8.4.0_musl /builder/shared-workdir/build/build_dir/toolchain-x86_64_gcc-8.4.0_musl; \\\n\tmkdir -p /builder/shared-workdir/build/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/stamp; \\\n\tmv /builder/shared-workdir/build/tmp/.ver_check /builder/shared-workdir/build/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/stamp/.ver_check; \\\n}\nx86_64 Only the last line contains the desired string. Future investigation should check why the build system prints this to stdout rather than stderr. Signed-off-by: Paul Spooren --- scripts/json_overview_image_info.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/json_overview_image_info.py b/scripts/json_overview_image_info.py index e0e1ff08d5..cd814a19c0 100755 --- a/scripts/json_overview_image_info.py +++ b/scripts/json_overview_image_info.py @@ -53,6 +53,8 @@ if output: [ "make", "--no-print-directory", + "-C", + "target/linux/{}".format(output["target"].split("/")[0]), "val.ARCH_PACKAGES", ], stdout=PIPE, From 9c3e240fef47a60484caf8db59dba02c27e3c298 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Fri, 19 Mar 2021 15:09:45 -0600 Subject: [PATCH 10/17] build: make sure asm gets built with -DPIC Fixes issue openwrt/packages#14921, whereby inline ASM wasn't getting built as PIC; look at gmp-6.2.1/mpn/x86/pentium/popcount.asm for example: ifdef(`PIC',` ... for a routine that exists in both PIC and non-PIC versions. Make sure that wherever $(FPIC) gets passed as a variable expansion that it gets quoted where necessary (such as setting environment variables in shell commands). Signed-off-by: Philip Prindeville --- rules.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rules.mk b/rules.mk index 099d411c84..08f5d3ca5c 100644 --- a/rules.mk +++ b/rules.mk @@ -75,12 +75,12 @@ IS_PACKAGE_BUILD := $(if $(filter package/%,$(BUILD_SUBDIR)),1) OPTIMIZE_FOR_CPU=$(subst i386,i486,$(ARCH)) ifneq (,$(findstring $(ARCH) , aarch64 aarch64_be powerpc )) - FPIC:=-fPIC + FPIC:=-DPIC -fPIC else - FPIC:=-fpic + FPIC:=-DPIC -fpic endif -HOST_FPIC:=-fPIC +HOST_FPIC:=-DPIC -fPIC ARCH_SUFFIX:=$(call qstrip,$(CONFIG_CPU_TYPE)) GCC_ARCH:= From ee6fbafecf1c45bcac2913c62fba83cb683c5932 Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Mon, 4 Jan 2021 20:55:38 +0000 Subject: [PATCH 11/17] build: add GNU install to prerequisites The recent removal of usbutils from core and replacement by hwdata in packages has exposed hwdata's requirement for certain GNU options on 'install' (-T) Other packages (sqm-scripts) have openwrt specific makefile sections to avoid GNU options but I suspect this is going to get harder in the future. Add GNU install as a prerequisite and link into $STAGING_DIR/host/etc/bin as per similar GNU utils This resolves an issue building under MacOS which would otherwise use a non-GNU options aware version of 'install' Signed-off-by: Kevin Darbyshire-Bryant --- include/prereq-build.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 32edc6e437..323e3ba1e6 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -136,6 +136,10 @@ $(eval $(call SetupHostCommand,bzip2,Please install 'bzip2', \ $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \ wget --version | grep GNU)) +$(eval $(call SetupHostCommand,install,Please install GNU 'install', \ + install --version | grep GNU, \ + ginstall --version | grep GNU)) + $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \ perl --version | grep "perl.*v5")) From 5ec2e9b8c7b429de95db6f00a0a68c702341f405 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Thu, 25 Mar 2021 10:25:54 -1000 Subject: [PATCH 12/17] build,json: 3rd fixup of default_packages This became a bit of a tragedy, caused by a corner cases which wasn't put into account during testing. DEFAULT_PACKAGES are defined in target/linux//Makefile but also in target/linux///target.mk. The latter was no longer imported when using DUMP=1, however not using DUMP=1 while running the Makefile in target/linux// caused duplicate packages in the list. As a solution, which should have been used from day 0, `make` runs in target/linux/ without DUMP=1, resulting in no duplicate packages and all inclusions from include/target.mk, linux/target//{Makefile, /target.mk} While at it, sort the list of default packages. Signed-off-by: Paul Spooren --- scripts/json_overview_image_info.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/scripts/json_overview_image_info.py b/scripts/json_overview_image_info.py index cd814a19c0..8dbd24af2d 100755 --- a/scripts/json_overview_image_info.py +++ b/scripts/json_overview_image_info.py @@ -33,28 +33,13 @@ for json_file in work_dir.glob("*.json"): ) if output: - output["default_packages"] = run( + default_packages, output["arch_packages"] = run( [ "make", "--no-print-directory", "-C", - "target/linux/{}".format(output["target"].split("/")[0]), + "target/linux/", "val.DEFAULT_PACKAGES", - "DUMP=1", - ], - stdout=PIPE, - stderr=PIPE, - check=True, - env=environ.copy().update({"TOPDIR": Path().cwd()}), - universal_newlines=True, - ).stdout.split() - - output["arch_packages"] = run( - [ - "make", - "--no-print-directory", - "-C", - "target/linux/{}".format(output["target"].split("/")[0]), "val.ARCH_PACKAGES", ], stdout=PIPE, @@ -62,7 +47,9 @@ if output: check=True, env=environ.copy().update({"TOPDIR": Path().cwd()}), universal_newlines=True, - ).stdout.strip() + ).stdout.splitlines() + + output["default_packages"] = sorted(default_packages.split()) output_path.write_text(json.dumps(output, sort_keys=True, separators=(",", ":"))) else: From 166f2bd6705474f5b31cc5e52f24114c8db77e64 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Wed, 24 Feb 2021 08:52:22 -0800 Subject: [PATCH 13/17] elfutils: enable building with MIPS16 Building with MIPS16 was disabled in 2013 due to an issue with GCC TLS: https://dev.archive.openwrt.org/ticket/13572. But after the problematic GCC version was retired, this change wasn't revisited. Re-enable MIPS16 builds to reduce average elfutils library sizes ~10%. This was compile-tested on malta/mips32be and malta/mips32le, and linked with iproute2 for run-testing. Package sizes follow: Library MIPS16:=0 MIPS16:=1 ------- --------- --------- libelf1 43217 37492 libasm1 12481 11658 libdw1 229723 205793 Signed-off-by: Tony Ambardar --- package/libs/elfutils/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile index dd0b8ecdde..3e36dc27b8 100644 --- a/package/libs/elfutils/Makefile +++ b/package/libs/elfutils/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=elfutils PKG_VERSION:=0.180 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION) @@ -21,7 +21,7 @@ PKG_CPE_ID:=cpe:/a:elfutils_project:elfutils PKG_FIXUP:=autoreconf PKG_INSTALL:=1 -PKG_USE_MIPS16:=0 +PKG_USE_MIPS16:=1 PKG_BUILD_DEPENDS:=!USE_GLIBC:argp-standalone include $(INCLUDE_DIR)/package.mk From a52382d5d76a3ad2e0652dcef78b56c3e3f066e6 Mon Sep 17 00:00:00 2001 From: Register <458892+aieu@users.noreply.github.com> Date: Wed, 24 Mar 2021 13:50:13 +0800 Subject: [PATCH 14/17] sunxi: h3: add more cpu operating points Signed-off-by: Register <458892+aieu@users.noreply.github.com> [Fixed format issues, add 960MHz and remove overclock part] Signed-off-by: AmadeusGhost --- ...n8i-h3-add-more-cpu-operating-points.patch | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 target/linux/sunxi/patches-4.19/302-sun8i-h3-add-more-cpu-operating-points.patch diff --git a/target/linux/sunxi/patches-4.19/302-sun8i-h3-add-more-cpu-operating-points.patch b/target/linux/sunxi/patches-4.19/302-sun8i-h3-add-more-cpu-operating-points.patch new file mode 100644 index 0000000000..5a215f439e --- /dev/null +++ b/target/linux/sunxi/patches-4.19/302-sun8i-h3-add-more-cpu-operating-points.patch @@ -0,0 +1,50 @@ +--- a/arch/arm/boot/dts/sun8i-h3.dtsi ++++ b/arch/arm/boot/dts/sun8i-h3.dtsi +@@ -59,11 +59,47 @@ + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + ++ opp@960000000 { ++ opp-hz = /bits/ 64 <960000000>; ++ opp-microvolt = <1200000 1200000 1300000>; ++ clock-latency-ns = <244144>; /* 8 32k periods */ ++ }; ++ + opp-1008000000 { + opp-hz = /bits/ 64 <1008000000>; + opp-microvolt = <1200000 1200000 1300000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; ++ ++ opp-1056000000 { ++ opp-hz = /bits/ 64 <1056000000>; ++ opp-microvolt = <1300000 1300000 1300000>; ++ clock-latency-ns = <244144>; /* 8 32k periods */ ++ }; ++ ++ opp-1104000000 { ++ opp-hz = /bits/ 64 <1104000000>; ++ opp-microvolt = <1300000 1300000 1300000>; ++ clock-latency-ns = <244144>; /* 8 32k periods */ ++ }; ++ ++ opp-1152000000 { ++ opp-hz = /bits/ 64 <1152000000>; ++ opp-microvolt = <1300000 1300000 1300000>; ++ clock-latency-ns = <244144>; /* 8 32k periods */ ++ }; ++ ++ opp-1200000000 { ++ opp-hz = /bits/ 64 <1200000000>; ++ opp-microvolt = <1300000 1300000 1300000>; ++ clock-latency-ns = <244144>; /* 8 32k periods */ ++ }; ++ ++ opp-1248000000 { ++ opp-hz = /bits/ 64 <1248000000>; ++ opp-microvolt = <1300000 1300000 1300000>; ++ clock-latency-ns = <244144>; /* 8 32k periods */ ++ }; + }; + + cpus { From 284c9b634563ec7ba6b80984cada39fa865455af Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Fri, 19 Mar 2021 15:06:03 +0800 Subject: [PATCH 15/17] sunxi: h5: add 1.2GHz CPU OPP --- target/linux/sunxi/image/cortex-a53.mk | 4 ++-- ...-arm64-dts-allwinner-h5-Add-CPU-OPP-table.patch | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/target/linux/sunxi/image/cortex-a53.mk b/target/linux/sunxi/image/cortex-a53.mk index dae515065e..47b7ecf951 100644 --- a/target/linux/sunxi/image/cortex-a53.mk +++ b/target/linux/sunxi/image/cortex-a53.mk @@ -30,8 +30,8 @@ TARGET_DEVICES += friendlyarm_nanopi-neo2 define Device/friendlyarm_nanopi-r1s-h5 DEVICE_VENDOR := FriendlyARM - DEVICE_MODEL:=Nanopi R1S H5 - DEVICE_PACKAGES:= kmod-eeprom-at24 kmod-gpio-button-hotplug kmod-leds-gpio \ + DEVICE_MODEL := Nanopi R1S H5 + DEVICE_PACKAGES := kmod-eeprom-at24 kmod-gpio-button-hotplug kmod-leds-gpio \ kmod-rtl8189es kmod-usb2 kmod-usb-net kmod-usb-net-rtl8152 wpad-basic SUPPORTED_DEVICES:=nanopi-r1s-h5 SUNXI_DTS_DIR := allwinner/ diff --git a/target/linux/sunxi/patches-4.19/025-arm64-dts-allwinner-h5-Add-CPU-OPP-table.patch b/target/linux/sunxi/patches-4.19/025-arm64-dts-allwinner-h5-Add-CPU-OPP-table.patch index 25292f438d..3e7ef4b978 100644 --- a/target/linux/sunxi/patches-4.19/025-arm64-dts-allwinner-h5-Add-CPU-OPP-table.patch +++ b/target/linux/sunxi/patches-4.19/025-arm64-dts-allwinner-h5-Add-CPU-OPP-table.patch @@ -31,7 +31,7 @@ new file mode 100644 index 0000000000000..b2657201957eb --- /dev/null +++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-cpu-opp.dtsi -@@ -0,0 +1,79 @@ +@@ -0,0 +1,91 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +// Copyright (C) 2020 Chen-Yu Tsai + @@ -93,6 +93,18 @@ index 0000000000000..b2657201957eb + opp-microvolt = <1300000 1300000 1310000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; ++ ++ opp-1200000000 { ++ opp-hz = /bits/ 64 <1200000000>; ++ opp-microvolt = <1300000 1300000 1310000>; ++ clock-latency-ns = <244144>; /* 8 32k periods */ ++ }; ++ ++ opp-1248000000 { ++ opp-hz = /bits/ 64 <1248000000>; ++ opp-microvolt = <1300000 1300000 1310000>; ++ clock-latency-ns = <244144>; /* 8 32k periods */ ++ }; + }; +}; + From 66ea9d183d0227d09da77e82f20e4455f7824d9d Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Tue, 16 Mar 2021 11:16:02 +0800 Subject: [PATCH 16/17] ndpi-netfilter: remove outdated package --- package/ntlf9t/ndpi-netfilter/Makefile | 66 --------- .../ndpi-netfilter/patches/001-main.patch | 126 ------------------ 2 files changed, 192 deletions(-) delete mode 100644 package/ntlf9t/ndpi-netfilter/Makefile delete mode 100644 package/ntlf9t/ndpi-netfilter/patches/001-main.patch diff --git a/package/ntlf9t/ndpi-netfilter/Makefile b/package/ntlf9t/ndpi-netfilter/Makefile deleted file mode 100644 index 853e746ec4..0000000000 --- a/package/ntlf9t/ndpi-netfilter/Makefile +++ /dev/null @@ -1,66 +0,0 @@ -# -# Copyright (C) 2017 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=ndpi-netfilter -PKG_VERSION:=3.0 -PKG_RELEASE:=1 - -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/betolj/ndpi-netfilter -PKG_MIRROR_HASH:=1a26ea73375a99831be6949faa9bc768e9f4f9e3594286729ec9e61dd6402b07 -PKG_SOURCE_VERSION:=4875069df027199698ba0b7c53541ae2a4e3ba00 - -PKG_LICENSE:=GPL-2.0 -PKG_LICENSE_FILES:=COPYING - -include $(INCLUDE_DIR)/package.mk -include $(INCLUDE_DIR)/kernel.mk - -define Package/iptables-mod-ndpi - SUBMENU:=Firewall - SECTION:=net - CATEGORY:=Network - TITLE:=nDPI successor of OpenDPI - URL:=https://github.com/ntop/nDPI - DEPENDS:=+iptables +iptables-mod-conntrack-extra +kmod-ipt-ndpi - MAINTAINER:=Thomas Heil -endef - -define Package/iptables-mod-ndpi/description - nDPI is a ntop-maintained superset of the popular OpenDPI library -endef - -define Build/Prepare - $(call Build/Prepare/Default) - $(TAR) -zxf $(PKG_BUILD_DIR)/nDPI.tar.gz -C $(PKG_BUILD_DIR) -endef - -MAKE_FLAGS +=\ - KERNEL_DIR="$(LINUX_DIR)" \ - ARCH="$(LINUX_KARCH)" \ - NDPI_PATH=$(PKG_BUILD_DIR)/nDPI \ - CROSS_COMPILE="$(TARGET_CROSS)" \ - all - -define Package/iptables-mod-ndpi/install - $(INSTALL_DIR) $(1)/usr/lib/iptables - $(INSTALL_BIN) $(PKG_BUILD_DIR)/ipt/libxt_ndpi.so $(1)/usr/lib/iptables -endef - -define KernelPackage/ipt-ndpi - SUBMENU:=Netfilter Extensions - TITLE:=nDPI netfilter module - DEPENDS:=+kmod-nf-conntrack +kmod-nf-conntrack-netlink +kmod-ipt-compat-xtables - FILES:= \ - $(PKG_BUILD_DIR)/src/xt_ndpi.ko - AUTOLOAD:=$(call AutoProbe,xt_ndpi) -endef - -$(eval $(call BuildPackage,iptables-mod-ndpi)) -$(eval $(call KernelPackage,ipt-ndpi)) diff --git a/package/ntlf9t/ndpi-netfilter/patches/001-main.patch b/package/ntlf9t/ndpi-netfilter/patches/001-main.patch deleted file mode 100644 index c099fe7dce..0000000000 --- a/package/ntlf9t/ndpi-netfilter/patches/001-main.patch +++ /dev/null @@ -1,126 +0,0 @@ ---- a/nDPI-patch/src/lib/protocols/netflow.c -+++ b/nDPI-patch/src/lib/protocols/netflow.c -@@ -21,6 +21,7 @@ - */ - - -+#include - #include "ndpi_api.h" - - #ifdef NDPI_PROTOCOL_NETFLOW -@@ -29,7 +30,11 @@ - #ifdef WIN32 - extern int gettimeofday(struct timeval * tp, struct timezone * tzp); - #endif -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) - #define do_gettimeofday(a) gettimeofday(a, NULL) -+#else -+#define ktime_get_real_ts64(a) gettimeofday(a, NULL) -+#endif - #endif - - struct flow_ver1_rec { -@@ -105,7 +110,11 @@ static void ndpi_check_netflow(struct ndpi_detection_module_struct *ndpi_struct, - // const u_int8_t *packet_payload = packet->payload; - u_int32_t payload_len = packet->payload_packet_len; - time_t now; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) - struct timeval now_tv; -+#else -+ struct timespec64 now_tv; -+#endif - - if((packet->udp != NULL) && (payload_len >= 24)) { - u_int16_t version = (packet->payload[0] << 8) + packet->payload[1], uptime_offset; -@@ -158,7 +167,11 @@ static void ndpi_check_netflow(struct ndpi_detection_module_struct *ndpi_struct, - _when = (u_int32_t*)&packet->payload[uptime_offset]; /* Sysuptime */ - when = ntohl(*_when); - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) - do_gettimeofday(&now_tv); -+#else -+ ktime_get_real_ts64(&now_tv); -+#endif - now = now_tv.tv_sec; - - if(((version == 1) && (when == 0)) ---- a/src/main.c -+++ b/src/main.c -@@ -383,9 +383,16 @@ static void ndpi_gc_flow(void) - union nf_inet_addr *ipdst; - - u64 t1; -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) - struct timeval tv; - - do_gettimeofday(&tv); -+#else -+ struct timespec64 tv; -+ -+ ktime_get_real_ts64(&tv); -+#endif - t1 = (uint64_t) tv.tv_sec; - - if (debug_dpi) pr_info ("xt_ndpi: call garbage collector.\n"); -@@ -418,7 +425,11 @@ ndpi_process_packet(struct nf_conn * ct, const uint64_t time, - - u8 exist_flow=0; - u64 t1; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) - struct timeval tv; -+#else -+ struct timespec64 tv; -+#endif - - spin_lock_bh (&flow_lock); - ipsrc = &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3; -@@ -449,7 +460,11 @@ ndpi_process_packet(struct nf_conn * ct, const uint64_t time, - } - } - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) - do_gettimeofday(&tv); -+#else -+ ktime_get_real_ts64(&tv); -+#endif - t1 = (uint64_t) tv.tv_sec; - - if (flow == NULL) { -@@ -602,7 +617,11 @@ ndpi_mt(const struct sk_buff *skb, struct xt_action_param *par) - - enum ip_conntrack_info ctinfo; - struct nf_conn * ct; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) - struct timeval tv; -+#else -+ struct timespec64 tv; -+#endif - struct sk_buff *linearized_skb = NULL; - const struct sk_buff *skb_use = NULL; - -@@ -630,7 +649,7 @@ ndpi_mt(const struct sk_buff *skb, struct xt_action_param *par) - #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - } else if (nf_ct_is_untracked(skb)){ - #else -- } else if (nf_ct_is_untracked(ct)){ -+ } else if (nf_ct_is_expired(ct)){ - #endif - pr_info ("xt_ndpi: ignoring untracked sk_buff.\n"); - return false; -@@ -641,9 +660,15 @@ ndpi_mt(const struct sk_buff *skb, struct xt_action_param *par) - ip = ip_hdr(skb_use); - tcph = (const void *)ip + ip_hdrlen(skb_use); - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) - do_gettimeofday(&tv); - time = ((uint64_t) tv.tv_sec) * detection_tick_resolution + - tv.tv_usec / (1000000 / detection_tick_resolution); -+#else -+ ktime_get_real_ts64(&tv); -+ time = ((uint64_t) tv.tv_sec) * detection_tick_resolution + -+ (tv.tv_nsec / 1000 )/ (1000000 / detection_tick_resolution); -+#endif - - /* reset for new packets and solve ct collisions */ - if (ctinfo == IP_CT_NEW) { From 1e603d80f21fab710f443371070967925029dc5b Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Wed, 17 Mar 2021 11:20:04 +0800 Subject: [PATCH 17/17] openvpn-easy-rsa: remove duplicate package --- .../ntlf9t/openvpn-easy-rsa-whisky/Makefile | 47 ------------------- .../patches/100-fix_EASYRSA_REQ_CN.patch | 11 ----- .../patches/101-static_EASYRSA.patch | 20 -------- 3 files changed, 78 deletions(-) delete mode 100644 package/ntlf9t/openvpn-easy-rsa-whisky/Makefile delete mode 100644 package/ntlf9t/openvpn-easy-rsa-whisky/patches/100-fix_EASYRSA_REQ_CN.patch delete mode 100644 package/ntlf9t/openvpn-easy-rsa-whisky/patches/101-static_EASYRSA.patch diff --git a/package/ntlf9t/openvpn-easy-rsa-whisky/Makefile b/package/ntlf9t/openvpn-easy-rsa-whisky/Makefile deleted file mode 100644 index 06c99db439..0000000000 --- a/package/ntlf9t/openvpn-easy-rsa-whisky/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright (C) 2010-2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=openvpn-easy-rsa-whisky - -PKG_VERSION:=3.0.6 -PKG_RELEASE:=2 -PKG_SOURCE_URL:=https://github.com/OpenVPN/easy-rsa/releases/download/v$(PKG_VERSION)/ -PKG_SOURCE:=EasyRSA-unix-v$(PKG_VERSION).tgz -PKG_HASH:=cb29aed2d27824e59dbaad547f11dcab380a53c9fe05681249e804af436f1396 -PKG_LICENSE:=GPL-2.0 -PKG_BUILD_DIR:=$(BUILD_DIR)/EasyRSA-v$(PKG_VERSION) - -include $(INCLUDE_DIR)/package.mk - -define Package/openvpn-easy-rsa-whisky - TITLE:=CLI utility to build and manage a PKI CA. - SECTION:=net - CATEGORY:=Network - URL:=http://openvpn.net - SUBMENU:=VPN - DEPENDS:=+openssl-util - PKGARCH:=all -endef - -define Build/Configure -endef - -define Build/Compile -endef - -define Package/openvpn-easy-rsa-whisky/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/easyrsa $(1)/usr/bin/ - $(INSTALL_DIR) $(1)/etc/easy-rsa - $(INSTALL_DATA) $(PKG_BUILD_DIR)/openssl-easyrsa.cnf $(1)/etc/easy-rsa/openssl-easyrsa.cnf - $(INSTALL_DIR) $(1)/etc/easy-rsa/x509-types - $(INSTALL_DATA) $(PKG_BUILD_DIR)/x509-types/* $(1)/etc/easy-rsa/x509-types/ -endef - -$(eval $(call BuildPackage,openvpn-easy-rsa-whisky)) diff --git a/package/ntlf9t/openvpn-easy-rsa-whisky/patches/100-fix_EASYRSA_REQ_CN.patch b/package/ntlf9t/openvpn-easy-rsa-whisky/patches/100-fix_EASYRSA_REQ_CN.patch deleted file mode 100644 index f1c4ee942c..0000000000 --- a/package/ntlf9t/openvpn-easy-rsa-whisky/patches/100-fix_EASYRSA_REQ_CN.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/easyrsa -+++ b/easyrsa -@@ -549,7 +549,7 @@ current CA keypair. If you intended to s - - # Default CN only when not in global EASYRSA_BATCH mode: - # shellcheck disable=SC2015 -- [ "$EASYRSA_BATCH" ] && opts="$opts -batch" || export EASYRSA_REQ_CN="Easy-RSA CA" -+ [ "$EASYRSA_BATCH" ] && opts="$opts -batch" || export EASYRSA_REQ_CN="${EASYRSA_REQ_CN:-Easy-RSA CA}" - - out_key_tmp="$(mktemp "$out_key.XXXXXXXXXX")"; EASYRSA_TEMP_FILE_2="$out_key_tmp" - out_file_tmp="$(mktemp "$out_file.XXXXXXXXXX")"; EASYRSA_TEMP_FILE_3="$out_file_tmp" diff --git a/package/ntlf9t/openvpn-easy-rsa-whisky/patches/101-static_EASYRSA.patch b/package/ntlf9t/openvpn-easy-rsa-whisky/patches/101-static_EASYRSA.patch deleted file mode 100644 index 9da4017801..0000000000 --- a/package/ntlf9t/openvpn-easy-rsa-whisky/patches/101-static_EASYRSA.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/easyrsa -+++ b/easyrsa -@@ -1033,7 +1033,7 @@ vars_setup() { - vars= - - # set up program path -- prog_vars="${0%/*}/vars" -+ prog_vars="/etc/easy-rsa/vars" - # set up PKI path - pki_vars="${EASYRSA_PKI:-$PWD/pki}/vars" - -@@ -1060,7 +1060,7 @@ Note: using Easy-RSA configuration from: - fi - - # Set defaults, preferring existing env-vars if present -- set_var EASYRSA "${0%/*}" -+ set_var EASYRSA "/etc/easy-rsa" - set_var EASYRSA_OPENSSL openssl - set_var EASYRSA_PKI "$PWD/pki" - set_var EASYRSA_DN cn_only