commit:     9df5a7e55212f98ea227493da7ff244aebca4e65
Author:     Nicholas Vinson <nvinson234 <AT> gmail <DOT> com>
AuthorDate: Sat Mar 26 22:41:16 2016 +0000
Commit:     Ian Delaney <idella4 <AT> gentoo <DOT> org>
CommitDate: Sun Mar 27 05:12:16 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9df5a7e5

net-misc/connman: Fix iptables and xtables issues

Fixes issues with iptables, xtables, and glibc when building and running
connan.  Specifically, the patch, connman-1.31-iptables-1.6.0.patch,
fixes the icompatibilities between iptables and connman (due to an ABI
break in iptables-1.6.0).  The patch, connman-1.31-xtables.patch, uses
some preprocessor tricks to route around incompatibilies seen between
newer Linux kernels and glibc when both net/if.h and linu/if.h are
included in the same source.

Gentoo-bug: #573174, #577584

Package-Manager: portage-2.2.28
Closes: https://github.com/gentoo/gentoo/pull/1144

 net-misc/connman/connman-1.31-r1.ebuild            | 74 ++++++++++++++++++++++
 .../files/connman-1.31-iptables-1.6.0.patch        | 36 +++++++++++
 net-misc/connman/files/connman-1.31-xtables.patch  | 47 ++++++++++++++
 3 files changed, 157 insertions(+)

diff --git a/net-misc/connman/connman-1.31-r1.ebuild 
b/net-misc/connman/connman-1.31-r1.ebuild
new file mode 100644
index 0000000..2b1ee46
--- /dev/null
+++ b/net-misc/connman/connman-1.31-r1.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="6"
+inherit systemd
+
+DESCRIPTION="Provides a daemon for managing internet connections"
+HOMEPAGE="https://01.org/connman";
+SRC_URI="mirror://kernel/linux/network/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
+IUSE="bluetooth debug doc examples +ethernet l2tp ofono openvpn openconnect 
pptp policykit tools vpnc +wifi wispr"
+
+RDEPEND=">=dev-libs/glib-2.16
+       >=sys-apps/dbus-1.2.24
+       >=net-firewall/iptables-1.4.8
+       bluetooth? ( net-wireless/bluez )
+       l2tp? ( net-dialup/xl2tpd )
+       ofono? ( net-misc/ofono )
+       openconnect? ( net-misc/openconnect )
+       openvpn? ( net-misc/openvpn )
+       policykit? ( sys-auth/polkit )
+       pptp? ( net-dialup/pptpclient )
+       vpnc? ( net-misc/vpnc )
+       wifi? ( >=net-wireless/wpa_supplicant-2.0[dbus] )
+       wispr? ( net-libs/gnutls )"
+
+DEPEND="${RDEPEND}
+       >=sys-kernel/linux-headers-2.6.39"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-1.16-execinfo-assumptions.patch"
+       "${FILESDIR}/${PN}-1.31-iptables-1.6.0.patch"
+       "${FILESDIR}/${PN}-1.31-xtables.patch"
+)
+
+src_configure() {
+       econf \
+               --localstatedir=/var \
+               --enable-client \
+               --enable-datafiles \
+               --enable-loopback=builtin \
+               $(use_enable examples test) \
+               $(use_enable ethernet ethernet builtin) \
+               $(use_enable wifi wifi builtin) \
+               $(use_enable bluetooth bluetooth builtin) \
+               $(use_enable l2tp l2tp builtin) \
+               $(use_enable ofono ofono builtin) \
+               $(use_enable openconnect openconnect builtin) \
+               $(use_enable openvpn openvpn builtin) \
+               $(use_enable policykit polkit builtin) \
+               $(use_enable pptp pptp builtin) \
+               $(use_enable vpnc vpnc builtin) \
+               $(use_enable wispr wispr builtin) \
+               $(use_enable debug) \
+               $(use_enable tools) \
+               --disable-iospm \
+               --disable-hh2serial-gps
+}
+
+src_install() {
+       default
+       dobin client/connmanctl
+
+       if use doc; then
+               dodoc doc/*.txt
+       fi
+       keepdir /var/lib/${PN}
+       newinitd "${FILESDIR}"/${PN}.initd2 ${PN}
+       newconfd "${FILESDIR}"/${PN}.confd ${PN}
+}

diff --git a/net-misc/connman/files/connman-1.31-iptables-1.6.0.patch 
b/net-misc/connman/files/connman-1.31-iptables-1.6.0.patch
new file mode 100644
index 0000000..30131e6
--- /dev/null
+++ b/net-misc/connman/files/connman-1.31-iptables-1.6.0.patch
@@ -0,0 +1,36 @@
+From acea08a0e4234a4c1a87bedc087c73ff36de0c7b Mon Sep 17 00:00:00 2001
+From: Wu Zheng <[email protected]>
+Date: Thu, 28 Jan 2016 18:04:17 +0800
+Subject: 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.
+---
+ 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,
+-- 
+cgit v0.12
+

diff --git a/net-misc/connman/files/connman-1.31-xtables.patch 
b/net-misc/connman/files/connman-1.31-xtables.patch
new file mode 100644
index 0000000..10bdecd
--- /dev/null
+++ b/net-misc/connman/files/connman-1.31-xtables.patch
@@ -0,0 +1,47 @@
+--- connman-1.31/src/iptables.c.old    2016-03-22 20:12:47.829460752 -0700
++++ connman-1.31/src/iptables.c        2016-03-22 21:33:36.835384724 -0700
+@@ -28,11 +28,11 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <unistd.h>
+ #include <sys/errno.h>
+ #include <sys/socket.h>
+-#include <xtables.h>
++#include "connman_xtables.h"
+ #include <inttypes.h>
+ 
+ #include <linux/netfilter_ipv4/ip_tables.h>
+ 
+ #include "connman.h"
+--- connman-1.31/src/firewall.c.old    2016-03-22 21:29:01.959472262 -0700
++++ connman-1.31/src/firewall.c        2016-03-22 21:33:53.048144181 -0700
+@@ -23,11 +23,11 @@
+ #include <config.h>
+ #endif
+ 
+ #include <errno.h>
+ 
+-#include <xtables.h>
++#include "connman_xtables.h"
+ #include <linux/netfilter_ipv4/ip_tables.h>
+ 
+ #include "connman.h"
+ 
+ #define CHAIN_PREFIX "connman-"
+--- /dev/null  2016-03-18 06:21:16.372989086 -0700
++++ connman-1.31/include/connman_xtables.h     2016-03-22 21:32:21.349504786 
-0700
+@@ -0,0 +1,14 @@
++#ifndef CONNMAN_XTABLES_H
++#define CONNMAN_XTABLES_H
++#ifdef __USE_MISC
++#define GENTOO_USE_MISC __USE_MISC
++#undef __USE_MISC
++#endif
++
++#include <xtables.h>
++
++#ifdef GENTOO_USE_MISC
++#define __USE_MISC GENTOO_USE_MISC
++#undef GENTOO_USE_MISC
++#endif
++#endif

Reply via email to