Send connman mailing list submissions to
        connman@lists.01.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
        connman-requ...@lists.01.org

You can reach the person managing the list at
        connman-ow...@lists.01.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."


Today's Topics:

   1. [PATCH 6/8] struct ether_arp definition is missing in bionic
      (Naveen Singh)
   2. [PATCH 7/8] gweb/gresolv.c: Adding android specific code in
      gresolv.c (Naveen Singh)
   3. [PATCH 8/8] resolver: MAXDNSSRCH definition for android
      (Naveen Singh)
   4. Re: [PATCH 1/8] configure.ac: Introduce the notion of android
      (Patrik Flykt)
   5. Re: [PATCH 2/8] configure.ac: Remove hard check of
      ns_initparse (Patrik Flykt)
   6. Re: [PATCH 6/8] struct ether_arp definition is missing in
      bionic (Patrik Flykt)
   7. Re: [PATCH 7/8] gweb/gresolv.c: Adding android specific code
      in gresolv.c (Patrik Flykt)


----------------------------------------------------------------------

Message: 1
Date: Wed, 21 Sep 2016 15:59:11 -0700
From: Naveen Singh <nasi...@google.com>
To: connman@lists.01.org
Cc: Naveen Singh <nasi...@google.com>
Subject: [PATCH 6/8] struct ether_arp definition is missing in bionic
Message-ID: <1474498753-120726-7-git-send-email-nasi...@google.com>

struct ether_arp is not defined in bionic. Introduced this definition
in gdhcp/ipv4ll.c and gdhcp/client.c under #ifdef ANDROID_COMPILE which
is defined in config.h by configure process
---
 gdhcp/client.c | 15 +++++++++++++++
 gdhcp/ipv4ll.c | 19 +++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/gdhcp/client.c b/gdhcp/client.c
index e9e38e7..eb354fa 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -47,6 +47,21 @@
 #include "common.h"
 #include "ipv4ll.h"
 
+#ifdef ANDROID_COMPILE
+struct ether_arp {
+       struct   arphdr ea_hdr;                 /* fixed-size header */
+       u_int8_t arp_sha[ETHER_ADDR_LEN];       /* sender hardware address */
+       u_int8_t arp_spa[4];                    /* sender protocol address */
+       u_int8_t arp_tha[ETHER_ADDR_LEN];       /* target hardware address */
+       u_int8_t arp_tpa[4];                    /* target protocol address */
+} __packed;
+#define        arp_hrd ea_hdr.ar_hrd
+#define        arp_pro ea_hdr.ar_pro
+#define        arp_hln ea_hdr.ar_hln
+#define        arp_pln ea_hdr.ar_pln
+#define        arp_op  ea_hdr.ar_op
+#endif
+
 #define DISCOVER_TIMEOUT 5
 #define DISCOVER_RETRIES 6
 
diff --git a/gdhcp/ipv4ll.c b/gdhcp/ipv4ll.c
index c43971f..56fcbfa 100644
--- a/gdhcp/ipv4ll.c
+++ b/gdhcp/ipv4ll.c
@@ -18,6 +18,10 @@
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -36,6 +40,21 @@
 #include "ipv4ll.h"
 #include "common.h"
 
+#ifdef ANDROID_COMPILE
+struct ether_arp {
+       struct   arphdr ea_hdr;                 /* fixed-size header */
+       u_int8_t arp_sha[ETHER_ADDR_LEN];       /* sender hardware address */
+       u_int8_t arp_spa[4];                    /* sender protocol address */
+       u_int8_t arp_tha[ETHER_ADDR_LEN];       /* target hardware address */
+       u_int8_t arp_tpa[4];                    /* target protocol address */
+} __packed;
+#define        arp_hrd ea_hdr.ar_hrd
+#define        arp_pro ea_hdr.ar_pro
+#define        arp_hln ea_hdr.ar_hln
+#define        arp_pln ea_hdr.ar_pln
+#define        arp_op  ea_hdr.ar_op
+#endif
+
 /**
  * Return a random link local IP (in host byte order)
  */
-- 
2.8.0.rc3.226.g39d4020



------------------------------

Message: 2
Date: Wed, 21 Sep 2016 15:59:12 -0700
From: Naveen Singh <nasi...@google.com>
To: connman@lists.01.org
Cc: Naveen Singh <nasi...@google.com>
Subject: [PATCH 7/8] gweb/gresolv.c: Adding android specific code in
        gresolv.c
Message-ID: <1474498753-120726-8-git-send-email-nasi...@google.com>

