protocols/ppp: fix install state detection with netifd
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 27 Apr 2012 18:10:51 +0000 (18:10 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 27 Apr 2012 18:10:51 +0000 (18:10 +0000)
protocols/ppp/luasrc/model/network/proto_ppp.lua

index af6f39402504bcf18a4c7c754d92cacbb72459cc..2988385b225bdd6cb41a00e081243bb26f82146e 100644 (file)
@@ -55,7 +55,17 @@ for _, p in ipairs({"ppp", "pptp", "pppoe", "pppoa", "3g"}) do
        end
 
        function proto.is_installed(self)
-               return nixio.fs.access("/lib/network/" .. p .. ".sh")
+               if nixio.fs.access("/lib/network/" .. p .. ".sh") then
+                       return true
+               elseif p == "pppoa" then
+                       return (nixio.fs.glob("/usr/lib/pppd/*/pppoatm.so")() ~= nil)
+               elseif p == "pppoe" then
+                       return (nixio.fs.glob("/usr/lib/pppd/*/rp-pppoe.so")() ~= nil)
+               elseif p == "3g" then
+                       return nixio.fs.access("/lib/netifd/proto/3g.sh")
+               else
+                       return nixio.fs.access("/lib/netifd/proto/ppp.sh")
+               end
        end
 
        function proto.is_floating(self)