libfluid
libfluid copied to clipboard
match.eth_type() is NULL
I extended the msg_controller to print out the eth-type for a packet-in event, as follows:
diff --git a/examples/controller/msg/MsgApps.hh b/examples/controller/msg/MsgApps.hh
index 904b6bf..f3eb81d 100644
--- a/examples/controller/msg/MsgApps.hh
+++ b/examples/controller/msg/MsgApps.hh
@@ -57,6 +57,11 @@ public:
return;
}
in_port = ofpi->match().in_port()->value();
+ if (ofpi->match().eth_type() == NULL) {
+ return;
+ }
+ uint32_t type = ofpi->match().eth_type()->value();
+ printf("Received packet of type %u.\n", type);
}
// Learn the source
I see that it either prints the eth-type as 0 or segfaults:
$ ./msg_controller l2l2 application (MultiLearningSwitch) started
Server running (0.0.0.0:6633)
Connection id=0 started
Connection id=0 established
Received packet of type 0.
Segmentation fault (core dumped)
Is this because of an issue in eth_type handling in the match object?
Can you please give more details? I'm running the code with your changes and it is working as expected.
Also, please try to get valgrind and gdb output to check exactly where the code is breaking.