You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In file: https://github.com/smartbgp/yabgp/blob/master/yabgp/message/attribute/nlri/ipv6_unicast.py
line 45: prefix_addr = str(netaddr.IPAddress(int(binascii.b2a_hex(nlri_data[1:offset]), 16))) \ + '/%s' % prefix_bit_len
It returns an address with extra leading zeros when prefix_bit_len is non-zero.
For example, an original IP prefix a::/96 will turn out to be 0:0: a::/96, because the parser netaddr.IPAddress does not know there are some zeros masked, it will put the missing zeros at the start of the IP address, causing this issue.
One possible correction is prefix_addr = str(netaddr.IPAddress(int(binascii.b2a_hex(nlri_data[1:offset]), 16)<<(full_length-prefix_bit_len))) \ + '/%s' % prefix_bit_len where full_length is 32 for ipv4 and 128 for ipv6.
The text was updated successfully, but these errors were encountered:
In file: https://github.com/smartbgp/yabgp/blob/master/yabgp/message/attribute/nlri/ipv6_unicast.py
line 45:
prefix_addr = str(netaddr.IPAddress(int(binascii.b2a_hex(nlri_data[1:offset]), 16))) \ + '/%s' % prefix_bit_len
It returns an address with extra leading zeros when prefix_bit_len is non-zero.
For example, an original IP prefix a::/96 will turn out to be 0:0: a::/96, because the parser
netaddr.IPAddress
does not know there are some zeros masked, it will put the missing zeros at the start of the IP address, causing this issue.One possible correction is
prefix_addr = str(netaddr.IPAddress(int(binascii.b2a_hex(nlri_data[1:offset]), 16)<<(full_length-prefix_bit_len))) \ + '/%s' % prefix_bit_len
where full_length is 32 for ipv4 and 128 for ipv6.The text was updated successfully, but these errors were encountered: