From patchwork Mon Feb 26 09:21:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Huettner X-Patchwork-Id: 1904213 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=34oce4gi; dkim=fail reason="signature verification failed" (2048-bit key) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=34oce4gi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tjw9f1sklz23qD for ; Mon, 26 Feb 2024 20:21:58 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 60E404074C; Mon, 26 Feb 2024 09:21:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P7lw-6EL_WFr; Mon, 26 Feb 2024 09:21:53 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 19F16406A7 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=34oce4gi; dkim=fail reason="signature verification failed" (2048-bit key) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=34oce4gi Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 19F16406A7; Mon, 26 Feb 2024 09:21:53 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DEC7FC0077; Mon, 26 Feb 2024 09:21:52 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id BFE21C0037 for ; Mon, 26 Feb 2024 09:21:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id A75FF409AC for ; Mon, 26 Feb 2024 09:21:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iGuDBABdA8Cx for ; Mon, 26 Feb 2024 09:21:50 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a01:111:f403:2612::601; helo=eur05-am6-obe.outbound.protection.outlook.com; envelope-from=felix.huettner@mail.schwarz; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org EC81840993 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=reject dis=none) header.from=mail.schwarz DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org EC81840993 Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=34oce4gi; dkim=pass (2048-bit key) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=34oce4gi Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20601.outbound.protection.outlook.com [IPv6:2a01:111:f403:2612::601]) by smtp2.osuosl.org (Postfix) with ESMTPS id EC81840993 for ; Mon, 26 Feb 2024 09:21:49 +0000 (UTC) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=DAqurDkXKxL4frOkIoytHHQLp3LmWw134VOop+pdHQA9jlLaqBr2p33pC540PQ9zJs2rhqVcZiRCXXuhIRx3Mny+0oMKSEabKOepCUYrmh6gULXcOPxS4fyTjNvdki4y8/nQLx0vDCRtyvkyGxhf22E33qkk8Lflz42B6aLrgXeYRmsQDDkWczEmjhIemyxFsIG/bAAsYyke5jvwXUNgFqNLeXreldUHF0PiojDLKCi0FjWDlN7wzv7eT61JsH1O83SWWwd+kaKRR/wpgFnUAUVMNKqKuijy2HhpFdzfQFEaxmPE/1Eo9tV568SD6oupJJcFa6f73agGTe6VozZsdw== ARC-Message-Signature: i=2; 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=kPQL02cUojC16ulXp8iL99PI4ubfsMzoa3b25d6hz0A=; b=cdIv3oDfmEisE6QAowXG2VaqyBEH/3Cg1+c7WIAQSAd96Gk4Wc29e+OA4h8G0tcxPQNhHRsI29ef2to08UnMxB2c454CQubkxKRdXWxkzcShL2wPbFDRj8Ir9mEw9zVGdKQbHTJoJ7cxkF5U8xrqVlYB6mS8BEgHm+9Oh/q9yRVbzeQe0kldFkzFQKq6ISiJwS64pWyFhDrZWc9iiSfPf/AcjB63nTk0FyYVhDqX3fXQwkHQ/1MkSOElfcb4njlCcyi6cTN4n06Ovwf5Wz3z+PtYVeLcUGux+dICXVWku1ZiWXkp+GUUFY2vqDhtCX0PYSCgC+urS4kUaEO0Ic1Kjw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 104.40.229.156) smtp.rcpttodomain=openvswitch.org smtp.mailfrom=mail.schwarz; dmarc=pass (p=reject sp=none pct=100) action=none header.from=mail.schwarz; dkim=pass (signature was verified) header.d=mail.schwarz; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=mail.schwarz] dkim=[1,1,header.d=mail.schwarz] dmarc=[1,1,header.from=mail.schwarz]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.schwarz; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kPQL02cUojC16ulXp8iL99PI4ubfsMzoa3b25d6hz0A=; b=34oce4gi79IpPxfP7xcMcuS4FIieCxq+arzGG8YcWl61v5Y+zMLLnoTIs1rsF1PiJOBwiaagUrgMQINogHVzHf7NLUBybJSrCSyl30NVy8WZBsN1itcHWJpkyyhUVLAI7g9ARbS7Wm/VcOGwbSUtn6sAhLMyUJ2ryqOXkkcf2qKKsqv/WAAizS4rlmz7R+qQgnILQ8teb1yOpxNyP36irKa7pMCJowapdoi4InnJnXF2tpeQ4NweEG/bFTvfxatc7FfKfRWEPPipFF+lB+9cbjqJP9zI1syYodoElg4oEUqKs/Md0ndwPOnGr9KDKUK7XhdBdhjuNXG6yBipPff8Iw== Received: from AM5PR04CA0019.eurprd04.prod.outlook.com (2603:10a6:206:1::32) by AS2PR10MB6896.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5fb::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.31; Mon, 26 Feb 2024 09:21:45 +0000 Received: from AMS0EPF000001AB.eurprd05.prod.outlook.com (2603:10a6:206:1:cafe::58) by AM5PR04CA0019.outlook.office365.com (2603:10a6:206:1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.49 via Frontend Transport; Mon, 26 Feb 2024 09:21:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 104.40.229.156) smtp.mailfrom=mail.schwarz; dkim=pass (signature was verified) header.d=mail.schwarz;dmarc=pass action=none header.from=mail.schwarz; Received-SPF: Pass (protection.outlook.com: domain of mail.schwarz designates 104.40.229.156 as permitted sender) receiver=protection.outlook.com; client-ip=104.40.229.156; helo=eu1.smtp.exclaimer.net; pr=C Received: from eu1.smtp.exclaimer.net (104.40.229.156) by AMS0EPF000001AB.mail.protection.outlook.com (10.167.16.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.7292.25 via Frontend Transport; Mon, 26 Feb 2024 09:21:44 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (104.47.14.51) by eu1.smtp.exclaimer.net (104.40.229.156) with Exclaimer Signature Manager ESMTP Proxy eu1.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_ECDHE_WITH_AES256_SHA384); Mon, 26 Feb 2024 09:21:44 +0000 X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 5094416 X-ExclaimerImprintLatency: 2476520 X-ExclaimerImprintAction: 0f5a3010b56949d3b75c719eefbf01b5 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XZ47p/I72ly+Jx3XCAR9MkGV9NJFrORXxYeELwoPt9+UXNDX7Bh7hZ3TzFt8yqdWrrv1RBYJ2wheaPA/vcR0T2dhGuezG3eIe7WT7HorSHzFGL1B5T32rZEC5RZbueySDd2AAgfKuH7OHsJG23piOe6m7aphyppaNzUW+SgBPEzmW9ZaPbFVnthwKX76cn9wotxiu/S6UTS7+bnaQrS01/kdZ/s+JFPPcIGlFPh8F0KXTgfCfOeYOnpZDFvazlUYx0Fo6UCQfzTh6hbArSsmApnKe1iQBwSN58t6Jug4xt2/pJKxl8WAQVtgFY8ng3XYJG+CXTc6XSSRTCdI/VrV4Q== 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=kPQL02cUojC16ulXp8iL99PI4ubfsMzoa3b25d6hz0A=; b=NDMXOUOl01hC/L+rI2s+1W/XuBij6tPJFCrAQyBwdLHUyFGMn7lUx9WcAOsbhbj5ScOT1/W3n5EUfZwrRihQJlMRX0d8OhxuvTjzdX/ReLaNw9/GZOymPbY8VLhCNJhFExjRDEkUWUrT023uA0JrkNj5JWbhBt4mxNi2n4lu7Owm/HToPuvKMDcuw/2aR8Ga2pejgBc3SA1MkNgOmmFSwRuCCFro9w6kN90lqGtmdoH6LD6tEtfZC0zOjxKUF3zilqdVDDPAzPxkIm1AFZZfowpKYJTC72fDmVL7VPcI3RymNxFYr+pmEwWVde4CzQxz5l1bUh6ZnbfTKxZ0CfBt3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mail.schwarz; dmarc=pass action=none header.from=mail.schwarz; dkim=pass header.d=mail.schwarz; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.schwarz; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kPQL02cUojC16ulXp8iL99PI4ubfsMzoa3b25d6hz0A=; b=34oce4gi79IpPxfP7xcMcuS4FIieCxq+arzGG8YcWl61v5Y+zMLLnoTIs1rsF1PiJOBwiaagUrgMQINogHVzHf7NLUBybJSrCSyl30NVy8WZBsN1itcHWJpkyyhUVLAI7g9ARbS7Wm/VcOGwbSUtn6sAhLMyUJ2ryqOXkkcf2qKKsqv/WAAizS4rlmz7R+qQgnILQ8teb1yOpxNyP36irKa7pMCJowapdoi4InnJnXF2tpeQ4NweEG/bFTvfxatc7FfKfRWEPPipFF+lB+9cbjqJP9zI1syYodoElg4oEUqKs/Md0ndwPOnGr9KDKUK7XhdBdhjuNXG6yBipPff8Iw== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mail.schwarz; Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) by GV1PR10MB7600.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150:8b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.34; Mon, 26 Feb 2024 09:21:42 +0000 Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::3cb1:ce2e:b6c:7798]) by PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::3cb1:ce2e:b6c:7798%4]) with mapi id 15.20.7316.023; Mon, 26 Feb 2024 09:21:42 +0000 Date: Mon, 26 Feb 2024 10:21:40 +0100 To: dev@openvswitch.org Message-ID: <8d9feafb2348fe27252a776769b45671a4df4be8.1708939063.git.felix.huettner@mail.schwarz> Mail-Followup-To: dev@openvswitch.org Content-Disposition: inline X-ClientProxiedBy: FR3P281CA0111.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::14) To PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAVPR10MB6914:EE_|GV1PR10MB7600:EE_|AMS0EPF000001AB:EE_|AS2PR10MB6896:EE_ X-MS-Office365-Filtering-Correlation-Id: 6282fd75-0c86-4c47-bcb7-08dc36ac59bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: lOB+G9Y5oCXCF8Xhg/+Hp2PBNvr2ii9TCBUWigWaGTP/NG7ebMT0jj5o3lepjL83a7g+yh9Jm1c4n74GGmlWK/wA7C0PaT/+jtE5drS7RMliSpS6PDExF9LQhzjabzrMyMvIvA0yLvTTIDk4wA4Ng29nyt2PG2cyQKSBfikR9NbeP0HchcJewQKewib6ydpLxjFa5brvL/zscroMKlvVZhh8Kj8nwzd++gprJWSa53JhiX5vWf2kVvGVJrUGxRh5jOy6qPQCYaeElbQSTnAnloz0cu2wOYWFVThCCmaYkHvJOc/5Mqx3BOx3mtkgyqZEcLzExL3X60wDzzPVkAyFU09cP5g/CKW5nwySlE8zMl3YG9dogpTXPPvxs7VOnh3SIS1ShYYV5Mg2R9eACCVTTmInJt6PPJsCoRfWDg4esO/y31pOQgAnmNqq5jJYSyFOh2mV5Wc4UtFDnTXJwOSr/Rrr6Dl3YNYgzQU0MQZ0AMM+O6vtTVAcgcKwaYKHoLc0X8P5yQ3DUWzeWgGBQMEScs8u0+8ejI61gilt2hUkjTWvIG1qeolW65S6xeTiiRMYPg4Mrdlk04OXCl+avikjH4CmpmmiI8gM+6JPgZYjYtFc/610XaHi7UoO1337Gei8P7FczuWBrQEkY181WWhjjQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR10MB7600 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF000001AB.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: b3ba6dac-879a-41d1-e5c6-08dc36ac5802 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hm3Gt8mQ7SsH9linKRIhIgP7NZ9VDKXXV2ooH6NdjDAO5BXb182SuZ3d4itsaWYbrMyGS/4QDbE7wq3gDSpW/zdsnXFPVOOjFscaTTQeF8iEwNAAs7eUjHHE3nCwz5gVc/vbB0dLkYQw86tSU3aFRD7S9IDOjgRs935SnNRwqvvNdZhmilPjeHocDBPgvPunPEmKzW/f5HasJenZczSHkGTGz/KssmNB/bv7213so3BRb0Ft7zlWsVNJpiGr5tzhRMxPAxmEDWlcOL22W0TK15eNGXBPasvoEfbm8jNUPiN9WcYxB+nwJRD4ZxoqcbTxgAw54rZ3Pob00EhwC7KqMCNLKShO6SJrKTMJmM5frpiVgDPI5kftuwwIRn5QPJ+57SbUzKA16lm9iyGsGi8ndQfPXoQ0L44iYRBmK295ewFhU7IpJkKGkqmU0jjuzSbvDe3g4L/JG351XhHZhn3elroICVJNnmmkUVNz/fCCZUmSRZu+zYF0qVC7r6oxczYYXXD/PNcRBiY1HuXpsUdNHI45ldp6q3FxguiSSXo4gk9KQADZsH4vdTvo3oqwPnioVcKqIq9YX3leca/lnVF8xx2deAGkmfNkyRZf8TqvnNpZJ6bHnvS5y49My1nhXklD7otqa9yu3Ib/CfsbdRBB+rrNFfG/JLkP7K6U1+sU0wq9o0xV3U36bPwGr+psPbUztxdc4PU3Q+qOWNbnUFja2wZCKagRes151SKgAGKvw+aZL4JEeyoDVmnqnFw8aeS9 X-Forefront-Antispam-Report: CIP:104.40.229.156; CTRY:NL; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:eu1.smtp.exclaimer.net; PTR:eu1.smtp.exclaimer.net; CAT:NONE; SFS:(13230031)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: mail.schwarz X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2024 09:21:44.4368 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6282fd75-0c86-4c47-bcb7-08dc36ac59bd X-MS-Exchange-CrossTenant-Id: d04f4717-5a6e-4b98-b3f9-6918e0385f4c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d04f4717-5a6e-4b98-b3f9-6918e0385f4c; Ip=[104.40.229.156]; Helo=[eu1.smtp.exclaimer.net] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001AB.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR10MB6896 Subject: [ovs-dev] [PATCH v5 1/2] util: Support checking for kernel versions. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Felix Huettner via dev From: Felix Huettner Reply-To: Felix Huettner Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Extract checking for a given kernel version to a separate function. It will be used also in the next patch. Signed-off-by: Felix Huettner --- v4->v5: - fix wrong ifdef that broke on macos - fix ovs_kernel_is_version_or_newer working in reverse than desired - ovs_kernel_is_version_or_newer now always returns false if uname errors (Thanks Eelco) v4: - extract function to check kernel version lib/netdev-linux.c | 14 +++----------- lib/util.c | 27 +++++++++++++++++++++++++++ lib/util.h | 4 ++++ 3 files changed, 34 insertions(+), 11 deletions(-) base-commit: 166ee41d282c506d100bc2185d60af277121b55b diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index bf91ef462..51bd71ae3 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -6427,18 +6427,10 @@ getqdisc_is_safe(void) static bool safe = false; if (ovsthread_once_start(&once)) { - struct utsname utsname; - int major, minor; - - if (uname(&utsname) == -1) { - VLOG_WARN("uname failed (%s)", ovs_strerror(errno)); - } else if (!ovs_scan(utsname.release, "%d.%d", &major, &minor)) { - VLOG_WARN("uname reported bad OS release (%s)", utsname.release); - } else if (major < 2 || (major == 2 && minor < 35)) { - VLOG_INFO("disabling unsafe RTM_GETQDISC in Linux kernel %s", - utsname.release); - } else { + if (ovs_kernel_is_version_or_newer(2, 35)) { safe = true; + } else { + VLOG_INFO("disabling unsafe RTM_GETQDISC in Linux kernel"); } ovsthread_once_done(&once); } diff --git a/lib/util.c b/lib/util.c index 3fb3a4b40..f5b2da095 100644 --- a/lib/util.c +++ b/lib/util.c @@ -27,6 +27,7 @@ #include #ifdef __linux__ #include +#include #endif #include #include @@ -2500,3 +2501,29 @@ OVS_CONSTRUCTOR(winsock_start) { } } #endif + +#ifdef __linux__ +bool +ovs_kernel_is_version_or_newer(int target_major, int target_minor) +{ + static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; + static int current_major, current_minor = -1; + + if (ovsthread_once_start(&once)) { + struct utsname utsname; + + if (uname(&utsname) == -1) { + VLOG_WARN("uname failed (%s)", ovs_strerror(errno)); + } else if (!ovs_scan(utsname.release, "%d.%d", + ¤t_major, ¤t_minor)) { + VLOG_WARN("uname reported bad OS release (%s)", utsname.release); + } + ovsthread_once_done(&once); + } + if (current_major == -1 || current_minor == -1) { + return false; + } + return current_major > target_major || ( + current_major == target_major && current_minor > target_minor); +} +#endif diff --git a/lib/util.h b/lib/util.h index f2d45bcac..55718fd87 100644 --- a/lib/util.h +++ b/lib/util.h @@ -611,4 +611,8 @@ int ftruncate(int fd, off_t length); } #endif +#ifdef __linux__ +bool ovs_kernel_is_version_or_newer(int target_major, int target_minor); +#endif + #endif /* util.h */ From patchwork Mon Feb 26 09:21:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Huettner X-Patchwork-Id: 1904214 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=NhDVQCNi; dkim=fail reason="signature verification failed" (2048-bit key) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=NhDVQCNi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tjw9k3KSHz23qD for ; Mon, 26 Feb 2024 20:22:02 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 2BB6B608DE; Mon, 26 Feb 2024 09:22:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EWrQdzg57XzT; Mon, 26 Feb 2024 09:21:58 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org C6555608DB Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=NhDVQCNi; dkim=fail reason="signature verification failed" (2048-bit key) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=NhDVQCNi Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id C6555608DB; Mon, 26 Feb 2024 09:21:58 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9E0C3C0077; Mon, 26 Feb 2024 09:21:58 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1A56BC0037 for ; Mon, 26 Feb 2024 09:21:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 09C1A81DE6 for ; Mon, 26 Feb 2024 09:21:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DThKi-_j46W7 for ; Mon, 26 Feb 2024 09:21:57 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a01:111:f403:2608::600; helo=eur02-db5-obe.outbound.protection.outlook.com; envelope-from=felix.huettner@mail.schwarz; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 8BE4D81DEB Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=reject dis=none) header.from=mail.schwarz DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 8BE4D81DEB Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=NhDVQCNi; dkim=pass (2048-bit key) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=NhDVQCNi Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on20600.outbound.protection.outlook.com [IPv6:2a01:111:f403:2608::600]) by smtp1.osuosl.org (Postfix) with ESMTPS id 8BE4D81DEB for ; Mon, 26 Feb 2024 09:21:56 +0000 (UTC) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=bfrK7nL72kt+fHPCGCaBSIGz0URPu2VRHHYCwF4Mtn128Rk/YI4sPFHjLr+jWIOtIA1pEgwxFlwNWzScjUSejGRTeqpckvMqmrlbrPtiQmxOaIOyK3nhl+Ll72DCUQztcXgVkCbx0nUSMpiCJRvLMrDdFECKkt+MADDhmwTZFHa7IT5UH9pid4dh5qDWF/ngAtVlg6dRn+WpwPr+kuaBn29dWq+hZ0UquucUUj50I1WxYMOygMrv7p9fmqJJLkLrYUOYzgmiwvu+kQM3FE6UoPqpgmLubkvbyDuqwLB4nPfSZDsWFUjOMKswJM/txHZyFk3OXyNmeaXAkn5rhxkG+Q== ARC-Message-Signature: i=2; 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=hSSAwRjM5JTJ4ArVOefOJfd6PiR8+/Z9kf39HOJyuYE=; b=YJS/wE60y40IDIeuK1fQagTpiJeohfA0nkrWmXiaEtevS0mB5Aq2ECXMjCrYNO4ntp/7kqqGPa3xi/ZWfHME3oodmTwamznKG9y4kLZ0Y/+V+Cu9ZhQjhy913gakYHAiQfOgQUtKVr/t0j7H2kfDRN7ccw9nCBQTs5dTGTm/C6wqSxPn12/krPKeW64nESosqxHexUgF0UKNahKzZEzcjiSZZAKwXyE2gx76eXBCuA9b0oCcQ6EoH9+yclKdl3p0LFQHXWRsag7aR4GT1KrgKWT1ONK2uHRZMNplEJU77reVi8QvESOoYRjQCrq6iWv3vS/hdBTGzSW+X1y9T1BY9Q== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 52.169.0.179) smtp.rcpttodomain=openvswitch.org smtp.mailfrom=mail.schwarz; dmarc=pass (p=reject sp=none pct=100) action=none header.from=mail.schwarz; dkim=pass (signature was verified) header.d=mail.schwarz; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=mail.schwarz] dkim=[1,1,header.d=mail.schwarz] dmarc=[1,1,header.from=mail.schwarz]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.schwarz; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hSSAwRjM5JTJ4ArVOefOJfd6PiR8+/Z9kf39HOJyuYE=; b=NhDVQCNioxW4U4epMpyRK3xOiCKgaFdmOLkHUFYQqd0OoDzOy5kqHe9oJ/UHBF+cHUTfvigMd/GoiPD5mJd4j8wCYZj9+iytVfn9qkfvnq3UxczAfAktQTesrFcpnMtSnAVXcV/QZmi1KljdwaB6cMOaPhlr7fuvAexYLwqaVdh4vNXEnFySTkzSfemyGjqTl//WzUNWjAIdr1QBnTtDF4zsZlv1+yxDs1gKkMGnQpAc7ITlZr3+2EdMoagiNKgrIenA9inkZh+lU5EllogKZX+5twiQKB9f6M42TjDsRG85sw5JIBh685JpCiBjNzIPmPgd7O5l06l0rxpv9QS54w== Received: from AS9PR05CA0126.eurprd05.prod.outlook.com (2603:10a6:20b:497::26) by DB4PR10MB7064.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:3f0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.34; Mon, 26 Feb 2024 09:21:52 +0000 Received: from AMS0EPF000001B0.eurprd05.prod.outlook.com (2603:10a6:20b:497:cafe::2c) by AS9PR05CA0126.outlook.office365.com (2603:10a6:20b:497::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.49 via Frontend Transport; Mon, 26 Feb 2024 09:21:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 52.169.0.179) smtp.mailfrom=mail.schwarz; dkim=pass (signature was verified) header.d=mail.schwarz;dmarc=pass action=none header.from=mail.schwarz; Received-SPF: Pass (protection.outlook.com: domain of mail.schwarz designates 52.169.0.179 as permitted sender) receiver=protection.outlook.com; client-ip=52.169.0.179; helo=eu2.smtp.exclaimer.net; pr=C Received: from eu2.smtp.exclaimer.net (52.169.0.179) by AMS0EPF000001B0.mail.protection.outlook.com (10.167.16.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.7292.25 via Frontend Transport; Mon, 26 Feb 2024 09:21:52 +0000 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (104.47.11.40) by eu2.smtp.exclaimer.net (52.169.0.179) with Exclaimer Signature Manager ESMTP Proxy eu2.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_ECDHE_WITH_AES256_SHA384); Mon, 26 Feb 2024 09:21:52 +0000 X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 6475462 X-ExclaimerImprintLatency: 1516531 X-ExclaimerImprintAction: 69c36f00bae64a44a01e25da8c249958 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OvcceCmCXFlUGqTfiKDp5kzBZvwe5mc4O8HbUwD13Z8OzccsaJs+0uwblQS0AN0KX06UgjRTnZbB1rWA8mcatT2ljgPcYFJY6bcpDxZsFPOW4lz1YIuyu/4eIK9u39NGjYXiO3y/TfNEoeeMaDR4gNHrq8SxtyaDmL2gE4j3NBXN7nfskT3mBaDGPJckXd3XVahGZZ8dYzdKMqDN35xzpIf4jicM3YGr75+vIsARZGJ9U0U7MOh0PuiGoEUpPGdqQM/kZMgO1c8VJgwkW5egWZ2BOBouX/bG63TMT0v+RXVpSOAIUQPzYh6pn/Ls5SvKunVDPI2sjoxoI7OLpm/Kdw== 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=hSSAwRjM5JTJ4ArVOefOJfd6PiR8+/Z9kf39HOJyuYE=; b=HjKUAWTbwccEqTR7jpBTdNNzqfd1J0ikJqxlVMZF8ocLG9FTFOcWvmQ3JLzKBrw56rrQaoMUz/IFZyqjfHZrjmQVdoqQ3r5ShTTMF+2nOadFChXuDo/Wgnr3KGfxs8NER8yDhIiidyJq783TKAH+PnCbkVSvM+9uCAdJXi+DbcRzzLRJp4Tet7JgXoV8gvH7a9nZAA1NDxEHir0TtEa3SR1r/W3PmK2lkh3BPXNyj9Sc/RcbX+ob9Qnwms2EmPME5NrBJjQaCHot/+VYI3r5BcSFrGH5iY0Qw1cuiKPUTmw4pmtG62DzOveM0cXmmrsU5Fpi9k2f8XOTTeWWrCuBFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mail.schwarz; dmarc=pass action=none header.from=mail.schwarz; dkim=pass header.d=mail.schwarz; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.schwarz; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hSSAwRjM5JTJ4ArVOefOJfd6PiR8+/Z9kf39HOJyuYE=; b=NhDVQCNioxW4U4epMpyRK3xOiCKgaFdmOLkHUFYQqd0OoDzOy5kqHe9oJ/UHBF+cHUTfvigMd/GoiPD5mJd4j8wCYZj9+iytVfn9qkfvnq3UxczAfAktQTesrFcpnMtSnAVXcV/QZmi1KljdwaB6cMOaPhlr7fuvAexYLwqaVdh4vNXEnFySTkzSfemyGjqTl//WzUNWjAIdr1QBnTtDF4zsZlv1+yxDs1gKkMGnQpAc7ITlZr3+2EdMoagiNKgrIenA9inkZh+lU5EllogKZX+5twiQKB9f6M42TjDsRG85sw5JIBh685JpCiBjNzIPmPgd7O5l06l0rxpv9QS54w== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mail.schwarz; Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) by AS2PR10MB6662.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:55d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.33; Mon, 26 Feb 2024 09:21:50 +0000 Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::3cb1:ce2e:b6c:7798]) by PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::3cb1:ce2e:b6c:7798%4]) with mapi id 15.20.7316.023; Mon, 26 Feb 2024 09:21:50 +0000 Date: Mon, 26 Feb 2024 10:21:48 +0100 To: dev@openvswitch.org Message-ID: <86651c69659fccaba9f511f47eeb4109df0cef08.1708939063.git.felix.huettner@mail.schwarz> Mail-Followup-To: dev@openvswitch.org References: <8d9feafb2348fe27252a776769b45671a4df4be8.1708939063.git.felix.huettner@mail.schwarz> Content-Disposition: inline In-Reply-To: <8d9feafb2348fe27252a776769b45671a4df4be8.1708939063.git.felix.huettner@mail.schwarz> X-ClientProxiedBy: FR3P281CA0112.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::15) To PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAVPR10MB6914:EE_|AS2PR10MB6662:EE_|AMS0EPF000001B0:EE_|DB4PR10MB7064:EE_ X-MS-Office365-Filtering-Correlation-Id: 42831d67-d189-4a3f-5a16-08dc36ac5e78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: y+OYoRE/D60aYqKkPNKOHjp7tda2c47WCpnbmkjfCiMQ1J3L2MD/qvFYn2QYx1pcDDLFOorh82wJgHBEeeQTsYG76O2soPeyuJxSczkiHcFq2kFUBa8zaOlWToh5gDvnASg4CHCFkqHTDmeA+7s0oZRlb6fmXVifrb3GWPU/eTNfMIx3QIJX/VHbjKvEhblVZyv9gJpAGnKe8PfTSAt1UkaA4ZdhM2jylNCVef7acoBmz3cynyGMaluMGKzTkkxNiTM2bFZyWG2uhOXaRI7kUKxoikiw3y0f/DZ/3sLfMQxpE/Be1KauMB3GrGYsD8j3H2jfP860AgQL1yPhbYc9qWmtTExck9nF6phUkXPLyMYLRJijnCb9gEQZv8Unb0pBvKqNamctT3sY1s9XfPFzlhTjEdwsOqoSTqUaewNbDyBBRR08paBf2X8n+L+7Mp3kphxqQdTCSxIm2MAlI9k1kyvtbH+IXRysR0fRHO6t7+QFRXm1nQ8JCdRgTsSFT+a2QsT3JW1LQ/prEtKFkTLrwXDnus8o7e51BzmJlJ3ukFuOemdhPfNt+vAF0a9sf3DQm6pHYPQFDriVAE5BJd1oEgFLuNRhZh121dakB7BXCx1TAWVLCI2WeIKNQ93ZgWR7 X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR10MB6662 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF000001B0.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 843836e9-921c-4832-f72b-08dc36ac5cf5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LSelbvpZ4ZkOWnUX6WFbf66RTmGZxBkUYaEj/SoSvsVmU7YUqZoWoFT/JVN7Omf37Zcsr9NF63uwbfhfw55PWhNHZNpPhiljJYWWZiCSuTRpJVJMEmUlsOdz79q9CLlnpBXu8pdGbm6BU/LKereV/hD9QWYmdO5fOX6F63Un38IVGcC+1A/fmfusQlfM7uApxd0kOuyk+UyBQ9qCTtBzb97oFb99iv6xD27JqmLjN3ch76yfN6lzLMtbhqYi/9s4/tM0GLuRuC4K3r+I3F54GyLtMqO+XP/fXHJEBG3omftfFrfR2P8QM23fIrayz2YH8JEox8x/dtgdXO8hq9V2sN+G1sEvj8Lo5QbCHID57xavemfGIp9XVRUELDkTeUEUl/NqRborwxEkBCSmtf2cpUeaUW8tvNyLF95tM2GRYovzhe9jWf7nCsk3K0t5/q74qeM2Lc4LVG17T/LvwPAWdqGl0UixbD/eJHr/1dhScHgYP/3rRd5jDCwFEjGWFU57zc2/TEKkh/GlKTzJNeLqtVrkEY1zjCflrHjToF1OweIglHZOxeWx+XqhaivCNAaoeFtvdkiMHf1u0jKV7Qkihx4D/VLpEH+1ag9V8gt28SYj+9y4w0jmh3/bvPNGlxymJdEarvpVJyYcMBi9PDtZEMm2LHXSu6gQRRYaDca3rf88f5sap1oPltSjyXXOOFBvxp251s0/A0fsJKqmgf/yppG6V9+3ddZ3KMj/84v6ghMBVE0BVwCqtpjVHKejogDT X-Forefront-Antispam-Report: CIP:52.169.0.179; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:eu2.smtp.exclaimer.net; PTR:eu2.smtp.exclaimer.net; CAT:NONE; SFS:(13230031)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: mail.schwarz X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2024 09:21:52.4332 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 42831d67-d189-4a3f-5a16-08dc36ac5e78 X-MS-Exchange-CrossTenant-Id: d04f4717-5a6e-4b98-b3f9-6918e0385f4c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d04f4717-5a6e-4b98-b3f9-6918e0385f4c; Ip=[52.169.0.179]; Helo=[eu2.smtp.exclaimer.net] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001B0.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR10MB7064 Subject: [ovs-dev] [PATCH v5 2/2] netlink-conntrack: Optimize flushing ct zone. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Felix Huettner via dev From: Felix Huettner Reply-To: Felix Huettner Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Previously the kernel did not provide a netlink interface to flush/list only conntrack entries matching a specific zone. With [1] and [2] it is now possible to flush and list conntrack entries filtered by zone. Older kernels not yet supporting this feature will ignore the filter. For the list request that means just returning all entries (which we can then filter in userspace as before). For the flush request that means deleting all conntrack entries. The implementation is now identical to the windows one, so we combine them. These significantly improves the performance of flushing conntrack zones when the conntrack table is large. Since flushing a conntrack zone is normally triggered via an openflow command it blocks the main ovs thread and thereby also blocks new flows from being applied. Using this new feature we can reduce the flushing time for zones by around 93%. In combination with OVN the creation of a Logical_Router (which causes the flushing of a ct zone) could block other operations, e.g. the failover of Logical_Routers (as they cause new flows to be created). This is visible from a user perspective as a ovn-controller that is idle (as it waits for vswitchd) and vswitchd reporting: "blocked 1000 ms waiting for main to quiesce" (potentially with ever increasing times). The following performance tests where run in a qemu vm with 500.000 conntrack entries distributed evenly over 500 ct zones using `ovstest test-netlink-conntrack flush zone=`. | flush zone with 1000 entries | flush zone with no entry | +---------------------+----------+---------------------+----------| | with the patch | without | with the patch | without | +----------+----------+----------+----------+----------+----------| | v6.8-rc4 | v6.7.1 | v6.8-rc4 | v6.8-rc4 | v6.7.1 | v6.8-rc4 | +---------+----------+----------+----------+----------+----------+----------| | Min | 0.260 | 3.946 | 3.497 | 0.228 | 3.462 | 3.212 | | Median | 0.319 | 4.237 | 4.349 | 0.298 | 4.460 | 4.010 | | 90%ile | 0.335 | 4.367 | 4.522 | 0.325 | 4.662 | 4.572 | | 99%ile | 0.348 | 4.495 | 4.773 | 0.340 | 4.931 | 6.003 | | Max | 0.362 | 4.543 | 5.054 | 0.348 | 5.390 | 6.396 | | Mean | 0.320 | 4.236 | 4.331 | 0.296 | 4.430 | 4.071 | | Total | 80.02 | 1058 | 1082 | 73.93 | 1107 | 1017 | [1]: https://github.com/torvalds/linux/commit/eff3c558bb7e61c41b53e4c8130e514a5a4df9ba [2]: https://github.com/torvalds/linux/commit/fa173a1b4e3fd1ab5451cbc57de6fc624c824b0a Co-Authored-By: Luca Czesla Signed-off-by: Luca Czesla Co-Authored-By: Max Lamprecht Signed-off-by: Max Lamprecht Signed-off-by: Felix Huettner --- v4->v5: none v3->v4: - combine the flush logic with windows implementation v2->v3: - update description to include upstream fix (Thanks to Ilya for finding that issue) v1->v2: - fixed wrong signed-off-by lib/netlink-conntrack.c | 52 ++++++++++++++++++++++++++++++++++++----- tests/system-traffic.at | 8 +++++++ 2 files changed, 54 insertions(+), 6 deletions(-) diff --git a/lib/netlink-conntrack.c b/lib/netlink-conntrack.c index 492bfcffb..d9015d9f0 100644 --- a/lib/netlink-conntrack.c +++ b/lib/netlink-conntrack.c @@ -141,6 +141,9 @@ nl_ct_dump_start(struct nl_ct_dump_state **statep, const uint16_t *zone, nl_msg_put_nfgenmsg(&state->buf, 0, AF_UNSPEC, NFNL_SUBSYS_CTNETLINK, IPCTNL_MSG_CT_GET, NLM_F_REQUEST); + if (zone) { + nl_msg_put_be16(&state->buf, CTA_ZONE, htons(*zone)); + } nl_dump_start(&state->dump, NETLINK_NETFILTER, &state->buf); ofpbuf_clear(&state->buf); @@ -263,11 +266,9 @@ out: return err; } -#ifdef _WIN32 -int -nl_ct_flush_zone(uint16_t flush_zone) +static int +nl_ct_flush_zone_with_cta_zone(uint16_t flush_zone) { - /* Windows can flush a specific zone */ struct ofpbuf buf; int err; @@ -282,24 +283,63 @@ nl_ct_flush_zone(uint16_t flush_zone) return err; } + +#ifdef _WIN32 +int +nl_ct_flush_zone(uint16_t flush_zone) +{ + return nl_ct_flush_zone_with_cta_zone(flush_zone); +} #else + +static bool +netlink_flush_supports_zone(void) +{ + static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; + static bool supported = false; + + if (ovsthread_once_start(&once)) { + if (ovs_kernel_is_version_or_newer(6, 8)) { + supported = true; + } else { + VLOG_INFO("disabling conntrack flush by zone. " + "Not supported in Linux kernel"); + } + ovsthread_once_done(&once); + } + return supported; +} + int nl_ct_flush_zone(uint16_t flush_zone) { - /* Apparently, there's no netlink interface to flush a specific zone. + /* In older kernels, there was no netlink interface to flush a specific + * conntrack zone. * This code dumps every connection, checks the zone and eventually * delete the entry. + * In newer kernels there is the option to specify a zone for filtering + * during dumps. Older kernels ignore this option. We set it here in the + * hope we only get relevant entries back, but fall back to filtering here + * to keep compatibility. * - * This is race-prone, but it is better than using shell scripts. */ + * This is race-prone, but it is better than using shell scripts. + * + * Additionally newer kernels also support flushing a zone without listing + * it first. */ struct nl_dump dump; struct ofpbuf buf, reply, delete; + if (netlink_flush_supports_zone()) { + return nl_ct_flush_zone_with_cta_zone(flush_zone); + } + ofpbuf_init(&buf, NL_DUMP_BUFSIZE); ofpbuf_init(&delete, NL_DUMP_BUFSIZE); nl_msg_put_nfgenmsg(&buf, 0, AF_UNSPEC, NFNL_SUBSYS_CTNETLINK, IPCTNL_MSG_CT_GET, NLM_F_REQUEST); + nl_msg_put_be16(&buf, CTA_ZONE, htons(flush_zone)); nl_dump_start(&dump, NETLINK_NETFILTER, &buf); ofpbuf_clear(&buf); diff --git a/tests/system-traffic.at b/tests/system-traffic.at index 98e494abf..43eaa534f 100644 --- a/tests/system-traffic.at +++ b/tests/system-traffic.at @@ -3376,6 +3376,14 @@ AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.4)], [0], [dnl tcp,orig=(src=10.1.1.3,dst=10.1.1.4,sport=,dport=),reply=(src=10.1.1.4,dst=10.1.1.3,sport=,dport=),zone=2,protoinfo=(state=) ]) +dnl flushing one zone should leave the others intact +AT_CHECK([ovs-appctl dpctl/flush-conntrack zone=2]) +AT_CHECK([ovs-appctl dpctl/dump-conntrack zone=1 | FORMAT_CT(10.1.1.2)], [0], [dnl +tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=,dport=),reply=(src=10.1.1.2,dst=10.1.1.1,sport=,dport=),zone=1,protoinfo=(state=) +]) +AT_CHECK([ovs-appctl dpctl/dump-conntrack zone=2 | FORMAT_CT(10.1.1.4)], [0], [dnl +]) + OVS_TRAFFIC_VSWITCHD_STOP AT_CLEANUP