Re: correct definition of localhost?

2008-08-09 Thread Aurelien Jarno
On Thu, Aug 07, 2008 at 06:41:46AM +0200, Aurelien Jarno wrote:
> On Mon, Jul 07, 2008 at 06:05:20PM +0200, Aurelien Jarno wrote:
> > Michael Banck a écrit :
> > > On Mon, Jul 07, 2008 at 05:49:04AM +0200, Aurelien Jarno wrote:
> > >> There is a bug upstream, but marked as invalid:
> > >>
> > >>   http://sources.redhat.com/bugzilla/show_bug.cgi?id=4980
> > >>
> > >> According to the upstream developer, there is a rationale for that, but
> > >> he never explained it, despite having been asked numerous times.
> > > 
> > > In his latest reply, the upstream developer said that code got rewritten
> > > since, I have not checked their repository though.
> > 
> > I have just built a version from CVS, and I confirm the bug is fixed.
> > However I failed to find the commit(s) which fixed it, and anyway I
> > doubt it's a single commit. Therefore I don't think we can backport the
> > fix for lenny.
> > 
> > We can try to use the proposed 2.7 patch instead.
> 
> Please open a bug report with severity (at least) important if you
> consider we should fix this bug for lenny. If not, the problem will be
> fixed when we switch to glibc 2.9.
> 

I have been able to identify the patch causing the bug to be fixed in
current glibc CVS. It's the IPv4 and IPv6 unified lookup, which means
the patch is big and not really easy to backport.

Therefore, I will use the proposed patch from the upstream BTS instead,
until we upload glibc 2.9 (for lenny+1)

-- 
  .''`.  Aurelien Jarno | GPG: 1024D/F1BCDB73
 : :' :  Debian developer   | Electrical Engineer
 `. `'   [EMAIL PROTECTED] | [EMAIL PROTECTED]
   `-people.debian.org/~aurel32 | www.aurel32.net


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: correct definition of localhost?

2008-08-06 Thread Aurelien Jarno
On Mon, Jul 07, 2008 at 06:05:20PM +0200, Aurelien Jarno wrote:
> Michael Banck a écrit :
> > On Mon, Jul 07, 2008 at 05:49:04AM +0200, Aurelien Jarno wrote:
> >> There is a bug upstream, but marked as invalid:
> >>
> >>   http://sources.redhat.com/bugzilla/show_bug.cgi?id=4980
> >>
> >> According to the upstream developer, there is a rationale for that, but
> >> he never explained it, despite having been asked numerous times.
> > 
> > In his latest reply, the upstream developer said that code got rewritten
> > since, I have not checked their repository though.
> 
> I have just built a version from CVS, and I confirm the bug is fixed.
> However I failed to find the commit(s) which fixed it, and anyway I
> doubt it's a single commit. Therefore I don't think we can backport the
> fix for lenny.
> 
> We can try to use the proposed 2.7 patch instead.

Please open a bug report with severity (at least) important if you
consider we should fix this bug for lenny. If not, the problem will be
fixed when we switch to glibc 2.9.

-- 
  .''`.  Aurelien Jarno | GPG: 1024D/F1BCDB73
 : :' :  Debian developer   | Electrical Engineer
 `. `'   [EMAIL PROTECTED] | [EMAIL PROTECTED]
   `-people.debian.org/~aurel32 | www.aurel32.net


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: correct definition of localhost?

2008-07-29 Thread Bjørn Mork
Steve Langasek <[EMAIL PROTECTED]> writes:
> On Tue, Jul 08, 2008 at 01:47:51PM +0200, Martijn van Oosterhout wrote:
>> On Tue, Jul 8, 2008 at 2:37 AM, Joey Hess <[EMAIL PROTECTED]> wrote:
>> > http://sourceware.org/bugzilla/show_bug.cgi?id=4980
>
>> I just find it wierd that there doesn't appear to be a single person
>> who can explain the reasoning for the change...
>
> Ulrich made the change, and he's not exactly known for giving helpful
> explanations.  Apparently he thinks bug ping-pong is a better use of his
> time.

