view module: support IPv4 addr syntax for v4-mapped-on-v6 addresses
When using systemd socket activation, it's possible to have IPv6 socket, which is also handling IPv4 address space:
[Socket]
BindIPv6Only=both
ListenDatagram=
ListenStream=
ListenDatagram=[::]:53
ListenStream=[::]:53
In this case, resolver will listen on all IPv4 and IPv6 interfaces. However, if view:addr
is used to define IPv4 rules, they won't be applied with the standard IPv4 syntax, e.g.:
view:addr('127.0.0.0/8', policy.all(policy.DENY))
Adding v4-mapped-on-v6 support for view:addr
would solve this issue.
Workarounds
- Either specify the IPv4 addresses in the special IPv4 mapped on IPv6 format, e.g
view:addr('::ffff:127.0.0.0/104', policy.all(policy.DENY))
- or bind to IPv4 and IPv6 interfaces separately
[Socket]
BindIPv6Only=ipv6-only
ListenDatagram=
ListenStream=
ListenDatagram=0.0.0.0:53
ListenStream=0.0.0.0:53
ListenDatagram=[::]:53
ListenStream=[::]:53
Edited by Tomas Krizek