From: Chuck Lever <chuck.lever@oracle.com>
To: Steve Dickson <steved@redhat.com>
Cc: libtirpc List <libtirpc-devel@lists.sourceforge.net>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH 2/2] Restore creating listening connection to server connections
Date: Tue, 10 Apr 2018 16:29:24 -0600 [thread overview]
Message-ID: <AEE2F42D-04C5-45AA-BC4B-773ED41B238E@oracle.com> (raw)
In-Reply-To: <20180410213043.5545-2-steved@redhat.com>
> On Apr 10, 2018, at 3:30 PM, Steve Dickson <steved@redhat.com> wrote:
>=20
> Commit 46e04a73 changed svc_com_create() to avoid using
> reserve ports but removed the listen() call which
> could break, undocumented expectations, of legacy
> server apps.
>=20
> Reserve ports are not needed for listening ports, so
> the new __binddynport() is used to avoid squatting
> on ports that are assigned to other network services,
> but it is important to say backwards compatible
> with the legacy glibc code so the the listen()
> call is added back.
svc_tli_create should already perform a call to __binddynport()
and to listen(2). That's why those calls were removed from
svc_com_create().
222 if (madefd || !__rpc_sockisbound(fd)) {
223 if (bindaddr =3D=3D NULL) {
224 if (__binddynport(fd) =3D=3D -1) {
225 warnx(
226 "svc_tli_create: could not bind to =
anonymous port");
227 goto freedata;
228 }
229 listen(fd, SOMAXCONN);
230 } else {
231 if (bind(fd,
232 (struct sockaddr *)bindaddr->addr.buf,
233 (socklen_t)si.si_alen) < 0) {
234 warnx(
235 "svc_tli_create: could not bind to requested =
address");
236 goto freedata;
237 }
238 listen(fd, (int)bindaddr->qlen);
239 }
240 =20
241 }
I expect that __rpc_sockisbound(fd) should be false
if svc_tli_create() is called from svc_com_create().
Can you tell why it isn't?
> Signed-off-by: Steve Dickson <steved@redhat.com>
> ---
> src/rpc_soc.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>=20
> diff --git a/src/rpc_soc.c b/src/rpc_soc.c
> index f32a27c..cf15216 100644
> --- a/src/rpc_soc.c
> +++ b/src/rpc_soc.c
> @@ -331,6 +331,13 @@ svc_com_create(fd, sendsize, recvsize, netid)
> madefd =3D TRUE;
> }
>=20
> + if (__binddynport(fd) =3D=3D -1) {
> + if (madefd)
> + (void)close(fd);
> + (void) syslog(LOG_ERR,
> + "svc%s_create: could not bind connection: %m", =
netid);
> + }
> + listen(fd, SOMAXCONN);
> svc =3D svc_tli_create(fd, nconf, NULL, sendsize, recvsize);
> (void) freenetconfigent(nconf);
> if (svc =3D=3D NULL) {
> --=20
> 2.14.3
>=20
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Chuck Lever
next prev parent reply other threads:[~2018-04-10 22:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-10 21:30 [PATCH 1/2] Restore using reserve ports for client connections Steve Dickson
2018-04-10 21:30 ` [PATCH 2/2] Restore creating listening connection to server connections Steve Dickson
2018-04-10 22:29 ` Chuck Lever [this message]
2018-04-11 13:39 ` Steve Dickson
2018-04-10 22:17 ` [Libtirpc-devel] [PATCH 1/2] Restore using reserve ports for client connections Chuck Lever
2018-04-11 12:34 ` Steve Dickson
2018-04-11 12:59 ` Thorsten Kukuk
2018-04-11 14:07 ` Steve Dickson
2018-04-11 14:09 ` Chuck Lever
2018-04-11 14:09 ` Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AEE2F42D-04C5-45AA-BC4B-773ED41B238E@oracle.com \
--to=chuck.lever@oracle.com \
--cc=libtirpc-devel@lists.sourceforge.net \
--cc=linux-nfs@vger.kernel.org \
--cc=steved@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).