Commit graph

18 commits

Author SHA1 Message Date
Jo-Philipp Wich
70ffbe65a0 luci-base: add a strict flag to the hostname validator
Some applications, e.g. dnsmasq, do not allow hostnames starting with an
underscore, therefor extend the existing hostname datatype validator with
a `strict` which disallows a leading underscore.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-04 23:21:53 +02:00
Jo-Philipp Wich
28e3b32854 treewide: unify mac address handling
Use the new luci.ip MAC address facilities to parse and verify MAC addresses
in a common way, instead of relying on various ad-hoc solutions.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-03-12 16:12:18 +01:00
Jo-Philipp Wich
3e1e4d5eb6 luci-base: fix Lua-side ip6hostid() datatype validation
A valid host ID as accepted by netifd must meet the following criteria:

 - Is either one of the two special "random" or "eui64" strings
 - Or is a valid IPv6 address according to inet_pton(AF_INET6)
 - Has the first 64 bit set to zero

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-02-16 17:05:48 +01:00
Yousong Zhou
3809bd6ffb luci-base: datatypes: add cidr, ipnet validator type
- Rewrite ipmask to use these subtypes
- Add ip{4,6}prefix validators to cbi.js

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2017-08-22 20:19:49 +08:00
danrl
cd8333cf0b luci-proto-wireguard: add support for fwmark option
Adds support for the fwmark option.

FwMark is a 32-bit fwmark for outgoing packets.
If set to 0 or "off", this option is disabled.

Signed-off-by: Dan Luedtke <mail@danrl.com>
2017-02-27 20:48:46 +01:00
danrl
94d6b7b70d luci-base: added dhcpv6 datatypes
Signed-off-by: Dan Luedtke <mail@danrl.com>
2017-02-15 09:50:58 +01:00
Hannu Nyman
11f23559e4 luci-base: add hexstring datatype
Add datatype 'hexstring' for input validaiton datatypes.

It will accept any hexadecimal string.

(no length validation, as rangelength can be used for that.)

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2017-02-09 16:58:07 +02:00
Jo-Philipp Wich
d85f7a8a00 luci-base: fix logic errors in ipmask4 and ipmask6 datatype validators
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-01-30 19:14:08 +01:00
Jo-Philipp Wich
ec9942925c luci-base: datatypes.lua: add missing parentheses in conditional
The missing parens lead to a wrong expression precedence, causing a runtime
error when attempting to compare nil with a number.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-01-24 13:51:27 +01:00
Jo-Philipp Wich
e4b1bb3156 luci-base: ipmask, ipmask4 and ipmask6 validators
These validators accept IP address specifications in the form

 - address
 - address/bits
 - address/netmask

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-01-23 16:15:22 +01:00
Jo-Philipp Wich
937f4fbbdf luci-base: datatypes.lua: cleanup white space
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-01-23 16:10:07 +01:00
Daniel Dickinson
c481f3f343 validation: Add option ipv4only option to host and hostport datatypes
Some applications only support ipv4 so add ipv4only option
to host and hostport datatypes so that for thos applications
that when an IP address is specified only and ipv4 ip address
gets accepted.
2015-12-15 20:41:01 -05:00
Daniel Dickinson
bbcfad7953 modules/luci-base: Fix ipaddrport validator to support ipv6
The previous versiono of ipaddrport validator only worked for ipv4
due to disallowing colons (:) in ip address which obvious fails for
ipv6.  We now instead allow either ipv4 address or an ipv6 address of
the form [<ipv6address>]:port
2015-12-15 20:40:14 -05:00
Daniel Dickinson
6318f67fd4 luci-base: Add time and data datatypes for use with firewall app
Adding LuCI configuation of the firewall time and data uci options
is in progress and this adds the necessary datatypes for validating
those fields.
2015-12-14 23:26:26 -05:00
Jo-Philipp Wich
9b30357454 luci-base: add hostport and ipaddrport validation types
Add two new types 'hostport' and 'ipaddrport' to validate strings in the form
'sub.example.org:1234' and '0.0.0.0:80'. The 'hostport' accepts hostnames or
IP addresses followed by a colon and a port number while the 'ipaddrport' type
accepts numeric IP addresses only, followed by a colon and a port.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-12-02 11:13:39 +01:00
Jo-Philipp Wich
41d2b33087 Update my email addresses in the license headers
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-16 23:49:44 +01:00
Jo-Philipp Wich
7a3493b1f7 Globally reduce copyright headers
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-16 23:38:38 +01:00
Jo-Philipp Wich
1bb4822dca Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names
 * Make each LuCI module its own standalone package
 * Deploy a shared luci.mk which is used by each module Makefile

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-08 16:26:20 +01:00