[PATCH]OpenWrt Asterisk DNS problem

Christian chennek at 123mail.org
Fri Sep 13 15:25:45 UTC 2013


Hello all,

 

OpenWrt's Asterisk package (at least version 1.8 and 11) has problems with
DNS requests. See the following OpenWrt ticket:

https://dev.openwrt.org/ticket/11929

 

The problem seems to be a an issue in uClibc 0.9.33.2 resolv.c. Someone
there named marko made a uClibc patch for it which solves the bug.

https://dev.openwrt.org/attachment/ticket/11929/560-res_init_asterisk.patch

More details for the patch are in the ticket. 

 

For the developers at OpenWrt it seems a strange problem because it only
affects certain DNS lookups. We are hoping someone upstream could take a
look at it and tell if the patch makes sense and possibly include it in
uClibc.

 

Thanks,

 

Christian

 

 

--- a/libc/inet/resolv.c

+++ b/libc/inet/resolv.c

@@ -3580,35 +3580,6 @@

}

#endif

-/* This needs to be after the use of _res in res_init, above.  */

-#undef _res

-

-#ifndef __UCLIBC_HAS_THREADS__

-/* The resolver state for use by single-threaded programs.

-   This differs from plain `struct __res_state _res;' in that it

doesn't

-   create a common definition, but a plain symbol that resides in .bss,

-   which can have an alias.  */

-struct __res_state _res __attribute__((section (".bss")));

-struct __res_state *__resp = &_res;

-#else /* __UCLIBC_HAS_THREADS__ */

-struct __res_state _res __attribute__((section (".bss")))

attribute_hidden;

-

-# if defined __UCLIBC_HAS_TLS__

-#  undef __resp

-__thread struct __res_state *__resp = &_res;

-/*

- * FIXME: Add usage of hidden attribute for this when used in the

shared

- *        library. It currently crashes the linker when doing section

- *        relocations.

- */

-extern __thread struct __res_state *__libc_resp

-       __attribute__ ((alias ("__resp"))) attribute_hidden;

-# else

-#  undef __resp

-struct __res_state *__resp = &_res;

-# endif

-#endif /* !__UCLIBC_HAS_THREADS__ */

-

static unsigned int

res_randomid(void)

{

@@ -3664,6 +3635,36 @@

}

libc_hidden_def(res_init)

+/* This needs to be after the use of _res in res_init, above.  */

+#undef _res

+

+#ifndef __UCLIBC_HAS_THREADS__

+/* The resolver state for use by single-threaded programs.

+   This differs from plain `struct __res_state _res;' in that it

doesn't

+   create a common definition, but a plain symbol that resides in .bss,

+   which can have an alias.  */

+struct __res_state _res __attribute__((section (".bss")));

+struct __res_state *__resp = &_res;

+#else /* __UCLIBC_HAS_THREADS__ */

+struct __res_state _res __attribute__((section (".bss")))

attribute_hidden;

+

+# if defined __UCLIBC_HAS_TLS__

+#  undef __resp

+__thread struct __res_state *__resp = &_res;

+/*

+ * FIXME: Add usage of hidden attribute for this when used in the

shared

+ *        library. It currently crashes the linker when doing section

+ *        relocations.

+ */

+extern __thread struct __res_state *__libc_resp

+       __attribute__ ((alias ("__resp"))) attribute_hidden;

+# else

+#  undef __resp

+struct __res_state *__resp = &_res;

+# endif

+#endif /* !__UCLIBC_HAS_THREADS__ */

+

+

/*

  * Set up default settings.  If the configuration file exist, the

  values

  * there will have precedence.  Otherwise, the server address is set to



More information about the uClibc mailing list