According to RFC 2545, both a global address and a link-local address can be sent as a next_hop address in BGPUpdate message. Since the link-local address is not needed in Ryu BGP, Ryu BGP ignore it if the address family is IPv6 unicast.
Signed-off-by: Hiroshi Yokoi <[email protected]> --- ryu/lib/packet/bgp.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py index 60e3b49..ff6d7af 100644 --- a/ryu/lib/packet/bgp.py +++ b/ryu/lib/packet/bgp.py @@ -2014,6 +2014,16 @@ class BGPPathAttributeMpReachNLRI(_PathAttribute): elif afi == addr_family.IP: next_hop = addrconv.ipv4.bin_to_text(next_hop_bin) elif afi == addr_family.IP6: + # next_hop_bin can include global address and link-local address + # according to RFC2545. Since a link-local address isn't needed in + # Ryu BGPSpeaker, we ignore it if both addresses were sent. + # The link-local address is supposed to follow after + # a global address and next_hop_len will be 32 bytes, + # so we use the first 16 bytes, which is a global address, + # as a next_hop and change the next_hop_len to 16. + if next_hop_len == 32: + next_hop_bin = next_hop_bin[:16] + next_hop_len = 16 next_hop = addrconv.ipv6.bin_to_text(next_hop_bin) else: raise ValueError('Invalid address familly(%d)' % afi) -- 1.8.5.2 (Apple Git-48) ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that Matters. http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
