p4lang / p4-applications

P4 Applications WG repo
107 stars 45 forks source link

INT transit program and invalid InternetChecksum length #45

Closed jamescoole-cisco closed 6 years ago

jamescoole-cisco commented 6 years ago

It looks like the checksum calculation in the INT transit example program is attempting to subtract data that isn't a multiple of 16b in size:

https://github.com/p4lang/p4-applications/blob/2042fb889e59cace423c602a53fa5298b03cd2fc/telemetry/specs/INT.mdk#L1488-L1491

https://github.com/p4lang/p4-applications/blob/2042fb889e59cace423c602a53fa5298b03cd2fc/telemetry/specs/INT.mdk#L1158-L1164

But this isn't supported by PSA's InternetChecksum extern

  /// Subtract data from existing checksum.  data must be a multiple of
  /// 16 bits long.
  void subtract<T>(in T data);

Is the intent here to subtract, and later add, the entire intl4_shim_t header?

jklr commented 6 years ago

@jamescoole-cisco the 6b field dscp was missed out in the ck.subtract() and ck.add() calls. I will add them. It was not caught as there is no implementation of PSA backend including the checksum extern. Thanks for the review.