Browse Source

Use own filtering code

master
Nico Schottelius 3 years ago
parent
commit
baa50b91c6
  1. 9
      doc/plan.org
  2. 11
      p4src/actions_delta_checksum.p4

9
doc/plan.org

@ -5266,6 +5266,15 @@ we get
sum 0x48ad (incorrect -> 0x85eb)
Still using scapy + adjusted diff:
/* here is also a possible overflow in both directions */
hdr.tcp.checksum = hdr.tcp.checksum + meta.v6sum - meta.v4sum;
gets
sum 0xc5f2 (incorrect -> 0xe7cf)
** The NetPFGA saga
Problems encountered:
- The logfile for a compile run is 10k+ lines

11
p4src/actions_delta_checksum.p4

@ -15,9 +15,10 @@ action v4sum() {
/* filtering code copied from scapy */
tmp = (tmp >> 16) + (tmp & 0xffff);
tmp = tmp + (tmp >> 16);
tmp = (tmp >> 16) + (tmp & 0xffff);
tmp = ~tmp;
meta.v4sum = (bit<16>) ((((tmp>>8) & 0xff)|tmp<<8) & 0xffff);
// meta.v4sum = (bit<16>) ((((tmp>>8) & 0xff)|tmp<<8) & 0xffff);
meta.v4sum = (bit<16>) tmp;
}
@ -48,9 +49,11 @@ action v6sum() {
/* filtering code copied from scapy */
tmp = (tmp >> 16) + (tmp & 0xffff);
tmp = tmp + (tmp >> 16);
tmp = (tmp >> 16) + (tmp & 0xffff);
// tmp = tmp + (tmp >> 16);
tmp = ~tmp;
meta.v6sum = (bit<16>) ((((tmp>>8) & 0xff)|tmp<<8) & 0xffff) ;
// meta.v6sum = (bit<16>) ((((tmp>>8) & 0xff)|tmp<<8) & 0xffff) ;
meta.v6sum = (bit<16>) tmp;
}

Loading…
Cancel
Save