Date: Mon, 19 Jan 2015 00:33:33 +0000 (UTC) From: Ryan Stone <rstone@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277352 - in head/usr.sbin: mountd rpc.lockd rpc.statd Message-ID: <201501190033.t0J0XXqZ056601@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rstone Date: Mon Jan 19 00:33:32 2015 New Revision: 277352 URL: https://svnweb.freebsd.org/changeset/base/277352 Log: When mountd is creating sockets, it iterates over all addresses specified in the "hosts" array and eventually looks up the network address with getaddrinfo(). At one point it checks for a numeric address and if it sees one, it sets a hint parameter to force getaddrinfo to interpret the host as a numeric address. However that hint is not cleared for subsequent iterations of the loop and if any hosts seen after this point are host names, getaddrinfo will fail on the name. The result of this bug is that you cannot pass a host name to the -h flag. Unfortunately, the first iteration will either process ::1 or 127.0.0.1, so the flag is set on the first iteration and all host names will fail to be processed. The same bug applies to rpc.lockd and rpc.statd, so fix them too. Differential Revision: https://reviews.freebsd.org/D1507 Reported by: Dylan Martin MFC after: 1 week Sponsored by: Sandvine Inc. Modified: head/usr.sbin/mountd/mountd.c head/usr.sbin/rpc.lockd/lockd.c head/usr.sbin/rpc.statd/statd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Sun Jan 18 23:15:49 2015 (r277351) +++ head/usr.sbin/mountd/mountd.c Mon Jan 19 00:33:32 2015 (r277352) @@ -627,7 +627,6 @@ create_service(struct netconfig *nconf) /* Get mountd's address on this transport */ memset(&hints, 0, sizeof hints); - hints.ai_flags = AI_PASSIVE; hints.ai_family = si.si_af; hints.ai_socktype = si.si_socktype; hints.ai_protocol = si.si_proto; @@ -644,6 +643,8 @@ create_service(struct netconfig *nconf) sock_fd[sock_fdcnt++] = -1; /* Set invalid for now. */ mallocd_res = 0; + hints.ai_flags = AI_PASSIVE; + /* * XXX - using RPC library internal functions. */ Modified: head/usr.sbin/rpc.lockd/lockd.c ============================================================================== --- head/usr.sbin/rpc.lockd/lockd.c Sun Jan 18 23:15:49 2015 (r277351) +++ head/usr.sbin/rpc.lockd/lockd.c Mon Jan 19 00:33:32 2015 (r277352) @@ -518,7 +518,6 @@ create_service(struct netconfig *nconf) /* Get rpc.statd's address on this transport */ memset(&hints, 0, sizeof hints); - hints.ai_flags = AI_PASSIVE; hints.ai_family = si.si_af; hints.ai_socktype = si.si_socktype; hints.ai_protocol = si.si_proto; @@ -534,6 +533,7 @@ create_service(struct netconfig *nconf) out_of_mem(); sock_fd[sock_fdcnt++] = -1; /* Set invalid for now. */ mallocd_res = 0; + hints.ai_flags = AI_PASSIVE; /* * XXX - using RPC library internal functions. Modified: head/usr.sbin/rpc.statd/statd.c ============================================================================== --- head/usr.sbin/rpc.statd/statd.c Sun Jan 18 23:15:49 2015 (r277351) +++ head/usr.sbin/rpc.statd/statd.c Mon Jan 19 00:33:32 2015 (r277352) @@ -343,7 +343,6 @@ create_service(struct netconfig *nconf) /* Get rpc.statd's address on this transport */ memset(&hints, 0, sizeof hints); - hints.ai_flags = AI_PASSIVE; hints.ai_family = si.si_af; hints.ai_socktype = si.si_socktype; hints.ai_protocol = si.si_proto; @@ -359,6 +358,7 @@ create_service(struct netconfig *nconf) out_of_mem(); sock_fd[sock_fdcnt++] = -1; /* Set invalid for now. */ mallocd_res = 0; + hints.ai_flags = AI_PASSIVE; /* * XXX - using RPC library internal functions.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501190033.t0J0XXqZ056601>