Refactor #n: go back to generic entry point, use if in apply{}

This commit is contained in:
Nico Schottelius 2019-03-30 14:59:46 +01:00
commit f32ad44e0b
6 changed files with 211 additions and 80 deletions

View file

@ -144,11 +144,26 @@
| 2019-03-27 | | |
| | switch cannot be used in actions! | |
| | Refactor program to use multiple tables instead of switch | |
| | Ethernet frame check sequence error | |
| | | |
| 2019-03-28 | Meet Laurent #4 | |
| | - Router solicitation for finding router on startup! | |
| | - Router solicitation for finding router on startup | |
| | - test.py for TDD | |
| | - Parsing icmp6 is not enough - one layer deeper | |
| | - No LPM priorities | |
| | - if/switch action logic | |
| | - partial translation working to IPv4 | |
| | - Focus on checksumming work (again) | |
| | | |
| | | |
| | Notes: | |
| | - Later using ternary matching | |
| | - Document (nested) if's in action (in thesis) | |
| | - SW and HW Targets Tofino [Albert, Thomas] | |
| | - P414/P416 for Tofino? | |
| | - Barefoot support/question: Ticket/Support System | |
| | - Can try P416 compiler | |
| | - Next week Laurent not around: send email + Albert/Thomas/Edgar meeting | |
| | | |
| | | |
| 2019-03-30 | NAT64 1:1 table ICMP, ICMPv6 working | |
@ -485,9 +500,15 @@ INFO:main:unhandled reassambled=<Ether dst=00:00:0a:00:00:42 src=00:00:0a:00:00
***** DONE egress is correct, comes out at h3
***** DONE protocol 58 is wrong -> should be 1
***** DONE figure out switch() syntax
***** TODO Calculate ICMP checksum
***** TODO transform protocol specific: icmp6 -> icmp
**** TODO transform protocol specific: icmp -> icmp6
****** DONE Implement double table, as there are no if's in actions
****** DONE Debug Ethernet frame check sequence error -> need to compute checksum
https://en.wikipedia.org/wiki/Frame_check_sequence
According to Edgar this should not be seen anyway.
****** TODO Calculate ICMP checksum
****** TODO Check field lengths
***** TODO transform protocol specific: icmp -> icmp6
**** TODO Make switch answer IPv4 icmp echo request for
**** TODO Add / check default route for v4 hosts
*** TODO Get p4 VM / vagrant running
@ -1393,39 +1414,45 @@ I could work around this by using if(! .. .hit) { my_action(table_id)
}, but it would not work with using default_action = ...
**** No switch in actions, No conditional execution in actions
***** 3 possible solutions
- multi table (state as of 2019-03-28)
- switch/if in actions: with shadow tables
- switch/if in apply block
Imho, compiler should be able to unroll these to some degree.
#+BEGIN_SRC
../p4src/static-mapping.p4(60): error: SwitchStatement: switch statements not allowed in actions
switch(hdr.icmp6.type) {
^^^^^^
#+END_SRC
***** log
Imho, compiler should be able to unroll these to some degree.
#+BEGIN_SRC
../p4src/static-mapping.p4(57): error: MethodCallStatement: Conditional execution in actions is not supported on this target
hdr.icmp.setValid();
^^^^^^^^^^^^^^^^^^^
../p4src/static-mapping.p4(70): error: MethodCallStatement: Conditional execution in actions is not supported on this target
hdr.icmp6.setInvalid();
^^^^^^^^^^^^^^^^^^^^^^
../p4src/static-mapping.p4(73): error: MethodCallStatement: Conditional execution in actions is not supported on this target
hdr.icmp6_na_ns.setInvalid();
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../p4src/static-mapping.p4(74): error: MethodCallStatement: Conditional execution in actions is not supported on this target
hdr.icmp6_option_link_layer_addr.setInvalid();
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation Error
p4@ubuntu:~/master-thesis/p4app$
#+END_SRC
#+BEGIN_SRC
../p4src/static-mapping.p4(60): error: SwitchStatement: switch statements not allowed in actions
switch(hdr.icmp6.type) {
^^^^^^
#+END_SRC
Code:
#+BEGIN_SRC
../p4src/static-mapping.p4(57): error: MethodCallStatement: Conditional execution in actions is not supported on this target
hdr.icmp.setValid();
^^^^^^^^^^^^^^^^^^^
../p4src/static-mapping.p4(70): error: MethodCallStatement: Conditional execution in actions is not supported on this target
hdr.icmp6.setInvalid();
^^^^^^^^^^^^^^^^^^^^^^
../p4src/static-mapping.p4(73): error: MethodCallStatement: Conditional execution in actions is not supported on this target
hdr.icmp6_na_ns.setInvalid();
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../p4src/static-mapping.p4(74): error: MethodCallStatement: Conditional execution in actions is not supported on this target
hdr.icmp6_option_link_layer_addr.setInvalid();
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation Error
p4@ubuntu:~/master-thesis/p4app$
#+END_SRC
#+BEGIN_SRC
if(hdr.ipv6.next_header == PROTO_ICMP6) {
nat64_icmp6();
}
#+END_SRC
Code:
#+BEGIN_SRC
if(hdr.ipv6.next_header == PROTO_ICMP6) {
nat64_icmp6();
}
#+END_SRC
*** Implementation limitations
**** No fragmentation support (yet)
@ -1443,6 +1470,8 @@ Only the destination network is matched for deciding on NAT64, as
priority based double LPM is not supported. This limits a prefix to be
used only in one network.
*** References / Follow up
**** RFC 791 IPv4 https://tools.ietf.org/html/rfc791
**** RFC 792 ICMP https://tools.ietf.org/html/rfc792
**** RFC 1017 ICMP checksum https://tools.ietf.org/html/rfc1071
**** RFC 2460 IPv6 (Checksum https://tools.ietf.org/html/rfc2460#section-8.1)
**** RFC 3810 MLD2 https://tools.ietf.org/html/rfc3810