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)
Fri, Mar 22, 2:17 PM
Unknown Object (File)
Fri, Mar 22, 12:10 PM
Unknown Object (File)
Fri, Mar 22, 10:30 AM
Unknown Object (File)
Fri, Mar 22, 10:26 AM
Unknown Object (File)
Fri, Mar 22, 10:26 AM
Unknown Object (File)
Mar 8 2024, 1:48 PM
Unknown Object (File)
Feb 14 2024, 1:36 PM
Unknown Object (File)
Feb 12 2024, 5:05 PM
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.