Page MenuHomeFreeBSD

libbsnmp: fix local client socket creation
ClosedPublic

Authored by glebius on Jun 25 2025, 2:17 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 2, 5:47 PM
Unknown Object (File)
Sun, Oct 26, 3:00 AM
Unknown Object (File)
Fri, Oct 24, 9:11 PM
Unknown Object (File)
Mon, Oct 20, 10:51 AM
Unknown Object (File)
Sat, Oct 18, 7:21 PM
Unknown Object (File)
Thu, Oct 16, 4:22 AM
Unknown Object (File)
Thu, Oct 16, 1:40 AM
Unknown Object (File)
Wed, Oct 15, 12:19 AM
Subscribers

Details

Summary

Revert "bsnmp: Use mkstemp when creating clients local socket"

The use of mktemp() was intentional here. We don't want a regular file to
be created. If created, it guarantees that following bind(2) would always
fail with EADDRINUSE and thus open_client_local() always fails.

This reverts commit 81e0e7b9e36d6a25b3af6482811318e085537d2f.

Diff Detail

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

Event Timeline

I am really puzzled how D34550 was created and how did it pass your review :)

I assume the original concern here was that mktemp() is subject to TOCTTOU races. Thus, it would be better to use mkdtemp() to create a unique temporary directory, and create our socket inside that directory.

In D51031#1164827, @des wrote:

I assume the original concern here was that mktemp() is subject to TOCTTOU races. Thus, it would be better to use mkdtemp() to create a unique temporary directory, and create our socket inside that directory.

Let's just revert this to original working state. I have upcoming review on this function that skips binding at all. This binding is not needed. The patch would still allow to use a bound socket for SNMP client, but that would be optional. The path name would be either specified by caller or no path name at all. This makes mktemp/mkstemp point moot.

I am really puzzled how D34550 was created and how did it pass your review :)

same way as this one, LGTM :)

side note, I don't recall the issue NetApp was having and AFAIK that information is not public.

but I trust your vision and if this change becomes an issue for NetApp, they can adapt.

This revision is now accepted and ready to land.Jun 25 2025, 5:39 PM

Note: 4 more reviews stacked on top of this one, if anyone interested.

glebius retitled this revision from bsnmp: fix local client socket creation to libbsnmp: fix local client socket creation.Jul 15 2025, 12:02 AM
This revision was automatically updated to reflect the committed changes.