diff options
-rw-r--r-- | opennhrp-editinterface-html.lsp | 2 | ||||
-rw-r--r-- | opennhrp-model.lua | 29 |
2 files changed, 19 insertions, 12 deletions
diff --git a/opennhrp-editinterface-html.lsp b/opennhrp-editinterface-html.lsp index 6afab11..924f6db 100644 --- a/opennhrp-editinterface-html.lsp +++ b/opennhrp-editinterface-html.lsp @@ -7,8 +7,10 @@ require("viewfunctions") function enabledisable(){ if ($("[name='type']").val() == "NHRP Enabled") { $("[name='map']").show(); + $("[name='dynamic-map']").show(); } else { $("[name='map']").hide(); + $("[name='dynamic-map']").hide(); } } $(function(){ diff --git a/opennhrp-model.lua b/opennhrp-model.lua index 554c041..753bf0f 100644 --- a/opennhrp-model.lua +++ b/opennhrp-model.lua @@ -78,8 +78,8 @@ local function parseconfigfile(configfilecontent) end local temp = {words[i+1], words[i+2]} i = i+2 - if words[i+1] == "register" then - temp[3] = words[i+1] + while words[i+1] == "register" or words[i+1] == "cisco" do + temp[#temp + 1] = words[i+1] i = i+1 end table.insert(config[currentinterface].map, temp) @@ -90,13 +90,16 @@ local function parseconfigfile(configfilecontent) end local temp = {words[i+1], words[i+2]} i = i+2 - if words[i+1] == "register" then - temp[3] = words[i+1] - i = i+1 - end table.insert(config[currentinterface]["dynamic-map"], temp) - elseif word == "cisco-authentication" then - config[currentinterface]["cisco-authentication"] = {words[i+1]} + elseif word == "multicast" then + -- there may be more than one multicast statement + if not config[currentinterface].multicast then + config[currentinterface].multicast = {} + end + table.insert(config[currentinterface].multicast, words[i+1]) + i = i+2 + elseif word == "cisco-authentication" or word == "holding-time" then + config[currentinterface][word] = {words[i+1]} i = i+1 elseif word == "redirect" or word == "shortcut" or word == "non-caching" or word == "shortcut-destination" then config[currentinterface][word] = {} @@ -144,7 +147,9 @@ local function validateinterfacedetails(interfacedetails) for i,map in ipairs(interfacedetails.value.map.value) do local words = {} for word in string.gmatch(map, "%S+") do words[#words+1] = word end - if not words[1] or not words[2] or (words[3] and words[3] ~= "register") or words[4] then + if not words[1] or not words[2] or + (words[3] and words[3] ~= "register" and words[3] ~= "cicso") or + (words[4] and words[4] ~= "register" and words[4] ~= "cisco") or words[5] then interfacedetails.value.map.errtxt = "Syntax error on line "..i success = false break @@ -153,7 +158,7 @@ local function validateinterfacedetails(interfacedetails) for i,map in ipairs(interfacedetails.value["dynamic-map"].value) do local words = {} for word in string.gmatch(map, "%S+") do words[#words+1] = word end - if not words[1] or not words[2] or (words[3] and words[3] ~= "register") or words[4] then + if not words[1] or not words[2] or words[3] then interfacedetails.value["dynamic-map"].errtxt = "Syntax error on line "..i success = false break @@ -212,8 +217,8 @@ function getinterfacedetails(interface) local details = {} details.interface = cfe({ value=interface, label="Interface" }) details.type = cfe({ type="select", value="Unused", label="Interface type", option={"Unused", "NHRP Enabled", "Shortcut Destination"} }) - details.map = cfe({ type="list", value={}, label="Static Peers", descr="List of static peer mappings of protocol-address to nbma-address. Optional 'register' parameter specifies Registration Request sent to this peer on startup. (protocol-address[/prefix] nbma-address [register])" }) - details["dynamic-map"] = cfe({ type="list", value={}, label="Dynamic Peers", descr="List of dynamic peer mappings of protocol-address to nbma-address. Optional 'register' parameter specifies Registration Request sent to this peer on startup. (protocol-address[/prefix] nbma-address [register])" }) + details.map = cfe({ type="list", value={}, label="Static Peers", descr="List of static peer mappings of protocol-address to nbma-address. Optional 'register' parameter specifies Registration Request sent to this peer on startup. If the statically mapped peer is running Cisco IOS, specify the cisco keyword. (protocol-address[/prefix] nbma-address [register] [cisco])" }) + details["dynamic-map"] = cfe({ type="list", value={}, label="Dynamic Peers", descr="List of dynamic peer mappings of protocol-address to nbma-domain-name. For each A record in the domain nbma-domain-name, opennhrp creates a dynamic NHS entry. (protocol-address/prefix nbma-domain-name)" }) configfilecontent = configfilecontent or fs.read_file(configfile) or "" config = config or parseconfigfile(configfilecontent) |