diff options
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-connectivity/connman/connman')
6 files changed, 410 insertions, 0 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0001-Detect-backtrace-API-availability-before-using-it.patch b/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0001-Detect-backtrace-API-availability-before-using-it.patch new file mode 100644 index 000000000..5dc6fd634 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0001-Detect-backtrace-API-availability-before-using-it.patch @@ -0,0 +1,55 @@ +From 00d4447395725abaa651e12ed40095081e04011e Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sun, 13 Sep 2015 13:22:01 -0700 +Subject: [PATCH 1/3] Detect backtrace() API availability before using it + +C libraries besides glibc do not have backtrace() implemented + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + configure.ac | 2 ++ + src/log.c | 5 ++--- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 69c0eeb..90099f2 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -171,6 +171,8 @@ fi + AM_CONDITIONAL(PPTP, test "${enable_pptp}" != "no") + AM_CONDITIONAL(PPTP_BUILTIN, test "${enable_pptp}" = "builtin") + ++AC_CHECK_HEADERS([execinfo.h]) ++ + AC_CHECK_HEADERS(resolv.h, dummy=yes, + AC_MSG_ERROR(resolver header files are required)) + AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [ +diff --git a/src/log.c b/src/log.c +index a693bd0..5b40c1f 100644 +--- a/src/log.c ++++ b/src/log.c +@@ -30,7 +30,6 @@ + #include <stdlib.h> + #include <string.h> + #include <syslog.h> +-#include <execinfo.h> + #include <dlfcn.h> + + #include "connman.h" +@@ -215,9 +214,9 @@ static void print_backtrace(unsigned int offset) + static void signal_handler(int signo) + { + connman_error("Aborting (signal %d) [%s]", signo, program_exec); +- ++#ifdef HAVE_EXECINFO_H + print_backtrace(2); +- ++#endif /* HAVE_EXECINFO_H */ + exit(EXIT_FAILURE); + } + +-- +2.5.1 + diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0001-iptables-Add-missing-function-item-of-xtables-to-mat.patch b/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0001-iptables-Add-missing-function-item-of-xtables-to-mat.patch new file mode 100644 index 000000000..1b5a3e440 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0001-iptables-Add-missing-function-item-of-xtables-to-mat.patch @@ -0,0 +1,42 @@ +From acea08a0e4234a4c1a87bedc087c73ff36de0c7b Mon Sep 17 00:00:00 2001 +From: Wu Zheng <wu.zheng@intel.com> +Date: Thu, 28 Jan 2016 18:04:17 +0800 +Subject: [PATCH] iptables: Add missing function item of xtables to match + iptables 1.6 + +The struct of xtables_globals has been modified in iptables 1.6. +If connman runs with iptables 1.6, it can crash. + +Program received signal SIGSEGV, Segmentation fault. +0x00000000 in ?? () +0xb7dea89c in xtables_find_target () from /usr/lib/libxtables.so.11 +0xb7deac1c in ?? () from /usr/lib/libxtables.so.11 +0xb7dea793 in xtables_find_target () from /usr/lib/libxtables.so.11 + +The the missing function item of xtables is added to xtables_globals. + +Upstream-Status: Backport + +Signed-off-by: Maxin B. John <maxin.john@intel.com> +Signed-off-by: Wu Zheng <wu.zheng@intel.com> +--- + src/iptables.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/iptables.c b/src/iptables.c +index bc0c763..5ef757a 100644 +--- a/src/iptables.c ++++ b/src/iptables.c +@@ -1566,6 +1566,9 @@ struct xtables_globals iptables_globals = { + .option_offset = 0, + .opts = iptables_opts, + .orig_opts = iptables_opts, ++#if XTABLES_VERSION_CODE > 10 ++ .compat_rev = xtables_compatible_revision, ++#endif + }; + + static struct xtables_target *prepare_target(struct connman_iptables *table, +-- +2.4.0 + diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch b/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch new file mode 100644 index 000000000..e6f03e632 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch @@ -0,0 +1,35 @@ +From 4ddaf78dad5a9ee4a0658235f71b75132192123e Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sat, 7 Apr 2012 18:52:12 -0700 +Subject: [PATCH] plugin.h: Change visibility to default for debug symbols + +gold refuses to link in undefined weak symbols which +have hidden visibility + +Signed-off-by: Khem Raj <raj.khem@gmail.com> + + +Upstream-Status: Pending +--- + include/plugin.h | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/plugin.h b/include/plugin.h +index 692a4e5..a9361c3 100644 +--- a/include/plugin.h ++++ b/include/plugin.h +@@ -89,9 +89,9 @@ struct connman_plugin_desc { + #else + #define CONNMAN_PLUGIN_DEFINE(name, description, version, priority, init, exit) \ + extern struct connman_debug_desc __start___debug[] \ +- __attribute__ ((weak, visibility("hidden"))); \ ++ __attribute__ ((weak, visibility("default"))); \ + extern struct connman_debug_desc __stop___debug[] \ +- __attribute__ ((weak, visibility("hidden"))); \ ++ __attribute__ ((weak, visibility("default"))); \ + extern struct connman_plugin_desc connman_plugin_desc \ + __attribute__ ((visibility("default"))); \ + struct connman_plugin_desc connman_plugin_desc = { \ +-- +1.7.5.4 + diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0002-resolve-musl-does-not-implement-res_ninit.patch b/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0002-resolve-musl-does-not-implement-res_ninit.patch new file mode 100644 index 000000000..059342771 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0002-resolve-musl-does-not-implement-res_ninit.patch @@ -0,0 +1,77 @@ +From 10b0d16d04b811b1ccd1f9b0cfe757bce8d876a1 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 6 Apr 2015 23:02:21 -0700 +Subject: [PATCH 2/3] resolve: musl does not implement res_ninit + +ported from +http://git.alpinelinux.org/cgit/aports/plain/testing/connman/libresolv.patch + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gweb/gresolv.c | 33 ++++++++++++--------------------- + 1 file changed, 12 insertions(+), 21 deletions(-) + +diff --git a/gweb/gresolv.c b/gweb/gresolv.c +index 5cf7a9a..3ad8e70 100644 +--- a/gweb/gresolv.c ++++ b/gweb/gresolv.c +@@ -875,8 +875,6 @@ GResolv *g_resolv_new(int index) + resolv->index = index; + resolv->nameserver_list = NULL; + +- res_ninit(&resolv->res); +- + return resolv; + } + +@@ -916,8 +914,6 @@ void g_resolv_unref(GResolv *resolv) + + flush_nameservers(resolv); + +- res_nclose(&resolv->res); +- + g_free(resolv); + } + +@@ -1020,24 +1016,19 @@ guint g_resolv_lookup_hostname(GResolv *resolv, const char *hostname, + debug(resolv, "hostname %s", hostname); + + if (!resolv->nameserver_list) { +- int i; +- +- for (i = 0; i < resolv->res.nscount; i++) { +- char buf[100]; +- int family = resolv->res.nsaddr_list[i].sin_family; +- void *sa_addr = &resolv->res.nsaddr_list[i].sin_addr; +- +- if (family != AF_INET && +- resolv->res._u._ext.nsaddrs[i]) { +- family = AF_INET6; +- sa_addr = &resolv->res._u._ext.nsaddrs[i]->sin6_addr; ++ FILE *f = fopen("/etc/resolv.conf", "r"); ++ if (f) { ++ char line[256], *s; ++ int i; ++ while (fgets(line, sizeof(line), f)) { ++ if (strncmp(line, "nameserver", 10) || !isspace(line[10])) ++ continue; ++ for (s = &line[11]; isspace(s[0]); s++); ++ for (i = 0; s[i] && !isspace(s[i]); i++); ++ s[i] = 0; ++ g_resolv_add_nameserver(resolv, s, 53, 0); + } +- +- if (family != AF_INET && family != AF_INET6) +- continue; +- +- if (inet_ntop(family, sa_addr, buf, sizeof(buf))) +- g_resolv_add_nameserver(resolv, buf, 53, 0); ++ fclose(f); + } + + if (!resolv->nameserver_list) +-- +2.5.1 + diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch b/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch new file mode 100644 index 000000000..eefc6834b --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch @@ -0,0 +1,118 @@ +From 67645a01a2f3f52625d8dd77f2811a9e213e1b7d Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sun, 13 Sep 2015 13:28:20 -0700 +Subject: [PATCH] Fix header inclusions for musl + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + gweb/gresolv.c | 1 + + plugins/wifi.c | 3 +-- + src/tethering.c | 2 -- + tools/dhcp-test.c | 1 - + tools/dnsproxy-test.c | 1 + + 5 files changed, 3 insertions(+), 5 deletions(-) + +Index: connman-1.30/gweb/gresolv.c +=================================================================== +--- connman-1.30.orig/gweb/gresolv.c ++++ connman-1.30/gweb/gresolv.c +@@ -28,6 +28,7 @@ + #include <stdarg.h> + #include <string.h> + #include <stdlib.h> ++#include <stdio.h> + #include <resolv.h> + #include <sys/types.h> + #include <sys/socket.h> +Index: connman-1.30/plugins/wifi.c +=================================================================== +--- connman-1.30.orig/plugins/wifi.c ++++ connman-1.30/plugins/wifi.c +@@ -30,9 +30,8 @@ + #include <string.h> + #include <sys/ioctl.h> + #include <sys/socket.h> +-#include <linux/if_arp.h> +-#include <linux/wireless.h> + #include <net/ethernet.h> ++#include <linux/wireless.h> + + #ifndef IFF_LOWER_UP + #define IFF_LOWER_UP 0x10000 +Index: connman-1.30/src/tethering.c +=================================================================== +--- connman-1.30.orig/src/tethering.c ++++ connman-1.30/src/tethering.c +@@ -31,10 +31,8 @@ + #include <stdio.h> + #include <sys/ioctl.h> + #include <net/if.h> +-#include <linux/sockios.h> + #include <string.h> + #include <fcntl.h> +-#include <linux/if_tun.h> + #include <netinet/in.h> + #include <linux/if_bridge.h> + +Index: connman-1.30/tools/dhcp-test.c +=================================================================== +--- connman-1.30.orig/tools/dhcp-test.c ++++ connman-1.30/tools/dhcp-test.c +@@ -33,7 +33,6 @@ + #include <arpa/inet.h> + #include <net/route.h> + #include <net/ethernet.h> +-#include <linux/if_arp.h> + + #include <gdhcp/gdhcp.h> + +Index: connman-1.30/tools/dnsproxy-test.c +=================================================================== +--- connman-1.30.orig/tools/dnsproxy-test.c ++++ connman-1.30/tools/dnsproxy-test.c +@@ -27,6 +27,7 @@ + #include <stdlib.h> + #include <string.h> + #include <unistd.h> ++#include <stdio.h> + #include <arpa/inet.h> + #include <netinet/in.h> + #include <sys/types.h> +Index: connman-1.30/configure.ac +=================================================================== +--- connman-1.30.orig/configure.ac ++++ connman-1.30/configure.ac +@@ -173,6 +173,8 @@ AM_CONDITIONAL(PPTP_BUILTIN, test "${ena + + AC_CHECK_HEADERS([execinfo.h]) + ++AC_CHECK_MEMBERS([struct in6_pktinfo.ipi6_addr], [], [], [[#include <netinet/in.h>]]) ++ + AC_CHECK_HEADERS(resolv.h, dummy=yes, + AC_MSG_ERROR(resolver header files are required)) + AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [ +Index: connman-1.30/gdhcp/common.h +=================================================================== +--- connman-1.30.orig/gdhcp/common.h ++++ connman-1.30/gdhcp/common.h +@@ -19,6 +19,7 @@ + * + */ + ++#include <config.h> + #include <netinet/udp.h> + #include <netinet/ip.h> + +@@ -170,8 +171,8 @@ static const uint8_t dhcp_option_lengths + [OPTION_U32] = 4, + }; + +-/* already defined within netinet/in.h if using GNU compiler */ +-#ifndef __USE_GNU ++/* already defined within netinet/in.h if using GNU or musl libc */ ++#ifndef HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR + struct in6_pktinfo { + struct in6_addr ipi6_addr; /* src/dst IPv6 address */ + unsigned int ipi6_ifindex; /* send/recv interface index */ diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/connman b/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/connman new file mode 100644 index 000000000..c64fa0d71 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/connman/connman/connman @@ -0,0 +1,83 @@ +#!/bin/sh + +DAEMON=/usr/sbin/connmand +PIDFILE=/var/run/connmand.pid +DESC="Connection Manager" + +if [ -f /etc/default/connman ] ; then + . /etc/default/connman +fi + +set -e + +nfsroot=0 + +exec 9<&0 < /proc/mounts +while read dev mtpt fstype rest; do + if test $mtpt = "/" ; then + case $fstype in + nfs | nfs4) + nfsroot=1 + break + ;; + *) + ;; + esac + fi +done + +do_start() { + EXTRA_PARAM="" + if test $nfsroot -eq 1 ; then + NET_DEVS=`cat /proc/net/dev | sed -ne 's/^\([a-zA-Z0-9 ]*\):.*$/\1/p'` + NET_ADDR=`cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'` + + if [ ! -z "$NET_ADDR" ]; then + if [ "$NET_ADDR" = dhcp ]; then + ethn=`ifconfig | grep "^eth" | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"` + if [ ! -z "$ethn" ]; then + EXTRA_PARAM="-I $ethn" + fi + else + for i in $NET_DEVS; do + ADDR=`ifconfig $i | sed 's/addr://g' | sed -ne 's/^.*inet \([0-9.]*\) .*$/\1/p'` + if [ "$NET_ADDR" = "$ADDR" ]; then + EXTRA_PARAM="-I $i" + break + fi + done + fi + fi + fi + if [ -f @DATADIR@/connman/wired-setup ] ; then + . @DATADIR@/connman/wired-setup + fi + $DAEMON $EXTRA_PARAM +} + +do_stop() { + start-stop-daemon --stop --name connmand --quiet +} + +case "$1" in + start) + echo "Starting $DESC" + do_start + ;; + stop) + echo "Stopping $DESC" + do_stop + ;; + restart|force-reload) + echo "Restarting $DESC" + do_stop + sleep 1 + do_start + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 |