[dnsdist] NetmaskGroup

Remi Gacogne remi.gacogne at powerdns.com
Wed Mar 7 19:38:35 UTC 2018


Hi Cédric,

On 03/07/2018 07:16 PM, cedric.rey at netplus.pro wrote:
> I’m trying to use the addMask(masks) function but I’m unable to have it
> work with a table? I didn’t get how to do it…

The syntax of NetmaskGroup:addMasks() was designed to take the kind of
tables returned by the exceed* functions and therefore is indeed not
very intuitive to use in other contexts. The table needs to have
ComboAddress objects as keys and numerical values. For example:

> myNMG = newNMG()
> myNMG:addMasks({[newCA("192.0.2.1")] = 0, [newCA("192.0.2.2")] = 0})
> myNMG:size()
2
> if myNMG:match(newCA("192.0.2.1")) then return 1 else return 0 end
1
> if myNMG:match(newCA("192.0.2.3")) then return 1 else return 0 end
0
>

Best regards,

-- 
Remi Gacogne
PowerDNS.COM BV - https://www.powerdns.com/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.powerdns.com/pipermail/dnsdist/attachments/20180307/d9cab651/attachment.sig>


More information about the dnsdist mailing list