about summary refs log tree commit diff
path: root/resolv
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-07-19 07:55:27 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-07-19 07:56:57 +0200
commit21a497cc58df2b9b02dc687b97f105335e7a1c50 (patch)
tree30c5a5180ce891b19fc8820b24727f466dde86c3 /resolv
parentb165c65c35d0fc4d60d63ae101f4edfa21c0d30b (diff)
downloadglibc-21a497cc58df2b9b02dc687b97f105335e7a1c50.tar.gz
glibc-21a497cc58df2b9b02dc687b97f105335e7a1c50.tar.xz
glibc-21a497cc58df2b9b02dc687b97f105335e7a1c50.zip
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>
Diffstat (limited to 'resolv')
-rw-r--r--resolv/Makefile2
-rw-r--r--resolv/Versions10
-rw-r--r--resolv/res_mkquery.c48
-rw-r--r--resolv/resolv-internal.h6
-rw-r--r--resolv/resolv.h2
5 files changed, 40 insertions, 28 deletions
diff --git a/resolv/Makefile b/resolv/Makefile
index e9689f7e2c..31658202d3 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -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
diff --git a/resolv/Versions b/resolv/Versions
index 429b3304c4..e3dd38b3a9 100644
--- a/resolv/Versions
+++ b/resolv/Versions
@@ -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;
diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
index 07c34d1340..ba6c983b58 100644
--- a/resolv/res_mkquery.c
+++ b/resolv/res_mkquery.c
@@ -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)
diff --git a/resolv/resolv-internal.h b/resolv/resolv-internal.h
index 1e21c38cc7..3cf8a77698 100644
--- a/resolv/resolv-internal.h
+++ b/resolv/resolv-internal.h
@@ -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
diff --git a/resolv/resolv.h b/resolv/resolv.h
index 39c5e59d31..21c88ca9f8 100644
--- a/resolv/resolv.h
+++ b/resolv/resolv.h
@@ -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