net: allow CSubNet of non-IP networks
Summary:
Allow creation of valid CSubNet objects of non-IP networks and only
match the single address they were created from (like /32 for IPv4 or
/128 for IPv6).
This fixes a deficiency in CConnman::DisconnectNode(const CNetAddr& addr)
and in BanMan which assume that creating a subnet from any address
using the CSubNet(CNetAddr) constructor would later match that address
only. Before this change a non-IP subnet would be invalid and would not
match any address.
Co-authored-by: Jon Atack <jon@atack.com>
This is a backport of core#20852
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D19133