luci-app-mwan3: show supported tracking methodes if needed bin is installed
authorFlorian Eckert <fe@dev.tdt.de>
Fri, 21 Dec 2018 09:15:36 +0000 (10:15 +0100)
committerFlorian Eckert <fe@dev.tdt.de>
Fri, 21 Dec 2018 09:33:24 +0000 (10:33 +0100)
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua

index a1880b3a9e5a5372bab9f0d872c9f1901fccf58c..4c970d4fa19e3ff27316a371e3ecb765182ce057 100644 (file)
@@ -34,12 +34,20 @@ track_ip.datatype = "host"
 track_method = mwan_interface:option(ListValue, "track_method", translate("Tracking method"))
 track_method.default = "ping"
 track_method:value("ping")
-track_method:value("nping-tcp")
-track_method:value("nping-udp")
-track_method:value("nping-icmp")
-track_method:value("nping-arp")
-track_method:value("arping")
-track_method:value("httping")
+if os.execute("which nping 1>/dev/null") == 0 then
+       track_method:value("nping-tcp")
+       track_method:value("nping-udp")
+       track_method:value("nping-icmp")
+       track_method:value("nping-arp")
+end
+
+if os.execute("which arping 1>/dev/null") == 0 then
+       track_method:value("arping")
+end
+
+if os.execute("which httping 1>/dev/null") == 0 then
+       track_method:value("httping")
+end
 
 reliability = mwan_interface:option(Value, "reliability", translate("Tracking reliability"),
        translate("Acceptable values: 1-100. This many Tracking IP addresses must respond for the link to be deemed up"))