diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-07-19 07:55:27 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-07-19 07:56:45 +0200 |
commit | b165c65c35d0fc4d60d63ae101f4edfa21c0d30b (patch) | |
tree | 989a2418ecc63814f3afc59a437ee30d96e89042 /resolv | |
parent | 66ac4268f48e4dbcb09b2b6128efa84a6564c1e6 (diff) | |
download | glibc-b165c65c35d0fc4d60d63ae101f4edfa21c0d30b.tar.gz glibc-b165c65c35d0fc4d60d63ae101f4edfa21c0d30b.tar.xz glibc-b165c65c35d0fc4d60d63ae101f4edfa21c0d30b.zip |
resolv: Move res_send, res_nsend into libc
Switch to public symbols without __ prefix (due to improved namespace management). __res_send, __res_nsend were moved using the script (with --no-new-version). res_send@@GLIBC_2.34 and res_nsend@@GLIBC_2.34 were added using make update-all-abi. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'resolv')
-rw-r--r-- | resolv/Makefile | 4 | ||||
-rw-r--r-- | resolv/Versions | 8 | ||||
-rw-r--r-- | resolv/res_enable_icmp.c | 4 | ||||
-rw-r--r-- | resolv/res_send.c | 54 | ||||
-rw-r--r-- | resolv/resolv-internal.h | 3 | ||||
-rw-r--r-- | resolv/resolv.h | 2 |
6 files changed, 45 insertions, 30 deletions
diff --git a/resolv/Makefile b/resolv/Makefile index 8c28afe5c4..e9689f7e2c 100644 --- a/resolv/Makefile +++ b/resolv/Makefile @@ -49,6 +49,7 @@ routines := \ res-name-checking \ res-state \ res_context_hostalias \ + res_enable_icmp \ res_get_nsaddr \ res_hconf \ res_init \ @@ -56,6 +57,7 @@ routines := \ res_nameinquery \ res_queriesmatch \ res_randomid \ + res_send \ resolv_conf \ resolv_context \ # routines @@ -151,12 +153,10 @@ libresolv-routines := \ res-putget \ res_data \ res_debug \ - res_enable_icmp \ res_hostalias \ res_isourserver \ res_mkquery \ res_query \ - res_send \ resolv-deprecated \ # libresolv-routines diff --git a/resolv/Versions b/resolv/Versions index b084660dde..429b3304c4 100644 --- a/resolv/Versions +++ b/resolv/Versions @@ -6,8 +6,10 @@ libc { __res_dnok; __res_hnok; __res_mailok; + __res_nsend; __res_ownok; __res_randomid; + __res_send; _res; dn_expand; h_errlist; @@ -21,6 +23,7 @@ libc { __res_init; __res_nclose; __res_ninit; + __res_nsend; __res_state; _res_hconf; } @@ -61,7 +64,9 @@ libc { res_dnok; res_hnok; res_mailok; + res_nsend; res_ownok; + res_send; } GLIBC_PRIVATE { %if !PTHREAD_IN_LIBC @@ -86,6 +91,7 @@ libc { __ns_name_uncompress; __ns_name_unpack; __res_context_hostalias; + __res_context_send; __res_get_nsaddr; __res_iclose; __resolv_context_get; @@ -126,7 +132,6 @@ libresolv { __res_isourserver; __res_nameinquery; __res_queriesmatch; - __res_send; __sym_ntop; __sym_ntos; __sym_ston; @@ -159,7 +164,6 @@ libresolv { __res_nquery; __res_nquerydomain; __res_nsearch; - __res_nsend; __res_query; __res_querydomain; __res_search; diff --git a/resolv/res_enable_icmp.c b/resolv/res_enable_icmp.c index 9aa61823df..3bfe6e4f4c 100644 --- a/resolv/res_enable_icmp.c +++ b/resolv/res_enable_icmp.c @@ -27,9 +27,9 @@ __res_enable_icmp (int family, int fd) switch (family) { case AF_INET: - return setsockopt (fd, SOL_IP, IP_RECVERR, &one, sizeof (one)); + return __setsockopt (fd, SOL_IP, IP_RECVERR, &one, sizeof (one)); case AF_INET6: - return setsockopt (fd, SOL_IPV6, IPV6_RECVERR, &one, sizeof (one)); + return __setsockopt (fd, SOL_IPV6, IPV6_RECVERR, &one, sizeof (one)); default: __set_errno (EAFNOSUPPORT); return -1; diff --git a/resolv/res_send.c b/resolv/res_send.c index b502ef5132..9f86f5fe47 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -425,6 +425,7 @@ __res_context_send (struct resolv_context *ctx, __set_errno (terrno); return (-1); } +libc_hidden_def (__res_context_send) /* Common part of res_nsend and res_send. */ static int @@ -444,19 +445,28 @@ context_send_common (struct resolv_context *ctx, } int -res_nsend (res_state statp, const unsigned char *buf, int buflen, - unsigned char *ans, int anssiz) +___res_nsend (res_state statp, const unsigned char *buf, int buflen, + unsigned char *ans, int anssiz) { return context_send_common (__resolv_context_get_override (statp), buf, buflen, ans, anssiz); } +versioned_symbol (libc, ___res_nsend, res_nsend, GLIBC_2_34); +#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_2, GLIBC_2_34) +compat_symbol (libresolv, ___res_nsend, __res_nsend, GLIBC_2_2); +#endif int -res_send (const unsigned char *buf, int buflen, unsigned char *ans, int anssiz) +___res_send (const unsigned char *buf, int buflen, unsigned char *ans, + int anssiz) { return context_send_common (__resolv_context_get (), buf, buflen, ans, anssiz); } +versioned_symbol (libc, ___res_send, res_send, GLIBC_2_34); +#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_34) +compat_symbol (libresolv, ___res_send, __res_send, GLIBC_2_0); +#endif /* Private */ @@ -582,9 +592,9 @@ send_vc(res_state statp, struct sockaddr_in6 peer; socklen_t size = sizeof peer; - if (getpeername(statp->_vcsock, - (struct sockaddr *)&peer, &size) < 0 || - !sock_eq(&peer, (struct sockaddr_in6 *) nsap)) { + if (__getpeername (statp->_vcsock, + (struct sockaddr *) &peer, &size) < 0 + || !sock_eq (&peer, (struct sockaddr_in6 *) nsap)) { __res_iclose(statp, false); statp->_flags &= ~RES_F_VC; } @@ -594,7 +604,7 @@ send_vc(res_state statp, if (statp->_vcsock >= 0) __res_iclose(statp, false); - statp->_vcsock = socket + statp->_vcsock = __socket (nsap->sa_family, SOCK_STREAM | SOCK_CLOEXEC, 0); if (statp->_vcsock < 0) { *terrno = errno; @@ -603,10 +613,10 @@ send_vc(res_state statp, return (-1); } __set_errno (0); - if (connect(statp->_vcsock, nsap, - nsap->sa_family == AF_INET - ? sizeof (struct sockaddr_in) - : sizeof (struct sockaddr_in6)) < 0) { + if (__connect (statp->_vcsock, nsap, + nsap->sa_family == AF_INET + ? sizeof (struct sockaddr_in) + : sizeof (struct sockaddr_in6)) < 0) { *terrno = errno; return close_and_return_error (statp, resplen2); } @@ -628,7 +638,8 @@ send_vc(res_state statp, niov = 4; explen += INT16SZ + buflen2; } - if (TEMP_FAILURE_RETRY (writev(statp->_vcsock, iov, niov)) != explen) { + if (TEMP_FAILURE_RETRY (__writev (statp->_vcsock, iov, niov)) + != explen) { *terrno = errno; return close_and_return_error (statp, resplen2); } @@ -789,14 +800,14 @@ reopen (res_state statp, int *terrno, int ns) /* only try IPv6 if IPv6 NS and if not failed before */ if (nsap->sa_family == AF_INET6 && !statp->ipv6_unavail) { - EXT(statp).nssocks[ns] = socket + EXT (statp).nssocks[ns] = __socket (PF_INET6, SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0); if (EXT(statp).nssocks[ns] < 0) statp->ipv6_unavail = errno == EAFNOSUPPORT; slen = sizeof (struct sockaddr_in6); } else if (nsap->sa_family == AF_INET) { - EXT(statp).nssocks[ns] = socket + EXT (statp).nssocks[ns] = __socket (PF_INET, SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0); slen = sizeof (struct sockaddr_in); @@ -837,7 +848,7 @@ reopen (res_state statp, int *terrno, int ns) the call to connect with slen. */ DIAG_PUSH_NEEDS_COMMENT; DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized"); - if (connect(EXT(statp).nssocks[ns], nsap, slen) < 0) { + if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) { DIAG_POP_NEEDS_COMMENT; __res_iclose(statp, false); return (0); @@ -1090,9 +1101,9 @@ send_dg(res_state statp, try_send: #endif if (nwritten != 0) - sr = send (pfd[0].fd, buf2, buflen2, MSG_NOSIGNAL); + sr = __send (pfd[0].fd, buf2, buflen2, MSG_NOSIGNAL); else - sr = send (pfd[0].fd, buf, buflen, MSG_NOSIGNAL); + sr = __send (pfd[0].fd, buf, buflen, MSG_NOSIGNAL); if (sr != (nwritten != 0 ? buflen2 : buflen)) { if (errno == EINTR || errno == EAGAIN) @@ -1133,7 +1144,7 @@ send_dg(res_state statp, && (thisansp != NULL && thisansp != ansp) #ifdef FIONREAD /* Is the size too small? */ - && (ioctl (pfd[0].fd, FIONREAD, thisresplenp) < 0 + && (__ioctl (pfd[0].fd, FIONREAD, thisresplenp) < 0 || *thisanssizp < *thisresplenp) #endif ) { @@ -1160,9 +1171,10 @@ send_dg(res_state statp, HEADER *anhp = (HEADER *) *thisansp; socklen_t fromlen = sizeof(struct sockaddr_in6); assert (sizeof(from) <= fromlen); - *thisresplenp = recvfrom(pfd[0].fd, (char*)*thisansp, - *thisanssizp, 0, - (struct sockaddr *)&from, &fromlen); + *thisresplenp = __recvfrom (pfd[0].fd, (char *) *thisansp, + *thisanssizp, 0, + (struct sockaddr *) &from, + &fromlen); if (__glibc_unlikely (*thisresplenp <= 0)) { if (errno == EINTR || errno == EAGAIN) { need_recompute = 1; diff --git a/resolv/resolv-internal.h b/resolv/resolv-internal.h index 7d37817232..1e21c38cc7 100644 --- a/resolv/resolv-internal.h +++ b/resolv/resolv-internal.h @@ -74,7 +74,8 @@ libresolv_hidden_proto (__res_context_query) int __res_context_send (struct resolv_context *, const unsigned char *, int, const unsigned char *, int, unsigned char *, int, unsigned char **, unsigned char **, - int *, int *, int *) attribute_hidden; + int *, int *, int *); +libc_hidden_proto (__res_context_send) /* Internal function similar to res_hostalias. */ const char *__res_context_hostalias (struct resolv_context *, diff --git a/resolv/resolv.h b/resolv/resolv.h index 9cce53f67b..39c5e59d31 100644 --- a/resolv/resolv.h +++ b/resolv/resolv.h @@ -172,7 +172,6 @@ __END_DECLS #define res_query __res_query #define res_querydomain __res_querydomain #define res_search __res_search -#define res_send __res_send #ifdef _LIBC # define __RESOLV_DEPRECATED @@ -233,7 +232,6 @@ __END_DECLS #define res_nquery __res_nquery #define res_nquerydomain __res_nquerydomain #define res_nsearch __res_nsearch -#define res_nsend __res_nsend #define res_queriesmatch __res_queriesmatch #define res_randomid __res_randomid #define sym_ntop __sym_ntop |