Page MenuHomeFreeBSD

Add tests for sendmsg(2), recvmsg(2), shutdown(2), sendfile(2)
ClosedPublic

Authored by aniketp on Jun 19 2018, 1:41 AM.
Tags
None
Referenced Files
F81612535: D15895.diff
Thu, Apr 18, 11:19 PM
Unknown Object (File)
Mar 11 2024, 2:57 PM
Unknown Object (File)
Mar 11 2024, 2:56 PM
Unknown Object (File)
Dec 23 2023, 11:37 AM
Unknown Object (File)
Dec 10 2023, 8:56 PM
Unknown Object (File)
Nov 15 2023, 8:07 PM
Unknown Object (File)
Nov 15 2023, 1:57 PM
Unknown Object (File)
Oct 14 2023, 7:09 PM
Subscribers

Details

Summary

This revision introduces atf-c(3) tests for final set of system calls categorized within
network audit class. The system calls, as mentioned in the title are:

  • sendmsg(2)
  • recvmsg(2)
  • sendfile(2)
  • shutdown(2)
Test Plan

Execute make && make install from test/sys/audit.
Execute kyua test from /usr/tests/sys/audit. All testcases should succeed.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 17448
Build 17280: arc lint + arc unit

Event Timeline

asomers requested changes to this revision.Jun 19 2018, 3:24 PM
asomers added inline comments.
tests/sys/audit/network.c
66

ALLCAPS is normally reserved for constants. Variables should be lower case.

76

s/addres/address

78

You should zero out hdrbuf's other fields, either explictly or by using bzero before initializing anything.

78

This is the wrong type. sizeof returns a size_t, not ssize_t. And msg_name is a socklen_t. So you'll obviously have to cast size_t to socklen_t at some point, but there's no reason to cast to ssize_t first.

925

Better to use sizeof(data). More future-proof that way.

939

Another good opportunity for "%#x".

This revision now requires changes to proceed.Jun 19 2018, 3:24 PM
aniketp marked 6 inline comments as done.

Lots of changes

  • Typecast changes to socklen_t
  • bzeroed struct msghdrs
  • Some tweaks in hex format identifiers and variable namings
asomers requested changes to this revision.Jun 19 2018, 4:58 PM
asomers added inline comments.
tests/sys/audit/network.c
860

You neglected to zero out sendbuf here, too. It would probably be easier to do it from within init_msghdr.

This revision now requires changes to proceed.Jun 19 2018, 4:58 PM

Use bzero from within the function init_msghdr()

LGTM. sendmsg(2), by the way, is my least favorite system call of all time.

This revision is now accepted and ready to land.Jun 19 2018, 5:39 PM
This revision was automatically updated to reflect the committed changes.