CSubNet::Match(): calculation error #6179

issue jonasschnelli opened this issue on May 23, 2015
  1. jonasschnelli commented at 12:34 PM on May 23, 2015: contributor

    CSubNet::Match() (check if a IP is within a subnet) is wrong. Currently this only affects the -whitelist config/startup argument. Examples: if you specify -whitelist=192.168.0.1/24, 192.168.0.2 does not match (but it should). This also happens for more complex subnet definitions like 192.168.0.20/29 where 192.168.0.18 should be within the subnet range, but CSubNet::Match() does return false.

    Edit: also affects -rpcallowip

  2. jonasschnelli commented at 7:53 AM on May 24, 2015: contributor

    The ip/CIDR string to CSubNet constructor is also buggy. Working on a fix.

  3. jonasschnelli cross-referenced this on May 25, 2015 from issue CSubNet: fix CIDR netmask calculation and match() function by jonasschnelli
  4. laanwj added the label Bug on May 26, 2015
  5. laanwj referenced this in commit b45c50ce51 on May 26, 2015
  6. laanwj cross-referenced this on May 26, 2015 from issue Fix two problems in CSubnet parsing by laanwj
  7. laanwj closed this on May 27, 2015

  8. laanwj referenced this in commit ae3d8f371a on May 27, 2015
  9. reddink referenced this in commit 202debc4d4 on May 27, 2020
  10. bitcoin locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:55 UTC