Bug 176420 - [kernel] incorrect errno for LOCAL_PEERCRED
Summary: [kernel] incorrect errno for LOCAL_PEERCRED
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Mark Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-25 13:10 UTC by Nicholas Wilson
Modified: 2025-01-20 00:30 UTC (History)
2 users (show)

See Also:


Attachments
file.diff (481 bytes, patch)
2013-02-25 13:10 UTC, Nicholas Wilson
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nicholas Wilson 2013-02-25 13:10:00 UTC
A tiny bug; error code is incorrect for the SEQPACKET retrieval of LOCAL_PEERCRED.

* An unconnected SOCK_STREAM: get ENOTCONN
* A SOCK_DGRAM: get EINVAL
* An unconnected SOCK_SEQPACKET: get EINVAL, but should get ENOTCONN

Fix: Patch attached for RELEASE-9.1

Patch attached with submission follows:
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2013-02-27 00:19:39 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-net

Over to maintainer(s).
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:44 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 3 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:40:13 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>
Comment 4 commit-hook freebsd_committer freebsd_triage 2025-01-06 22:57:58 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1c933f464fdbb630f9663751f04c29cdcda38902

commit 1c933f464fdbb630f9663751f04c29cdcda38902
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-01-06 22:55:38 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-01-06 22:56:34 +0000

    unix: Be consistent about error handling for unconnected sockets

    SOCK_STREAM and SOCK_SEQPACKET sockets should get the same treatment
    here.

    PR:             176420
    MFC after:      2 weeks

 sys/kern/uipc_usrreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 5 Nicholas Wilson 2025-01-11 17:15:01 UTC
Wow, my twelve year old patch applied cleanly! 

Nice, thank you Mark.

I expect there's roughly zero people in the world in that time who have used SEQPACKET (unusual), over a local socket, with PEERCRED (unusual), on FreeBSD (fairly obscure community).

So, thank you!
Comment 6 Mark Johnston freebsd_committer freebsd_triage 2025-01-11 17:25:43 UTC
(In reply to Nicholas Wilson from comment #5)
Certainly, sorry it took so long to get this addressed.

As you might surmise, some of us have been trying to comb through the bugzilla backlog.  I agree that the bug is rather obscure, but this patch seemed obviously right, especially when looking at the handling of socket types in uipc_usrreq.c more generally.  So, thanks for the report.
Comment 7 commit-hook freebsd_committer freebsd_triage 2025-01-20 00:28:25 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=8373644ee2c848bab47d87d24b31d673e6515bce

commit 8373644ee2c848bab47d87d24b31d673e6515bce
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-01-06 22:55:38 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-01-20 00:26:27 +0000

    unix: Be consistent about error handling for unconnected sockets

    SOCK_STREAM and SOCK_SEQPACKET sockets should get the same treatment
    here.

    PR:             176420
    MFC after:      2 weeks

    (cherry picked from commit 1c933f464fdbb630f9663751f04c29cdcda38902)

 sys/kern/uipc_usrreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)