|
nlri_hex += binascii.unhexlify(hex(prefix.ip)[2:]) |
length of prefix is variable,
nlri_hex += binascii.unhexlify(hex(prefix.ip)[2:math.ceil(prefix.prefixlen / 8)*2+2])
eg.
2001:db8::/40
1 2 3 4 5 6
40 20 01 0d b8 0
1 byte for length, math.ceil(40/8) = 5byte for prefix
yabgp/yabgp/message/attribute/nlri/ipv6_unicast.py
Line 63 in f073633
length of prefix is variable,
nlri_hex += binascii.unhexlify(hex(prefix.ip)[2:math.ceil(prefix.prefixlen / 8)*2+2])
eg.
2001:db8::/40
1 2 3 4 5 6
40 20 01 0d b8 0
1 byte for length, math.ceil(40/8) = 5byte for prefix