Whitelist subnets

Fixes #1501