Skip to content

Issues with Segmentation Faults when deploying custom externs in simple_switch_grpc #1439

Description

@aneeshnotfound

Hi,

I followed the instructions on implementing custom externs as given by #1140

However, I am running into segmentation faults when trying to modify P4 variables inside a C++ function within simple_switch_grpc. While passing variables as const or by value works for reading, arithmetic, and logging, passing them as non-const references leads to garbage memory allocation and crashes. I need to ensure that changes made to these variables in C++ properly reflect back in the P4 code. Does simple_switch_grpc support mutable P4 variable references in external C++ functions, and if so, what is the correct way to pass them?

I ran the following command to compile my p4 code:

p4c-bm2-ss —emit-externs -o program.json program.p4 —p4runtime-files p4info.txtpb

I ran the same executable command for simple_switch_grpc as mentioned on the README but with the addition of —load-modules=/extern_lib/definition.so

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions