Skip to content

match.eth_type() is NULL #2

@adk9

Description

@adk9

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions