summaryrefslogtreecommitdiffhomepage
path: root/libs/uvl
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-09-03 01:45:43 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-09-03 01:45:43 +0000
commit2b767fc45c564b94df4153d99d5501bb208e6fe5 (patch)
tree736960a4a496ef6be1ebb84744646d9b03d73c19 /libs/uvl
parentc842b668b0ada4757aca0f7feccf041a24628b2b (diff)
* luci/libs/uvl: completed network scheme, add "uint" and "ipaddr" datatypes
Diffstat (limited to 'libs/uvl')
-rw-r--r--libs/uvl/luasrc/uvl/datatypes.lua13
-rw-r--r--libs/uvl/root/lib/uci/schema/default/network130
2 files changed, 143 insertions, 0 deletions
diff --git a/libs/uvl/luasrc/uvl/datatypes.lua b/libs/uvl/luasrc/uvl/datatypes.lua
index 586e3f8b8..3dfe37dbe 100644
--- a/libs/uvl/luasrc/uvl/datatypes.lua
+++ b/libs/uvl/luasrc/uvl/datatypes.lua
@@ -31,6 +31,15 @@ function boolean( val )
return false
end
+function uint( val )
+ local n = tonumber(val)
+ if n ~= nil and math.floor(n) == n and n >= 0 then
+ return true
+ end
+
+ return false
+end
+
function integer( val )
local n = tonumber(val)
if n ~= nil and math.floor(n) == n then
@@ -44,6 +53,10 @@ function float( val )
return ( tonumber(val) ~= nil )
end
+function ipaddr( val )
+ return ip4addr(val) or ip6addr(val)
+end
+
function ip4addr( val )
if val then
return luci.ip.IPv4(val) and true or false
diff --git a/libs/uvl/root/lib/uci/schema/default/network b/libs/uvl/root/lib/uci/schema/default/network
index df9fc0e5e..da9eb133c 100644
--- a/libs/uvl/root/lib/uci/schema/default/network
+++ b/libs/uvl/root/lib/uci/schema/default/network
@@ -8,6 +8,7 @@ config section
option title 'Network interface definition'
option package 'network'
list depends 'proto=static, ipaddr, netmask'
+ list depends 'proto=static, ip6addr'
list depends 'proto=pppoe, username, password'
list depends 'proto=pptp, username, password, server'
list depends 'proto=dhcp'
@@ -21,6 +22,12 @@ config variable
option required true
config variable
+ option name 'macaddr'
+ option title 'Interface MAC address'
+ option section 'network.interface'
+ option datatype 'macaddr'
+
+config variable
option name 'ipaddr'
option title 'IPv4 host address'
option section 'network.interface'
@@ -33,6 +40,54 @@ config variable
option datatype 'ip4addr'
config variable
+ option name 'gateway'
+ option title 'IPv4 gateway'
+ option section 'network.interface'
+ option datatype 'ip4addr'
+
+config variable
+ option name 'bcast'
+ option title 'IPv4 broadcast address'
+ option section 'network.interface'
+ option datatype 'ip4addr'
+
+config variable
+ option name 'ip6addr'
+ option title 'IPv6 address (CIDR)'
+ option section 'network.interface'
+ option datatype 'ip6addr'
+
+config variable
+ option name 'ip6gw'
+ option title 'IPv6 gateway'
+ option section 'network.interface'
+ option datatype 'ip6addr'
+
+config variable
+ option name 'dns'
+ option title 'DNS server (IPv4 or IPv6)'
+ option section 'network.interface'
+ option datatype 'ipaddr'
+
+config variable
+ option name 'mtu'
+ option title 'MTU'
+ option section 'network.interface'
+ option datatype 'uint'
+
+config variable
+ option name 'keepalive'
+ option title 'Number of connection failures before reconnect (PPTP)'
+ option section 'network.interface'
+ option datatype 'uint'
+
+config variable
+ option name 'demand'
+ option title 'Number of seconds to wait before closing the connection due to inactivity (PPTP)'
+ option section 'network.interface'
+ option datatype 'uint'
+
+config variable
option name 'proto'
option title 'Option proto'
option section 'network.interface'
@@ -71,6 +126,81 @@ config enum
option title 'This is a bridge interface'
+
+config section
+ option name 'alias'
+ option title 'Alias interface definition'
+ option package 'network'
+ list depends 'proto=static, ipaddr, netmask'
+ list depends 'proto=static, ip6addr'
+ list depends 'proto=pppoe, username, password'
+ list depends 'proto=pptp, username, password, server'
+ list depends 'proto=dhcp'
+ option named true
+
+config variable
+ option name 'interface'
+ option title 'Parent interface name'
+ option section 'network.alias'
+ option valueof 'network.interface'
+ option required true
+
+config variable
+ option name 'ipaddr'
+ option title 'IPv4 host address'
+ option section 'network.alias'
+ option datatype 'ip4addr'
+
+config variable
+ option name 'netmask'
+ option title 'IPv4 network mask'
+ option section 'network.alias'
+ option datatype 'ip4addr'
+
+config variable
+ option name 'gateway'
+ option title 'IPv4 gateway'
+ option section 'network.alias'
+ option datatype 'ip4addr'
+
+config variable
+ option name 'bcast'
+ option title 'IPv4 broadcast address'
+ option section 'network.alias'
+ option datatype 'ip4addr'
+
+config variable
+ option name 'ip6addr'
+ option title 'IPv6 address (CIDR)'
+ option section 'network.alias'
+ option datatype 'ip6addr'
+
+config variable
+ option name 'ip6gw'
+ option title 'IPv6 gateway'
+ option section 'network.alias'
+ option datatype 'ip6addr'
+
+config variable
+ option name 'dns'
+ option title 'DNS server (IPv4 or IPv6)'
+ option section 'network.alias'
+ option datatype 'ipaddr'
+
+config variable
+ option name 'proto'
+ option title 'Alias interface protocol'
+ option section 'network.alias'
+ option type 'enum'
+ option required true
+
+config enum
+ option variable 'network.alias.proto'
+ option value 'static'
+ option title 'Interface has static network configuration'
+
+
+
config section
option name 'switch'
option title 'Section switch'