Correct ReachTlvParser to handle IPv6 prefix 20/101820/1
authorOlivier Dugeon <olivier.dugeon@orange.com>
Tue, 12 Jul 2022 07:52:40 +0000 (09:52 +0200)
committerRobert Varga <nite@hq.sk>
Fri, 29 Jul 2022 16:52:51 +0000 (16:52 +0000)
commit65c0ff185011eb3213d3d0eddce2609c5c09f6c1
tree580c098a90968e0db218a25f1ae7da6946e5acbf
parent4ce56134a7598339253eead614885be15aff5ed1
Correct ReachTlvParser to handle IPv6 prefix

ReachTlvParser class supports Ipv6 prefix only in serialization
methods. ParseTlvBody handles only IPv4 prefix. Thus, if a peer
BGP Link State router sends an Update Message with an IPv6
prefix in IP Reachability Information NLRI, ParseTlvBody
method fails to parse the IPv6 prefix and assert a
BGPDocumentedException.

This patch looks to the length of the buffer to be parsed to
determine if the prefix is an IPv4 or an IPv6 one. SerializeModel
method has been also updated to avoid exception to determine
if the prefix is an IPv4 or an IPv6 one.

JIRA: BGPCEP-1009
Change-Id: Ia5bac0fb2a6087e5c5cfbca0e3eee7d8fd7b822c
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a98dcd4eb1d794f45117fa5e70beda9e4189d48d)
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/ReachTlvParser.java