Another great example of his wonderful communication skills:
http://lkml.org/lkml/2008/5/31/2

Just in case anyone thought there actually *was* an explanation.


Bjørn
-- 
You pathetic young weakling


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: correct definition of localhost?

2008-07-11 Thread s. keeling
Ralf Hildebrandt <[EMAIL PROTECTED]>:
>  * Martijn van Oosterhout <[EMAIL PROTECTED]>:
> > On Tue, Jul 8, 2008 at 2:37 AM, Joey Hess <[EMAIL PROTECTED]> wrote:
> > > http://sourceware.org/bugzilla/show_bug.cgi?id=4980
> > 
> > I just find it wierd that there doesn't appear to be a single person
> > who can explain the reasoning for the change...
> 
>  That bugtracker entry sure makes some interesting reading

Yeah, and for lurkers, don't be tempted to add to the discussion there
(looking at it in a browser, I was tempted, you may be too).  It's a
bug report, not a forum.  Do that elsewhere.


-- 
Any technology distinguishable from magic is insufficiently advanced.
(*)http://blinkynet.net/comp/uip5.html  Linux Counter #80292
- -http://www.faqs.org/rfcs/rfc1855.htmlPlease, don't Cc: me.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: correct definition of localhost?

2008-07-11 Thread s. keeling
["Followup-To:" header set to linux.debian.devel.]
sean finney <[EMAIL PROTECTED]>:
>  On Tuesday 08 July 2008 06:40:05 pm Steve Langasek wrote:
> 
> > Ulrich made the change, and he's not exactly known for giving helpful
> > explanations.  Apparently he thinks bug ping-pong is a better use of his
> > time.
> 
>  it sounds like we have another contender for the annual j=F6rg schilling=20
>  award[1].

Let's just be thankful he's not as odd as Reiser.


-- 
Any technology distinguishable from magic is insufficiently advanced.
(*)http://blinkynet.net/comp/uip5.html  Linux Counter #80292
- -http://www.faqs.org/rfcs/rfc1855.htmlPlease, don't Cc: me.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: correct definition of localhost?

2008-07-08 Thread sean finney
On Tuesday 08 July 2008 06:40:05 pm Steve Langasek wrote:

> Ulrich made the change, and he's not exactly known for giving helpful
> explanations.  Apparently he thinks bug ping-pong is a better use of his
> time.

it sounds like we have another contender for the annual jörg schilling 
award[1].


sean

[1] http://mako.cc/copyrighteous/images/trophy.png


signature.asc
Description: This is a digitally signed message part.


Re: correct definition of localhost?

2008-07-08 Thread Steve Langasek
On Tue, Jul 08, 2008 at 01:47:51PM +0200, Martijn van Oosterhout wrote:
> On Tue, Jul 8, 2008 at 2:37 AM, Joey Hess <[EMAIL PROTECTED]> wrote:
> > http://sourceware.org/bugzilla/show_bug.cgi?id=4980

> I just find it wierd that there doesn't appear to be a single person
> who can explain the reasoning for the change...

Ulrich made the change, and he's not exactly known for giving helpful
explanations.  Apparently he thinks bug ping-pong is a better use of his
time.

