[BGPCEP-1009] BGPDocumentedException with IPv6 prefix in BGP Link State Created: 12/Jul/22  Updated: 31/Oct/22  Resolved: 29/Jul/22

Status: Resolved
Project: bgpcep
Component/s: BGP
Affects Version/s: 0.17.0, 0.16.15, 0.17.2, 0.17.5
Fix Version/s: 0.18.0, 0.17.6, 0.16.16

Type: Bug Priority: High
Reporter: Olivier Dugeon Assignee: Olivier Dugeon
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Setting up a BGP Link State session with a router able to advertise IPv6 prefix causes BGPDocumentedException which in turn close the BGP session. Then, ODL try to setup again the BGP session which ended for the same reason going into an infinite loop of BGP session open / close until the BGP peer is removed. Karaf log contains the following error:

2022-07-04T09:30:09,800 | ERROR | epollEventLoopGroup-5-1 | BGPDocumentedException           | 221 - org.opendaylight.bgpcep.bgp-parser-api - 0.17.0.SNAPSHOT | Error = MALFORMED_ATTR_LIST 
org.opendaylight.protocol.bgp.parser.BGPDocumentedException: Could not parse BGP attributes. 
       at org.opendaylight.protocol.bgp.parser.impl.message.BGPUpdateMessageParser.parseAttributes(BGPUpdateMessageParser.java:205) [bundleFile:?] 
       at org.opendaylight.protocol.bgp.parser.impl.message.BGPUpdateMessageParser.parseMessageBody(BGPUpdateMessageParser.java:155) [bundleFile:?] 
       at org.opendaylight.protocol.bgp.parser.impl.message.BGPUpdateMessageParser.parseMessageBody(BGPUpdateMessageParser.java:66) [bundleFile:?] 
       at org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleMessageRegistry.parseBody(SimpleMessageRegistry.java:32) [bundleFile:?] 
       at org.opendaylight.protocol.bgp.parser.spi.AbstractMessageRegistry.parseMessage(AbstractMessageRegistry.java:66) [bundleFile:?] 
       at org.opendaylight.protocol.bgp.rib.impl.BGPByteToMessageDecoder.decode(BGPByteToMessageDecoder.java:47) [bundleFile:?] 
       at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:507) [bundleFile:4.1.69.Final] 
       at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:446) [bundleFile:4.1.69.Final] 
       at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) [bundleFile:4.1.69.Final] 
       at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [bundleFile:4.1.69.Final] 
       at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [bundleFile:4.1.69.Final] 
       at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [bundleFile:4.1.69.Final] 
       at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) [bundleFile:4.1.69.Final] 
       at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:311) [bundleFile:4.1.69.Final] 
       at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:432) [bundleFile:4.1.69.Final] 
       at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) [bundleFile:4.1.69.Final] 
       at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [bundleFile:4.1.69.Final] 
       at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [bundleFile:4.1.69.Final] 
       at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [bundleFile:4.1.69.Final] 
       at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [bundleFile:4.1.69.Final] 
       at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [bundleFile:4.1.69.Final] 
       at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [bundleFile:4.1.69.Final] 
       at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [bundleFile:4.1.69.Final] 
       at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795) [bundleFile:4.1.69.Final] 
       at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe$1.run(AbstractEpollChannel.java:425) [bundleFile:4.1.69.Final] 
       at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) [bundleFile:4.1.69.Final] 
       at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469) [bundleFile:4.1.69.Final] 
       at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:384) [bundleFile:4.1.69.Final] 
       at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) [bundleFile:4.1.69.Final] 
       at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [bundleFile:4.1.69.Final] 
       at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [bundleFile:4.1.69.Final] 
       at java.lang.Thread.run(Thread.java:829) [?:?] 
Caused by: java.lang.IndexOutOfBoundsException: dstIndex: 0 
       at io.netty.buffer.UnsafeByteBufUtil.getBytes(UnsafeByteBufUtil.java:484) ~[bundleFile:4.1.69.Final] 
       at io.netty.buffer.PooledUnsafeDirectByteBuf.getBytes(PooledUnsafeDirectByteBuf.java:130) ~[bundleFile:4.1.69.Final] 
       at io.netty.buffer.AbstractUnpooledSlicedByteBuf.getBytes(AbstractUnpooledSlicedByteBuf.java:243) ~[bundleFile:4.1.69.Final] 
       at io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:896) ~[bundleFile:4.1.69.Final] 
       at org.opendaylight.protocol.util.Ipv4Util.prefixForByteBuf(Ipv4Util.java:141) ~[bundleFile:?] 
       at org.opendaylight.protocol.util.Ipv4Util.prefixForByteBuf(Ipv4Util.java:125) ~[bundleFile:?] 
       at org.opendaylight.protocol.bgp.linkstate.impl.tlvs.ReachTlvParser.parseTlvBody(ReachTlvParser.java:37) ~[bundleFile:?] 
       at org.opendaylight.protocol.bgp.linkstate.impl.tlvs.ReachTlvParser.parseTlvBody(ReachTlvParser.java:26) ~[bundleFile:?] 
       at org.opendaylight.protocol.bgp.linkstate.spi.pojo.SimpleNlriTypeRegistry.parseTlv(SimpleNlriTypeRegistry.java:205) ~[bundleFile:?] 
       at org.opendaylight.protocol.bgp.linkstate.spi.pojo.SimpleNlriTypeRegistry.parseSubTlvs(SimpleNlriTypeRegistry.java:212) ~[bundleFile:?] 
       at org.opendaylight.protocol.bgp.linkstate.impl.nlri.AbstractPrefixNlriParser.parsePrefixDescriptor(AbstractPrefixNlriParser.java:50) ~[bundleFile:?] 
       at org.opendaylight.protocol.bgp.linkstate.impl.nlri.AbstractPrefixNlriParser.parseObjectType(AbstractPrefixNlriParser.java:37) ~[bundleFile:?] 
       at org.opendaylight.protocol.bgp.linkstate.spi.AbstractNlriTypeCodec.parseTypeNlri(AbstractNlriTypeCodec.java:24) ~[bundleFile:?] 
       at org.opendaylight.protocol.bgp.linkstate.spi.pojo.SimpleNlriTypeRegistry.parseNlriType(SimpleNlriTypeRegistry.java:175) ~[bundleFile:?] 
       at org.opendaylight.protocol.bgp.linkstate.impl.nlri.LinkstateNlriParser.parseNlri(LinkstateNlriParser.java:98) ~[bundleFile:?] 
       at org.opendaylight.protocol.bgp.linkstate.impl.nlri.LinkstateNlriParser.parseNlri(LinkstateNlriParser.java:130) ~[bundleFile:?] 
       at org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleNlriRegistry.parseMpReach(SimpleNlriRegistry.java:232) ~[bundleFile:?] 
       at org.opendaylight.protocol.bgp.parser.impl.message.update.MPReachAttributeParser.parseAttribute(MPReachAttributeParser.java:42) ~[bundleFile:?] 
       at org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleAttributeRegistry.parseAttributes(SimpleAttributeRegistry.java:172) ~[bundleFile:?] 
       at org.opendaylight.protocol.bgp.parser.impl.message.BGPUpdateMessageParser.parseAttributes(BGPUpdateMessageParser.java:202) ~[bundleFile:?] 
       ... 31 more

This is due to ReachTlvParser class in org.opendaylight.protocol.bgp.linkstate.impl.tlvs package which not properly handle IPv6 prefix in parseTlvBody method.


Generated at Wed Feb 07 19:14:46 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.