This commit adds support for ARGT_MSK6 to make_arg_list().
---
src/arg.c | 11 +++++++++--
src/hlua.c | 7 +++++++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/arg.c b/src/arg.c
index 52977b718..b31858d3b 100644
--- a/src/arg.c
+++ b/src/arg.c
@@ -206,8 +206,15 @@ int make_arg_list(const char *in, int len, uint64_t mask,
struct arg **argp,
goto parse_err;
break;
- case ARGT_MSK6: /* not yet implemented */
- goto not_impl;
+ case ARGT_MSK6:
+ if (in == beg) // empty mask
+ goto empty_err;
+
+ if (!str2mask6(word, &arg->data.ipv6))
+ goto parse_err;
+
+ arg->type = ARGT_IPV6;
+ break;
case ARGT_TIME:
if (in == beg) // empty time
diff --git a/src/hlua.c b/src/hlua.c
index fa629ba94..ebe8c92b1 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -704,6 +704,13 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first,
struct arg *argp,
break;
case ARGT_MSK6:
+ memcpy(trash.str, argp[idx].data.str.str,
argp[idx].data.str.len);
+ trash.str[argp[idx].data.str.len] = 0;
+ if (!str2mask6(trash.str, &argp[idx].data.ipv6))
+ WILL_LJMP(luaL_argerror(L, first + idx,
"invalid IPv6 mask"));
+ argp[idx].type = ARGT_MSK6;
+ break;
+
case ARGT_MAP:
case ARGT_REG:
case ARGT_USR:
--
2.15.1