From 700effdec6e66e4a93c88613f2da1d3d8c141fcb Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 17 Feb 2014 12:12:24 +0000 Subject: [PATCH] add validation rules to proto static Signed-off-by: John Crispin --- proto.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/proto.c b/proto.c index e4465eb..64be308 100644 --- a/proto.c +++ b/proto.c @@ -55,9 +55,20 @@ static const struct uci_blob_param_info proto_ip_attr_info[__OPT_MAX] = { [OPT_IP6PREFIX] = { .type = BLOBMSG_TYPE_STRING }, }; +static const char * const proto_ip_validate[__OPT_MAX] = { + [OPT_IPADDR] = "ip4addr", + [OPT_IP6ADDR] = "ip6addr", + [OPT_NETMASK] = "netmask", + [OPT_BROADCAST] = "ipaddr", + [OPT_GATEWAY] = "ip4addr", + [OPT_IP6GW] = "ip6addr", + [OPT_IP6PREFIX] = "ip6addr", +}; + const struct uci_blob_param_list proto_ip_attr = { .n_params = __OPT_MAX, .params = proto_ip_attributes, + .validate = proto_ip_validate, .info = proto_ip_attr_info, }; -- 2.25.1