From patchwork Mon Aug 28 11:32:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram Yagnaraman X-Patchwork-Id: 13367926 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9906B11C97 for ; Mon, 28 Aug 2023 12:28:55 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2104.outbound.protection.outlook.com [40.107.20.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD8B818F; Mon, 28 Aug 2023 05:28:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vt3w2SiJ0TLcQs65e1Dk3DAfIYhxaZdJ8mtGHHA4aX0CuzbGGK6CL14CsqE7ZWbOdBBVvz6kR1HSo+TYqVPcZm5wbvsk2wHjZ2KXXua1dir5rBhBuxWDLU6gFJ74UXlsiaIpvIRDVKikDOyZJg3BMgf7PyBW0p8MrXcKoxDvOKODibt2PVXsabBzkQd2z0ZWVQTd4r8pMx99w2tDyMRj7PeAdJ/ylRj0dQpDnfn9pgzhfi9+E04aaHjzhM738/CJ7lwvC20XD/QYd/KNVnOGnrJjg5Adzax+qBj6qksMhmfib2sfKAEYJNIDebGHnFrjGs1bJsHmznYXRGV9trbQUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jK1SaxBau9ezB/599xhQ+OmyNo0RpfRZjw0urTfez3U=; b=Pwq5eFrVMy/ICwuibPz4BmWUY5OTTzGr8TkdUIukD1U49xjfIz/EsG/N+2V0p2r8W/+u/MU94BEhFscNHUYYI1Hl5sY/wZub8JAYFaczEi/A6bwgf42d8KjLUDoaR1/3kmxI1z2S2oqrxucio9svtlUCb5xGB0nhPp3qBeLfoCk8kWCrngzB8ibSpQyaCnsP0baHU86gSu0mP/in5q1CUgHoIa0dsUVj2rEWJ/BsaRHJhZTzsHtX+j8+M55fdw8PzZoMb0uc22T5AZ/ev1ppNKvOO4aasjEDNAQSi0jbM3bqkIXKAadOyzwXypouzb3wkLeadn5T/edGxDklVkZlqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=est.tech; dmarc=pass action=none header.from=est.tech; dkim=pass header.d=est.tech; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=estab.onmicrosoft.com; s=selector2-estab-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jK1SaxBau9ezB/599xhQ+OmyNo0RpfRZjw0urTfez3U=; b=RuF1lD4tP8IOLqELW4kjpILzDxabUewBnl6XjNBbWidFwPokF7//EE9lWMC3Dg0jCjYOKeeacho5/fV5pa4F+ichGMtlrYrKVry6sf3StLWLxJcCHBhW1mnhq63AF5x0R29r0787qnci6u78GaYbgQFrqJPYiigTTQP1tUs9K7o= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=est.tech; Received: from DBBP189MB1433.EURP189.PROD.OUTLOOK.COM (2603:10a6:10:1e7::15) by AM0P189MB0817.EURP189.PROD.OUTLOOK.COM (2603:10a6:208:195::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.29; Mon, 28 Aug 2023 12:28:31 +0000 Received: from DBBP189MB1433.EURP189.PROD.OUTLOOK.COM ([fe80::759b:94eb:c2e8:c670]) by DBBP189MB1433.EURP189.PROD.OUTLOOK.COM ([fe80::759b:94eb:c2e8:c670%6]) with mapi id 15.20.6699.034; Mon, 28 Aug 2023 12:28:31 +0000 From: Sriram Yagnaraman To: Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Ido Schimmel , Shuah Khan , Petr Machata , Sriram Yagnaraman Subject: [PATCH net v3 1/3] ipv4: ignore dst hint for multipath routes Date: Mon, 28 Aug 2023 13:32:19 +0200 Message-Id: <20230828113221.20123-2-sriram.yagnaraman@est.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230828113221.20123-1-sriram.yagnaraman@est.tech> References: <20230828113221.20123-1-sriram.yagnaraman@est.tech> X-ClientProxiedBy: GV3P280CA0013.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:b::34) To DBBP189MB1433.EURP189.PROD.OUTLOOK.COM (2603:10a6:10:1e7::15) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DBBP189MB1433:EE_|AM0P189MB0817:EE_ X-MS-Office365-Filtering-Correlation-Id: 979aeabd-d43b-4f4e-b7e8-08dba7c2498d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ej8cWE8y1YbVuAqj6x7av3u5HgJteevVpdiKL+1D3jH66m87VC0w2cQ4b8kr3Zs7mqLAoBcRkdI5zmfr2Aqn+YbX6DZ2gmDk6lt8QTzPHytUOI3dPlK31YFGP48cjmc3TNBpPkxWpgXMSA4wLZRSLvVFx2wBYm+cxSRuaC5mKlV5JyRlloGt+tt+4Lo2yMD9fy3dTcEwI/dSzD+81SwX/7KL/9OOaY1xiFcsDOxFOkA6samA+/qaXgqZ8q2ex+kD3O7HohVnLo3Bv7Xfyf/rCsrS+ib/Ey5iRvy8BU/LQ8D6YRcTC4irFNKd4b6lppPgJhUqvXdcgAYIHT9NumTNkoSWwU7/Z6+iEMdMqSJtsMYnGAYG8B7gyTB27xQO0lHDnwfSIs2ClvAFpcfupRWkKcuF+QOrR1Qz5X7oYscaA0ZACwSsUJ4FEX0LNH3VJrDds9Q0rGMCFkcEfhxI67oyLg8kHe4fcWz3r7lCz2ZKoCmtjz7v6XzSEojXEGF9/qAU6XL2rQGt14KQDlhnhwuDvt+aFl/A0k8Rx+JoFBRBzX/GjXTXdO4bdLN6JOvNhdJF8ZNUN97M/qrGJke/Zbn++UOpcAGFk9sb+Czi2UV7zyNkRoZ+KinBOqtC9mI3jfzpfAt3mntcCub0nTjGdjZnJw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DBBP189MB1433.EURP189.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(346002)(396003)(39830400003)(376002)(136003)(1800799009)(451199024)(186009)(109986022)(1076003)(44832011)(83380400001)(6512007)(478600001)(26005)(7416002)(2616005)(5660300002)(2906002)(8676002)(8936002)(4326008)(70586007)(6486002)(38100700002)(66946007)(66476007)(86362001)(66556008)(54906003)(41300700001)(36756003)(316002)(6666004)(6506007)(266003)(37730700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3tD+CaR0cv6EHBU0KbzpCmwCgBARIBDFz2+VGErD0gZ5MS27lCKE31vssR/E/VRpg7Rdhq/mbNYyNWLZhMk6HKRofC2LpeGtkypFBTO/ulkhuKoDqozsn0Ve0E0N0DP6H8gyO34pivs3FCB+Qf8A0b9uv2H7D9uxOSVrTyRIow8oECULe/R90QJKBCfzr0JeJBljIaX7d6u9RNYqjFtSF3DrWqwmyiukteEer3UaamYl4eAxaNiSKtlV7+ZbqWKGUPZ0Gu1w7zEaHjXX4PAThiav12g7nB2lem9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zZqOxDZLBoCHGg1clWfT5AlCr8jM7+icKOwlleO+aibrCJNeH4CL36Laa6Qzj91G++JC8z86XOvAlhzfUtcajRLdaTjO6av5jsCfVFYMGQb46ja1TE+I/k+eMu47jhTqFK/U73JE0aaZCvgFe4G18J4oksAyIka/hK6F67XctxzwsvEkX0p2ymvSXt5/tuYzIN+6sCnv0H68YX86XO5unf7j5wqglTdP/IanvrsCX/lRbnW+xNiHPRTyu9AqH62zNw== X-OriginatorOrg: est.tech X-MS-Exchange-CrossTenant-Network-Message-Id: 979aeabd-d43b-4f4e-b7e8-08dba7c2498d X-MS-Exchange-CrossTenant-AuthSource: DBBP189MB1433.EURP189.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2023 12:28:30.3954 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d2585e63-66b9-44b6-a76e-4f4b217d97fd X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WhyELbPz2dYKw4RbZbARTQ273AcM18BRKQfQHhJONS3iSkuUjN/xs7lV8Xgy2vzyupog0lHhx45TEd/6zyB9ZoKxV2hy3HNwt3WYgNgGnxY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0P189MB0817 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Route hints when the nexthop is part of a multipath group causes packets in the same receive batch to be sent to the same nexthop irrespective of the multipath hash of the packet. So, do not extract route hint for packets whose destination is part of a multipath group. A new SKB flag IPSKB_MULTIPATH is introduced for this purpose, set the flag when route is looked up in ip_mkroute_input() and use it in ip_extract_route_hint() to check for the existence of the flag. Fixes: 02b24941619f ("ipv4: use dst hint for ipv4 list receive") Signed-off-by: Sriram Yagnaraman Reviewed-by: Ido Schimmel Reviewed-by: David Ahern --- include/net/ip.h | 1 + net/ipv4/ip_input.c | 3 ++- net/ipv4/route.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/net/ip.h b/include/net/ip.h index 19adacd5ece0..464176a88f86 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -57,6 +57,7 @@ struct inet_skb_parm { #define IPSKB_FRAG_PMTU BIT(6) #define IPSKB_L3SLAVE BIT(7) #define IPSKB_NOPOLICY BIT(8) +#define IPSKB_MULTIPATH BIT(9) u16 frag_max_size; }; diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index fe9ead9ee863..5e9c8156656a 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c @@ -584,7 +584,8 @@ static void ip_sublist_rcv_finish(struct list_head *head) static struct sk_buff *ip_extract_route_hint(const struct net *net, struct sk_buff *skb, int rt_type) { - if (fib4_has_custom_rules(net) || rt_type == RTN_BROADCAST) + if (fib4_has_custom_rules(net) || rt_type == RTN_BROADCAST || + IPCB(skb)->flags & IPSKB_MULTIPATH) return NULL; return skb; diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 92fede388d52..33626619aee7 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -2144,6 +2144,7 @@ static int ip_mkroute_input(struct sk_buff *skb, int h = fib_multipath_hash(res->fi->fib_net, NULL, skb, hkeys); fib_select_multipath(res, h); + IPCB(skb)->flags |= IPSKB_MULTIPATH; } #endif From patchwork Mon Aug 28 11:32:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram Yagnaraman X-Patchwork-Id: 13367927 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 698AC11C97 for ; Mon, 28 Aug 2023 12:28:59 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2104.outbound.protection.outlook.com [40.107.20.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 851BC198; Mon, 28 Aug 2023 05:28:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bUy5bQ/iDd8p00KyQWKVAnSI5VcoKMROGuLmLaMQZ5eBzicwhMY/84JBripQoU6BMi9O+i8TgLzt4THcRcVoL+FZY3+/ei3mSzZG/JYbr7tk5v9Rdlp29bYDchSJsND6+vzyp5fj/D8Ll5ys9iw9X+LkI4tVlRC8LcSFlb9gGbT+yl77uzqnbMF1zgyxLfYtMVUknCFTJCFAeyzvjeP8E21K/VpDuzf0d80q/A7FJpzoWeNeXw7wHpj4XxtigaO6ogGgEwvhsDN34DUEb3EeY3qlYUC/gD0YAHc3b1DSjgLu+LcxiXjm/fpyV20dARfMuJiLKTWuqqio6HuTnCEEQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XCE4pKlxfpEHlaaymtwqhceY03ZRJGtavqbhBRwkLUk=; b=O9AbBEmbWmoDvHOAN1eQtjwly0CJuChrl/x/rvr7PI/dkhDzV3bM9yhOyir2bq0PIvoRZen/vm6oikgYsJKlFwCtyv4mR6pwItoPHAkn1SIwz4brDHeAzBCrCHmmtX7Z5rb4hYEZ+FZdOOkesHsk7x1AUrBR29BGk0kBmw0NRYcfwbypUPmj5woso4aEoeYIfWAmvvFyjUAVO2xqTYID8B2RAzJlNEaKmkKQSYAekljULl9bo+POG2gZhGvPajrr4MsPMP6Fdv3Piv+jmEyXh5GVKZMpvBvuAKkNcma4rq4+1cyibcke1Uq1byvfl81CKs3yvOf21EmxYg2Pfch6vA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=est.tech; dmarc=pass action=none header.from=est.tech; dkim=pass header.d=est.tech; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=estab.onmicrosoft.com; s=selector2-estab-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XCE4pKlxfpEHlaaymtwqhceY03ZRJGtavqbhBRwkLUk=; b=EygHwJ1qk3B4vOKlTNuwxHgDhx9nPW/60V6D8KGIezgyYlTwH77uJ/eljL/gKy/whS+ApHnk0Yi+PeKYMWt4TjiP0fnGLOe9N0Cyp3qmuy+CtuTEnF86dW0v0foxlfI9W1aAFGKPNGBH1bUnMOJtMrqTkS1hiAPDoky/yqsnS8s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=est.tech; Received: from DBBP189MB1433.EURP189.PROD.OUTLOOK.COM (2603:10a6:10:1e7::15) by AM0P189MB0817.EURP189.PROD.OUTLOOK.COM (2603:10a6:208:195::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.29; Mon, 28 Aug 2023 12:28:31 +0000 Received: from DBBP189MB1433.EURP189.PROD.OUTLOOK.COM ([fe80::759b:94eb:c2e8:c670]) by DBBP189MB1433.EURP189.PROD.OUTLOOK.COM ([fe80::759b:94eb:c2e8:c670%6]) with mapi id 15.20.6699.034; Mon, 28 Aug 2023 12:28:31 +0000 From: Sriram Yagnaraman To: Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Ido Schimmel , Shuah Khan , Petr Machata , Sriram Yagnaraman Subject: [PATCH net v3 2/3] ipv6: ignore dst hint for multipath routes Date: Mon, 28 Aug 2023 13:32:20 +0200 Message-Id: <20230828113221.20123-3-sriram.yagnaraman@est.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230828113221.20123-1-sriram.yagnaraman@est.tech> References: <20230828113221.20123-1-sriram.yagnaraman@est.tech> X-ClientProxiedBy: GV3P280CA0015.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:b::13) To DBBP189MB1433.EURP189.PROD.OUTLOOK.COM (2603:10a6:10:1e7::15) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DBBP189MB1433:EE_|AM0P189MB0817:EE_ X-MS-Office365-Filtering-Correlation-Id: 54189382-a968-4e20-6769-08dba7c24a6b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: on+fdWGmaGkveMkE+6dhNIi7ACdjkhnb/vLdGjRtgmiUD9OpuunmJPWZy8Ew55q7p+pHBzzdT0rcLiTxBXM6cZueNklQ5MY/zGCZ3lPNzHT/5yR7Yd+3pYM+JJaq3oCE0RQ67saRBFEZFcd3TLonIYn9Nwzvbz+RF2aMZhi+5qv4gJ7JN9S5Io1uLDSsph+yk/DgI9LMy8ID5hx8GFsE95l1wGZuW7OFFYSPmWU0Ytfjq1Uq8roDuRNQwTAASwxRw5iny7/rWGoyjVdLiOYNPK8CdnAYvIcvmv0kS4Cdfr397Ci5fbTWnmwhJT6ZtRmGxJXglYCoBa35q8bJgz5EZbrjOtPEQtq7wOrYVL6mWaiC4NnG2hN74RLOdStoSd1avi3Zm3QFA3GzXxOyhhw3/uOD6ib0apmIiuXdq7OktKsGYd9+Za/P98YwRV1kWpIUiexXcI/UnmiXZpe3M5Wy79+zJYC29iLF8Nh6YHoBotTHPcOtuBiK1FBGa726gJdYoEnoxNX0+SCgmq66g3CmogUa7fFI/eZpG9oMY9B01r8xFJodqUKOoz3eoYUxYNjq8z3uIkIuHE0BIM3Uy9cc/5kjVZqDaADqqsiTn3lpK3+4BKHscw4sllM9VJOkY3d3SCOEbEYmh/bSPss3eCo2AQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DBBP189MB1433.EURP189.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(346002)(396003)(39830400003)(376002)(136003)(1800799009)(451199024)(186009)(109986022)(1076003)(44832011)(83380400001)(6512007)(478600001)(26005)(7416002)(2616005)(5660300002)(2906002)(8676002)(8936002)(4326008)(70586007)(6486002)(38100700002)(66946007)(66476007)(86362001)(66556008)(54906003)(41300700001)(36756003)(316002)(6666004)(6506007)(266003)(37730700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A0r2WbnPsslOehp9jNThfrdlUbfIH+oXVxFBKguVYfP5H3O9MsFenVLHG3EEqdwDrI1pONWYIJvQyXFwRt33qZH3tgmhJiy+sXeXTYfOLbmiQIGicFFVyebAzWnDuKxniqIwT/Q3TgR/ZBsyPUixWPCd05N74fOEPklWzt8sDTQH89P+pBprMs3JAjUKfTUzjkvfMM01kj+wu4jDwCggl5tKBuTxLu8QPEyXLdMM+ly28yL6R9ThuBtGw4DAn7mNw44JE0StxHNa6dTs6YKKTb8ONprh8ZSEncrKkoopPxEktfOTCZsNem2DghOdg/KEhP/FefkGT+nlgBd9Pwy15O6phBjzeF8w5T72BjS1wIgS3FP97ISvuuSEL7z6yk/Br04GLBXMJud31p0w0YA2iruGQnY/iqGR7TudF0LP/espgbcip+qHrznJjNPlWuy+zMBQCcWWgT3uz9jFI1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deM4ZEMgadVQlLBAWOas2vWd9Zt+l+gZag+V/ECm8wp5AwRvc6NeSQG4InIHbS3MnjrCD37ZWn6467w== X-OriginatorOrg: est.tech X-MS-Exchange-CrossTenant-Network-Message-Id: 54189382-a968-4e20-6769-08dba7c24a6b X-MS-Exchange-CrossTenant-AuthSource: DBBP189MB1433.EURP189.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2023 12:28:31.8233 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d2585e63-66b9-44b6-a76e-4f4b217d97fd X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mApcCxbGhFC4P+DwHemdRKtgxSQ4E65PZS8uUWWNLVZcWQvYye5bZVFFqlbOHmhyYO7cYfnM50sa2jvEXq23RM/rkybxUS8ODn35FV5C5/c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0P189MB0817 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Route hints when the nexthop is part of a multipath group causes packets in the same receive batch to be sent to the same nexthop irrespective of the multipath hash of the packet. So, do not extract route hint for packets whose destination is part of a multipath group. A new SKB flag IP6SKB_MULTIPATH is introduced for this purpose, set the flag when route is looked up in fib6_select_path() and use it in ip6_can_use_hint() to check for the existence of the flag. Fixes: 197dbf24e360 ("ipv6: introduce and uses route look hints for list input.") Signed-off-by: Sriram Yagnaraman Reviewed-by: Ido Schimmel Reviewed-by: David Ahern --- include/linux/ipv6.h | 1 + net/ipv6/ip6_input.c | 3 ++- net/ipv6/route.c | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 839247a4f48e..fe3492a67b35 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -146,6 +146,7 @@ struct inet6_skb_parm { #define IP6SKB_JUMBOGRAM 128 #define IP6SKB_SEG6 256 #define IP6SKB_FAKEJUMBO 512 +#define IP6SKB_MULTIPATH 1024 }; #if defined(CONFIG_NET_L3_MASTER_DEV) diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index d94041bb4287..b8378814532c 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c @@ -99,7 +99,8 @@ static bool ip6_can_use_hint(const struct sk_buff *skb, static struct sk_buff *ip6_extract_route_hint(const struct net *net, struct sk_buff *skb) { - if (fib6_routes_require_src(net) || fib6_has_custom_rules(net)) + if (fib6_routes_require_src(net) || fib6_has_custom_rules(net) || + IP6CB(skb)->flags & IP6SKB_MULTIPATH) return NULL; return skb; diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 56a55585eb79..a02328c93a53 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -424,6 +424,9 @@ void fib6_select_path(const struct net *net, struct fib6_result *res, if (match->nh && have_oif_match && res->nh) return; + if (skb) + IP6CB(skb)->flags |= IP6SKB_MULTIPATH; + /* We might have already computed the hash for ICMPv6 errors. In such * case it will always be non-zero. Otherwise now is the time to do it. */ From patchwork Mon Aug 28 11:32:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram Yagnaraman X-Patchwork-Id: 13367928 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D48B7125C7 for ; Mon, 28 Aug 2023 12:29:00 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2104.outbound.protection.outlook.com [40.107.20.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E29AE3; Mon, 28 Aug 2023 05:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eTi21TR5jQAYr57SJA/itAx0I0NN6jb+vsytGwV+F51IrNg3vRhyLDMUOTY3z3xZggJhqv6DYiPz8mJX2V+H9kktwgL17m38M3Tm6FUXCSL2YJBRq2HPWyt/G8ShoRqDi3d6QIWTNaR5jVvDV8p4cSQXutOiY5Mo4ThrkBaSbpTHSgFI36++zYSyEjdfdArl96YK5EFl+3KIexH7MMQokBmXJgOayAJG8/6J8JYYTHjfP19GE8ST+L0D7LE7bYTweh1gIa8BpZY7c7+nDwIz0mFXGJVJcRz04YQnWUO5Om0pUzLs/tUVPsM7bg5NhjEoo3GRPy6VUtLHLpMj3f0J7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gDdXtPY2jD0AbYZtlEe4gTzE1rwYZ3Er0OcdaOhpk4I=; b=gk3TMqj2cGx9ylwxO3xFC0SVczUDDvsciYGkeob7ncXhXAMlDKB9PVs3cRX6KVA/Rea3bGlSIfmTiYLKYgu0xXY8ZDy4k2zAeYdVXjczFtApiHVr7Zs2Rjpu6aEOpiuiLVXT6PnKvtjkDXPuGqsDMMASNz9CXobsxggycY2XhP8jsNrxaWkX6kn7XkGgRcTr2m9nqCCwmj/xY/Iitmb5LHkhux0nw4VAzfCz0GKGncWOHKBCuQmwab4/taZATpV0EsInnkoFDAvVUa0L2wucWq5jO6P83oGNvyzS7ejnbZ+WQ+lVEMugrD/LK1k8yUBrFyvRpbZmS/RC19QdfRg93A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=est.tech; dmarc=pass action=none header.from=est.tech; dkim=pass header.d=est.tech; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=estab.onmicrosoft.com; s=selector2-estab-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gDdXtPY2jD0AbYZtlEe4gTzE1rwYZ3Er0OcdaOhpk4I=; b=MV6Gzvym7B+hftELlo/v7dLGfa6zPybiYX0E7wigpNovKLUNThV6TtS1SoC+a/ZmgtmoKhLTUW6g9SsWtUJph+WGmijEiNlvktHBOVF/Q9z22HtLp/OOsqGDN7A4HGC7Qk6fYzpcBHoE2831h4o1wvgN1oDxE2BVye5ciEFMSaA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=est.tech; Received: from DBBP189MB1433.EURP189.PROD.OUTLOOK.COM (2603:10a6:10:1e7::15) by AM0P189MB0817.EURP189.PROD.OUTLOOK.COM (2603:10a6:208:195::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.29; Mon, 28 Aug 2023 12:28:32 +0000 Received: from DBBP189MB1433.EURP189.PROD.OUTLOOK.COM ([fe80::759b:94eb:c2e8:c670]) by DBBP189MB1433.EURP189.PROD.OUTLOOK.COM ([fe80::759b:94eb:c2e8:c670%6]) with mapi id 15.20.6699.034; Mon, 28 Aug 2023 12:28:32 +0000 From: Sriram Yagnaraman To: Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Ido Schimmel , Shuah Khan , Petr Machata , Sriram Yagnaraman Subject: [PATCH net v3 3/3] selftests: fib_tests: Add multipath list receive tests Date: Mon, 28 Aug 2023 13:32:21 +0200 Message-Id: <20230828113221.20123-4-sriram.yagnaraman@est.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230828113221.20123-1-sriram.yagnaraman@est.tech> References: <20230828113221.20123-1-sriram.yagnaraman@est.tech> X-ClientProxiedBy: GV3P280CA0028.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:b::8) To DBBP189MB1433.EURP189.PROD.OUTLOOK.COM (2603:10a6:10:1e7::15) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DBBP189MB1433:EE_|AM0P189MB0817:EE_ X-MS-Office365-Filtering-Correlation-Id: b612b7a6-c6fb-4a1e-aec3-08dba7c24ab7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vP+r5FQCc5itI8xIe3KNUgFVX4ZFvOoR3lfL4b3zYcAonJi59AlpYRq121KbYJqrdLyLUZRGZZPAoi/G8jHqEI/V0y9vUIXlfFpnNSq4+ylmHTE23mDfD1eWf7Sw3vU0OrkVNptDoIxbdsblMcihSXPHwwY2/rEs0I94gv3MWbA0NayP0ELUX+BVfXeDaZNOJ2VkNdsT4QJxT6d8Hk4tvDeSBmN694aFLRDpOx2XAqOZDN8iD4GIrg3tzFB25lAuPfzYaUNCaShCnzDiYwXYkH33jOPxXN1RrAS0Qsxv8ZGSDE3YpgtIo81emtTbByTfKH+KB9FnnvvsDlaujWr1UVH+e+bdAv7HaoENvxTn8wbU4lqGDvzisNfc8kA0GIvSX3U1XdeL8tFB5KfYWWrGltlDYqodZn6iyzJtPGQx/7VnvCJp5nP3/TqErrMKyUJOS06DBHPSmJmk/k9kNmNJSBRmLm5GJsZgXSyuD3l+EJnkhj6Kbs1fAfzGx8B0TcHuBb75wLRgEXM6DnbqUiaFPSfLISonbGdiuUYmUZbhjma7n6eFfs6Ky9JON6whir/RnFvheT9U3KcI5MSKZhjIYFxtlRQfXcLMc6kgdPoLS5yXPp0H7VxnpUEAf5DH78ckoQKzHH31oIR3XYVSLRfpuw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DBBP189MB1433.EURP189.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(346002)(396003)(39830400003)(376002)(136003)(1800799009)(451199024)(186009)(109986022)(1076003)(44832011)(83380400001)(6512007)(478600001)(26005)(7416002)(2616005)(5660300002)(2906002)(8676002)(8936002)(4326008)(70586007)(6486002)(38100700002)(66946007)(66476007)(86362001)(66556008)(54906003)(41300700001)(36756003)(316002)(6666004)(6506007)(266003)(37730700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WL8j1eMB0YSlaJKzo07sh1XxAoSWDVySq5WFuundpY64JCJ3e9J+ZxI19qe9IASMqMlXUz93oTy7dRLrdRDXCyPVZyFrtFbbhNJ7grMcJ9XvyJjxFqJYpIqYCgsaPpHtZqo0anz9zaBG/tRJGhvByrjjgy9jRvKWcLMWOalaC6lcb2L0IPnoUXqNfYq/g66UxtjrZt4VcH4brq8oTQUGYQKTTgKi2TTT/aq3lJlRhz062CCAVfSruIJnLgbmn/Cn5IpEwZpu/tVTk+uCGipMGPKamrFO0p9ff97hVT+CvdAqpCm3dg5V2GXetEYiIizW6otItdiq9BPT1VOT6iP5Gkj4InvhcevYwwjb6DvNfSO1MbnAR+xKbJchdLv6t/2g2hRUH/BUgqKKOg5QEoToe94hgqWFklzlmqZQ9nKCtrmDoOg3Voh1IVS8NpvdPh3Btt8XkX4RiQhWuaOSiVgjkLBzTTX6qdb9jRscbIqtSE13jOfHwrxoKElitYHm46oB14xSUEAvbV6ioO2Jg0b/ohdMHSsr5ZByyLSFP/g5jU2kqfj7Q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ech X-MS-Exchange-CrossTenant-Network-Message-Id: b612b7a6-c6fb-4a1e-aec3-08dba7c24ab7 X-MS-Exchange-CrossTenant-AuthSource: DBBP189MB1433.EURP189.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2023 12:28:32.3749 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d2585e63-66b9-44b6-a76e-4f4b217d97fd X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: m4nrR2PLQCUUd+Gyx+Jk/0om7y2JT1HcMRzqXl10jwNkJeDYyw2ZwkcGzxOATQ3V+pNTM8iXiTOjOJQxNuP1gwjSb1kBkRG5v724A9nWaqM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0P189MB0817 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org The test uses perf stat to count the number of fib:fib_table_lookup tracepoint hits for IPv4 and the number of fib6:fib6_table_lookup for IPv6. The measured count is checked to be within 5% of the total number of packets sent via veth1. Signed-off-by: Sriram Yagnaraman --- tools/testing/selftests/net/fib_tests.sh | 150 ++++++++++++++++++++++- 1 file changed, 149 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh index 35d89dfa6f11..1cf78cf4d346 100755 --- a/tools/testing/selftests/net/fib_tests.sh +++ b/tools/testing/selftests/net/fib_tests.sh @@ -9,7 +9,7 @@ ret=0 ksft_skip=4 # all tests in this script. Can be overridden with -t option -TESTS="unregister down carrier nexthop suppress ipv6_notify ipv4_notify ipv6_rt ipv4_rt ipv6_addr_metric ipv4_addr_metric ipv6_route_metrics ipv4_route_metrics ipv4_route_v6_gw rp_filter ipv4_del_addr ipv4_mangle ipv6_mangle ipv4_bcast_neigh" +TESTS="unregister down carrier nexthop suppress ipv6_notify ipv4_notify ipv6_rt ipv4_rt ipv6_addr_metric ipv4_addr_metric ipv6_route_metrics ipv4_route_metrics ipv4_route_v6_gw rp_filter ipv4_del_addr ipv4_mangle ipv6_mangle ipv4_bcast_neigh ipv4_mpath_list ipv6_mpath_list" VERBOSE=0 PAUSE_ON_FAIL=no @@ -2138,6 +2138,152 @@ ipv4_bcast_neigh_test() cleanup } +mpath_dep_check() +{ + if [ ! -x "$(command -v mausezahn)" ]; then + echo "mausezahn command not found. Skipping test" + return 1 + fi + + if [ ! -x "$(command -v jq)" ]; then + echo "jq command not found. Skipping test" + return 1 + fi + + if [ ! -x "$(command -v bc)" ]; then + echo "bc command not found. Skipping test" + return 1 + fi + + if [ ! -x "$(command -v perf)" ]; then + echo "perf command not found. Skipping test" + return 1 + fi + + perf list fib:* | grep -q fib_table_lookup + if [ $? -ne 0 ]; then + echo "IPv4 FIB tracepoint not found. Skipping test" + return 1 + fi + + perf list fib6:* | grep -q fib6_table_lookup + if [ $? -ne 0 ]; then + echo "IPv6 FIB tracepoint not found. Skipping test" + return 1 + fi + + return 0 +} + +list_rcv_eval() +{ + local name=$1; shift + local file=$1; shift + local expected=$1; shift + local exp=$1; shift + + + local count=$(tail -n 1 $file | jq '.["counter-value"] | tonumber | floor') + local ratio=$(echo "scale=2; $count / $expected" | bc -l) + local res=$(echo "$ratio $exp" | bc) + [[ $res -eq 1 ]] + log_test $? 0 "$name route hit ratio ($ratio)" +} + +ipv4_mpath_list_test() +{ + echo + echo "IPv4 multipath list receive tests" + + mpath_dep_check || return 1 + + route_setup + + set -e + run_cmd "ip netns exec ns1 ethtool -K veth1 tcp-segmentation-offload off" + + run_cmd "ip netns exec ns2 bash -c \"echo 20000 > /sys/class/net/veth2/gro_flush_timeout\"" + run_cmd "ip netns exec ns2 bash -c \"echo 1 > /sys/class/net/veth2/napi_defer_hard_irqs\"" + run_cmd "ip netns exec ns2 ethtool -K veth2 generic-receive-offload on" + run_cmd "ip -n ns2 link add name nh1 up type dummy" + run_cmd "ip -n ns2 link add name nh2 up type dummy" + run_cmd "ip -n ns2 address add 172.16.201.1/24 dev nh1" + run_cmd "ip -n ns2 address add 172.16.202.1/24 dev nh2" + run_cmd "ip -n ns2 neigh add 172.16.201.2 lladdr 00:11:22:33:44:55 nud perm dev nh1" + run_cmd "ip -n ns2 neigh add 172.16.202.2 lladdr 00:aa:bb:cc:dd:ee nud perm dev nh2" + run_cmd "ip -n ns2 route add 203.0.113.0/24 + nexthop via 172.16.201.2 nexthop via 172.16.202.2" + run_cmd "ip netns exec ns2 sysctl -qw net.ipv4.fib_multipath_hash_policy=1" + set +e + + local dmac=$(ip -n ns2 -j link show dev veth2 | jq -r '.[]["address"]') + local tmp_file=$(mktemp) + local cmd="ip netns exec ns1 mausezahn veth1 -a own -b $dmac + -A 172.16.101.1 -B 203.0.113.1 -t udp 'sp=12345,dp=0-65535' -q" + + # Packets forwarded in a list using a multipath route must not reuse a + # cached result so that a flow always hits the same nexthop. In other + # words, the FIB lookup tracepoint needs to be triggered for every + # packet. + run_cmd "perf stat -e fib:fib_table_lookup --filter 'err == 0' -j -o $tmp_file -- $cmd" + list_rcv_eval "Multipath" $tmp_file 65536 ">= 0.95" + + # The same is not true for a single path route. + run_cmd "ip -n ns2 route replace 203.0.113.0/24 nexthop via 172.16.201.2" + run_cmd "perf stat -e fib:fib_table_lookup --filter 'err == 0' -j -o $tmp_file -- $cmd" + list_rcv_eval "Single path" $tmp_file 65536 "< 0.95" + + rm $tmp_file + route_cleanup +} + +ipv6_mpath_list_test() +{ + echo + echo "IPv6 multipath list receive tests" + + mpath_dep_check || return 1 + + route_setup + + set -e + run_cmd "ip netns exec ns1 ethtool -K veth1 tcp-segmentation-offload off" + + run_cmd "ip netns exec ns2 bash -c \"echo 20000 > /sys/class/net/veth2/gro_flush_timeout\"" + run_cmd "ip netns exec ns2 bash -c \"echo 1 > /sys/class/net/veth2/napi_defer_hard_irqs\"" + run_cmd "ip netns exec ns2 ethtool -K veth2 generic-receive-offload on" + run_cmd "ip -n ns2 link add name nh1 up type dummy" + run_cmd "ip -n ns2 link add name nh2 up type dummy" + run_cmd "ip -n ns2 -6 address add 2001:db8:201::1/64 dev nh1" + run_cmd "ip -n ns2 -6 address add 2001:db8:202::1/64 dev nh2" + run_cmd "ip -n ns2 -6 neigh add 2001:db8:201::2 lladdr 00:11:22:33:44:55 nud perm dev nh1" + run_cmd "ip -n ns2 -6 neigh add 2001:db8:202::2 lladdr 00:aa:bb:cc:dd:ee nud perm dev nh2" + run_cmd "ip -n ns2 -6 route add 2001:db8:301::/64 + nexthop via 2001:db8:201::2 nexthop via 2001:db8:202::2" + run_cmd "ip netns exec ns2 sysctl -qw net.ipv6.fib_multipath_hash_policy=1" + set +e + + local dmac=$(ip -n ns2 -j link show dev veth2 | jq -r '.[]["address"]') + local tmp_file=$(mktemp) + local cmd="ip netns exec ns1 mausezahn -6 veth1 -a own -b $dmac + -A 2001:db8:101::1 -B 2001:db8:301::1 -t udp 'sp=12345,dp=0-65535' -q" + + # Packets forwarded in a list using a multipath route must not reuse a + # cached result so that a flow always hits the same nexthop. In other + # words, the FIB lookup tracepoint needs to be triggered for every + # packet. + run_cmd "perf stat -e fib6:fib6_table_lookup --filter 'err == 0' -j -o $tmp_file -- $cmd" + list_rcv_eval "Multipath" $tmp_file 65536 ">= 0.95" + + # The same is not true for a single path route. + run_cmd "ip -n ns2 route replace 2001:db8:301::/64 nexthop via 2001:db8:201::2" + run_cmd "perf stat -e fib6:fib6_table_lookup --filter 'err == 0' -j -o $tmp_file -- $cmd" + list_rcv_eval "Single path" $tmp_file 65536 "< 0.95" + + rm $tmp_file + route_cleanup +} + ################################################################################ # usage @@ -2217,6 +2363,8 @@ do ipv4_mangle) ipv4_mangle_test;; ipv6_mangle) ipv6_mangle_test;; ipv4_bcast_neigh) ipv4_bcast_neigh_test;; + ipv4_mpath_list) ipv4_mpath_list_test;; + ipv6_mpath_list) ipv6_mpath_list_test;; help) echo "Test names: $TESTS"; exit 0;; esac