Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Aug 2022 09:19:29 -0700
From:      Gleb Smirnoff <glebius@freebsd.org>
To:        John Baldwin <jhb@freebsd.org>
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:  <Yv0VEQge6ttaC0Rv@FreeBSD.org>
In-Reply-To: <62dca1e0-8d66-6291-149e-5785af0e2658@FreeBSD.org>
References:  <202208161940.27GJercD039480@gitrepo.freebsd.org> <62dca1e0-8d66-6291-149e-5785af0e2658@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
  John,

On Wed, Aug 17, 2022 at 09:04:08AM -0700, John Baldwin wrote:
J> > diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
J> > index a7bdfce97707..6a3ac2abd90b 100644
J> > --- a/sys/netinet6/udp6_usrreq.c
J> > +++ b/sys/netinet6/udp6_usrreq.c
J> > @@ -131,12 +131,18 @@ VNET_DEFINE(int, zero_checksum_port) = 0;
J> >   SYSCTL_INT(_net_inet6_udp6, OID_AUTO, rfc6935_port, CTLFLAG_VNET | CTLFLAG_RW,
J> >       &VNET_NAME(zero_checksum_port), 0,
J> >       "Zero UDP checksum allowed for traffic to/from this port.");
J> > +
J> > +
J> > +/* netinet/udp_usrreqs.c */
J> > +pr_abort_t	udp_abort;
J> > +pr_disconnect_t	udp_disconnect;
J> > +pr_send_t	udp_send;
J> > +
J> 
J> Oof, can you please put these in a header instead?  <netinet/udp_var.h> would seem to be
J> a good candidate.

I actually don't want to share these functions to anybody.  Sometimes we are
in a situation when two compilation units are historically separated,
while they need to call into each other functions, which by design are private.

With declaration in the caller unit I emphasize that nobody except udp6_usrreq.c
may call functions from udp_usrreq.c. I find this self-documenting and better than
exposing it in udp_var.h or anywhere else.

We got many examples of this problem in the network stack. A good example is tcp_init()
calling into various sub-inits, all of which are never ever supposed to be called by
anybody else.  They should have been just static, but historically are separated into
separate files.

-- 
Gleb Smirnoff



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Yv0VEQge6ttaC0Rv>