Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp61308ybl; Thu, 5 Dec 2019 15:11:21 -0800 (PST) X-Google-Smtp-Source: APXvYqx3R1iHbiqQLn0/y4yeRwsEMdeDxueJKsknGSwUataaO875AO3v3/BszOf5YaShx/ui0nZn X-Received: by 2002:a05:6808:9ba:: with SMTP id e26mr9823290oig.81.1575587481189; Thu, 05 Dec 2019 15:11:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575587481; cv=none; d=google.com; s=arc-20160816; b=SWjjerAgrbBOEpmfxNHjVJdwKptrPjohIDA1dVNQEWi/ySqLtRIdrN0Hf6Z42f58kH pJqFt2Aw6hCLXVNw2BAmA0iWXGhHiwNEQtvw7StJmU0u2cM/HHtFvDnqYEiSPehhy2qK /Lksf6s8OkPNHOEnwEyu5Pkz9TU0WOheRPq4aRC5Y5U1Hci+WdikgrIV0jkEwvFebVRH TjpzIG9ydL8uxwZJcvc/4Xc/9rwXsZH8hiilykOKaPUchX583LxiyEXWd66eISgnD/vB +hUFszHg0+h7W1qSwYTpdnqYvsjlg01wr0wQ6yTTI+T7zG+5rBn1YrSjd1Dvk96Y+F2A dI6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1JPfNuBXQhk8YXxL8WSqzuO08VOreA8MnDT4sN2wfiA=; b=Sjk8x1DQi4xofg1F3qXbyvGkW7cFvdkHpcvPne+2Mk8S+FOmBQbHLML8iSK8PRqS+G L+Tnnl+ptGfkBm7qkVil50YOsZkmbNYc3Tz0S0bI2w6nS56imM63DElFhFkPz0/Rp14d Q9+nlubyrFDCRbLSadxGK6HyPS2BxVDQlQ5vm787SSrs11AKug8bXBht6kwwPaQd207A /brUOpSk8vzNitQWqyjVYkQLWm4OyjcrWbOh4x67yII0yn83ZJ7JO1kb0pHYr7vG/rju clFJlkqpIh9BR+hbKSDDTojcVo9uYhaYQ3KEiJYHns84cWQ6e4hZfXZ5N6Mv+yxHajmV Q3sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@valentin-vidic.from.hr header.s=2017 header.b=Uh8XTKyp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 100si6652857otn.128.2019.12.05.15.11.07; Thu, 05 Dec 2019 15:11:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@valentin-vidic.from.hr header.s=2017 header.b=Uh8XTKyp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726097AbfLEXIo (ORCPT + 99 others); Thu, 5 Dec 2019 18:08:44 -0500 Received: from valentin-vidic.from.hr ([94.229.67.141]:39831 "EHLO valentin-vidic.from.hr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725926AbfLEXIo (ORCPT ); Thu, 5 Dec 2019 18:08:44 -0500 X-Virus-Scanned: Debian amavisd-new at valentin-vidic.from.hr Received: by valentin-vidic.from.hr (Postfix, from userid 1000) id 369ED2A9; Fri, 6 Dec 2019 00:08:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=valentin-vidic.from.hr; s=2017; t=1575587315; bh=gOfv2vg4JtHkkPl08ul7DDaNE8L+hWoX0Am0lJG/V0A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Uh8XTKypfL1JWzKMadXYcUfM2Ho6PZCRoU7LKfZYM3PvgnfUsct1693HZ1juX7Kvr v2q6VZsnHk5f5WdXQumZ8txy7FXewbhbMR8ysVmolnn9GOOEUtJGDLdDOGmKIoDM6U nvquzrQkgitkdsgWY49hkmGnLt6dcb7AhOcc9gke1GyAqbm6Jwck9F/rb4TrKb/Djd HMz3P8pbGrr2G8E1tRdWPiB/gA64OhgY5Z8rPxAQQanwyQgqgmwavWdYwj7Gts0bWE YdZrXY5uBZqwIxPCq6gVEWbQoev+y/SnZfVrPugptGiuZgwJPuBEaOlIvQHz+z3+/K nrevkXXK/CE/g== Date: Fri, 6 Dec 2019 00:08:35 +0100 From: Valentin =?utf-8?B?VmlkacSH?= To: Willem de Bruijn Cc: Jakub Kicinski , Boris Pismenny , Aviad Yehezkel , John Fastabend , Daniel Borkmann , "David S. Miller" , Network Development , linux-kernel Subject: Re: [PATCH v3] net/tls: Fix return values to avoid ENOTSUPP Message-ID: <20191205230835.GB20116@valentin-vidic.from.hr> References: <20191204.165528.1483577978366613524.davem@davemloft.net> <20191205064118.8299-1-vvidic@valentin-vidic.from.hr> <20191205113411.5e672807@cakuba.netronome.com> <20191205204343.GA20116@valentin-vidic.from.hr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 05, 2019 at 04:26:14PM -0500, Willem de Bruijn wrote: > > I based these on the description from the sendmsg manpage, but you decide: > > > > EOPNOTSUPP > > Some bit in the flags argument is inappropriate for the socket type. > > Interesting. That is a narrower interpretation than asm-generic/errno.h > > #define EOPNOTSUPP 95 /* Operation not supported on > transport endpoint */ > > which is also the string that strerror() generates. Found one interesting example where EINVAL seems to mean "this value will never work" and EOPNOTSUPP means "this value will not work in the current state/type of socket": case TCP_FASTOPEN_CONNECT: if (val > 1 || val < 0) { err = -EINVAL; } else if (net->ipv4.sysctl_tcp_fastopen & TFO_CLIENT_ENABLE) { if (sk->sk_state == TCP_CLOSE) tp->fastopen_connect = val; else err = -EINVAL; } else { err = -EOPNOTSUPP; } break; > I think there is a fundamental difference between, say, passing an > argument of incorrect length (optlen < sizeof(..)) and asking for a > possibly unsupported cipher mode. But consistency trumps that. > > I don't mean to drag this out by bike-shedding. > > Happy to defer to maintainers on whether the errno on published code > can and should be changed, which is the more fundamental issue than > the exact errno. > > FWIW, I also did not see existing openssl and gnutls callers test the > specific errno. The calls just fail on any setsockopt return value -1. Right, I'm also fine with whatever the maintainer decides to take :) -- Valentin