This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3] [BZ #11438] getaddrinfo: map RFC 1918 addresses to global scope


On Tue, Sep 25, 2012 at 03:43:23PM -0400, Carlos O'Donell wrote:
[...]
> Is it possible to add a test-case for this to prevent a regression and
> further validate the changes do what we expect?

It depends on what exactly is needed to be tested for regressions.

It's relatively easy to extend tst-rfc3484.c with a check that 10/8,
172.16/12 and 192.168/16 are in the same scope as 192.0.2/24, e.g.:

diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c
index 29e1461..db3ae1b 100644
--- a/posix/tst-rfc3484.c
+++ b/posix/tst-rfc3484.c
@@ -71,6 +71,9 @@ service_user *__nss_hosts_database attribute_hidden;
 
 struct sockaddr_in addrs[] =
 {
+  { .sin_family = AF_INET, .sin_addr = { h (0x0aa85f19) } },
+  { .sin_family = AF_INET, .sin_addr = { h (0xac105f19) } },
+  { .sin_family = AF_INET, .sin_addr = { h (0xc0000219) } },
   { .sin_family = AF_INET, .sin_addr = { h (0xc0a86d1d) } },
   { .sin_family = AF_INET, .sin_addr = { h (0xc0a85d03) } },
   { .sin_family = AF_INET, .sin_addr = { h (0xc0a82c3d) } },
@@ -86,7 +89,7 @@ static size_t order[naddrs];
 
 static int expected[naddrs] =
   {
-    6, 1, 0, 3, 2, 4, 5
+    9, 4, 3, 6, 5, 7, 8, 2, 0, 1
   };
 
 
With proposed change to default_scopes applied, it will literally match
scope assignment rules described in section 3.2 of RFC 6724, so it's
hardly worth adding a test that default_scopes matches it.
However, a check that getaddrinfo actually complies with section 3.2 of
RFC 6724 is not going to be so easy.


-- 
ldv

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]