]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: config: Add support for ARGT_MSK6
authorTim Duesterhus <tim@bastelstu.be>
Thu, 25 Jan 2018 15:24:50 +0000 (16:24 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 25 Jan 2018 21:25:40 +0000 (22:25 +0100)
This commit adds support for ARGT_MSK6 to make_arg_list().

src/arg.c
src/hlua.c

index 52977b7180f728f6feff76e6f0740c66dee92f87..b31858d3b3cade133b8661106f8a3f50988a3e63 100644 (file)
--- 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
index fa629ba943356dc58a3a38056c63466b26537366..ebe8c92b1743bad4d8fdb623990e081dba5b0b4b 100644 (file)
@@ -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: