[OPNFLWPLUG-261] NullPointerException occurred when a MD-SAL flow has a push-vlan action Created: 05/Sep/14  Updated: 27/Sep/21  Resolved: 11/Sep/14

Status: Resolved
Project: OpenFlowPlugin
Component/s: General
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Hideyuki Tai Assignee: Michal Rehak
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: 1713

 Description   

This issue was originally reported in OPNFLWPLUG-222.

When a controller with the OF plugin connected to a OpenFlow 1.0 switch and I tried to install a flow entry with push-vlan action into the switch, NullPointerException occurred.

It seems that OF plugin does not correctly ignore push-vlan action.
(We think that ignoring push-vlan action against OF 1.0 switch is ok, but the way to ignore is not correct.)
Due to this issue, VTN Manager failed to create a flow entry.

I used the latest code on September 2nd, 2014.

You can reproduce this issue using RESTCONF API.

URL: http://192.168.2.56:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/9

Method: PUT

Body:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<priority>29</priority>
<flow-name>Foo8</flow-name>
<match>
<ethernet-match>
<ethernet-type>
<type>2048</type>
</ethernet-type>
</ethernet-match>
<ipv4-destination>10.0.10.9/24</ipv4-destination>
</match>
<id>9</id>
<table_id>0</table_id>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<push-vlan-action>
<vlan-id>156</vlan-id>
<ethernet-type>33024</ethernet-type>
</push-vlan-action>
</action>
</apply-actions>
</instruction>
</instructions>
</flow>

The output what I saw:

2014-09-02 22:13:08.662 EDT [nioEventLoopGroup-11-1] WARN o.o.o.protocol.impl.core.OFEncoder - Message serialization failed
java.lang.NullPointerException: null
at org.opendaylight.openflowjava.protocol.impl.util.TypeKeyMakerFactory$2.make(TypeKeyMakerFactory.java:64) ~[bundlefile:na]
at org.opendaylight.openflowjava.protocol.impl.util.TypeKeyMakerFactory$2.make(TypeKeyMakerFactory.java:61) ~[bundlefile:na]
at org.opendaylight.openflowjava.protocol.impl.util.ListSerializer.serializeList(ListSerializer.java:38) ~[bundlefile:na]
at org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10FlowModInputMessageFactory.serialize(OF10FlowModInputMessageFactory.java:52) ~[bundlefile:na]
at org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10FlowModInputMessageFactory.serialize(OF10FlowModInputMessageFactory.java:31) ~[bundlefile:na]
at org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory.messageToBuffer(SerializationFactory.java:36) ~[bundlefile:na]
at org.opendaylight.openflowjava.protocol.impl.core.OFEncoder.encode(OFEncoder.java:41) [bundlefile:na]
at org.opendaylight.openflowjava.protocol.impl.core.OFEncoder.encode(OFEncoder.java:26) [bundlefile:na]
at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:111) [bundlefile:4.0.19.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:666) [bundlefile:4.0.19.Final]
at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:724) [bundlefile:4.0.19.Final]
at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:659) [bundlefile:4.0.19.Final]
at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:645) [bundlefile:4.0.19.Final]
at io.netty.channel.DefaultChannelPipeline.write(DefaultChannelPipeline.java:878) [bundlefile:4.0.19.Final]
at io.netty.channel.AbstractChannel.write(AbstractChannel.java:231) [bundlefile:4.0.19.Final]
at org.opendaylight.openflowjava.protocol.impl.connection.ChannelOutboundQueue.flush(ChannelOutboundQueue.java:189) [bundlefile:na]
at org.opendaylight.openflowjava.protocol.impl.connection.ChannelOutboundQueue.access$000(ChannelOutboundQueue.java:40) [bundlefile:na]
at org.opendaylight.openflowjava.protocol.impl.connection.ChannelOutboundQueue$1.run(ChannelOutboundQueue.java:84) [bundlefile:na]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:341) [bundlefile:4.0.19.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:346) [bundlefile:4.0.19.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [bundlefile:4.0.19.Final]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_65]

When I applied the following patch, the above NPE didn't occur.

diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/ActionConvertor.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/ActionConvertor.java
index 4938e41..541ef92 100644
— a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/ActionConvertor.java
+++ b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/ActionConvertor.java
@@ -359,7 +359,7 @@ public final class ActionConvertor {
if (version == OFConstants.OFP_VERSION_1_0)

{ // if client configure openflow 1.0 switch as a openflow 1.3 switch using openflow 1.3 instructions // then we can ignore PUSH_VLAN as set-vlan-id will push a vlan header if not present - return emtpyAction(actionBuilder); + return null; }

PushVlanActionCase pushVlanActionCase = (PushVlanActionCase) action;



 Comments   
Comment by Michal Rehak [ 05/Sep/14 ]

Source of the NPE is in ActionConvertor in OFPlugin. Sanitizing NPE in OFJava can introduce performance regression and will never clearly explain the cause as OFJava receives corrupted data.

Comment by Michal Rehak [ 10/Sep/14 ]

https://git.opendaylight.org/gerrit/#/c/11006/

Generated at Wed Feb 07 20:31:59 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.