HomePhabricator

net: allow CSubNet of non-IP networks

Description

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

Details

Provenance
Vasil Dimov <vd@FreeBSD.org>Authored on Jan 4 2021, 17:37
PiRKCommitted on Dec 16 2025, 15:05
PiRKPushed on Dec 16 2025, 15:05
Reviewer
Restricted Project
Differential Revision
D19133: net: allow CSubNet of non-IP networks
Parents
rABCef557d28e56c: [Chronik] Add `finalization_timeout_secs` to `BroadcastTx(s)Request`
Branches
Unknown
Tags
Unknown