From patchwork Mon Dec 16 22:08:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Weber X-Patchwork-Id: 1210786 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rockwellcollins.com Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47cFlq4fK1z9sPL for ; Tue, 17 Dec 2019 09:08:39 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id ED129882E7; Mon, 16 Dec 2019 22:08:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iCpD1hntI2mn; Mon, 16 Dec 2019 22:08:36 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 7894C882F2; Mon, 16 Dec 2019 22:08:36 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id ED3651BF297 for ; Mon, 16 Dec 2019 22:08:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id E298B226E5 for ; Mon, 16 Dec 2019 22:08:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aEheMmlZg-qy for ; Mon, 16 Dec 2019 22:08:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from da1vs02.rockwellcollins.com (da1vs02.rockwellcollins.com [205.175.227.29]) by silver.osuosl.org (Postfix) with ESMTPS id 6979F226D7 for ; Mon, 16 Dec 2019 22:08:34 +0000 (UTC) IronPort-SDR: Oh/SqzlXJ0++Z0FIN/51CQZooQFCuWAwr49P+WodqHZWR8rk3j9A8E3zX0ApUwJ8JNkDATP4Y1 kt1KCAUo0X+nY09OfB5yWuczXctJH2JTNkNXkchNBNFqWMI0P8KANEKSFtCX8pDaicxuUsrNHq mH3ftu1dgmkNIGuwimxQ/YF4cFeEaHcZtcLK1NYCPUPDFMvg0rwk/ytn8FhSwsbVm6GaOS23YX Ifsmw7YbgAotZIEENhlXcyzrV2kTHySsFOv6qMahzQw4vWEnS7dANWzswM+DgULroRlZIGEf3E KW0= Received: from ofwda1n02.rockwellcollins.com (HELO ciulimr01.rockwellcollins.com) ([205.175.227.14]) by da1vs02.rockwellcollins.com with ESMTP; 16 Dec 2019 16:08:33 -0600 X-Received: from biscuits.rockwellcollins.lab (biscuits.rockwellcollins.lab [10.148.119.137]) by ciulimr01.rockwellcollins.com (Postfix) with ESMTP id 4F6EB6038A; Mon, 16 Dec 2019 16:08:33 -0600 (CST) From: Matt Weber To: buildroot@buildroot.org Date: Mon, 16 Dec 2019 16:08:32 -0600 Message-Id: <20191216220832.6792-1-matthew.weber@rockwellcollins.com> X-Mailer: git-send-email 2.17.1 Subject: [Buildroot] [PATCH v2] ebtables: add option to install save/restore utils X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Owens MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: David Owens This patch adds an option to include the tools on target that allow the saving and restoring of ebtables. The upstream save utility is replaced in this commit as it depended on perl which is not always possible on an embedded system. The commit used to replace this script seems to note it as a common approach across a few distros. Signed-off-by: David Owens Signed-off-by: Matt Weber --- Changes v1 -> v2 - Split out the save and restore so that only when saving bash is a dependency --- ...-ebtables-save-perl-script-with-bash.patch | 75 +++++++++++++++++++ package/ebtables/Config.in | 15 ++++ package/ebtables/ebtables.mk | 16 ++++ 3 files changed, 106 insertions(+) create mode 100644 package/ebtables/0003-replace-ebtables-save-perl-script-with-bash.patch diff --git a/package/ebtables/0003-replace-ebtables-save-perl-script-with-bash.patch b/package/ebtables/0003-replace-ebtables-save-perl-script-with-bash.patch new file mode 100644 index 0000000000..687eb6a373 --- /dev/null +++ b/package/ebtables/0003-replace-ebtables-save-perl-script-with-bash.patch @@ -0,0 +1,75 @@ +From 73536d15c80be96049289d96fc32122467c56b1d Mon Sep 17 00:00:00 2001 +From: Matt Weber +Date: Mon, 16 Dec 2019 13:27:30 -0600 +Subject: [PATCH] ebtables: replace ebtables-save perl script with bash rewrite + +Fedora provides a bash replacement for the default ebtables-save perl +script. Using it allows the ebtables run-time dependency on perl to +be replaced with a runtime dependency on bash - which is lower +overhead and more likely to be present on typical embedded systems +already. + + https://bugzilla.redhat.com/show_bug.cgi?id=746040 + http://pkgs.fedoraproject.org/cgit/rpms/ebtables.git/tree/ebtables-save + +Upstream: +https://github.com/openembedded/meta-openembedded/commit/7f723007364ba79de05447671e83d4eefb3097dc + +Signed-off-by: Matthew Weber +--- + ebtables-save.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 43 insertions(+) + create mode 100644 ebtables-save.sh + +diff --git a/ebtables-save.sh b/ebtables-save.sh +new file mode 100644 +index 0000000..2d7fc4e +--- /dev/null ++++ b/ebtables-save.sh +@@ -0,0 +1,43 @@ ++#!/bin/bash ++ ++EBTABLES="/sbin/ebtables" ++ ++[ -x "$EBTABLES" ] || exit 1 ++ ++echo "# Generated by ebtables-save v1.0 on $(date)" ++ ++cnt="" ++[ "x$EBTABLES_SAVE_COUNTER" = "xyes" ] && cnt="--Lc" ++ ++for table_name in $(grep -E '^ebtable_' /proc/modules | cut -f1 -d' ' | sed s/ebtable_//); do ++ table=$($EBTABLES -t $table_name -L $cnt) ++ [ $? -eq 0 ] || { echo "$table"; exit -1; } ++ ++ chain="" ++ rules="" ++ while read line; do ++ [ -z "$line" ] && continue ++ ++ case "$line" in ++ Bridge\ table:\ *) ++ echo "*${line:14}" ++ ;; ++ Bridge\ chain:\ *) ++ chain="${line:14}" ++ chain="${chain%%,*}" ++ policy="${line##*policy: }" ++ echo ":$chain $policy" ++ ;; ++ *) ++ if [ "$cnt" = "--Lc" ]; then ++ line=${line/, pcnt \=/ -c} ++ line=${line/-- bcnt \=/} ++ fi ++ rules="$rules-A $chain $line\n" ++ ;; ++ esac ++ done <