plugin/forward: Document and warn for unsupported FROM CIDR notations (#4639)

* trap unsupported FROM cidr notations

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* make is a warning

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
Chris O'Haver 2021-05-20 03:24:36 -04:00 committed by GitHub
parent 5d80a6e21e
commit 0348b019be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View file

@ -92,8 +92,13 @@ func parseStanza(c *caddy.Controller) (*Forward, error) {
if !c.Args(&f.from) {
return f, c.ArgErr()
}
origFrom := f.from
f.from = plugin.Host(f.from).Normalize()[0] // there can only be one here, won't work with non-octet reverse
if len(f.from) > 1 {
log.Warningf("Unsupported CIDR notation: '%s' expands to multiple zones. Using only '%s'.", origFrom, f.from)
}
to := c.RemainingArgs()
if len(to) == 0 {
return f, c.ArgErr()