Correct ReachTlvParser to handle IPv6 prefix 39/101839/6
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 14:22:49 +0000 (14:22 +0000)
commita98dcd4eb1d794f45117fa5e70beda9e4189d48d
treeb66b5e36f4f9afc62d67889ca3b0b2965b1a7f69
parenta0b76def776c42055e7bd678b69cc5ab3c7136fb
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>
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/ReachTlvParser.java