From 3d83c15fe166595e00e54ade6beec30aab4d2664 Mon Sep 17 00:00:00 2001 From: Andrew Shadura Date: Sat, 8 Oct 2016 18:29:08 +0200 Subject: luci-mod-admin-full: routes: add support for route types Allow specifying route types. Signed-off-by: Andrew Shadura --- .../luasrc/model/cbi/admin_network/routes.lua | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'modules/luci-mod-admin-full/luasrc') diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/routes.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/routes.lua index ac02b156e..e5f308e6d 100644 --- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/routes.lua +++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/routes.lua @@ -41,6 +41,18 @@ mtu.placeholder = 1500 mtu.datatype = "range(64,9000)" mtu.rmempty = true +routetype = s:option(Value, "type", translate("Route type")) +routetype:value("", "unicast") +routetype:value("local", "local") +routetype:value("broadcast", "broadcast") +routetype:value("multicast", "multicast") +routetype:value("unreachable", "unreachable") +routetype:value("prohibit", "prohibit") +routetype:value("blackhole", "blackhole") +routetype:value("anycast", "anycast") +routetype.default = "" +routetype.rmempty = true + if fs.access("/proc/net/ipv6_route") then s = m:section(TypedSection, "route6", translate("Static IPv6 Routes")) s.addremove = true @@ -68,6 +80,18 @@ if fs.access("/proc/net/ipv6_route") then mtu.placeholder = 1500 mtu.datatype = "range(64,9000)" mtu.rmempty = true + + routetype = s:option(Value, "type", translate("Route type")) + routetype:value("", "unicast") + routetype:value("local", "local") + routetype:value("broadcast", "broadcast") + routetype:value("multicast", "multicast") + routetype:value("unreachable", "unreachable") + routetype:value("prohibit", "prohibit") + routetype:value("blackhole", "blackhole") + routetype:value("anycast", "anycast") + routetype.default = "" + routetype.rmempty = true end -- cgit v1.2.3 From 44d43c6932c502b27a1a172047d591f32555f96c Mon Sep 17 00:00:00 2001 From: Andrew Shadura Date: Sat, 8 Oct 2016 18:41:52 +0200 Subject: luci-mod-admin-full: routes: specify sizes for metric and MTU Specify reasonable sizes for metric and MTU fields to prevent the table from being too wide. Signed-off-by: Andrew Shadura --- modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/routes.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/luci-mod-admin-full/luasrc') diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/routes.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/routes.lua index e5f308e6d..1970f36a2 100644 --- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/routes.lua +++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/routes.lua @@ -34,11 +34,13 @@ g.rmempty = true metric = s:option(Value, "metric", translate("Metric")) metric.placeholder = 0 metric.datatype = "range(0,255)" +metric.size = 5 metric.rmempty = true mtu = s:option(Value, "mtu", translate("MTU")) mtu.placeholder = 1500 mtu.datatype = "range(64,9000)" +mtu.size = 5 mtu.rmempty = true routetype = s:option(Value, "type", translate("Route type")) @@ -74,11 +76,13 @@ if fs.access("/proc/net/ipv6_route") then metric = s:option(Value, "metric", translate("Metric")) metric.placeholder = 0 metric.datatype = "range(0,65535)" -- XXX: not sure + metric.size = 5 metric.rmempty = true mtu = s:option(Value, "mtu", translate("MTU")) mtu.placeholder = 1500 mtu.datatype = "range(64,9000)" + mtu.size = 5 mtu.rmempty = true routetype = s:option(Value, "type", translate("Route type")) -- cgit v1.2.3