From e9deca32b7e455ba805adc35aa49d635b2a2537e Mon Sep 17 00:00:00 2001 From: Vinh Nguyen Date: Fri, 18 Nov 2016 15:03:39 -0800 Subject: [PATCH] Bug 7209 - Null Pointer Exception in LearnCodecUtil when add learn flow for ipv6 The exception caused by using ByteBuf::readShort (valid range: -32,768 32,767) for ipv6 etherType '0x86dd' The fix is to use ByteBuf::readUnsignedShort Change-Id: I238535565a66692b5d4dbe39b8cb7809867f3cde Signed-off-by: Vinh Nguyen --- .../openflowjava/nx/codec/action/LearnCodecUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/LearnCodecUtil.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/LearnCodecUtil.java index 0a08c8958b..01b3004cf0 100644 --- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/LearnCodecUtil.java +++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/LearnCodecUtil.java @@ -261,7 +261,7 @@ public class LearnCodecUtil { private static FlowMods readFlowModAddMatchFromValue(ByteBuf message, short numBits) { FlowModAddMatchFromValueBuilder builder = new FlowModAddMatchFromValueBuilder(); - builder.setValue((int) message.readShort()); + builder.setValue((int) message.readUnsignedShort()); builder.setSrcField((long) message.readInt()); builder.setSrcOfs((int) message.readShort()); builder.setFlowModNumBits((int) numBits); @@ -292,7 +292,7 @@ public class LearnCodecUtil { private static FlowMods readFlowModCopyFromValue(ByteBuf message, short numBits) { FlowModCopyValueIntoFieldBuilder builder = new FlowModCopyValueIntoFieldBuilder(); - builder.setValue((int) message.readShort()); + builder.setValue((int) message.readUnsignedShort()); builder.setDstField((long) message.readInt()); builder.setDstOfs((int) message.readShort()); builder.setFlowModNumBits((int) numBits); -- 2.36.6