From jdc@parodius.com  Mon Apr 24 01:20:54 2006
Return-Path: <jdc@parodius.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 0578F16A405
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 24 Apr 2006 01:20:54 +0000 (UTC)
	(envelope-from jdc@parodius.com)
Received: from mx1.parodius.com (mx1.parodius.com [64.62.145.229])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3491D43D5E
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 24 Apr 2006 01:20:53 +0000 (GMT)
	(envelope-from jdc@parodius.com)
Received: by mx1.parodius.com (Postfix, from userid 500)
	id EC2EE5E33; Sun, 23 Apr 2006 18:20:52 -0700 (PDT)
Message-Id: <20060424012052.EC2EE5E33@mx1.parodius.com>
Date: Sun, 23 Apr 2006 18:20:52 -0700 (PDT)
From: Jeremy Chadwick <freebsd@jdc.parodius.com>
Reply-To: Jeremy Chadwick <freebsd@jdc.parodius.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: rpcbind ignores NO_INET6=yes in make.conf
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         96242
>Category:       kern
>Synopsis:       [rpc] rpcbind ignores NO_INET6=yes in make.conf
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    yar
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 24 01:30:16 GMT 2006
>Closed-Date:    Sun Aug 06 10:55:34 GMT 2006
>Last-Modified:  Sun Aug 06 10:55:34 GMT 2006
>Originator:     Jeremy Chadwick
>Release:        FreeBSD 6.1-RC i386
>Organization:
Parodius Networking
>Environment:
FreeBSD eos.parodius.com 6.1-RC FreeBSD 6.1-RC #0: Sun Apr 23 17:10:37 PDT 2006     root@eos.parodius.com:/usr/obj/usr/src/sys/EOS  i386
>Description:
	This appears to be a repeat of the situation in PR 73865,
	except for 6.1.  It appears 6.1 does something different...

	When starting rpcbind with a kernel that lacks INET6 support,
	even despite NO_INET6=true being in make.conf, users are shown
	the following:

Apr 23 17:51:12 eos rpcbind: cannot get information for udp6
Apr 23 17:51:12 eos rpcbind: cannot get information for tcp6

	Possibly the problem is within libc, because rpcbind relies on
	the libc call __rpc_nconf2sockinfo() to determine whether or
	not to spit out the above warning message?

	What I'm trying to say is using NOINET6 on FreeBSD 5.x fixes
	this, while using NO_INET6 on FreeBSD 6.x does not.

	Details of commits to rpcbind recently:

http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.sbin/rpcbind/#dirlist
>How-To-Repeat:
	`/etc/rc.d/rpcbind start` on a system which lacks INET6 support
	in the kernel.
>Fix:
	None at this time.

>Release-Note:
>Audit-Trail:

From: Alex Kozlov <spam@rm-rf.kiev.ua>
To: Jeremy Chadwick <freebsd@jdc.parodius.com>
Cc: bug-followup@freebsd.org, freebsd-bugs@freebsd.org
Subject: Re: kern/96242: rpcbind ignores NO_INET6=yes in make.conf
Date: Mon, 24 Apr 2006 06:52:38 +0300

 On Sun, Apr 23, 2006 at 08:36:56PM -0700, Jeremy Chadwick wrote:
 > On Mon, Apr 24, 2006 at 06:10:50AM +0300, Alex Kozlov wrote:
 > > It harmless. 
 > > But if you wish, you can comment udp6/tcp6 lines in /etc/netconfig
 > 
 > Hey, thanks for this!  That totally fixed the problem.  Surprisingly,
 > until now, I'd never heard of that file...
 Plain, old TI-RPC ')
 
 > 
 > Again, thanks!
 This is quick and dirty fix.
 In more propper way you may want apply this patch:
 
 --- rpcbind.c	Sun Nov  7 06:32:51 2004
 +++ rpcbind.c.new	Mon Apr 24 06:42:19 2006
 @@ -173,7 +173,12 @@
  	init_transport(nconf);
  
  	while ((nconf = getnetconfig(nc_handle))) {
 +#ifdef INET6
  		if (nconf->nc_flag & NC_VISIBLE)
 +#else
 +		if (nconf->nc_flag & NC_VISIBLE &&
 +					   nconf->nc_protofmly !=NC_INET6 )
 +#endif
  			init_transport(nconf);
  	}
  	endnetconfig(nc_handle);
 
 --
 Adios

