diff options
author | Joseph Myers <joseph@codesourcery.com> | 2014-12-16 18:18:49 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2014-12-16 18:18:49 +0000 |
commit | 9a44d530c464d081e925b1c1af2b8bbe6e7b3207 (patch) | |
tree | a426306b1967ad948ba3a7351f87fa177aba019a /sysdeps/unix/sysv | |
parent | d003ada20e8015df173c06f3292acacc7b148632 (diff) | |
download | glibc-9a44d530c464d081e925b1c1af2b8bbe6e7b3207.tar.gz glibc-9a44d530c464d081e925b1c1af2b8bbe6e7b3207.tar.xz glibc-9a44d530c464d081e925b1c1af2b8bbe6e7b3207.zip |
Fix resolver if_* namespace (bug 17717).
Resolver code, brought in by pthreads (at least), uses if_* interfaces that weren't in POSIX before 2001, resulting in linknamespace failures. This patch changes those interfaces to be weak aliases of __if_* and makes the resolver use __if_* directly. Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by this patch). [BZ #17717] * inet/if_index.c (if_nametoindex): Rename to __if_nametoindex and define as weak alias of __if_nametoindex. Use libc_hidden_weak. (if_indextoname): Rename to __if_indextoname and define as weak alias of __if_indextoname. Use libc_hidden_weak. (if_freenameindex): Rename to __if_freenameindex and define as weak alias of __if_freenameindex. (if_nameindex): Rename to __if_nameindex and define as weak alias of __if_nameindex. * sysdeps/mach/hurd/if_index.c (if_nametoindex): Rename to __if_nametoindex and define as weak alias of __if_nametoindex. Use libc_hidden_weak. (if_freenameindex): Rename to __if_freenameindex and define as weak alias of __if_freenameindex. (if_nameindex): Rename to __if_nameindex and define as weak alias of __if_nameindex. (if_indextoname): Rename to __if_indextoname and define as weak alias of __if_indextoname. Use libc_hidden_weak. * sysdeps/unix/sysv/linux/if_index.c (if_nametoindex): Rename to __if_nametoindex and define as weak alias of __if_nametoindex. Use libc_hidden_weak. (if_freenameindex): Rename to __if_freenameindex and define as weak alias of __if_freenameindex. Use libc_hidden_weak. (if_nameindex_netlink): Use __if_freenameindex instead of if_freenameindex. (if_nameindex): Rename to __if_nameindex and define as weak alias of __if_nameindex. Use libc_hidden_weak. (if_indextoname): Rename to __if_indextoname and define as weak alias of __if_indextoname. Use libc_hidden_weak. * include/net/if.h [!_ISOMAC] (__if_nametoindex): Declare and use libc_hidden_proto. [!_ISOMAC] (__if_freenameindex): Likewise. * resolv/res_init.c (__res_vinit): Use __if_nametoindex instead of if_nametoindex. * conform/Makefile (test-xfail-XPG4/grp.h/linknamespace): Remove variable. (test-xfail-XPG4/pwd.h/linknamespace): Likewise. (test-xfail-UNIX98/aio.h/linknamespace): Likewise. (test-xfail-UNIX98/grp.h/linknamespace): Likewise. (test-xfail-UNIX98/pthread.h/linknamespace): Likewise. (test-xfail-UNIX98/pwd.h/linknamespace): Likewise. (test-xfail-UNIX98/sched.h/linknamespace): Likewise. (test-xfail-UNIX98/time.h/linknamespace): Likewise.
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r-- | sysdeps/unix/sysv/linux/if_index.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c index 0fac763f9f..b0644f2f9d 100644 --- a/sysdeps/unix/sysv/linux/if_index.c +++ b/sysdeps/unix/sysv/linux/if_index.c @@ -31,7 +31,7 @@ unsigned int -if_nametoindex (const char *ifname) +__if_nametoindex (const char *ifname) { #ifndef SIOCGIFINDEX __set_errno (ENOSYS); @@ -56,11 +56,13 @@ if_nametoindex (const char *ifname) return ifr.ifr_ifindex; #endif } -libc_hidden_def (if_nametoindex) +libc_hidden_def (__if_nametoindex) +weak_alias (__if_nametoindex, if_nametoindex) +libc_hidden_weak (if_nametoindex) void -if_freenameindex (struct if_nameindex *ifn) +__if_freenameindex (struct if_nameindex *ifn) { struct if_nameindex *ptr = ifn; while (ptr->if_name || ptr->if_index) @@ -70,7 +72,9 @@ if_freenameindex (struct if_nameindex *ifn) } free (ifn); } -libc_hidden_def (if_freenameindex) +libc_hidden_def (__if_freenameindex) +weak_alias (__if_freenameindex, if_freenameindex) +libc_hidden_weak (if_freenameindex) static struct if_nameindex * @@ -162,7 +166,7 @@ if_nameindex_netlink (void) if (idx[nifs].if_name == NULL) { idx[nifs].if_index = 0; - if_freenameindex (idx); + __if_freenameindex (idx); idx = NULL; goto nomem; } @@ -189,7 +193,7 @@ if_nameindex_netlink (void) struct if_nameindex * -if_nameindex (void) +__if_nameindex (void) { #ifndef SIOCGIFINDEX __set_errno (ENOSYS); @@ -199,11 +203,12 @@ if_nameindex (void) return result; #endif } -libc_hidden_def (if_nameindex) +weak_alias (__if_nameindex, if_nameindex) +libc_hidden_weak (if_nameindex) char * -if_indextoname (unsigned int ifindex, char *ifname) +__if_indextoname (unsigned int ifindex, char *ifname) { /* We may be able to do the conversion directly, rather than searching a list. This ioctl is not present in kernels before version 2.1.50. */ @@ -232,4 +237,5 @@ if_indextoname (unsigned int ifindex, char *ifname) else return strncpy (ifname, ifr.ifr_name, IFNAMSIZ); } -libc_hidden_def (if_indextoname) +weak_alias (__if_indextoname, if_indextoname) +libc_hidden_weak (if_indextoname) |