1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

resolv: Move res_mkquery, res_nmkquery into libc

This switches to public symbols without __ prefixes, due to improved
namespace management in glibc.

The symbols res_mkquery, __res_mkquery, __res_nmkquery were
moved with the script (using --no-new-version).
res_mkquery@@GLIBC_2.34, res_nmkquery@@GLIBC_2.34 were added using
make update-all-abi.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Florian Weimer
2021-07-19 07:55:27 +02:00
parent b165c65c35
commit 21a497cc58
69 changed files with 188 additions and 104 deletions

View File

@@ -54,6 +54,7 @@ routines := \
res_hconf \
res_init \
res_libc \
res_mkquery \
res_nameinquery \
res_queriesmatch \
res_randomid \
@@ -155,7 +156,6 @@ libresolv-routines := \
res_debug \
res_hostalias \
res_isourserver \
res_mkquery \
res_query \
resolv-deprecated \
# libresolv-routines

View File

@@ -17,12 +17,15 @@ libc {
herror;
hstrerror;
res_init;
res_mkquery;
}
GLIBC_2.2 {
__dn_expand;
__res_init;
__res_mkquery;
__res_nclose;
__res_ninit;
__res_nmkquery;
__res_nsend;
__res_state;
_res_hconf;
@@ -64,6 +67,8 @@ libc {
res_dnok;
res_hnok;
res_mailok;
res_mkquery;
res_nmkquery;
res_nsend;
res_ownok;
res_send;
@@ -91,9 +96,11 @@ libc {
__ns_name_uncompress;
__ns_name_unpack;
__res_context_hostalias;
__res_context_mkquery;
__res_context_send;
__res_get_nsaddr;
__res_iclose;
__res_nopt;
__resolv_context_get;
__resolv_context_get_override;
__resolv_context_get_preinit;
@@ -150,7 +157,6 @@ libresolv {
res_gethostbyaddr;
res_gethostbyname2;
res_gethostbyname;
res_mkquery;
res_query;
res_querydomain;
res_search;
@@ -159,8 +165,6 @@ libresolv {
}
GLIBC_2.2 {
__res_hostalias;
__res_mkquery;
__res_nmkquery;
__res_nquery;
__res_nquerydomain;
__res_nsearch;

View File

@@ -141,9 +141,9 @@ __res_context_mkquery (struct resolv_context *ctx, int op, const char *dname,
if ((buflen -= QFIXEDSZ) < 0)
return -1;
compose:
n = ns_name_compress (dname, cp, buflen,
(const unsigned char **) dnptrs,
(const unsigned char **) lastdnptr);
n = __ns_name_compress (dname, cp, buflen,
(const unsigned char **) dnptrs,
(const unsigned char **) lastdnptr);
if (n < 0)
return -1;
cp += n;
@@ -155,9 +155,9 @@ __res_context_mkquery (struct resolv_context *ctx, int op, const char *dname,
break;
/* Make an additional record for completion domain. */
n = ns_name_compress ((char *)data, cp, buflen,
(const unsigned char **) dnptrs,
(const unsigned char **) lastdnptr);
n = __ns_name_compress ((char *)data, cp, buflen,
(const unsigned char **) dnptrs,
(const unsigned char **) lastdnptr);
if (__glibc_unlikely (n < 0))
return -1;
cp += n;
@@ -174,6 +174,7 @@ __res_context_mkquery (struct resolv_context *ctx, int op, const char *dname,
}
return cp - buf;
}
libc_hidden_def (__res_context_mkquery)
/* Common part of res_nmkquery and res_mkquery. */
static int
@@ -203,27 +204,38 @@ context_mkquery_common (struct resolv_context *ctx,
DATALEN and NEWRR_IN are currently ignored. */
int
res_nmkquery (res_state statp, int op, const char *dname,
int class, int type,
const unsigned char *data, int datalen,
const unsigned char *newrr_in,
unsigned char *buf, int buflen)
___res_nmkquery (res_state statp, int op, const char *dname,
int class, int type,
const unsigned char *data, int datalen,
const unsigned char *newrr_in,
unsigned char *buf, int buflen)
{
return context_mkquery_common
(__resolv_context_get_override (statp),
op, dname, class, type, data, buf, buflen);
}
versioned_symbol (libc, ___res_nmkquery, res_nmkquery, GLIBC_2_34);
#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_2, GLIBC_2_34)
compat_symbol (libresolv, ___res_nmkquery, __res_nmkquery, GLIBC_2_2);
#endif
int
res_mkquery (int op, const char *dname, int class, int type,
const unsigned char *data, int datalen,
const unsigned char *newrr_in,
unsigned char *buf, int buflen)
___res_mkquery (int op, const char *dname, int class, int type,
const unsigned char *data, int datalen,
const unsigned char *newrr_in,
unsigned char *buf, int buflen)
{
return context_mkquery_common
(__resolv_context_get_preinit (),
op, dname, class, type, data, buf, buflen);
}
versioned_symbol (libc, ___res_mkquery, res_mkquery, GLIBC_2_34);
#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)
compat_symbol (libresolv, ___res_mkquery, res_mkquery, GLIBC_2_0);
#endif
#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_2, GLIBC_2_34)
compat_symbol (libresolv, ___res_mkquery, __res_mkquery, GLIBC_2_2);
#endif
/* Create an OPT resource record. Return the length of the final
packet, or -1 on error.
@@ -285,8 +297,4 @@ __res_nopt (struct resolv_context *ctx,
return cp - buf;
}
#if SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)
# undef res_mkquery
weak_alias (__res_mkquery, res_mkquery);
#endif
libc_hidden_def (__res_nopt)

View File

@@ -55,7 +55,8 @@ struct resolv_context;
Also used by __res_context_query. */
int __res_context_mkquery (struct resolv_context *, int op, const char *dname,
int class, int type, const unsigned char *data,
unsigned char *buf, int buflen) attribute_hidden;
unsigned char *buf, int buflen);
libc_hidden_proto (__res_context_mkquery)
/* Main resolver query function for use within glibc. */
int __res_context_search (struct resolv_context *, const char *, int, int,
@@ -84,7 +85,8 @@ libc_hidden_proto (__res_context_hostalias);
/* Add an OPT record to a DNS query. */
int __res_nopt (struct resolv_context *, int n0,
unsigned char *buf, int buflen, int anslen) attribute_hidden;
unsigned char *buf, int buflen, int anslen);
libc_hidden_proto (__res_nopt)
/* Convert from presentation format (which usually means ASCII
printable) to network format (which is usually some kind of binary

View File

@@ -168,7 +168,6 @@ __END_DECLS
#define res_close __res_close
#define res_init __res_init
#define res_isourserver __res_isourserver
#define res_mkquery __res_mkquery
#define res_query __res_query
#define res_querydomain __res_querydomain
#define res_search __res_search
@@ -228,7 +227,6 @@ __END_DECLS
#define res_nameinquery __res_nameinquery
#define res_nclose __res_nclose
#define res_ninit __res_ninit
#define res_nmkquery __res_nmkquery
#define res_nquery __res_nquery
#define res_nquerydomain __res_nquerydomain
#define res_nsearch __res_nsearch