[PATCH] make luci.ip.IPvX a bit more forgiving
authorJo-Philipp Wich <jow@openwrt.org>
Sat, 1 Aug 2009 20:40:55 +0000 (20:40 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sat, 1 Aug 2009 20:40:55 +0000 (20:40 +0000)
Signed-Off-By: Malte S. Stretz <mss at apache.org>
libs/core/luasrc/ip.lua

index 8ac017e..0a66804 100644 (file)
@@ -159,6 +159,7 @@ function IPv4(address, netmask)
        local data = {}
        local prefix = address:match("/(.+)")
        address = address:gsub("/.+","")
+       address = address:gsub("^%[(.*)%]$", "%1"):upper():gsub("^::FFFF:", "")
 
        if netmask then
                prefix = obj:prefix(netmask)
@@ -206,6 +207,7 @@ function IPv6(address, netmask)
        local data = {}
        local prefix = address:match("/(.+)")
        address = address:gsub("/.+","")
+       address = address:gsub("^%[(.*)%]$", "%1")
 
        if netmask then
                prefix = obj:prefix(netmask)