From patchwork Mon May 4 20:47:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Linus_L=C3=BCssing?= X-Patchwork-Id: 4439 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=188.40.49.9; helo=mail.passe0815.de; envelope-from=linus.luessing@c0d3.blue; receiver=b.a.t.m.a.n@lists.open-mesh.org Received: from mail.passe0815.de (mail.passe0815.de [188.40.49.9]) by open-mesh.org (Postfix) with ESMTPS id B77DA600689 for ; Mon, 4 May 2015 22:47:28 +0200 (CEST) Received: from mail.passe0815.de (localhost [127.0.0.1]) by mail.passe0815.de (Postfix) with ESMTP id 9F78258642C for ; Mon, 4 May 2015 22:47:26 +0200 (CEST) Received: from localhost (unknown [IPv6:2001:67c:2d50:0:c89e:b9c3:6e31:4b8f]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.passe0815.de (Postfix) with ESMTPSA id E5DC258601F; Mon, 4 May 2015 22:47:24 +0200 (CEST) From: =?UTF-8?q?Linus=20L=C3=BCssing?= To: b.a.t.m.a.n@lists.open-mesh.org Date: Mon, 4 May 2015 22:47:23 +0200 Message-Id: <1430772443-3545-1-git-send-email-linus.luessing@c0d3.blue> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430691231-9120-1-git-send-email-linus.luessing@c0d3.blue> References: <1430691231-9120-1-git-send-email-linus.luessing@c0d3.blue> MIME-Version: 1.0 X-GPG-Mailgate: Not encrypted, public key not found Subject: [B.A.T.M.A.N.] [PATCH RFCv4 3/3] compat: disable multicast optimizations for old kernels X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 May 2015 20:47:35 -0000 With this patch, the Makefile searches for the symbols needed for the multicast optimizations in the kernel's .config and Module.symvers. If they are not there, a warning is issued during "make" and the multicast.c is excluded from the build process. The advantage of this is that there's no need for hackish substitutions in the original code base. Also, this approach is independant of the actual kernel version, so it's easily possible to backport the upstream functions to your own, older kernel if you desire. Signed-off-by: Linus Lüssing --- Makefile | 6 ++++++ check-dependencies.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 check-dependencies.sh diff --git a/Makefile b/Makefile index ee3be1d..a66ec66 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,12 @@ ifneq ($(REVISION),) NOSTDINC_FLAGS += -DBATADV_SOURCE_VERSION=\"$(REVISION)\" endif +ifeq ($(CONFIG_BATMAN_ADV_MCAST),y) +ifneq ($(shell $(PWD)/check-dependencies.sh $(KERNELPATH); echo $$?),0) + override CONFIG_BATMAN_ADV_MCAST=n +endif +endif + BUILD_FLAGS := \ M=$(PWD)/net/batman-adv \ CONFIG_BATMAN_ADV=m \ diff --git a/check-dependencies.sh b/check-dependencies.sh new file mode 100755 index 0000000..86e0654 --- /dev/null +++ b/check-dependencies.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +DEPS_CONFIG_BATMAN_ADV_MCAST="CONFIG_IPV6:ipv6_mc_check_mld ip_mc_check_igmp" + +KERNELPATH="$1" +RET=0 + +for s in $DEPS_CONFIG_BATMAN_ADV_MCAST; do + if [ -n "${s##*:*}" ]; then + conf="" + dep="$s" + else + conf="${s%%:*}" + dep="${s#*:}" + fi + + [ -n "$conf" ] && ! egrep -q "$conf=(m|y)" ${KERNELPATH}/.config && \ + continue + + grep -q "$dep" ${KERNELPATH}/Module.symvers && continue + + echo "WARNING: Missing built-in symbol \"$dep\" -" \ + "disabling CONFIG_BATMAN_ADV_MCAST (Kernel too old?)" \ + >&2 + + RET=1 +done + +exit $RET