Fix two problems in CSubnet parsing #6186

pull laanwj wants to merge 2 commits into bitcoin:master from laanwj:2015_05_csubnet_fix changing 3 files +18 −9
  1. laanwj commented at 7:02 AM on May 26, 2015: member

    Fix two CSubNet constructor problems:

    • The use of /x where 8 does not divide x was broken, due to a bit-order issue
    • The use of e.g. 1.2.3.4/24 where the netmasked bits in the network are not 0 was broken. Fix this by explicitly normalizing the network according to the bitmask.

    Also add tests for these cases.

    Fixes #6179. Thanks to @jonasschnelli for reporting and initial fix.

  2. Simplify code for CSubnet
    Simplify the code by using CAddress.ip directly, instead of the reversed
    GetByte() semantics.
    19e8d7be42
  3. Fix two problems in CSubNet parsing
    Fix two CSubNet constructor problems:
    
    - The use of `/x` where 8 does not divide x was broken, due to a
      bit-order issue
    
    - The use of e.g. `1.2.3.4/24` where the netmasked bits in the network
      are not 0 was broken. Fix this by explicitly normalizing the netwok
      according to the bitmask.
    
    Also add tests for these cases.
    
    Fixes #6179. Thanks to @jonasschnelli for reporting and initial fix.
    b45c50ce51
  4. jonasschnelli commented at 7:09 AM on May 26, 2015: contributor

    Tested ACK.

  5. laanwj commented at 7:12 AM on May 26, 2015: member

    Needs backport to 0.10 branch as well

  6. laanwj added the label Bug on May 26, 2015
  7. laanwj merged this on May 27, 2015
  8. laanwj closed this on May 27, 2015

  9. laanwj referenced this in commit 182686cdbd on May 27, 2015
  10. laanwj referenced this in commit e4a7d51537 on May 27, 2015
  11. laanwj referenced this in commit ae3d8f371a on May 27, 2015
  12. laanwj commented at 7:12 AM on May 27, 2015: member

    Rebased to 0.10 via e4a7d51537509dab765976f8642f9e15b84408bb ae3d8f371ab2e6886e1ffab8d16495ffccbfc5e4

  13. reddink referenced this in commit aad36a1c33 on May 27, 2020
  14. reddink referenced this in commit 202debc4d4 on May 27, 2020
  15. MarcoFalke 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-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me