Changeset 8869

Show
Ignore:
Timestamp:
07/04/12 11:02:21 (11 months ago)
Author:
jow
Message:

protocols/ppp: add mtu options to all ppp protocols, add lcp options to pptp

Location:
luci/trunk/protocols/ppp/luasrc/model/cbi/admin_network
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • luci/trunk/protocols/ppp/luasrc/model/cbi/admin_network/proto_ppp.lua

    r7872 r8869  
    1515local device, username, password 
    1616local ipv6, defaultroute, metric, peerdns, dns, 
    17       keepalive_failure, keepalive_interval, demand 
     17      keepalive_failure, keepalive_interval, demand, mtu 
    1818 
    1919 
     
    130130demand.placeholder = "0" 
    131131demand.datatype    = "uinteger" 
     132 
     133 
     134mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) 
     135mtu.placeholder = "1500" 
     136mtu.datatype    = "max(1500)" 
  • luci/trunk/protocols/ppp/luasrc/model/cbi/admin_network/proto_pppoa.lua

    r7872 r8869  
    1515local encaps, atmdev, vci, vpi, username, password 
    1616local ipv6, defaultroute, metric, peerdns, dns, 
    17       keepalive_failure, keepalive_interval, demand 
     17      keepalive_failure, keepalive_interval, demand, mtu 
    1818 
    1919 
     
    136136demand.placeholder = "0" 
    137137demand.datatype    = "uinteger" 
     138 
     139 
     140mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) 
     141mtu.placeholder = "1500" 
     142mtu.datatype    = "max(1500)" 
  • luci/trunk/protocols/ppp/luasrc/model/cbi/admin_network/proto_pppoe.lua

    r7872 r8869  
    1515local username, password, ac, service 
    1616local ipv6, defaultroute, metric, peerdns, dns, 
    17       keepalive_failure, keepalive_interval, demand 
     17      keepalive_failure, keepalive_interval, demand, mtu 
    1818 
    1919 
     
    130130demand.placeholder = "0" 
    131131demand.datatype    = "uinteger" 
     132 
     133 
     134mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) 
     135mtu.placeholder = "1500" 
     136mtu.datatype    = "max(1500)" 
  • luci/trunk/protocols/ppp/luasrc/model/cbi/admin_network/proto_pptp.lua

    r8774 r8869  
    1414 
    1515local server, username, password 
    16 local defaultroute, metric, peerdns, dns 
     16local defaultroute, metric, peerdns, dns, 
     17    keepalive_failure, keepalive_interval, demand, mtu 
    1718 
    1819 
     
    5657dns.datatype = "ipaddr" 
    5758dns.cast     = "string" 
     59 
     60 
     61keepalive_failure = section:taboption("advanced", Value, "_keepalive_failure", 
     62    translate("LCP echo failure threshold"), 
     63    translate("Presume peer to be dead after given amount of LCP echo failures, use 0 to ignore failures")) 
     64 
     65function keepalive_failure.cfgvalue(self, section) 
     66    local v = m:get(section, "keepalive") 
     67    if v and #v > 0 then 
     68        return tonumber(v:match("^(%d+)[ ,]+%d+") or v) 
     69    end 
     70end 
     71 
     72function keepalive_failure.write() end 
     73function keepalive_failure.remove() end 
     74 
     75keepalive_failure.placeholder = "0" 
     76keepalive_failure.datatype    = "uinteger" 
     77 
     78 
     79keepalive_interval = section:taboption("advanced", Value, "_keepalive_interval", 
     80    translate("LCP echo interval"), 
     81    translate("Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold")) 
     82 
     83function keepalive_interval.cfgvalue(self, section) 
     84    local v = m:get(section, "keepalive") 
     85    if v and #v > 0 then 
     86        return tonumber(v:match("^%d+[ ,]+(%d+)")) 
     87    end 
     88end 
     89 
     90function keepalive_interval.write(self, section, value) 
     91    local f = tonumber(keepalive_failure:formvalue(section)) or 0 
     92    local i = tonumber(value) or 5 
     93    if i < 1 then i = 1 end 
     94    if f > 0 then 
     95        m:set(section, "keepalive", "%d %d" %{ f, i }) 
     96    else 
     97        m:del(section, "keepalive") 
     98    end 
     99end 
     100 
     101keepalive_interval.remove      = keepalive_interval.write 
     102keepalive_interval.placeholder = "5" 
     103keepalive_interval.datatype    = "min(1)" 
     104 
     105 
     106demand = section:taboption("advanced", Value, "demand", 
     107    translate("Inactivity timeout"), 
     108    translate("Close inactive connection after the given amount of seconds, use 0 to persist connection")) 
     109 
     110demand.placeholder = "0" 
     111demand.datatype    = "uinteger" 
     112 
     113 
     114mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) 
     115mtu.placeholder = "1500" 
     116mtu.datatype    = "max(1500)"