Merge full IPv6 handling code from BMV2 side
This commit is contained in:
parent
6b176fdc06
commit
dc7d78252e
2 changed files with 36 additions and 10 deletions
|
|
@ -2,6 +2,10 @@
|
|||
#include <sume_switch.p4>
|
||||
#include "headers.p4"
|
||||
|
||||
/* required for netfpga */
|
||||
#define USE_NICO_DELTA_CHECKSUM 1
|
||||
|
||||
|
||||
// typedef bit<48> EthAddr_t;
|
||||
// header Ethernet_h {
|
||||
// EthAddr_t dstAddr;
|
||||
|
|
@ -75,6 +79,7 @@ control RealMain(
|
|||
|
||||
#include "actions_nat64_generic.p4"
|
||||
#include "actions_egress.p4"
|
||||
#include "actions_delta_checksum.p4"
|
||||
|
||||
|
||||
action swap_eth_addresses() {
|
||||
|
|
@ -126,6 +131,7 @@ control RealMain(
|
|||
if(nat64.apply().hit) { /* generic / static nat64 done */
|
||||
if(hdr.icmp6.isValid()) {
|
||||
nat64_icmp6_generic();
|
||||
|
||||
if(hdr.icmp6.type == ICMP6_ECHO_REPLY) {
|
||||
hdr.icmp.type = ICMP_ECHO_REPLY;
|
||||
hdr.icmp.code = 0;
|
||||
|
|
@ -134,7 +140,24 @@ control RealMain(
|
|||
hdr.icmp.type = ICMP_ECHO_REQUEST;
|
||||
hdr.icmp.code = 0;
|
||||
}
|
||||
if(hdr.udp.isValid()) {
|
||||
#ifdef USE_NICO_DELTA_CHECKSUM
|
||||
delta_udp_from_v6_to_v4();
|
||||
#else
|
||||
meta.chk_udp_v4 = 1;
|
||||
#endif
|
||||
}
|
||||
if(hdr.tcp.isValid()) {
|
||||
#ifdef USE_NICO_DELTA_CHECKSUM
|
||||
delta_tcp_from_v6_to_v4();
|
||||
#else
|
||||
|
||||
meta.chk_tcp_v4 = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
v4_networks.apply(); /* apply egress for IPv4 */
|
||||
exit; /* no further v6 processing */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue