Use an action to do the same thing as before

This commit is contained in:
Nico Schottelius 2019-03-27 18:22:37 +01:00
parent 7d9e9e1cfd
commit 12658b23ac
2 changed files with 30 additions and 4 deletions

View file

@ -1398,6 +1398,26 @@ I could work around this by using if(! .. .hit) { my_action(table_id)
^^^^^^
#+END_SRC
**** No conditional execution in actions
#+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
*** Implementation limitations
**** No fragmentation support (yet)
**** No session handling (yet)

View file

@ -48,6 +48,12 @@ control MyIngress(inout headers hdr,
/********************** NAT64 / NAT46 ACTIONS ***********************************/
action mimic_assign_echo_request()
{
hdr.icmp.type = ICMP_ECHO_REQUEST;
}
/* changes for icmp6 -> icmp
- first echo request/reply
- later maybe other
@ -58,11 +64,11 @@ control MyIngress(inout headers hdr,
hdr.ipv4.protocol = PROTO_ICMP; // overwrite generic same protocol assumption
if(hdr.icmp6.type == ICMP6_ECHO_REQUEST) {
hdr.icmp.type = ICMP_ECHO_REQUEST;
}
if(hdr.icmp6.type == ICMP6_ECHO_REPLY) {
hdr.icmp.type = ICMP_ECHO_REPLY;
mimic_assign_echo_request();
}
// if(hdr.icmp6.type == ICMP6_ECHO_REPLY) {
// hdr.icmp.type = ICMP_ECHO_REPLY;
// }
/* trigger checksumming */
meta.switch_task = TASK_CHECKSUM_ICMP;