summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--interfaces-model.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/interfaces-model.lua b/interfaces-model.lua
index b67b463..bcc3288 100644
--- a/interfaces-model.lua
+++ b/interfaces-model.lua
@@ -187,16 +187,15 @@ iface.unpack_interfaces = function ()
if string.match(line, "^#") then
comment = iface.append(comment, line , "#%s*" )
elseif string.match(line, "^auto") then
- local name = string.match(line, "auto%s+(%w+)")
+ local name = string.match(line, "auto%s+(%S+)")
auto[name] = true
elseif string.match(line, "^iface") then
- local name, family, method = string.match(line, "%w+%s+([%w.]+)%s+(%w+)%s+(%w+)")
+ local name, family, method = string.match(line, "%S+%s+(%S+)%s+(%S+)%s+(%S+)")
array[#array + 1] = iface.iface_type(family, method)
local interface = array[#array].value
interface.comment.value = comment
comment = ""
- -- iface <name> [inet | ipx] <method> -- we assume inet
- interface.name.value = name
+ interface.name.value = name or ""
elseif #array then
-- it must be some kind of parameter
local param, val =
@@ -353,6 +352,9 @@ iface.validate = function (def)
if #newdef.value.name.value == 0 then
newdef.value.name.errtxt = "The interface must have a name"
success = false
+ elseif string.find(newdef.value.name.value, "%s") then
+ newdef.value.name.errtxt = "Cannot contain spaces"
+ success = false
end
-- More validation tests go here ---
--