Some of the structures are defined differently between glibc and bionic.
For example struct __res_state is defined in resolv_private.h in bionic
instead of resolv.h in glibc. __res_state definition is also different
between bionic and glibc. In glibc, this structure directly contains
nsaddrs which is an array of pointers of type sockaddr_in6. In bionic
ipv6 addresses are handled through an extension structure called struct
__res_state_ext. This commit addresses this difference by approopriately
accessing the members by using a compile time flag ANDROID_COMPILE which
is defined in config.h, created by configure process.
---
 gweb/gresolv.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gweb/gresolv.c b/gweb/gresolv.c
index 8a51a9f..1b46f62 100644
--- a/gweb/gresolv.c
+++ b/gweb/gresolv.c
@@ -38,6 +38,11 @@
 
 #include "gresolv.h"
 
+#ifdef ANDROID_COMPILE
+#include <resolv_private.h>
+#include <res_private.h>
+#endif
+
 struct sort_result {
        int precedence;
        int src_scope;
@@ -1026,9 +1031,19 @@ guint g_resolv_lookup_hostname(GResolv *resolv, const 
char *hostname,
                        void *sa_addr = &resolv->res.nsaddr_list[i].sin_addr;
 
                        if (family != AF_INET &&
-                                       resolv->res._u._ext.nsaddrs[i]) {
+#ifdef ANDROID_COMPILE
+                               &resolv->res._u._ext.ext->nsaddrs[i].sin6
+#else
+                               resolv->res._u._ext.nsaddrs[i]
+#endif
+                          )
+                       {
                                family = AF_INET6;
+#ifdef ANDROID_COMPILE
+                               sa_addr = 
&resolv->res._u._ext.ext->nsaddrs[i].sin6;
+#else
                                sa_addr = 
&resolv->res._u._ext.nsaddrs[i]->sin6_addr;
+#endif
                        }
 
                        if (family != AF_INET && family != AF_INET6)
-- 
2.8.0.rc3.226.g39d4020



------------------------------

Message: 3
Date: Wed, 21 Sep 2016 15:59:13 -0700
From: Naveen Singh <nasi...@google.com>
To: connman@lists.01.org
Cc: Naveen Singh <nasi...@google.com>
Subject: [PATCH 8/8] resolver: MAXDNSSRCH definition for android
Message-ID: <1474498753-120726-9-git-send-email-nasi...@google.com>

MAXDNSSRCH is defined in resolv_params.h in bionic. This commit includes
this file for android compilation.
---
 src/resolver.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/resolver.c b/src/resolver.c
index fbe4be7..3059353 100644
--- a/src/resolver.c
+++ b/src/resolver.c
@@ -32,6 +32,9 @@
 #include <sys/stat.h>
 #include <resolv.h>
 #include <netdb.h>
+#ifdef ANDROID_COMPILE
+#include <resolv_params.h>
+#endif
 
 #include "connman.h"
 
-- 
2.8.0.rc3.226.g39d4020



------------------------------

Message: 4
Date: Thu, 22 Sep 2016 08:53:55 +0300
From: Patrik Flykt <patrik.fl...@linux.intel.com>
To: Naveen Singh <nasi...@google.com>, connman@lists.01.org
Subject: Re: [PATCH 1/8] configure.ac: Introduce the notion of android
Message-ID: <1474523635.11736.50.ca...@linux.intel.com>
Content-Type: text/plain; charset="UTF-8"

On Wed, 2016-09-21 at 15:59 -0700, Naveen Singh wrote:
> This change is targeted towards detecting whether connman is compiled
> for android. It does this by finding if host option passed to
> configure
> has "android" in it. If it finds it makes two variables ANDROID and
> ANDROID_COMPILE as 1. The first variable can be used in Makefile.am
> for
> including different set of libraries (because of difference between
> bionic and glibc). The second variable, ANDROID_COMPILE gets added
> into
> config.h and then can be used in C code to conditionally compile
> android
> specific code.
> ---
> ?configure.ac | 16 ++++++++++++++++
> ?1 file changed, 16 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index b477aa1..267f058 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -35,6 +35,22 @@ AC_PROG_LIBTOOL
> ?
> ?gl_CONFIGMAKE_PREP
> ?
> +android_compile=no
> +AC_MSG_CHECKING([check for android])
> +
> +     case "${host}" in
> +             *android*)
> +                     android_compile=yes
> +             ;;
> +     esac
> +
> +AC_MSG_RESULT(${android_compile})
> +AM_CONDITIONAL([ANDROID], test "${android_compile}" = "yes")
> +
> +if (test "${android_compile}" = "yes"); then
> +     AC_DEFINE([ANDROID_COMPILE], 1, [android environment
> compilation])
> +fi
> +

While this produces the desired result and compiles ConnMan using
bionic, I rather see discreet features detected with automake.

The patch set is excellent, as now we have the issues and desired
effects documented.


        Patrik


> ?AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
> ?                     [disable code optimization through
> compiler]), [
> ?     if (test "${enableval}" = "no"); then


------------------------------

Message: 5
Date: Thu, 22 Sep 2016 09:10:10 +0300
From: Patrik Flykt <patrik.fl...@linux.intel.com>
To: Naveen Singh <nasi...@google.com>, connman@lists.01.org
Subject: Re: [PATCH 2/8] configure.ac: Remove hard check of
        ns_initparse
Message-ID: <1474524610.11736.60.ca...@linux.intel.com>
Content-Type: text/plain; charset="UTF-8"

On Wed, 2016-09-21 at 15:59 -0700, Naveen Singh wrote:
> AC_CHECK_LIB was performed for ns_initparse in libresolv.so. For
> android
> there is no libresolv.so. This sysmobol exists in libc.so.This change
> removes that hard check.
> ---
> ?configure.ac | 9 ++++++---
> ?1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 267f058..a5e8bb0 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -193,10 +193,13 @@ AM_CONDITIONAL(PPTP_BUILTIN, test
> "${enable_pptp}" = "builtin")
> ?
> ?AC_CHECK_HEADERS(resolv.h, dummy=yes,
> ?     AC_MSG_ERROR(resolver header files are required))
> -AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
> -     AC_CHECK_LIB(resolv, __ns_initparse, dummy=yes,
> -             AC_MSG_ERROR(resolver library support is required))
> +
> +if (test "${android_compile}" = "no"); then
> +     AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
> +             AC_CHECK_LIB(resolv, __ns_initparse, dummy=yes,
> +                     AC_MSG_ERROR(resolver library support is
> required))
> ?])
> +fi

