NetBSD Problem Report #58241

From www@netbsd.org  Fri May 10 06:15:26 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 2BB6F1A9242
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 10 May 2024 06:15:26 +0000 (UTC)
Message-Id: <20240510061524.C511A1A9245@mollari.NetBSD.org>
Date: Fri, 10 May 2024 06:15:24 +0000 (UTC)
From: aharen@jprs.co.jp
Reply-To: aharen@jprs.co.jp
To: gnats-bugs@NetBSD.org
Subject: setsockopt() sets undocumented errno
X-Send-Pr-Version: www-1.0

>Number:         58241
>Category:       kern
>Synopsis:       setsockopt() sets undocumented errno
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 10 06:20:00 +0000 2024
>Originator:     Yoshitaka Aharen
>Release:        NetBSD 10.0
>Organization:
>Environment:
NetBSD i-060b5c885a3a2d13a.ap-northeast-1.compute.internal 10.0 NetBSD 10.0 (GENERIC64) #0: Thu Mar 28 08:33:33 UTC 2024  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC64 evbarm
>Description:
setsockopt() sets undocumented errno in some cases.

According to ERRORS section the man page of setsockopt(2), it can be read that the possible errno are: EBADF/EFAULT/EINVAL/ENOPROTOOPT/ENOTSOCK.
However, if the connection has been reset when calling setsockopt() with SOL_SOCKET level or IPPROTO_TCP level, errno is set to ECONNRESET.

It would be better to either:
  (1) update the man page
    or
  (2) change the kernel behavior to the same as the man page (Note: FreeBSD/OpenBSD/Linux doesn't set such errno)
>How-To-Repeat:

>Fix:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.