Define missing __inet6_scopeid_pton internal function used by getaddrinfo

Message ID 20170803002352.62vnzxfs7jnu236t@var.youpi.perso.aquilenet.fr
State New, archived
Headers

Commit Message

Samuel Thibault Aug. 3, 2017, 12:23 a.m. UTC
  * posix/tst-rfc3484.c: Include <netinet/in.h> and <net/if.h>
(__inet6_scopeid_pton): New function.
  

Comments

Samuel Thibault Aug. 3, 2017, 12:36 a.m. UTC | #1
Samuel Thibault, on jeu. 03 août 2017 02:23:52 +0200, wrote:
> * posix/tst-rfc3484.c: Include <netinet/in.h> and <net/if.h>
> (__inet6_scopeid_pton): New function.

And likewise for tst-rfc3484-2 and tst-rfc3484-3.
  
Samuel Thibault Aug. 3, 2017, 8:54 a.m. UTC | #2
Samuel Thibault, on jeu. 03 août 2017 02:36:26 +0200, wrote:
> Samuel Thibault, on jeu. 03 août 2017 02:23:52 +0200, wrote:
> > * posix/tst-rfc3484.c: Include <netinet/in.h> and <net/if.h>
> > (__inet6_scopeid_pton): New function.
> 
> And likewise for tst-rfc3484-2 and tst-rfc3484-3.

Err inet/tst-inet6_scopeid_pton.c also needs it, but how is this
supposed to link when __inet6_scopeid_pton is marked attribute_hidden?

Should it perhaps just

#include <ctype.h>

#define isdigit_l(c, locale) isdigit(c)
#define ____strtoull_l_internal(s, end, base, group, locale) strtoul(s, end, base)
#define __if_nametoindex if_nametoindex
#include "inet6_scopeid_pton.c"

?

Samuel
  

Patch

Index: glibc-2.25/posix/tst-rfc3484.c
===================================================================
--- glibc-2.25.orig/posix/tst-rfc3484.c
+++ glibc-2.25/posix/tst-rfc3484.c
@@ -2,6 +2,8 @@ 
 #include <stdio.h>
 #include <ifaddrs.h>
 #include <stdint.h>
+#include <netinet/in.h>
+#include <net/if.h>
 
 /* Internal definitions used in the libc code.  */
 #define __getservbyname_r getservbyname_r
@@ -55,6 +57,15 @@  _res_hconf_init (void)
 {
 }
 
+int
+internal_function
+__inet6_scopeid_pton (const struct in6_addr *address, const char *scope,
+                      uint32_t *result)
+{
+  *result = if_nametoindex(scope);
+  return 0;
+}
+
 #undef	USE_NSCD
 #include "../sysdeps/posix/getaddrinfo.c"