luci-0.9: merge r5191
authorJo-Philipp Wich <jow@openwrt.org>
Sat, 1 Aug 2009 20:41:52 +0000 (20:41 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sat, 1 Aug 2009 20:41:52 +0000 (20:41 +0000)
libs/core/luasrc/ip.lua

index 8ac017e0228098ee1ce53fc6668697af9cf8fdd0..0a66804e8e2eb1a249e85e042f86dbbe8b7190f5 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)