+dsp = require "luci.dispatcher"
+uci = require "uci"
+
+
+function interfaceWarnings(overview, count, iface_max)
+ local warnings = ""
+ if count <= iface_max then
+ warnings = string.format("<strong>%s</strong><br />",
+ translatef("There are currently %d of %d supported interfaces configured", count, iface_max)
+ )
+ else
+ warnings = string.format("<strong>%s</strong><br />",
+ translatef("WARNING: %d interfaces are configured exceeding the maximum of %d!", count, iface_max)
+ )
+ end
+
+ for i, k in pairs(overview) do
+ if overview[i]["network"] == false then
+ warnings = warnings .. string.format("<strong>%s</strong><br />",
+ translatef("WARNING: Interface %s are not found in /etc/config/network", i)
+ )
+ end
+
+ if overview[i]["default_route"] == false then
+ warnings = warnings .. string.format("<strong>%s</strong><br />",
+ translatef("WARNING: Interface %s has no default route in the main routing table", i)
+ )
+ end
+
+ if overview[i]["reliability"] == false then
+ warnings = warnings .. string.format("<strong>%s</strong><br />",
+ translatef("WARNING: Interface %s has a higher reliability " ..
+ "requirement than tracking hosts (%d)", i, overview[i]["tracking"])
+ )
+ end
+
+ if overview[i]["duplicate_metric"] == true then
+ warnings = warnings .. string.format("<strong>%s</strong><br />",
+ translatef("WARNING: Interface %s has a duplicate metric %s configured", i, overview[i]["metric"])
+ )
+ end
+ end
+
+ return warnings
+end
+
+function configCheck()
+ local overview = {}
+ local count = 0
+ local duplicate_metric = {}