From: Alex Kozlov <stalker@rm-rf.kiev.ua>
To: Jeremy Chadwick <freebsd@jdc.parodius.com>
Cc: bug-followup@freebsd.org
Subject: Re: kern/96242: rpcbind ignores NO_INET6=yes in make.conf
Date: Mon, 24 Apr 2006 09:07:03 +0300

 On Mon, Apr 24, 2006 at 06:52:38AM +0300, Alex Kozlov wrote:
 > On Sun, Apr 23, 2006 at 08:36:56PM -0700, Jeremy Chadwick wrote:
 > > On Mon, Apr 24, 2006 at 06:10:50AM +0300, Alex Kozlov wrote:
 > > > It harmless. 
 > > > But if you wish, you can comment udp6/tcp6 lines in /etc/netconfig
 > > 
 > > Hey, thanks for this!  That totally fixed the problem.  Surprisingly,
 > > until now, I'd never heard of that file...
 > Plain, old TI-RPC ')
 > 
 > > 
 > > Again, thanks!
 > This is quick and dirty fix.
 > In more propper way you may want apply this patch:
 > 
 Sorry. I mean:
 --- rpcbind.c   Sun Nov  7 06:32:51 2004
 +++ rpcbind.c.new Mon Apr 24 08:55:48 2006
 @@ -173,7 +173,12 @@
     init_transport(nconf);
 
     while ((nconf = getnetconfig(nc_handle))) {
 +#ifdef INET6
         if (nconf->nc_flag & NC_VISIBLE)
 +#else
 +       if (nconf->nc_flag & NC_VISIBLE &&
 +                      strcmp(nconf->nc_protofmly, NC_INET6) != 0)
 +#endif
             init_transport(nconf);
     }
     endnetconfig(nc_handle);
 
 
 --
 Adios

From: Jeremy Chadwick <freebsd@jdc.parodius.com>
To: Alex Kozlov <stalker@rm-rf.kiev.ua>
Cc: bug-followup@freebsd.org
Subject: Re: kern/96242: rpcbind ignores NO_INET6=yes in make.conf
Date: Tue, 25 Apr 2006 04:51:48 -0700

 On Mon, Apr 24, 2006 at 09:07:03AM +0300, Alex Kozlov wrote:
 > {snip patch}
 
 This patch works great.  I'd say go ahead and commit, but one thing
 to point out: style(9) says the following:
 
 Unary operators do not require spaces, binary operators do.  Do not use
 parentheses unless they are required for precedence or unless the state-
 ment is confusing without them.  Remember that other people may confuse
 easier than you.  Do YOU understand the following?
 
         a = b->c[0] + ~d == (e || f) || g && h ? i : j >> 1;
         k = !(l & FLAGS);
 
 That said, I'd recommend this instead:
 
 	if ( (nconf->nc_flag & NC_VISIBLE) &&
 		(strcmp(nconf->nc_protofmly, NC_INET6) != 0) )
 
 I'm being picky, of course... that's all.  :-)
 
 -- 
 | Jeremy Chadwick                                 jdc at parodius.com |
 | Parodius Networking                        http://www.parodius.com/ |
 | UNIX Systems Administrator                   Mountain View, CA, USA |
 | Making life hard for others since 1977.                             |
 

