From: Arran Cudbard-Bell Date: Thu, 7 Mar 2019 08:22:25 +0000 (+0800) Subject: Fix update where no range identifier is specified when the addresses where added X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45232db5f303d6eaaa3a930c782b7fa6ab08a316;p=thirdparty%2Ffreeradius-server.git Fix update where no range identifier is specified when the addresses where added --- diff --git a/src/modules/rlm_redis_ippool/rlm_redis_ippool.c b/src/modules/rlm_redis_ippool/rlm_redis_ippool.c index 775d28e5581..a53d38bed87 100644 --- a/src/modules/rlm_redis_ippool/rlm_redis_ippool.c +++ b/src/modules/rlm_redis_ippool/rlm_redis_ippool.c @@ -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 */