Bug 781686 - wrong adresses returned
Summary: wrong adresses returned
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: nss-myhostname
Version: 16
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Lennart Poettering
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-01-14 08:47 UTC by Jean-Jacques Sarton
Modified: 2013-02-13 16:22 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-13 16:22:22 UTC
Type: ---


Attachments (Terms of Use)

Description Jean-Jacques Sarton 2012-01-14 08:47:59 UTC
Description of problem:
a query to getaddrinfo() return IPv6 link local adresses this is wrong!

Version-Release number of selected component (if applicable):
0.3-1

How reproducible:
always

Steps to Reproduce:
1. compile the attached code
2. insert myhostname in the nsswitch.con file
2. call queryHost with the host name
3.
  
Actual results:
For all if which are up, the link local adress fe89:... is returned

Expected results:
link locale adresse shall not be returned!

Additional info:#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <syslog.h>

void printAddr(struct addrinfo *rp)
{
   char ad[80];
   struct sockaddr_in  *sa;
   struct sockaddr_in6 *sa6;
   ad[0] = 0;

   if ( rp->ai_addr != NULL )
   {
      sa  = (struct sockaddr_in*)rp->ai_addr;
      sa6 = (struct sockaddr_in6*)rp->ai_addr;
      switch(sa->sin_family)
      {
         case AF_INET:
            inet_ntop(AF_INET, &sa->sin_addr, ad, sizeof(ad));
         break;
         case AF_INET6:
            inet_ntop(AF_INET6, &sa6->sin6_addr.s6_addr, ad, sizeof(ad));
         break;
      }
   }
   printf("%s",ad);
}

int main(int argc, char **argv)
{
   char *node;
   struct addrinfo hints;
   struct addrinfo *res, *rp;
   int i;
   int family = AF_UNSPEC;

   if ( argc < 2 )
      return 1;
   node = argv[1];

   if ( argc == 3 )
   {
      switch(argv[2][0])
      {
         case '4': family = AF_INET; break;
         case '6': family = AF_INET6; break;
      }
   }

   memset(&hints, 0, sizeof hints);
   hints.ai_family   = family;
   hints.ai_socktype = SOCK_STREAM;
   hints.ai_protocol = 0;
   hints.ai_flags = AI_PASSIVE;

   if ( (i=getaddrinfo(node, NULL, &hints, &res)) != 0)
   {
      fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(i));
      return 1;
   }

   for (i = 1,rp = res; rp != NULL; rp = rp->ai_next, i++)
   {
      printf("%3d: ",i);
      printf("Family inet%1s ",rp->ai_family==AF_INET?"":"6");
      printAddr(rp);
      printf("\n");
   }

   freeaddrinfo(res);
   return 0;
}

Comment 1 Jean-Jacques Sarton 2012-01-14 18:44:20 UTC
RFC 4472              Considerations with IPv6 DNS            April 2006

2.1.  Limited-Scope Addresses

   The IPv6 addressing architecture [RFC4291] includes two kinds of
   local-use addresses: link-local (fe80::/10) and site-local
   (fec0::/10).  The site-local addresses have been deprecated [RFC3879]
   but are discussed with unique local addresses in Appendix A.

   Link-local addresses should never be published in DNS (whether in
   forward or reverse tree), because they have only local (to the
   connected link) significance [WIP-DC2005].

Comment 2 Fedora End Of Life 2013-01-16 15:00:57 UTC
This message is a reminder that Fedora 16 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 16. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '16'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 16's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 16 is end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" and open it against that version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 3 Fedora End Of Life 2013-02-13 16:22:24 UTC
Fedora 16 changed to end-of-life (EOL) status on 2013-02-12. Fedora 16 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.