diff options
author | Oto Šťáva <oto.stava@nic.cz> | 2022-06-01 09:48:28 +0200 |
---|---|---|
committer | Oto Šťáva <oto.stava@nic.cz> | 2022-06-01 09:48:28 +0200 |
commit | adcebea93a4b6d4907e2da8e613936f8592c4b93 (patch) | |
tree | bc74a149ddaff78cf546e4cce4dbb9ccaba52d24 /modules | |
parent | renumber: document additions from the parent commit (diff) | |
download | knot-resolver-adcebea93a4b6d4907e2da8e613936f8592c4b93.tar.xz knot-resolver-adcebea93a4b6d4907e2da8e613936f8592c4b93.zip |
renumber: add test for single IP rewrite
Diffstat (limited to 'modules')
-rw-r--r-- | modules/renumber/renumber.test.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/renumber/renumber.test.lua b/modules/renumber/renumber.test.lua index a74b609f..734b7e62 100644 --- a/modules/renumber/renumber.test.lua +++ b/modules/renumber/renumber.test.lua @@ -33,6 +33,13 @@ local function prepare_cache() }), nil, ffi.C.KR_RANK_SECURE + ffi.C.KR_RANK_AUTH)) assert(c:insert( + gen_rrset('a10-3plus4.test.', + kres.type.A, { + kres.str2ip('10.3.0.1'), + kres.str2ip('10.4.0.1') + }), + nil, ffi.C.KR_RANK_SECURE + ffi.C.KR_RANK_AUTH)) + assert(c:insert( gen_rrset('a166-66.test.', kres.type.A, kres.str2ip('166.66.42.123')), nil, ffi.C.KR_RANK_SECURE + ffi.C.KR_RANK_AUTH)) @@ -56,6 +63,8 @@ local function test_renumber() 'a10-2.test.', kres.type.A, kres.rcode.NOERROR, '192.168.2.1') check_answer('mix of known and unknown IPv4 ranges is remapped correctly', 'a10-0plus2.test.', kres.type.A, kres.rcode.NOERROR, {'192.168.2.1', '10.0.0.1'}) + check_answer('mix of known and unknown IPv4 ranges is remapped correctly to exact address', + 'a10-3plus4.test.', kres.type.A, kres.rcode.NOERROR, {'10.3.0.1', '192.168.3.10'}) check_answer('known IPv4 range is remapped when matching second-defined rule', 'a166-66.test.', kres.type.A, kres.rcode.NOERROR, '127.0.42.123') @@ -78,6 +87,7 @@ modules.load('renumber < cache') renumber.config({ -- Source subnet, destination subnet {'10.2.0.0/24', '192.168.2.0'}, + {'10.4.0.0/24', '192.168.3.10!'}, {'166.66.0.0/16', '127.0.0.0'}, {'2001:db8:1::/48', '2001:db8:2::'}, }) |