Changeset 7115

Show
Ignore:
Timestamp:
06/10/11 15:15:10 (2 years ago)
Author:
jow
Message:

modules/admin-full: add AHCP client support

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • luci/trunk/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua

    r6960 r7115  
    3434local has_6to4   = fs.access("/lib/network/6to4.sh") 
    3535local has_relay  = fs.access("/lib/network/relay.sh") 
     36local has_ahcp   = fs.access("/lib/network/ahcp.sh") 
    3637 
    3738m = Map("network", translate("Interfaces") .. " - " .. arg[1]:upper(), translate("On this page you can configure the network interfaces. You can bridge several interfaces by ticking the \"bridge interfaces\" field and enter the names of several network interfaces separated by spaces. You can also use <abbr title=\"Virtual Local Area Network\">VLAN</abbr> notation <samp>INTERFACE.VLANNR</samp> (<abbr title=\"for example\">e.g.</abbr>: <samp>eth0.1</samp>).")) 
     
    6970if has_6in4 or has_6to4 then s:tab("tunnel", translate("Tunnel Settings")) end 
    7071if has_relay then s:tab("relay", translate("Relay Settings")) end 
     72if has_ahcp then s:tab("ahcp", translate("AHCP Settings")) end 
    7173s:tab("physical", translate("Physical Settings")) 
    7274if has_firewall then s:tab("firewall", translate("Firewall Settings")) end 
     
    9597if has_6to4  then p:value("6to4",  "6to4")    end 
    9698if has_relay then p:value("relay", "Relay")   end 
     99if has_ahcp  then p:value("ahcp",  "AHCP")    end 
    97100p:value("none", translate("none")) 
    98101 
     
    123126ifname_single:depends({ type = "", proto = "pppoe"  }) 
    124127ifname_single:depends({ type = "", proto = "pppoa"  }) 
     128ifname_single:depends({ type = "", proto = "ahcp"   }) 
    125129ifname_single:depends({ type = "", proto = "none"   }) 
    126130 
     
    542546end 
    543547 
     548if has_ahcp then 
     549    mca = s:taboption("ahcp", Value, "multicast_address", translate("Multicast address")) 
     550    mca.optional    = true 
     551    mca.placeholder = "ff02::cca6:c0f9:e182:5359" 
     552    mca.datatype    = "ip6addr" 
     553    mca:depends("proto", "ahcp") 
     554 
     555    port = s:taboption("ahcp", Value, "port", translate("Port")) 
     556    port.optional    = true 
     557    port.placeholder = 5359 
     558    port.datatype    = "port" 
     559    port:depends("proto", "ahcp") 
     560 
     561    fam = s:taboption("ahcp", ListValue, "_family", translate("Protocol family")) 
     562    fam:value("", translate("IPv4 and IPv6")) 
     563    fam:value("ipv4", translate("IPv4 only")) 
     564    fam:value("ipv6", translate("IPv6 only")) 
     565    fam:depends("proto", "ahcp") 
     566 
     567    function fam.cfgvalue(self, section) 
     568        local v4 = m.uci:get_bool("network", section, "ipv4_only") 
     569        local v6 = m.uci:get_bool("network", section, "ipv6_only") 
     570        if v4 then 
     571            return "ipv4" 
     572        elseif v6 then 
     573            return "ipv6" 
     574        end 
     575        return "" 
     576    end 
     577 
     578    function fam.write(self, section, value) 
     579        if value == "ipv4" then 
     580            m.uci:set("network", section, "ipv4_only", "true") 
     581            m.uci:delete("network", section, "ipv6_only") 
     582        elseif value == "ipv6" then 
     583            m.uci:set("network", section, "ipv6_only", "true") 
     584            m.uci:delete("network", section, "ipv4_only") 
     585        end 
     586    end 
     587 
     588    function fam.remove(self, section) 
     589        m.uci:delete("network", section, "ipv4_only") 
     590        m.uci:delete("network", section, "ipv6_only") 
     591    end 
     592 
     593    nodns = s:taboption("ahcp", Flag, "no_dns", translate("Disable DNS setup")) 
     594    nodns.optional = true 
     595    nodns.enabled  = "true" 
     596    nodns.disabled = "false" 
     597    nodns.default  = nodns.disabled 
     598    nodns:depends("proto", "ahcp") 
     599 
     600    ltime = s:taboption("ahcp", Value, "lease_time", translate("Lease validity time")) 
     601    ltime.optional    = true 
     602    ltime.placeholder = 3666 
     603    ltime.datatype    = "uinteger" 
     604    ltime:depends("proto", "ahcp") 
     605end 
    544606 
    545607if net:proto() ~= "relay" then