From patchwork Tue May 8 15:43:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Brivio X-Patchwork-Id: 910306 X-Patchwork-Delegate: kadlec@blackhole.kfki.hu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40gP0d2j7Wz9s1w for ; Wed, 9 May 2018 01:43:45 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755236AbeEHPno (ORCPT ); Tue, 8 May 2018 11:43:44 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50974 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754952AbeEHPnn (ORCPT ); Tue, 8 May 2018 11:43:43 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 84CB6818F6EB; Tue, 8 May 2018 15:43:43 +0000 (UTC) Received: from epycfail.redhat.com (ovpn-112-49.ams2.redhat.com [10.36.112.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id C092BAFD64; Tue, 8 May 2018 15:43:42 +0000 (UTC) From: Stefano Brivio To: Jozsef Kadlecsik Cc: netfilter-devel@vger.kernel.org Subject: [PATCH ipset] tests/check_klog.sh: Try dmesg too, don't let shell terminate script Date: Tue, 8 May 2018 17:43:30 +0200 Message-Id: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 08 May 2018 15:43:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 08 May 2018 15:43:43 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'sbrivio@redhat.com' RCPT:'' Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Some hosts might not use /var/log/kern.log for kernel messages, so if we can't find a match there, try dmesg next. If no matches are found, don't let the shell terminate the script, so that we have a chance to try dmesg and actually echo "no match!" if no matches are found: set +e before the setname loop. Signed-off-by: Stefano Brivio --- tests/check_klog.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/check_klog.sh b/tests/check_klog.sh index 146e492b2770..9af5f66f28eb 100755 --- a/tests/check_klog.sh +++ b/tests/check_klog.sh @@ -42,8 +42,12 @@ ipaddr=`expand_ipv6 $1`; shift proto=`echo $1 | tr a-z A-Z`; shift port=$1; shift +set +e for setname in $@; do match=`tail -n +$loglines /var/log/kern.log | grep -e "in set $setname: .* SRC=$ipaddr .* PROTO=$proto SPT=$port .*"` + if [ -z "$match" ]; then + match=`dmesg | tail -n +$loglines | grep -e "in set $setname: .* SRC=$ipaddr .* PROTO=$proto SPT=$port .*"` + fi if [ -z "$match" ]; then echo "no match!" exit 1