Page MenuHomeFreeBSD

libnv: read entire datagram in nvlist_recv()
ClosedPublic

Authored by rew on Oct 29 2021, 12:31 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 10, 5:17 AM
Unknown Object (File)
Sat, Nov 23, 2:26 PM
Unknown Object (File)
Sat, Nov 23, 2:22 PM
Unknown Object (File)
Oct 21 2024, 12:14 AM
Unknown Object (File)
Oct 19 2024, 1:22 PM
Unknown Object (File)
Oct 3 2024, 4:38 PM
Unknown Object (File)
Sep 22 2024, 2:22 AM
Unknown Object (File)
Sep 18 2024, 8:43 AM
Subscribers

Details

Summary

When SOCK_DGRAM is used, a portion of the datagram is discarded during
the initial recv() when getting the nvlist_header.

To workaround this, use MSG_PEEK for the initial recv() when using a
datagram socket.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rew requested review of this revision.Oct 29 2021, 12:31 AM

Could you also add test for this case?

add ATF tests for SOCK_DGRAM with nvlist_send()/nvlist_recv().

The test-case nvlist_send_recv__send_many_fds_dgram, wouldn't pass
without sysctl tuning. Specifically, net.local.dgram.maxdgram and
net.local.dgram.recvspace.

Not sure if this test should be enabled by default.

@lwhsu Is those settings ok with our tests machines?

ping @lwhsu

Let me know if there's anything I can do to help to get these tests in.

If the settings are unacceptable for the test machines, I can atf_skip the offending test.

Just to be clear, I've added 3 tests - and only the one test-case needs sysctl tuning to pass.

Any objections here?

If I don't hear back from @lwhsu , I'll disable the nvlist_send_recv__send_many_fds__dgram test case on commit.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 6 2021, 6:58 PM
This revision was automatically updated to reflect the committed changes.