X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=applications%2Fluci-app-ddns%2Fluasrc%2Fcontroller%2Fddns.lua;h=d6ccf9cd45f54f602d5b538f9b6da596d0426b53;hp=abaf1c76a3bb70a7c6c9de1939bbd082e376a92a;hb=59d391b5bdf86e889a188307adc6e49397a5e9b0;hpb=1a7b0b22a85d8294d7a2c196b708266c872dd054 diff --git a/applications/luci-app-ddns/luasrc/controller/ddns.lua b/applications/luci-app-ddns/luasrc/controller/ddns.lua index abaf1c76a..d6ccf9cd4 100755 --- a/applications/luci-app-ddns/luasrc/controller/ddns.lua +++ b/applications/luci-app-ddns/luasrc/controller/ddns.lua @@ -1,7 +1,7 @@ -- Copyright 2008 Steven Barth -- Copyright 2008 Jo-Philipp Wich -- Copyright 2013 Manuel Munz --- Copyright 2014 Christian Schoenebeck +-- Copyright 2014-2016 Christian Schoenebeck -- Licensed to the public under the Apache License 2.0. module("luci.controller.ddns", package.seeall) @@ -18,11 +18,11 @@ local UTIL = require "luci.util" local DDNS = require "luci.tools.ddns" -- ddns multiused functions local srv_name = "ddns-scripts" -local srv_ver_min = "2.5.0" -- minimum version of service required +local srv_ver_min = "2.7.1" -- minimum version of service required local srv_ver_cmd = [[/usr/lib/ddns/dynamic_dns_updater.sh --version | awk {'print $2'}]] local app_name = "luci-app-ddns" local app_title = "Dynamic DNS" -local app_version = "2.3.1-1" +local app_version = "2.4.4-1" function index() local nxfs = require "nixio.fs" -- global definitions not available @@ -96,11 +96,11 @@ function app_title_main() end function service_version() local ver = nil - IPKG.list_installed(srv_name, function(n, ver, d) - -- nothing to do + IPKG.list_installed(srv_name, function(n, v, d) + if v and (#v > 0) then ver = v end end ) - if not ver then + if not ver or (#ver == 0) then ver = UTIL.exec(srv_ver_cmd) if #ver == 0 then ver = nil end end @@ -190,9 +190,11 @@ local function _get_status() local dnsserver = s["dns_server"] or "" local force_ipversion = tonumber(s["force_ipversion"] or 0) local force_dnstcp = tonumber(s["force_dnstcp"] or 0) + local is_glue = tonumber(s["is_glue"] or 0) local command = [[/usr/lib/ddns/dynamic_dns_lucihelper.sh]] command = command .. [[ get_registered_ip ]] .. lookup_host .. [[ ]] .. use_ipv6 .. - [[ ]] .. force_ipversion .. [[ ]] .. force_dnstcp .. [[ ]] .. dnsserver + [[ ]] .. force_ipversion .. [[ ]] .. force_dnstcp .. [[ ]] .. dnsserver .. + [[ ]] .. is_glue local reg_ip = SYS.exec(command) if reg_ip == "" then reg_ip = "_nodata_"