Changeset 7966

Show
Ignore:
Timestamp:
11/18/11 18:03:32 (18 months ago)
Author:
soma
Message:

applications/olsr: Set defaults for values and check which IpVersion? olsrd uses

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • luci/trunk/applications/luci-olsr/luasrc/model/cbi/olsr/olsrdhna.lua

    r7070 r7966  
    33 
    44Copyright 2008 Steven Barth <steven@midlink.org> 
     5Copyright 2011 Manuel Munz <freifunk at somakoma dot de> 
    56 
    67Licensed under the Apache License, Version 2.0 (the "License"); 
     
    1314]]-- 
    1415 
    15 mh = Map("olsrd", translate("OLSR - HNA-Announcements")) 
     16local uci = require "luci.model.uci".cursor() 
     17local ipv =  uci:get_first("olsrd", "olsrd", "IpVersion", "4") 
    1618 
     19mh = Map("olsrd", translate("OLSR - HNA-Announcements"), translate("Hosts in a OLSR routed network can announce connecitivity " .. 
     20    "to external networks using HNA messages.")) 
    1721 
    18 hna4 = mh:section(TypedSection, "Hna4", translate("Hna4"), translate("Both values must use the dotted decimal notation.")) 
    19 hna4.addremove = true 
    20 hna4.anonymous = true 
    21 hna4.template  = "cbi/tblsection" 
     22if ipv == "6and4" or ipv == "4" then 
     23    hna4 = mh:section(TypedSection, "Hna4", translate("Hna4"), translate("Both values must use the dotted decimal notation.")) 
     24    hna4.addremove = true 
     25    hna4.anonymous = true 
     26    hna4.template  = "cbi/tblsection" 
    2227 
    23 net4 = hna4:option(Value, "netaddr", translate("Network address")) 
    24 net4.datatype = "ip4addr" 
    25 net4.placeholder = "15.15.0.0" 
    26 msk4 = hna4:option(Value, "netmask", translate("Netmask")) 
    27 msk4.datatype = "ip4addr" 
    28 msk4.placeholder = "255.255.255.0" 
     28    net4 = hna4:option(Value, "netaddr", translate("Network address")) 
     29    net4.datatype = "ip4addr" 
     30    net4.placeholder = "10.11.12.13" 
     31    net4.default = "10.11.12.13" 
     32    msk4 = hna4:option(Value, "netmask", translate("Netmask")) 
     33    msk4.datatype = "ip4addr" 
     34    msk4.placeholder = "255.255.255.255" 
     35    msk4.default = "255.255.255.255" 
     36end 
    2937 
    30 hna6 = mh:section(TypedSection, "Hna6", translate("Hna6"), translate("IPv6 network must be given in full notation, " .. 
    31     "prefix must be in CIDR notation.")) 
    32 hna6.addremove = true 
    33 hna6.anonymous = true 
    34 hna6.template  = "cbi/tblsection" 
     38if ipv == "6and4" or ipv == "6" then 
     39    hna6 = mh:section(TypedSection, "Hna6", translate("Hna6"), translate("IPv6 network must be given in full notation, " .. 
     40        "prefix must be in CIDR notation.")) 
     41    hna6.addremove = true 
     42    hna6.anonymous = true 
     43    hna6.template  = "cbi/tblsection" 
    3544 
    36 net6 = hna6:option(Value, "netaddr", translate("Network address")) 
    37 net6.datatype = "ip6addr" 
    38 net6.placeholder = "fec0:2200:106:0:0:0:0:0" 
    39 msk6 = hna6:option(Value, "prefix", translate("Prefix")) 
    40 msk6.datatype = "range(0,128)" 
    41 msk6.placeholder = "48" 
    42  
     45    net6 = hna6:option(Value, "netaddr", translate("Network address")) 
     46    net6.datatype = "ip6addr" 
     47    net6.placeholder = "fec0:2200:106:0:0:0:0:0" 
     48    net6.default = "fec0:2200:106:0:0:0:0:0" 
     49    msk6 = hna6:option(Value, "prefix", translate("Prefix")) 
     50    msk6.datatype = "range(0,128)" 
     51    msk6.placeholder = "128" 
     52    msk6.default = "128" 
     53end 
    4354 
    4455return mh 
     56