Ok, so unconditionally failing if libresolv isn't found will not work.
So using
AC_CHECK_FUNCS(<functions to look for in here>, RESOLVER_BUILTIN=yes, 
AC_MSG_ERROR(resolverl ibrary support is required))
instead of calling?AC_MSG_ERROR() unconditionally fixes the issue (I
will admit upfront that I'm not an automake guru, though)? Then one can
use the?RESOLVER_BUILTIN variable in patch 3/8 and 4/8?

And we still need to properly name the variable RESOLVER_BUILTIN, it
was just the first thing on the top of my head.


        Patrik

> ?
> ?AC_CHECK_HEADERS([execinfo.h])
> ?AM_CONDITIONAL([BACKTRACE], [test "${ac_cv_header_execinfo_h}" =
> "yes"])


------------------------------

Message: 6
Date: Thu, 22 Sep 2016 09:14:19 +0300
From: Patrik Flykt <patrik.fl...@linux.intel.com>
To: Naveen Singh <nasi...@google.com>, connman@lists.01.org
Subject: Re: [PATCH 6/8] struct ether_arp definition is missing in
        bionic
Message-ID: <1474524859.11736.62.ca...@linux.intel.com>
Content-Type: text/plain; charset="UTF-8"

On Wed, 2016-09-21 at 15:59 -0700, Naveen Singh wrote:
> struct ether_arp is not defined in bionic. Introduced this definition
> in gdhcp/ipv4ll.c and gdhcp/client.c under #ifdef ANDROID_COMPILE
> which
> is defined in config.h by configure process
> ---
> ?gdhcp/client.c | 15 +++++++++++++++
> ?gdhcp/ipv4ll.c | 19 +++++++++++++++++++
> ?2 files changed, 34 insertions(+)
> 
> diff --git a/gdhcp/client.c b/gdhcp/client.c
> index e9e38e7..eb354fa 100644
> --- a/gdhcp/client.c
> +++ b/gdhcp/client.c
> @@ -47,6 +47,21 @@
> ?#include "common.h"
> ?#include "ipv4ll.h"
> ?
> +#ifdef ANDROID_COMPILE
> +struct ether_arp {
> +     struct???arphdr ea_hdr;?????????????????/* fixed-size header
> */
> +     u_int8_t arp_sha[ETHER_ADDR_LEN];???????/* sender hardware
> address */
> +     u_int8_t arp_spa[4];????????????????????/* sender protocol
> address */
> +     u_int8_t arp_tha[ETHER_ADDR_LEN];???????/* target hardware
> address */
> +     u_int8_t arp_tpa[4];????????????????????/* target protocol
> address */
> +} __packed;
> +#define????????arp_hrd ea_hdr.ar_hrd
> +#define????????arp_pro ea_hdr.ar_pro
> +#define????????arp_hln ea_hdr.ar_hln
> +#define????????arp_pln ea_hdr.ar_pln
> +#define????????arp_op??ea_hdr.ar_op
> +#endif
> +

Again, autodiscovery is very much preferred. Does?AC_CHECK_TYPE() for
struct ether_arp work here?


        Patrik

> ?#define DISCOVER_TIMEOUT 5
> ?#define DISCOVER_RETRIES 6
> ?
> diff --git a/gdhcp/ipv4ll.c b/gdhcp/ipv4ll.c
> index c43971f..56fcbfa 100644
> --- a/gdhcp/ipv4ll.c
> +++ b/gdhcp/ipv4ll.c
> @@ -18,6 +18,10 @@
> ? *??Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
> MA??02110-1301??USA
> ? *
> ? */
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
> ?#include <string.h>
> ?#include <stdlib.h>
> ?#include <errno.h>
> @@ -36,6 +40,21 @@
> ?#include "ipv4ll.h"
> ?#include "common.h"
> ?
> +#ifdef ANDROID_COMPILE
> +struct ether_arp {
> +     struct???arphdr ea_hdr;?????????????????/* fixed-size header
> */
> +     u_int8_t arp_sha[ETHER_ADDR_LEN];???????/* sender hardware
> address */
> +     u_int8_t arp_spa[4];????????????????????/* sender protocol
> address */
> +     u_int8_t arp_tha[ETHER_ADDR_LEN];???????/* target hardware
> address */
> +     u_int8_t arp_tpa[4];????????????????????/* target protocol
> address */
> +} __packed;
> +#define????????arp_hrd ea_hdr.ar_hrd
> +#define????????arp_pro ea_hdr.ar_pro
> +#define????????arp_hln ea_hdr.ar_hln
> +#define????????arp_pln ea_hdr.ar_pln
> +#define????????arp_op??ea_hdr.ar_op
> +#endif
> +
> ?/**
> ? * Return a random link local IP (in host byte order)
> ? */


------------------------------

Message: 7
Date: Thu, 22 Sep 2016 09:19:28 +0300
From: Patrik Flykt <patrik.fl...@linux.intel.com>
To: Naveen Singh <nasi...@google.com>, connman@lists.01.org
Subject: Re: [PATCH 7/8] gweb/gresolv.c: Adding android specific code
        in gresolv.c
Message-ID: <1474525168.11736.64.ca...@linux.intel.com>
Content-Type: text/plain; charset="UTF-8"

On Wed, 2016-09-21 at 15:59 -0700, Naveen Singh wrote:
> Some of the structures are defined differently between glibc and
> bionic.
> For example struct __res_state is defined in resolv_private.h in
> bionic
> instead of resolv.h in glibc. __res_state definition is also
> different
> between bionic and glibc. In glibc, this structure directly contains
> nsaddrs which is an array of pointers of type sockaddr_in6. In bionic
> ipv6 addresses are handled through an extension structure called
> struct
> __res_state_ext. This commit addresses this difference by
> approopriately
> accessing the members by using a compile time flag ANDROID_COMPILE
> which
> is defined in config.h, created by configure process.
> ---
> ?gweb/gresolv.c | 17 ++++++++++++++++-
> ?1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/gweb/gresolv.c b/gweb/gresolv.c
> index 8a51a9f..1b46f62 100644
> --- a/gweb/gresolv.c
> +++ b/gweb/gresolv.c
> @@ -38,6 +38,11 @@
> ?
> ?#include "gresolv.h"
> ?
> +#ifdef ANDROID_COMPILE
> +#include <resolv_private.h>
> +#include <res_private.h>
> +#endif
> +
> ?struct sort_result {
> ?     int precedence;
> ?     int src_scope;
> @@ -1026,9 +1031,19 @@ guint g_resolv_lookup_hostname(GResolv
> *resolv, const char *hostname,
> ?                     void *sa_addr = &resolv-
> >res.nsaddr_list[i].sin_addr;
> ?
> ?                     if (family != AF_INET &&
> -                                     resolv-
> >res._u._ext.nsaddrs[i]) {
> +#ifdef ANDROID_COMPILE
> +                             &resolv->res._u._ext.ext-
> >nsaddrs[i].sin6
> +#else
> +                             resolv->res._u._ext.nsaddrs[i]
> +#endif
> +                     ???)
> +                     {
> ?                             family = AF_INET6;
> +#ifdef ANDROID_COMPILE
> +                             sa_addr = &resolv->res._u._ext.ext-
> >nsaddrs[i].sin6;
> +#else
> ?                             sa_addr = &resolv-
> >res._u._ext.nsaddrs[i]->sin6_addr;
> +#endif

This looks like a case of?AC_CHECK_MEMBERS () and an #ifdef ... #define
to extract the correct memeber function?

        Patrik

> ?                     }
> ?
> ?                     if (family != AF_INET && family != AF_INET6)


------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list
connman@lists.01.org
https://lists.01.org/mailman/listinfo/connman


------------------------------

End of connman Digest, Vol 11, Issue 25
***************************************

Reply via email to