From: Alex Kozlov <spam@rm-rf.kiev.ua>
To: Jeremy Chadwick <freebsd@jdc.parodius.com>
Cc: bug-followup@freebsd.org
Subject: Re: kern/96242: rpcbind ignores NO_INET6=yes in make.conf
Date: Tue, 25 Apr 2006 19:00:11 +0300

 On Tue, Apr 25, 2006 at 04:51:48AM -0700, Jeremy Chadwick wrote:
 > On Mon, Apr 24, 2006 at 09:07:03AM +0300, Alex Kozlov wrote:
 
 > That said, I'd recommend this instead:
 > 
 > 	if ( (nconf->nc_flag & NC_VISIBLE) &&
 > 		(strcmp(nconf->nc_protofmly, NC_INET6) != 0) )
 > 
 > I'm being picky, of course... that's all.  :-)
 This is your pr. You can make any necessary changes.
 
 --
 Adios
Responsible-Changed-From-To: freebsd-bugs->yar 
Responsible-Changed-By: yar 
Responsible-Changed-When: Wed Jul 26 08:47:00 UTC 2006 
Responsible-Changed-Why:  
This is related to my pet toy PR bin/100805. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=96242 

From: Yar Tikhiy <yar@comp.chem.msu.su>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/96242: [rpc] rpcbind ignores NO_INET6=yes in make.conf
Date: Thu, 27 Jul 2006 17:44:27 +0400

 JFTR: rpcinfo(1) may have similarities to rpcbind(8).
 Presently src/usr.bin/rpcinfo/rpcinfo.c doesn't depend
 on INET6 explicitly.  It may have implicit dependencies
 that would pop up if run in an IPv6-disabled system, as
 in this PR.
 
 I should test this later.
 
 -- 
 Yar
State-Changed-From-To: open->feedback 
State-Changed-By: yar 
State-Changed-When: Sat Jul 29 19:06:37 UTC 2006 
State-Changed-Why:  
I don't think that the issue should be fixed by the questionable hack 
in rpcbind(8).  When a system doesn't support INET6, its config 
files shouldn't use INET6-specific directives in the first place. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=96242 

From: Yar Tikhiy <yar@comp.chem.msu.su>
To: bug-followup@FreeBSD.org, freebsd@jdc.parodius.com, stalker@rm-rf.kiev.ua
Cc:  
Subject: Re: kern/96242: [rpc] rpcbind ignores NO_INET6=yes in make.conf
Date: Sat, 29 Jul 2006 22:56:38 +0400

 Hi folks,
 
 I do not like the idea of changing rpcbind.c so that it skips over
 "inet6" lines in /etc/netconfig if built without -DINET6.  When you
 compile something without -DINET6, the utility isn't supposed to
 know of INET6 at all.  On the contrary, the proposed change uses
 NC_INET6 in the !INET6 case, which is next to nonsense.  When the
 system is built without INET6 support, its config files shouldn't
 use INET6-specific directives.  Another example is sendmail:  When
 built without -DINET6, it chokes on the stock freebsd.cf because
 it doesn't know of Family=inet6.  This can seem inconvenient, but
 it's the right way of things.
 
 Therefore I think that this PR should be closed without applying
 the change to rpcbind.
 
 -- 
 Yar

