From patchwork Wed Jun 20 05:42:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 931966 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@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=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="nCaYbv6W"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 419Ydk6MmTz9s3C for ; Wed, 20 Jun 2018 15:43:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753321AbeFTFnF (ORCPT ); Wed, 20 Jun 2018 01:43:05 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:50562 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752102AbeFTFm6 (ORCPT ); Wed, 20 Jun 2018 01:42:58 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5K5csuo177930; Wed, 20 Jun 2018 05:42:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=kIVqQMezaXObOFULkIOSH82jPhauM4KnI3hQfkviMB0=; b=nCaYbv6W5zjDZzSbCYd6jaCfORrQpMA9Rri7fJJ7xZvwrcTmuA//S5Hgg/gqbOLtaGH5 a+KYw3p3jN2P28pDu0p3NS6U8xdb8juLBZnrtb5nzxNrvZPxf0elGhB4co7LU49muBtb Uf/T5vwVRzYL0EPC3ZgSjCx11CvhKVrxJr019QDWMA2g8bzNOnR+9ttWLUAZ6g1ytKkq GljUA2OmniU3AURzwi26NwwVdbI2mWeF6GIinUSGbv6yjwEdJcaq0LNy7y1Bhg5awZUN NVANKrp487q6RKtOSSu7riHONDoShby9bZaHKYX0eVBkZRrqABrEkbrCN+5GHWX+4Zlz 4g== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2jmtgwtvr6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jun 2018 05:42:55 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5K5gswf000706 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jun 2018 05:42:55 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w5K5gs0U015220; Wed, 20 Jun 2018 05:42:54 GMT Received: from slnelson-mint18.us.oracle.com (/10.159.143.233) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Jun 2018 22:42:54 -0700 From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, anders.roxell@linaro.org Subject: [PATCH net-next 2/2] selftests: rtnetlink: use a local IP address for IPsec tests Date: Tue, 19 Jun 2018 22:42:43 -0700 Message-Id: <1529473363-4036-3-git-send-email-shannon.nelson@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529473363-4036-1-git-send-email-shannon.nelson@oracle.com> References: <1529473363-4036-1-git-send-email-shannon.nelson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8929 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806200064 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Find an IP address on this machine to use as a source IP, and make up a destination IP address based on the source IP. No actual messages will be sent, just a couple of IPsec rules are created and deleted. Fixes: 5e596ee171ba ("selftests: add xfrm state-policy-monitor to rtnetlink.sh") Reported-by: Anders Roxell Signed-off-by: Shannon Nelson --- tools/testing/selftests/net/rtnetlink.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index 0a2bc6e..b33a371 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -522,8 +522,12 @@ kci_test_macsec() #------------------------------------------------------------------- kci_test_ipsec() { - srcip="14.0.0.52" - dstip="14.0.0.70" + # find an ip address on this machine and make up a destination + srcip=`ip -o addr | awk '/inet / { print $4; }' | grep -v "^127" | head -1 | cut -f1 -d/` + net=`echo $srcip | cut -f1-3 -d.` + base=`echo $srcip | cut -f4 -d.` + dstip="$net."`expr $base + 1` + algo="aead rfc4106(gcm(aes)) 0x3132333435363738393031323334353664636261 128" # flush to be sure there's nothing configured