Page MenuHomeFreeBSD

ping: add tests of the Internet checksum function
ClosedPublic

Authored by jansucan on Aug 20 2019, 1:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 14, 9:36 PM
Unknown Object (File)
Fri, Nov 8, 4:48 PM
Unknown Object (File)
Mon, Oct 28, 8:18 PM
Unknown Object (File)
Mon, Oct 28, 8:18 PM
Unknown Object (File)
Mon, Oct 28, 8:18 PM
Unknown Object (File)
Mon, Oct 28, 8:18 PM
Unknown Object (File)
Mon, Oct 28, 8:17 PM
Unknown Object (File)
Mon, Oct 28, 8:17 PM
Subscribers

Details

Summary

Add tests of the Internet checksum function

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google LLC (Google Summer of Code 2019)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

asomers requested changes to this revision.Aug 20 2019, 3:49 PM

Don't forget to add an entry to etc/mtree/BSD.tests.dist

sbin/ping/tests/in_cksum_test.c
89 ↗(On Diff #61041)

This doesn't guarantee that the array will be unaligned. It merely doesn't guarantee that it will be aligned. Better to declare an array that's aligned, then compute the checksum starting from the second byte. That way you'll know it's unaligned.

This revision now requires changes to proceed.Aug 20 2019, 3:49 PM

Add an entry to etc/mtree/BSD.tests.dist.

Ensure an unaligned data by starting from the second byte of an aligned data buffer.

sbin/ping/tests/in_cksum_test.c
89 ↗(On Diff #61041)

Thanks. It has been fixed.

sbin/ping/tests/in_cksum_test.c
93 ↗(On Diff #61053)

But now the second argument is wrong. Shouldn't it be nitems(data) - 1?

Correct unaligned data buffer size.

sbin/ping/tests/in_cksum_test.c
93 ↗(On Diff #61053)

You're right. Thanks. I'm editing too many diffs at once.

sbin/ping/tests/Makefile
6 ↗(On Diff #61054)

Here's a footgun you didn't know about: WARNS is by default set to 6 for libraries and binaries, but 0 for tests. You need to set it explicitly.

Set WARNS to 6 explicitly for tests.

sbin/ping/tests/Makefile
6 ↗(On Diff #61054)

Fixed.

This revision is now accepted and ready to land.Aug 20 2019, 9:57 PM
This revision was automatically updated to reflect the committed changes.