From: Jeremy Chadwick <freebsd@jdc.parodius.com>
To: Yar Tikhiy <yar@comp.chem.msu.su>
Cc: bug-followup@FreeBSD.org, stalker@rm-rf.kiev.ua
Subject: Re: kern/96242: [rpc] rpcbind ignores NO_INET6=yes in make.conf
Date: Sat, 29 Jul 2006 12:54:55 -0700

 On Sat, Jul 29, 2006 at 10:56:38PM +0400, Yar Tikhiy wrote:
 > Hi folks,
 > 
 > I do not like the idea of changing rpcbind.c so that it skips over
 > "inet6" lines in /etc/netconfig if built without -DINET6.  When you
 > compile something without -DINET6, the utility isn't supposed to
 > know of INET6 at all.  On the contrary, the proposed change uses
 > NC_INET6 in the !INET6 case, which is next to nonsense.  When the
 > system is built without INET6 support, its config files shouldn't
 > use INET6-specific directives.  Another example is sendmail:  When
 > built without -DINET6, it chokes on the stock freebsd.cf because
 > it doesn't know of Family=inet6.  This can seem inconvenient, but
 > it's the right way of things.
 > 
 > Therefore I think that this PR should be closed without applying
 > the change to rpcbind.
 
 I both agree and disagree here.
 
 The problem is that if you remove IPv6 support from the FreeBSD
 kernel (e.g. remove "options INET6"), you must also rebuild all
 binaries on the system to let them know that IPv6 capable
 functions and general networking framework (amongst other things,
 including configuration file directives) are no longer available.
 
 There are tons of base-system applications which have this kind-of
 solution applied to them already.  In fact, many open-source
 applications let you decide this during configure-time using
 things like --disable-ipv6.  This completely disabled IPv6-related
 code in the application.  The same should apply to FreeBSD
 binaries per the NO_INET6 make.conf directive.
 
 The other problem is that if a system is built without IPv6 support
 in the kernel, and the application blindly attempts to bind to
 an IPv6 number (e.g. ::1 for localhost, or binding to the IPv6-
 equivalent of INADDR_ANY), the application is going to fail in
 one of two ways: 1) the libc calls for IPv6 support won't exist,
 which means the application won't compile, 2) assuming the app-
 lication does compile, libc calls with arguments that use IPv6
 parameters will return with a failure, which will cause the
 application to spit out nastygrams (such as rpcbind(8), for
 example!) on the console or in logs.
 
 Basically what I'm trying to say is this:
 
 Removing "options IPV6" in the kernel, and adding NO_INET6=true
 to make.conf, buildkernel, installkernel, buildworld, installworld,
 mergemaster, should result in a system that does not try to do
 ANYTHING related to IPv6.  By that I mean, there should be absolutely
 no IPv6-related code in any binary on the system, including the
 kernel.
 
 > I don't think that the issue should be fixed by the questionable hack 
 > in rpcbind(8).  When a system doesn't support INET6, its config 
 > files shouldn't use INET6-specific directives in the first place. 
 
 This is where I do agree; the configuration files which use IPv6
 directives (e.g. Family=inet6 in sendmail.mc, and tcp6/udp6 in
 netconfig) should reflect this change.
 
 mergemaster would be the tool to manage this kind-of change.  We
 should bring in the mergemaster maintainer(s) to handle something
 like this -- though I have no idea how to implement it...
 
 -- 
 | Jeremy Chadwick                                 jdc at parodius.com |
 | Parodius Networking                        http://www.parodius.com/ |
 | UNIX Systems Administrator                   Mountain View, CA, USA |
 | Making life hard for others since 1977.               PGP: 4BD6C0CB |
 

