Hello everyone,
I'm trying to use "update_checksum_with_payload" function to recalculate UDP checksum in P4-16. My code snippet is as follows:
update_checksum_with_payload(hdr.udp.isValid(),{
hdr.ipv4.srcAddr,
hdr.ipv4.dstAddr,
8w0,
hdr.ipv4.protocol,
hdr.udp.len,
hdr.udp.srcPort,
hdr.udp.dstPort,
hdr.udp.len},
hdr.udp.checksum,
HashAlgorithm.csum16
);
The code is compiling correctly. Unfortunately, it's not updating the UDP checksum.
If I replace the update_checksum_with_payload with update_checksum, I'm getting same incorrect checksum (NOTE: I'm using the same source and destination IP and UDP port for the entire experiment). From this, it's looking like the update_checksum_with_payload is skipping the payload while UDP checksum calculation.
Any help regarding this will be very helpful.
Thanks and regards
Abhik Bose
Research scholar
CSE, IIT Bombay