]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix update where no range identifier is specified when the addresses where added
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 7 Mar 2019 08:22:25 +0000 (16:22 +0800)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 7 Mar 2019 08:22:25 +0000 (16:22 +0800)
src/modules/rlm_redis_ippool/rlm_redis_ippool.c

index 775d28e5581f2da02abc82cb22ade5c39b8ef128..a53d38bed871c69979740aaecc7682c43e0b7634 100644 (file)
@@ -253,7 +253,10 @@ static char lua_update_cmd[] =
         */
        "address_key = '{' .. KEYS[1] .. '}:"IPPOOL_ADDRESS_KEY":' .. ARGV[3]" EOL      /* 6 */
        "found = redis.call('HMGET', address_key, 'range', 'device', 'gateway', 'counter' )" EOL        /* 7 */
-       "if not found[1] then" EOL                                                      /* 8 */
+       /*
+        *      Range may be nil (if not used), so we use the device key
+        */
+       "if not found[2] then" EOL                                                      /* 8 */
        "  return {" STRINGIFY(_IPPOOL_RCODE_NOT_FOUND) "}" EOL                         /* 9 */
        "end" EOL                                                                       /* 10 */
        "if found[2] ~= ARGV[4] then" EOL                                               /* 11 */