From nobody Wed Aug 17 16:57:22 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M7Dhh6Mtkz4Yg6V; Wed, 17 Aug 2022 16:57:24 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M7Dhg66hRz3rlf; Wed, 17 Aug 2022 16:57:23 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 27HGvM8P031731 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 17 Aug 2022 09:57:22 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 27HGvM2d031730; Wed, 17 Aug 2022 09:57:22 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Wed, 17 Aug 2022 09:57:22 -0700 From: Gleb Smirnoff To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: c93db4abf454 - main - udp: call UDP methods from UDP over IPv6 directly Message-ID: References: <202208161940.27GJercD039480@gitrepo.freebsd.org> <62dca1e0-8d66-6291-149e-5785af0e2658@FreeBSD.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4M7Dhg66hRz3rlf X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=softfail (mx1.freebsd.org: 162.251.186.162 is neither permitted nor denied by domain of glebius@freebsd.org) smtp.mailfrom=glebius@freebsd.org X-Spamd-Result: default: False [-3.10 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.999]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org]; RCVD_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US]; ARC_NA(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; DMARC_NA(0.00)[freebsd.org]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[glebius]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; HAS_XAW(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On Wed, Aug 17, 2022 at 09:37:44AM -0700, John Baldwin wrote: J> On 8/17/22 9:19 AM, Gleb Smirnoff wrote: J> > John, J> > J> > On Wed, Aug 17, 2022 at 09:04:08AM -0700, John Baldwin wrote: J> > J> > diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c J> > J> > index a7bdfce97707..6a3ac2abd90b 100644 J> > J> > --- a/sys/netinet6/udp6_usrreq.c J> > J> > +++ b/sys/netinet6/udp6_usrreq.c J> > J> > @@ -131,12 +131,18 @@ VNET_DEFINE(int, zero_checksum_port) = 0; J> > J> > SYSCTL_INT(_net_inet6_udp6, OID_AUTO, rfc6935_port, CTLFLAG_VNET | CTLFLAG_RW, J> > J> > &VNET_NAME(zero_checksum_port), 0, J> > J> > "Zero UDP checksum allowed for traffic to/from this port."); J> > J> > + J> > J> > + J> > J> > +/* netinet/udp_usrreqs.c */ J> > J> > +pr_abort_t udp_abort; J> > J> > +pr_disconnect_t udp_disconnect; J> > J> > +pr_send_t udp_send; J> > J> > + J> > J> J> > J> Oof, can you please put these in a header instead? would seem to be J> > J> a good candidate. J> > J> > I actually don't want to share these functions to anybody. Sometimes we are J> > in a situation when two compilation units are historically separated, J> > while they need to call into each other functions, which by design are private. J> J> Putting them in a header doesn't really change that. Anyone can add a local J> prototype and call it. Even better, they can add a _wrong_ prototype and J> call it with the wrong arguments. Or more likely, if the original function changes J> then previously working code breaks and the compiler won't catch this. In this J> specific case you mostly sidestep that due to using a typedef, but in general the J> wrong prototype problem is the reason to store prototypes in headers. J> J> I'm not sure that "I don't trust other developers" is a valid reason to avoid the J> use of headers, or at least I'm not sure it outweighs "code breaks without J> the compiler noticing in the future". I'd rather signpost it in the header J> clarifying when it is allowed to be used (e.g. /* Shared between udp*_usrreq.c. */ J> or the like) I'm already working on the change you suggested and I'm already in dependency hell. Since the typedefs are declared in protosw.h that would require anybody who included udp_var.h also include protosw.h. And we have lots of files that include udp_var.h for good or for no reason. Of course I don't want to sprinkle protosw.h include all around. Suggestion by Jessica about udp_usrreq_private.h seems to be more viable, but is it worth to create yet another include to share a function between 2 files, when we are sure that there would never be a 3 file to include it? -- Gleb Smirnoff