Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tool doesn't handle default transitions in the parser #30

Open
rajkiranjoshi opened this issue Sep 16, 2020 · 1 comment
Open

Tool doesn't handle default transitions in the parser #30

rajkiranjoshi opened this issue Sep 16, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@rajkiranjoshi
Copy link
Collaborator

rajkiranjoshi commented Sep 16, 2020

The tool runs into errors for PcapPlusPlus and Scapy backends when the defined parser in P4 program contains a default transition to the next parser state. The type of error varies depending on how the default transition is:

  1. Default transition via a transition select block: In this case the error is TypeError: 'NoneType' object has no attribute '__getitem__'

  2. Default transition which is directly specified like transition parse_next_state: In this case the error is KeyError: u'bos'. Here the p4c compiler would merge the parser states and the said transition actually doesn't exist. This is a right thing to do from P4 perspective, but it confuses the tool.

Attached zip contains:

  1. perc-tcp-options.p4: by default it is a working P4 file. Follow comments around "BUGGY Line #⁠1" and "BUGGY Line #⁠2" to reproduce the two error respectively. Reproduce only one error at a time.
  2. graphs/ParseGraph-works.pdf: a working parser graph
  3. graphs/ParseGraph-bug_line1.pdf: parser graph corresponding to the first error.
  4. graphs/ParseGraph-bug_line2.pdf: parser graph corresponding to the second error.

perc-tcp-options.zip

@rhl-bthr
Copy link
Collaborator

rhl-bthr commented Sep 19, 2020

Setup:
TrafficTool at dedb485, python2.7.17, p4c installed via ppa.

Unable to reproduce 1.
Reproduced 2. It works for pCap++ when we don't use the standard headers, so that's where the root cause could be. Looking into it

@rhl-bthr rhl-bthr self-assigned this Sep 29, 2020
@rhl-bthr rhl-bthr added the bug Something isn't working label Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants