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
This commit is contained in:
Nicholas Vinson
2016-03-27 13:12:16 +08:00
committed by Ian Delaney
parent e48ab33680
commit 9df5a7e552
3 changed files with 157 additions and 0 deletions
+74
View File
@@ -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}
}
@@ -0,0 +1,36 @@
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: 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
@@ -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