From patchwork Mon Dec 16 20:06:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Weber X-Patchwork-Id: 1210745 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 47cC3l6kPqz9sPW for ; Tue, 17 Dec 2019 07:07:15 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 0F87F85C8C; Mon, 16 Dec 2019 20:07:12 +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 NSpDL5S73Gzk; Mon, 16 Dec 2019 20:07:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 5539685F29; Mon, 16 Dec 2019 20:07:09 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 340431BF3EE for ; Mon, 16 Dec 2019 20:06:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 30FCA86371 for ; Mon, 16 Dec 2019 20:06:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Uq9KadQA9kq1 for ; Mon, 16 Dec 2019 20:06:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from da1vs04.rockwellcollins.com (smtpimr.rockwellcollins.com [205.175.227.52]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 245EC86108 for ; Mon, 16 Dec 2019 20:06:55 +0000 (UTC) IronPort-SDR: W1RvkdMPNjATsVZMONgjW4L0E1YewuYGNDOrLBAuz4z9PVUrhOSHHa+FjtAiCo3nUeXNrOmpSj QAUxCQxs0WSGMpPrT0ZNfatPYt61SH3WG6xq8feBaj16xmvWDpRPAIAgk8Gsxqx0bt7g2/av5t BzoinG0ukdiy9N7R9CmNPjL9Z7tZExEChdFnGPTlAYgGxRI1SdLVQNcgboDcsUtHRFbSHLgBhz 04Bje1cMaB1Gt4k+BIeyg22lfIhWWgC+fo7uMeVQARvGFCJ60jOLJ73PhvtCjM4mtHsY3Wiol1 zwY= Received: from ofwda1n02.rockwellcollins.com (HELO dtulimr01.rockwellcollins.com) ([205.175.227.14]) by da1vs04.rockwellcollins.com with ESMTP; 16 Dec 2019 14:06:54 -0600 X-Received: from biscuits.rockwellcollins.lab (biscuits.rockwellcollins.lab [10.148.119.137]) by dtulimr01.rockwellcollins.com (Postfix) with ESMTP id 19DC66058E; Mon, 16 Dec 2019 14:06:53 -0600 (CST) From: Matt Weber To: buildroot@buildroot.org Date: Mon, 16 Dec 2019 14:06:52 -0600 Message-Id: <20191216200652.4416-1-matthew.weber@rockwellcollins.com> X-Mailer: git-send-email 2.17.1 Subject: [Buildroot] [PATCH] 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 --- ...-ebtables-save-perl-script-with-bash.patch | 75 +++++++++++++++++++ package/ebtables/Config.in | 10 +++ package/ebtables/ebtables.mk | 11 +++ 3 files changed, 96 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 <