[BGPCEP-659] IPv6 prefix read error Created: 19/Apr/17  Updated: 03/Mar/19  Resolved: 20/Apr/17

Status: Resolved
Project: bgpcep
Component/s: BGP
Affects Version/s: Bugzilla Migration
Fix Version/s: Bugzilla Migration

Type: Bug
Reporter: Kevin Wang Assignee: Kevin Wang
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 8252

 Description   

IPv6 prefix is not parsed correctly. The expected prefix length is 16 bytes. However, the read length is -16 bytes. It is due to the utility method doesn't convert the length byte into unsigned value.

To reproduce this problem, just try to advertise a IPv6 unicast route to the controller with prefix length 128.

The similar problem may happen to IPv4 as well upon checking the code.

2017-04-14 17:58:52,539 | ERROR | ntLoopGroup-11-1 | BGPDocumentedException | 346 - org.opendaylight.bgpcep.bgp-parser-api - 0.6.1.Boron-SR1 | Error = MALFORMED_ATTR_LIST
org.opendaylight.protocol.bgp.parser.BGPDocumentedException: Could not parse BGP attributes.
at org.opendaylight.protocol.bgp.parser.impl.message.BGPUpdateMessageParser.parseMessageBody(BGPUpdateMessageParser.java:135)[348:org.opendaylight.bgpcep.bgp-parser-impl:0.6.1.Boron-SR1]
at org.opendaylight.protocol.bgp.parser.impl.message.BGPUpdateMessageParser.parseMessageBody(BGPUpdateMessageParser.java:46)[348:org.opendaylight.bgpcep.bgp-parser-impl:0.6.1.Boron-SR1]
at org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleMessageRegistry.parseBody(SimpleMessageRegistry.java:31)[347:org.opendaylight.bgpcep.bgp-parser-spi:0.6.1.Boron-SR1]
at org.opendaylight.protocol.bgp.parser.spi.AbstractMessageRegistry.parseMessage(AbstractMessageRegistry.java:66)[347:org.opendaylight.bgpcep.bgp-parser-spi:0.6.1.Boron-SR1]
at org.opendaylight.protocol.bgp.rib.impl.BGPByteToMessageDecoder.decode(BGPByteToMessageDecoder.java:49)[360:org.opendaylight.bgpcep.bgp-rib-impl:0.6.1.Boron-SR1]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:411)[114:io.netty.codec:4.0.37.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248)[114:io.netty.codec:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)[113:io.netty.transport:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328)[113:io.netty.transport:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:321)[113:io.netty.transport:4.0.37.Final]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)[114:io.netty.codec:4.0.37.Final]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:280)[114:io.netty.codec:4.0.37.Final]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:396)[114:io.netty.codec:4.0.37.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248)[114:io.netty.codec:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)[113:io.netty.transport:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328)[113:io.netty.transport:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:321)[113:io.netty.transport:4.0.37.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1280)[113:io.netty.transport:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)[113:io.netty.transport:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328)[113:io.netty.transport:4.0.37.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:890)[113:io.netty.transport:4.0.37.Final]
at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:879)[117:io.netty.transport-native-epoll:4.0.37.Final]
at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:387)[117:io.netty.transport-native-epoll:4.0.37.Final]
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:303)[117:io.netty.transport-native-epoll:4.0.37.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)[112:io.netty.common:4.0.37.Final]
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:145)[112:io.netty.common:4.0.37.Final]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_101]
Caused by: java.lang.IllegalStateException: NLRI length read from message doesn't match. Length expected (read from NLRI) is 1537, length readable is 1296
at com.google.common.base.Preconditions.checkState(Preconditions.java:197)[39:com.google.guava:18.0.0]
at org.opendaylight.protocol.bgp.flowspec.AbstractFlowspecNlriParser.verifyNlriLength(AbstractFlowspecNlriParser.java:608)[361:org.opendaylight.bgpcep.bgp-flowspec:0.6.1.Boron-SR1]
at org.opendaylight.protocol.bgp.flowspec.AbstractFlowspecNlriParser.parseNlri(AbstractFlowspecNlriParser.java:629)[361:org.opendaylight.bgpcep.bgp-flowspec:0.6.1.Boron-SR1]
at org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleNlriRegistry.parseMpReach(SimpleNlriRegistry.java:239)[347:org.opendaylight.bgpcep.bgp-parser-spi:0.6.1.Boron-SR1]
at org.opendaylight.protocol.bgp.parser.impl.message.update.MPReachAttributeParser.parseAttribute(MPReachAttributeParser.java:49)[348:org.opendaylight.bgpcep.bgp-parser-impl:0.6.1.Boron-SR1]
at org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleAttributeRegistry.parseAttributes(SimpleAttributeRegistry.java:138)[347:org.opendaylight.bgpcep.bgp-parser-spi:0.6.1.Boron-SR1]
at org.opendaylight.protocol.bgp.parser.impl.message.BGPUpdateMessageParser.parseMessageBody(BGPUpdateMessageParser.java:131)[348:org.opendaylight.bgpcep.bgp-parser-impl:0.6.1.Boron-SR1]
... 26 more
2017-04-14 17:58:52,541 | WARN | ntLoopGroup-11-1 | BGPSessionImpl | 360 - org.opendaylight.bgpcep.bgp-rib-impl - 0.6.1.Boron-SR1 | BGP session encountered error



 Comments   
Comment by Kevin Wang [ 20/Apr/17 ]

master: https://git.opendaylight.org/gerrit/#/c/55684/

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