Closed gescheit closed 8 years ago
Thanks for opening the request. There's some partial support, but it isn't fully supported and I'm not especially surprised about the segfault.
@gescheit could you provide an example of your code where it segfaulted? It will help in expediting the progress.
here's a snip of my py.test code...
ipv6.py
import pytricia
import logging
from pprint import pprint
PERM_WHITELIST = [
## TODO -- more
# http://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml
# v6
'FF01:0:0:0:0:0:0:1',
'FF01:0:0:0:0:0:0:2',
]
class Ipv6(object):
def __init__(self):
pass
# https://github.com/jsommers/pytricia
def process(self, data, whitelist):
print('setting up trie')
wl = pytricia.PyTricia()
print('adding perm whitelist')
[wl.insert(x, True) for x in PERM_WHITELIST]
print('adding submitted whitelist')
[wl.insert(y, True) for y in whitelist]
return (y for y in data if y not in wl)
test_ipv6.py
import pytest
from ipv6 import Ipv6
from pprint import pprint
data = [
'2001:4860:4860::8888'
]
whitelist = [
'2001:4860:4860::8888',
]
def test_feed_ipv6_whitelist():
x = Ipv6()
y = x.process(data, whitelist)
assert '2001:4860:4860::8888' not in y
understood there's a bunch of ways to describe a v6 address, w/o looking too much at your code, there's not enough room in the buffer.. ?
I've been running through the code and I think that pytricia.c right now does not have functionality to support IPv6 addresses. Specifically, I think it assumes the addresses given are IPv4.
This issue has been noted and I will work on it.
@wesyoung yes, that is one problem I think. The buffer assumes that the address is IPv4 (only 32 bytes stack allocated).
The underlying patricia.c code should support IPv6 (it has preprocessing macros that include IPv6 code if the flags are defined).
v6 support is fixed in the repo. Will update the pypi soon.
Hello! Seem IPv6 is not supported. I catch segfault in case of IPv6 address.