-- 
Steve Langasek   Give me a lever long enough and a Free OS
Debian Developer   to set it on, and I can move the world.
Ubuntu Developerhttp://www.debian.org/
[EMAIL PROTECTED] [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: correct definition of localhost?

2008-07-08 Thread Roger Leigh
On Tue, Jul 08, 2008 at 01:52:43PM +0200, Ralf Hildebrandt wrote:
> * Martijn van Oosterhout <[EMAIL PROTECTED]>:
> > On Tue, Jul 8, 2008 at 2:37 AM, Joey Hess <[EMAIL PROTECTED]> wrote:
> > > http://sourceware.org/bugzilla/show_bug.cgi?id=4980
> > 
> > I just find it wierd that there doesn't appear to be a single person
> > who can explain the reasoning for the change...
> 
> That bugtracker entry sure makes some interesting reading

It brings back memories of

  https://bugzilla.redhat.com/show_bug.cgi?id=119185
  http://lwn.net/Articles/196523/

drepper's attitude is just as bad, even if the effects aren't quite so
severe in this case.


-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?   http://gutenprint.sourceforge.net/
   `-GPG Public Key: 0x25BFB848   Please GPG sign your mail.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: correct definition of localhost?

2008-07-08 Thread Ralf Hildebrandt
* Martijn van Oosterhout <[EMAIL PROTECTED]>:
> On Tue, Jul 8, 2008 at 2:37 AM, Joey Hess <[EMAIL PROTECTED]> wrote:
> > http://sourceware.org/bugzilla/show_bug.cgi?id=4980
> 
> I just find it wierd that there doesn't appear to be a single person
> who can explain the reasoning for the change...

That bugtracker entry sure makes some interesting reading

-- 
Ralf Hildebrandt (i.A. des IT-Zentrums) [EMAIL PROTECTED]
Charite - Universitätsmedizin BerlinTel.  +49 (0)30-450 570-155
Gemeinsame Einrichtung von FU- und HU-BerlinFax.  +49 (0)30-450 570-962
IT-Zentrum Standort CBF send no mail to [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: correct definition of localhost?

2008-07-08 Thread Martijn van Oosterhout
On Tue, Jul 8, 2008 at 2:37 AM, Joey Hess <[EMAIL PROTECTED]> wrote:
> http://sourceware.org/bugzilla/show_bug.cgi?id=4980

I just find it wierd that there doesn't appear to be a single person
who can explain the reasoning for the change...

Have a nice day,
-- 
Martijn van Oosterhout <[EMAIL PROTECTED]> http://svana.org/kleptog/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: correct definition of localhost?

2008-07-07 Thread Joey Hess
http://sourceware.org/bugzilla/show_bug.cgi?id=4980

-- 
see shy jo, Amazed to be able to both mindlessly forward links
from reddit and possibly contribute value this this
thread at the same time. Not amazed at Drepper's behavior,
particualarly.


signature.asc
Description: Digital signature


Re: correct definition of localhost?

2008-07-07 Thread Aurelien Jarno
Michael Banck a écrit :
> On Mon, Jul 07, 2008 at 05:49:04AM +0200, Aurelien Jarno wrote:
>> There is a bug upstream, but marked as invalid:
>>
>>   http://sources.redhat.com/bugzilla/show_bug.cgi?id=4980
>>
>> According to the upstream developer, there is a rationale for that, but
>> he never explained it, despite having been asked numerous times.
> 
> In his latest reply, the upstream developer said that code got rewritten
> since, I have not checked their repository though.

I have just built a version from CVS, and I confirm the bug is fixed.
However I failed to find the commit(s) which fixed it, and anyway I
doubt it's a single commit. Therefore I don't think we can backport the
fix for lenny.

We can try to use the proposed 2.7 patch instead.

-- 
  .''`.  Aurelien Jarno | GPG: 1024D/F1BCDB73
 : :' :  Debian developer   | Electrical Engineer
 `. `'   [EMAIL PROTECTED] | [EMAIL PROTECTED]
   `-people.debian.org/~aurel32 | www.aurel32.net


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: correct definition of localhost?

2008-07-07 Thread Michael Banck
On Mon, Jul 07, 2008 at 05:49:04AM +0200, Aurelien Jarno wrote:
> There is a bug upstream, but marked as invalid:
> 
>   http://sources.redhat.com/bugzilla/show_bug.cgi?id=4980
> 
> According to the upstream developer, there is a rationale for that, but
> he never explained it, despite having been asked numerous times.

In his latest reply, the upstream developer said that code got rewritten
since, I have not checked their repository though.


Michael


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: correct definition of localhost?

2008-07-06 Thread Kurt Roeckx
On Sun, Jul 06, 2008 at 05:14:44PM -0700, Steve Langasek wrote:
> On Mon, Jul 07, 2008 at 01:39:37AM +0200, Kurt Roeckx wrote:
> 
> > You don't seem to request ipv4 addresses, you request AF_UNSPEC, which
> > should get you both ipv4 and ipv6.  You get 127.0.0.1 twice, and ::1 one
> > time.
> 
> You'll find that the duplication of 127.0.0.1 is still there if you specify
> AF_INET instead, because the problematic duplication happens when requesting
> records for the ipv4 address family.  I left it as AF_UNSPEC in the test
> case to show that the problem exists when using protocol-agnostic best
> practices, which is what slapd does.

I was just confused when reading it, and understood it as only
requesting AF_INET.  That was just to make it clear.

> >> - the ::1 address should *not* be special-cased by nss_files.  I really
> >>   can't perceive any reason why it should be special-cased in the first
> >>   place; i.e., why should the files backend behave differently than the DNS
> >>   backend, and why would we want names that were specifically assigned to
> >>   ::1, including names like "ip6-loopback", to be automatically mapped to
> >>   127.0.0.1?
> 
> > I can't find any good reason why it should be changing ::1 to 127.0.0.1.
> > So I think that atleast glibc should stop doing that.  In any case, it
> > shouldn't return 127.0.0.1 twice when it's not configured to return
> > it twice.
> 
> What do you mean by "configured to return it twice"?  Would that mean
> duplicate lines in /etc/hosts (i.e., misconfiguration)?

Yes.

> >> - we should only set up a single 'localhost' entry in /etc/hosts, pointing
> >>   at ::1, and let nss_files handle the mapping to 127.0.0.1 automatically.
> 
> > - You could also argue that openldap should get fixed to deal with cases
> >   where it tries to bind to the same ip/port twice.  On the other hand,
> >   I don't think it a normal case, and I think it's unlikely that people
> >   would set up dns to have 2 times the same IP address and then try
> >   to bind to that hostname.
> 
> Well, as I said before,
> 
> >> I don't think it's the responsibility of callers such as slapd to check 
> >> that
> >> getaddrinfo() hasn't returned duplicate entries [...]
> 
> so if you have an argument of why extra complexity should be added to the
> caller to deal with duplicate records which, one way or another, should not
> exist (IMHO), I'm interested to hear it.

The only case I can come up with would be misconfiguration, which I
don't think is a good reason.


Kurt


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: correct definition of localhost?

2008-07-06 Thread Aurelien Jarno
Steve Langasek a écrit :
> Hi folks,
> 
> I've run across an ipv4/ipv6 configuration issue which I think needs to have
> light cast on it so we can try to resolve this in time for lenny (whatever
> the right resolution actually is), in order to avoid a pile-up of
> /etc/hosts-related kludges as has been known to happen before...
> 
> In response to bug #427067, the netbase maintainer made a change that adds
> localhost as an alias for ::1 on new installs.  In April of this year, the
> Debian Installer team followed suit, adding this line in the netcfg udeb.
> 
> The result of these changes is that since July 2007, any new lenny or sid
> chroots have had two addresses listed for localhost, and since April of this
> year, any new installs of lenny done using d-i have had it as well.
> 
> Now, the problem I ran into is that when I enabled the test suite in the
> openldap2.3 package, the build failed mysteriously on a seemingly random set
> of architectures.  The reason?  The test suite configures slapd to run on a
> particular port on localhost, and the glibc "files" NSS backend
> special-cases the ::1 IPv6 loopback address, so that when you request an
> IPv4 address, it will map any ::1 entries to 127.0.0.1 for you.  But of
> course we already have an entry for localhost as 127.0.0.1, so now we end up
> with duplicate addresses returned, and slapd tries to bind twice to the same
> address and port!
> 
> A test program showing this behavior is attached - compile and run it on a
> system with '::1 localhost' set in /etc/hosts, and you'll see 127.0.0.1
> returned twice.  An alternate test case, which also works on systems with
> older /etc/hosts and which I think shows the counterintuitiveness of the
> nss_files special-casing, is to run "getent ahostsv4 ip6-localhost".
> 
> I don't think it's the responsibility of callers such as slapd to check that
> getaddrinfo() hasn't returned duplicate entries, so I see a couple of
> solutions here:
> 
> - the ::1 address should *not* be special-cased by nss_files.  I really
>   can't perceive any reason why it should be special-cased in the first
>   place; i.e., why should the files backend behave differently than the DNS
>   backend, and why would we want names that were specifically assigned to
>   ::1, including names like "ip6-loopback", to be automatically mapped to
>   127.0.0.1?
> 
> - we should only set up a single 'localhost' entry in /etc/hosts, pointing
>   at ::1, and let nss_files handle the mapping to 127.0.0.1 automatically.
> 
> Are there other solutions that should be considered?  Is one of these more
> acceptable than the other?  To me it seems obvious that the best choice is
> to not treat the files backend specially in the first place, but I don't
> know the rationale behind this special-casing either.

There is a bug upstream, but marked as invalid:

  http://sources.redhat.com/bugzilla/show_bug.cgi?id=4980

According to the upstream developer, there is a rationale for that, but
he never explained it, despite having been asked numerous times.

Somebody has published a patch, if it works as expected, it may be worth
to include it in Debian.

Cheers,
Aurelien

-- 
  .''`.  Aurelien Jarno | GPG: 1024D/F1BCDB73
 : :' :  Debian developer   | Electrical Engineer
 `. `'   [EMAIL PROTECTED] | [EMAIL PROTECTED]
   `-people.debian.org/~aurel32 | www.aurel32.net


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: correct definition of localhost?

2008-07-06 Thread William Pitcock
On Sun, 2008-07-06 at 17:14 -0700, Steve Langasek wrote:
> 
> As for DNS, at least in the case of bind I find that duplicate records
> are
> weeded out by the server.  If you can suggest a DNS server that would
> not
> condense the duplicate records, I'd be happy to test to see what the
> behavior of nss_dns is.

PowerDNS doesn't condense anything. It returns whatever is in the MySQL
database...

William


signature.asc
Description: This is a digitally signed message part


Re: correct definition of localhost?

2008-07-06 Thread Steve Langasek
On Mon, Jul 07, 2008 at 01:39:37AM +0200, Kurt Roeckx wrote:

> You don't seem to request ipv4 addresses, you request AF_UNSPEC, which
> should get you both ipv4 and ipv6.  You get 127.0.0.1 twice, and ::1 one
> time.

You'll find that the duplication of 127.0.0.1 is still there if you specify
AF_INET instead, because the problematic duplication happens when requesting
records for the ipv4 address family.  I left it as AF_UNSPEC in the test
case to show that the problem exists when using protocol-agnostic best
practices, which is what slapd does.

>> - the ::1 address should *not* be special-cased by nss_files.  I really
>>   can't perceive any reason why it should be special-cased in the first
>>   place; i.e., why should the files backend behave differently than the DNS
>>   backend, and why would we want names that were specifically assigned to
>>   ::1, including names like "ip6-loopback", to be automatically mapped to
>>   127.0.0.1?

> I can't find any good reason why it should be changing ::1 to 127.0.0.1.
> So I think that atleast glibc should stop doing that.  In any case, it
> shouldn't return 127.0.0.1 twice when it's not configured to return
> it twice.

What do you mean by "configured to return it twice"?  Would that mean
duplicate lines in /etc/hosts (i.e., misconfiguration)?

>> - we should only set up a single 'localhost' entry in /etc/hosts, pointing
>>   at ::1, and let nss_files handle the mapping to 127.0.0.1 automatically.

> - You could also argue that openldap should get fixed to deal with cases
>   where it tries to bind to the same ip/port twice.  On the other hand,
>   I don't think it a normal case, and I think it's unlikely that people
>   would set up dns to have 2 times the same IP address and then try
>   to bind to that hostname.

Well, as I said before,

>> I don't think it's the responsibility of callers such as slapd to check that
>> getaddrinfo() hasn't returned duplicate entries [...]

so if you have an argument of why extra complexity should be added to the
caller to deal with duplicate records which, one way or another, should not
exist (IMHO), I'm interested to hear it.

As for DNS, at least in the case of bind I find that duplicate records are
weeded out by the server.  If you can suggest a DNS server that would not
condense the duplicate records, I'd be happy to test to see what the
behavior of nss_dns is.

-- 
Steve Langasek   Give me a lever long enough and a Free OS
Debian Developer   to set it on, and I can move the world.
Ubuntu Developerhttp://www.debian.org/
[EMAIL PROTECTED] [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: correct definition of localhost?

2008-07-06 Thread Kurt Roeckx
On Sun, Jul 06, 2008 at 03:09:09PM -0700, Steve Langasek wrote:
> Hi folks,
> 
> I've run across an ipv4/ipv6 configuration issue which I think needs to have
> light cast on it so we can try to resolve this in time for lenny (whatever
> the right resolution actually is), in order to avoid a pile-up of
> /etc/hosts-related kludges as has been known to happen before...
> 
> In response to bug #427067, the netbase maintainer made a change that adds
> localhost as an alias for ::1 on new installs.  In April of this year, the
> Debian Installer team followed suit, adding this line in the netcfg udeb.
> 
> The result of these changes is that since July 2007, any new lenny or sid
> chroots have had two addresses listed for localhost, and since April of this
> year, any new installs of lenny done using d-i have had it as well.
> 
> Now, the problem I ran into is that when I enabled the test suite in the
> openldap2.3 package, the build failed mysteriously on a seemingly random set
> of architectures.  The reason?  The test suite configures slapd to run on a
> particular port on localhost, and the glibc "files" NSS backend
> special-cases the ::1 IPv6 loopback address, so that when you request an
> IPv4 address, it will map any ::1 entries to 127.0.0.1 for you.  But of
> course we already have an entry for localhost as 127.0.0.1, so now we end up
> with duplicate addresses returned, and slapd tries to bind twice to the same
> address and port!

You don't seem to request ipv4 addresses, you request AF_UNSPEC, which
should get you both ipv4 and ipv6.  You get 127.0.0.1 twice, and ::1 one
time.

> A test program showing this behavior is attached - compile and run it on a
> system with '::1 localhost' set in /etc/hosts, and you'll see 127.0.0.1
> returned twice.  An alternate test case, which also works on systems with
> older /etc/hosts and which I think shows the counterintuitiveness of the
> nss_files special-casing, is to run "getent ahostsv4 ip6-localhost".
> 
> I don't think it's the responsibility of callers such as slapd to check that
> getaddrinfo() hasn't returned duplicate entries, so I see a couple of
> solutions here:
> 
> - the ::1 address should *not* be special-cased by nss_files.  I really
>   can't perceive any reason why it should be special-cased in the first
>   place; i.e., why should the files backend behave differently than the DNS
>   backend, and why would we want names that were specifically assigned to
>   ::1, including names like "ip6-loopback", to be automatically mapped to
>   127.0.0.1?

I can't find any good reason why it should be changing ::1 to 127.0.0.1.
So I think that atleast glibc should stop doing that.  In any case, it
shouldn't return 127.0.0.1 twice when it's not configured to return
it twice.

> - we should only set up a single 'localhost' entry in /etc/hosts, pointing
>   at ::1, and let nss_files handle the mapping to 127.0.0.1 automatically.

- You could also argue that openldap should get fixed to deal with cases
  where it tries to bind to the same ip/port twice.  On the other hand,
  I don't think it a normal case, and I think it's unlikely that people
  would set up dns to have 2 times the same IP address and then try
  to bind to that hostname.


Kurt


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



correct definition of localhost?

2008-07-06 Thread Steve Langasek
Hi folks,

I've run across an ipv4/ipv6 configuration issue which I think needs to have
light cast on it so we can try to resolve this in time for lenny (whatever
the right resolution actually is), in order to avoid a pile-up of
/etc/hosts-related kludges as has been known to happen before...

In response to bug #427067, the netbase maintainer made a change that adds
localhost as an alias for ::1 on new installs.  In April of this year, the
Debian Installer team followed suit, adding this line in the netcfg udeb.

The result of these changes is that since July 2007, any new lenny or sid
chroots have had two addresses listed for localhost, and since April of this
year, any new installs of lenny done using d-i have had it as well.

Now, the problem I ran into is that when I enabled the test suite in the
openldap2.3 package, the build failed mysteriously on a seemingly random set
of architectures.  The reason?  The test suite configures slapd to run on a
particular port on localhost, and the glibc "files" NSS backend
special-cases the ::1 IPv6 loopback address, so that when you request an
IPv4 address, it will map any ::1 entries to 127.0.0.1 for you.  But of
course we already have an entry for localhost as 127.0.0.1, so now we end up
with duplicate addresses returned, and slapd tries to bind twice to the same
address and port!

A test program showing this behavior is attached - compile and run it on a
system with '::1 localhost' set in /etc/hosts, and you'll see 127.0.0.1
returned twice.  An alternate test case, which also works on systems with
older /etc/hosts and which I think shows the counterintuitiveness of the
nss_files special-casing, is to run "getent ahostsv4 ip6-localhost".

I don't think it's the responsibility of callers such as slapd to check that
getaddrinfo() hasn't returned duplicate entries, so I see a couple of
solutions here:

- the ::1 address should *not* be special-cased by nss_files.  I really
  can't perceive any reason why it should be special-cased in the first
  place; i.e., why should the files backend behave differently than the DNS
  backend, and why would we want names that were specifically assigned to
  ::1, including names like "ip6-loopback", to be automatically mapped to
  127.0.0.1?

- we should only set up a single 'localhost' entry in /etc/hosts, pointing
  at ::1, and let nss_files handle the mapping to 127.0.0.1 automatically.

Are there other solutions that should be considered?  Is one of these more
acceptable than the other?  To me it seems obvious that the best choice is
to not treat the files backend specially in the first place, but I don't
know the rationale behind this special-casing either.

Cheers,
-- 
Steve Langasek   Give me a lever long enough and a Free OS
Debian Developer   to set it on, and I can move the world.
Ubuntu Developerhttp://www.debian.org/
[EMAIL PROTECTED] [EMAIL PROTECTED]
#include 
#include 
#include 
#include 
#include 
#include 

int main() {
	const char *host= "localhost";
	const char *port= "9011";
	struct addrinfo hints, *res, *sai;
	struct hostent *result;
	char buf[INET6_ADDRSTRLEN];
	int buflen = sizeof(buf);
	int err;

	/* this call is just here to force glibc to set up the internal
	 * _res state, so that it sees the "multi on" that's configured
	 * by default in /etc/host.conf when we call getaddrinfo() below.
	 * Of course we could just use gethostbyname_r() itself, but
	 * getaddrinfo() is a truer test case.
	 */
	gethostbyname_r(host, NULL, NULL, 0, &result, &err);

	memset( &hints, '\0', sizeof(hints) );
	hints.ai_flags = AI_PASSIVE;
	hints.ai_socktype = SOCK_STREAM;
	hints.ai_family = AF_UNSPEC;

	err = getaddrinfo(host, port, &hints, &res);
	if (err) {
		perror("getaddrinfo failed");
		exit(1);
	}

	for (sai = res; sai != NULL; sai = sai->ai_next)
	{
		switch (sai->ai_family) {
		case AF_INET6:
			inet_ntop(AF_INET6,
			  &((struct sockaddr_in6 *)sai->ai_addr)->sin6_addr,
			  buf, buflen);
break;
		case AF_INET:
			inet_ntop(AF_INET,
			  &((struct sockaddr_in *)sai->ai_addr)->sin_addr,
			  buf, buflen);
break;
		}

		printf("name returned: %s\n",buf);
	}
}