jsommers / pytricia

A library for fast IP address lookup in Python.
GNU Lesser General Public License v3.0
216 stars 22 forks source link

Illegal/Invalid CIDR/Subnet notation is allowed #21

Closed cbuijs closed 1 year ago

cbuijs commented 6 years ago

It is allowed to add invalid/illegal CIDR notation:

>>> import pytricia
>>> a = pytricia.PyTricia(128)
>>> a['192.168.1.23/24'] = 'Whatever'
>>> a.keys()
['192.168.1.23/24']

It seems to take the network address into account though:

>>> '192.168.1.2' in a
True

I would expect when adding a CIDR/IP address that only valid ones are allowed (subnet/bit-mask wise).

cbuijs commented 1 year ago

Stale