From: Yar Tikhiy <yar@comp.chem.msu.su>
To: Jeremy Chadwick <freebsd@jdc.parodius.com>
Cc: bug-followup@freebsd.org
Subject: Re: kern/96242: [rpc] rpcbind ignores NO_INET6=yes in make.conf
Date: Wed, 2 Aug 2006 02:18:49 +0400

 On Sat, Jul 29, 2006 at 08:00:46PM +0000, Jeremy Chadwick wrote:
 >  On Sat, Jul 29, 2006 at 10:56:38PM +0400, Yar Tikhiy wrote:
 >  > Hi folks,
 >  > 
 >  > I do not like the idea of changing rpcbind.c so that it skips over
 >  > "inet6" lines in /etc/netconfig if built without -DINET6.  When you
 >  > compile something without -DINET6, the utility isn't supposed to
 >  > know of INET6 at all.  On the contrary, the proposed change uses
 >  > NC_INET6 in the !INET6 case, which is next to nonsense.  When the
 >  > system is built without INET6 support, its config files shouldn't
 >  > use INET6-specific directives.  Another example is sendmail:  When
 >  > built without -DINET6, it chokes on the stock freebsd.cf because
 >  > it doesn't know of Family=inet6.  This can seem inconvenient, but
 >  > it's the right way of things.
 >  > 
 >  > Therefore I think that this PR should be closed without applying
 >  > the change to rpcbind.
 >  
 >  I both agree and disagree here.
 
 I fully understand your ambivalent feelings over this issue :-)
 
 >  The problem is that if you remove IPv6 support from the FreeBSD
 >  kernel (e.g. remove "options INET6"), you must also rebuild all
 >  binaries on the system to let them know that IPv6 capable
 >  functions and general networking framework (amongst other things,
 >  including configuration file directives) are no longer available.
 
 Not exactly.  In most cases, IPv6-capable daemons and tools can run
 under a kernel built without "options INET6".  I've been running
 such configurations for years until computers grew so much memory
 that it became needless to cut down the kernel.  You just need to
 avoid asking the daemons to do IPv6 things, and the code will never
 be reached.
 
 >  There are tons of base-system applications which have this kind-of
 >  solution applied to them already.  In fact, many open-source
 >  applications let you decide this during configure-time using
 >  things like --disable-ipv6.  This completely disabled IPv6-related
 >  code in the application.  The same should apply to FreeBSD
 >  binaries per the NO_INET6 make.conf directive.
 
 Ideally, yes.  In practice, however, there are parts of src/ that
 are not ready yet to obey NO_INET6 (or WITHOUT_INET6 in CURRENT.)
 I'm starting to doubt the idea of fixing all such places because
 it's tedious work and IPv6 is becoming more and more popular.  Can
 you imagine today turning off the plain INET support in the system?
 
 >  The other problem is that if a system is built without IPv6 support
 >  in the kernel, and the application blindly attempts to bind to
 >  an IPv6 number (e.g. ::1 for localhost, or binding to the IPv6-
 >  equivalent of INADDR_ANY), the application is going to fail in
 >  one of two ways: 1) the libc calls for IPv6 support won't exist,
 >  which means the application won't compile, 2) assuming the app-
 
 Well, to the best of my knowledge, there are no special IPv6 calls.
 Fortunately, the IPv6 developers learned the lessons of the past
 well and defined a multi-protocol API.  However, various IPv6-related
 macros can be undefined.  Then 1) is a funny way to test applications
 for how they can do without IPv6 at all.  However, there is a grey
 area.  E.g., should the DNS resolver pretend it doesn't know of
 AAAA records?  And so on...
 
 >  lication does compile, libc calls with arguments that use IPv6
 >  parameters will return with a failure, which will cause the
 >  application to spit out nastygrams (such as rpcbind(8), for
 >  example!) on the console or in logs.
 
 2) is usually the matter of configuration.
 
 >  Basically what I'm trying to say is this:
 >  
 >  Removing "options IPV6" in the kernel, and adding NO_INET6=true
 >  to make.conf, buildkernel, installkernel, buildworld, installworld,
 >  mergemaster, should result in a system that does not try to do
 >  ANYTHING related to IPv6.  By that I mean, there should be absolutely
 >  no IPv6-related code in any binary on the system, including the
 >  kernel.
 
 There is PR bin/100805 bringing up this rather large issue.  Perhaps
 it would be better to go on with it while having closed this PR as
 its topic is quite narrow.
 
 >  > I don't think that the issue should be fixed by the questionable hack 
 >  > in rpcbind(8).  When a system doesn't support INET6, its config 
 >  > files shouldn't use INET6-specific directives in the first place. 
 >  
 >  This is where I do agree; the configuration files which use IPv6
 >  directives (e.g. Family=inet6 in sendmail.mc, and tcp6/udp6 in
 >  netconfig) should reflect this change.
 >  
 >  mergemaster would be the tool to manage this kind-of change.  We
 >  should bring in the mergemaster maintainer(s) to handle something
 >  like this -- though I have no idea how to implement it...
 
 This is a very good point.  But the question is:  Do we have time
 to do all this before IPv6 support becomes mandatory? :-)
 
 -- 
 Yar
State-Changed-From-To: feedback->closed 
State-Changed-By: yar 
State-Changed-When: Sun Aug 6 10:52:16 UTC 2006 
State-Changed-Why:  
The problem didn't prove to be specific to rpcbind, so the latter 
shouldn't be hacked to work around it. 

Please continue the discussion under the more general PR bin/100805. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=96242 
>Unformatted:
