From patchwork Tue Nov 26 14:36:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Huettner X-Patchwork-Id: 2015466 X-Patchwork-Delegate: echaudro@redhat.com 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=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=JVLFRRw8; dkim=fail reason="signature verification failed" (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=JVLFRRw8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (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 4XyQC620Dbz1yQY for ; Wed, 27 Nov 2024 01:37:22 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 89D978520A; Tue, 26 Nov 2024 14:37:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id HdM9xsHHngJQ; Tue, 26 Nov 2024 14:37:19 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org DC9B185236 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=JVLFRRw8; dkim=fail reason="signature verification failed" (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=JVLFRRw8 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id DC9B185236; Tue, 26 Nov 2024 14:37:18 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BB619C08A9; Tue, 26 Nov 2024 14:37:18 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 04B96C08AA for ; Tue, 26 Nov 2024 14:37:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C76098515C for ; Tue, 26 Nov 2024 14:37:16 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Pk81V4Lht0v0 for ; Tue, 26 Nov 2024 14:37:15 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a01:111:f403:2612::625; helo=eur05-am6-obe.outbound.protection.outlook.com; envelope-from=felix.huettner@stackit.cloud; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org E478B8512B Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=reject dis=none) header.from=stackit.cloud DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E478B8512B Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20625.outbound.protection.outlook.com [IPv6:2a01:111:f403:2612::625]) by smtp1.osuosl.org (Postfix) with ESMTPS id E478B8512B for ; Tue, 26 Nov 2024 14:37:14 +0000 (UTC) ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=hHfLM3cHQFO6cRG555btUqJ4KHgneEatuH0kwysSSKKYkVb0MxEO73Po7oELchik3/u0EEGNsSkNYqGtBqQpYukprBvfSX8TCriOK7N1I7QITs9392SZULSua8RhJOGWINTqYfKjgiauhj/Lco+woueo/twib4STiqTRyfYaUQmFr5NJi7aqhFdVvKfMzbz4iXct58HdnfBNDe8tVwCmtg5ze9GJ6RlpphHZtwaSS4QlLLGKMdByOVL7ZsOC6gB9JHTNKpBiO8FSjBWTijgm4qaTovBVT5jivfvQvpZoK8qRbdGE9o8AuImbKUB/6lQ9b8I3lj20yqNOu+VazxPEYQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=eW84pSEVqrFdS64Z0EVYC1SqAdKxXl8AvwAmhFazefY=; b=WF4c92wB2Lq1zbFMlAOsKsyUnhrDJsH+CY/5XcuMrzz1w+WWMb+HVuONZnnEHBRScUw4Ld8kEBKS86VGyRAgSvfnZWhEQ/IzOLjcKoswrO/vTApvVqdd2Pq9LNRsCyZ0XdSfTbFjjKcG75UsIl+aM5+gGca31UCY8JzjZ84Igb0DJxZe2VbDvUK0y2zXcpnAp+OVBdIlRjoTtfJQhsZ+mc8855hU4Qy4saTSIyVoXvXMMGph3KwbVkiGdmpi/j40f8afUoDAabL7ua5b7bgsVTz0zAvqtzHH60w4YRb5dsqgaeUtRzLh/JibdLtumAB5CQ7cG2f1PjfiZuLR//KWPA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=fail (sender ip is 104.40.229.156) smtp.rcpttodomain=openvswitch.org smtp.mailfrom=stackit.cloud; dmarc=pass (p=reject sp=none pct=100) action=none header.from=stackit.cloud; dkim=pass (signature was verified) header.d=stackit.cloud; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=stackit.cloud] dkim=[1,1,header.d=stackit.cloud] dmarc=[1,1,header.from=stackit.cloud]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackit.cloud; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eW84pSEVqrFdS64Z0EVYC1SqAdKxXl8AvwAmhFazefY=; b=JVLFRRw8vwaV3TiPKiOTgKeG8d4a5PacptOSwEaD3uFUGycSkminiFBPayz5mT7zdHWMV8TVdbrORKawGoIAzs5OIJUH2ImcNBeK+ew5Tb+Krd8YMtSYw5PKYhqmvJXYaB9azsSGJacIb0ELq3GASpdMkWO1MzrnCWq2xesFQZjKi4JxNGR7XsNb1usBIkx4WwHs0DHTa3qZbkqpI241pgqdJwlJg7kMg8tuV6sMXjocz6L7XKlvvX8epiC3WajvhCLKQ5QEwYkKcRLq/pxS2We25rxD1rxo2zKGrNiLe6TjsxM65+ACuy7Hc1qdzPejIPJdkPNMfdBGzBPXhb6W4w== Received: from DU7PR01CA0030.eurprd01.prod.exchangelabs.com (2603:10a6:10:50e::19) by AS2PR10MB7887.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:647::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.11; Tue, 26 Nov 2024 14:37:06 +0000 Received: from DB1PEPF000509FC.eurprd03.prod.outlook.com (2603:10a6:10:50e:cafe::e6) by DU7PR01CA0030.outlook.office365.com (2603:10a6:10:50e::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.19 via Frontend Transport; Tue, 26 Nov 2024 14:37:06 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 104.40.229.156) smtp.mailfrom=stackit.cloud; dkim=pass (signature was verified) header.d=stackit.cloud;dmarc=pass action=none header.from=stackit.cloud; Received-SPF: Fail (protection.outlook.com: domain of stackit.cloud does not designate 104.40.229.156 as permitted sender) receiver=protection.outlook.com; client-ip=104.40.229.156; helo=eu1.smtp.exclaimer.net; Received: from eu1.smtp.exclaimer.net (104.40.229.156) by DB1PEPF000509FC.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Tue, 26 Nov 2024 14:37:04 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (104.47.17.112) by eu1.smtp.exclaimer.net (104.40.229.156) with Exclaimer Signature Manager ESMTP Proxy eu1.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_DIFFIEHELLMAN_WITH_AES256_NONE); Tue, 26 Nov 2024 14:37:04 +0000 X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 12076610 X-ExclaimerImprintLatency: 9158339 X-ExclaimerImprintAction: a2d728009355407b9488eddc1ff827f6 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=t5dTq07TpqCIQMRZJsT+/Z96MsO8R0iWa1+Xmclf3/EgBZ/DYAr1HLKqegOp6tT55yMY0cor9/1JlY9uQGl+83l/haEz6Y7+xKz5ItrWvx68aOjj3FeBTZ6nlu6f9lqB4BPCIt3OJJ1QjtFn/AWW1T5FkT8jqv9UC+/96BXqYagl6vtIa2PSBLVTsEGLn4ZRgHQyjQuvTELs3AKPLdiTvudqRjfq1cRJ/qrBYIZURoQv1GEx3whcrsaGhRZJemoRCIWASu4Mq7TOEDpAJ3srzwCU1mWik4lO8b3bKXsyvUgEZVogIKI1+sL0qTqt1/aqkLFksqHGBP54jcVVP3jRqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=eW84pSEVqrFdS64Z0EVYC1SqAdKxXl8AvwAmhFazefY=; b=CDsYu+1h8RIxIE5X/9Gtd7FEtPKwegBTAFfg2vCPpiFMqAGre3H4TrzDnBp+DP+y50Y90eFA98b2DJm8mr7xRiDF12jEzNE4/Ri305AGLpreMwOz3RWgrKV0KeEiqHXcYmGzONUeeu29ER+Vb5edDerimpOTDIF5NsZv575nMJN9tUtgzGfSKgu5XtP5oARLCG8/5dMSsVX6uBu6Ihv/e8k8Or5jObdUvmkrt69E+SfLp3NA2qxIq+kKtapiKF2gvl/q4o1biSmTLCF8KsuEBjqFidkD3DDTHdiRTgHpMl9O2fWNr488ScCZDkNtAZ6QEnV2UAYO5fqVeuAy1hfyag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stackit.cloud; dmarc=pass action=none header.from=stackit.cloud; dkim=pass header.d=stackit.cloud; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackit.cloud; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eW84pSEVqrFdS64Z0EVYC1SqAdKxXl8AvwAmhFazefY=; b=JVLFRRw8vwaV3TiPKiOTgKeG8d4a5PacptOSwEaD3uFUGycSkminiFBPayz5mT7zdHWMV8TVdbrORKawGoIAzs5OIJUH2ImcNBeK+ew5Tb+Krd8YMtSYw5PKYhqmvJXYaB9azsSGJacIb0ELq3GASpdMkWO1MzrnCWq2xesFQZjKi4JxNGR7XsNb1usBIkx4WwHs0DHTa3qZbkqpI241pgqdJwlJg7kMg8tuV6sMXjocz6L7XKlvvX8epiC3WajvhCLKQ5QEwYkKcRLq/pxS2We25rxD1rxo2zKGrNiLe6TjsxM65+ACuy7Hc1qdzPejIPJdkPNMfdBGzBPXhb6W4w== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=stackit.cloud; Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) by DB8PR10MB3193.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:114::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12; Tue, 26 Nov 2024 14:36:59 +0000 Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::f00d:feeb:e45e:54f8]) by PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::f00d:feeb:e45e:54f8%4]) with mapi id 15.20.8207.010; Tue, 26 Nov 2024 14:36:59 +0000 Date: Tue, 26 Nov 2024 15:36:58 +0100 To: dev@openvswitch.org Message-ID: <9ed677d47072dc3b68e76c10257a247b56473edc.1732630344.git.felix.huettner@stackit.cloud> Mail-Followup-To: dev@openvswitch.org References: Content-Disposition: inline In-Reply-To: X-please-dont-add-a-signature: thanks X-ClientProxiedBy: FR3P281CA0113.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::12) To PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAVPR10MB6914:EE_|DB8PR10MB3193:EE_|DB1PEPF000509FC:EE_|AS2PR10MB7887:EE_ X-MS-Office365-Filtering-Correlation-Id: 5da77063-dea0-475a-1ab0-08dd0e27cc46 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info-Original: wlN7D3FuAlEtH2/tt4gVFlBHcmGJ5cYPqVzdn8HKzuvdT9m8lkK6e1nhih+ZDN7Gvie03QxSH6RLgOXT6WJS3rOjDpbKUXv5LIGnnG+g/3EjxCAxQlIqWdUtSWM3cHLzhZPscn5ZBTcCZZeNX4MpPf7DX5VJaCM3vpVpiNOj/83W4AjgX02gqKcUOA0E0hXNnH/W9Bp31SLUtL+vMcmqPmIaMVLLZe/MppnmkE2jUBHoZSqWn5edXFIpY9JTQuPJiZtjl7vb15b6lkJKuDQciz0hyRUEETvKnmwPKNeUoGTZYsUWFzUL6UGgE0PdYHzTDC4mwKLBgROJP1qtn9QgahHQiXWDFxEBH+LhW0sTKx3cTmA4zMrY6naWPHYWnali7Vp8P5nt8EVPK1iyBoRJHbRbe3Js26VNfiYVZC2RjpA9SedH/BDuv9z7FjJS3Pc3zrZHn5laH+4vfAG2OA8/hdTBAYtcjfUV38racUfkq4T43ViFTQL3LGeKuQv7PrzkZbMl1SrA2QzqdFjsl1OTy/bKF2Ux4WTqNYCIJlao0Bu7Bt7HTIe3YjkTySvnJkB4L2yfyKfKJ5gupzl9tf/Vxidk/QENXPqokWF9pCIonURWofjOa3qBVMwplIcxjz42vWgVTjJ1iY/+mPlyJQtnZDvfHeSlGrYKbkhuxxSWpqEpxwCR0F8S548sOQczlvU6CXy2sm3X42q3UyVoRPRYxgbtVOt5pc9Xf4fdlqQvfjpsULTRT5wdnC7SjYjLsGibHbSnBmrymZAtbX+8kRU41ad7mEwIKvqOv7SImdLH3W63CzI/LBZKUN+mYKbwHrqqGHvDwc5zCX1l0O3S3pZvNLTnoAFl39QXYapuutq750b7aiMiD033+s3y0KV/p8z5bHOJmPYResLmjpWGbwglU4Li9On4Qj+xy3Mz6WobB2BPPXeW1qFPnXQ+o+BNiGEzun/ndV05XT+RfHhHkiPB5K92tXQcJvJIRyltZGQ8kDPlpVl7WOYgK329nUWOkdsNt2JGrtOqfpyyqtD7jIIEoN0B3bT3U0nH2Vi16C2VJlsqTzq2fin/C38Ql8PEIf6M4Jyp93GD8ohvL2AIJ6vpeztqAwKpdcUvTmKPKmC1OeevIAW7fnipUlZiT/miKajL6I2TothSDRW6cDTebbcgPIOFUZ0kwq2W73m2UFdGxPG8i6b4h7/vneSvoq9iqcfvl7Br9RBoqn4Ar+pLEvQ73RImkWI6LB//I2stBPqShmv1XjSpz1HGXAGO7mo+zx+92SDA6MxcKOSWaP7LOzHRB4j6AcUNJjkg1UtGY3Jl2FMP/MhUrsC/9x4rKnw9YNCJMuX8MJDRUOSzLRNTu1ztFOh/vjV5bPHTBoCCNpLCiSU= 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:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR10MB3193 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF000509FC.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 578e55c3-47dd-458e-37a9-08dd0e27c916 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|35042699022|82310400026|1800799024|14060799003|36860700013; X-Microsoft-Antispam-Message-Info: Y8//r1gZ7xvbQjz5cRWk3jA+TbcbeLho7n5ILf6VTCgM5+/3RWb5ptBBwOR56ctQm6LLxG5Pj5/1Lc02TLLhDB6BhgKFH8woI6dscWCXnnyDwStK9uoeU3XJvtGRK1DyaN7CCjOsGYkkBFqFLM1Ouxj/Ar9HumK4e0vtdAt6HUi03ZNZcvjbAcV++TooWZ/PuIX7Ka/48o0KC58KWYQe9Mx1AXMDL6raXGNJecNb6o2R8YhEbPhg/G/Wsb6gyqMFrteGUIbtJK9jhZGzQ5telpT+MtJ3iH7KMjsAzN6a9uiAspyhtSFyYIxkx0pmbDHdbSWfUlovgvpF6wCh1AnXuAry9ufv5r/F9keM4AGJAT2aWGx4oC2QeX7W0lpHTMiDjJZt6WQwLjvuRm7uosLxjjfHL8Y0XlCD2Bq5z639T1vacfrnP9ce6SMrOBlzS40DOb6n8WDLJ4aJ9w4GNMiflD/O7UYkL01GOLY86F6oA5UBP0ghFyVW5/knyBkyJPxxphDJbRu0En6JSViXAOmtOowmOFyn4Ll+v3oHDSKc0mwhMSwfc3hI9jcadrEWSK5Sb0dxT86t1ssQ1lvvAcf/PS9RLSVwk5TjGg6yXF6hYXL2IeExWcJ/ykIOMbXsuRcXX+6c/+VRtPIPEhPqDgi9bkfpX/DIPNvGyFSi0M8045SJoWE/LwKAnhhO0HM2L27A2WR2aFLAKcud6L24s+dPDbfYqtFaMFBUaGgnOWREvLoqlynQ2o0WgzlBAu0eT4LUSPO+9rG3pQn7mnFgGXnmQ5p5M8LaI0CzwYm05cqGrI9H1iwliqcO71Fxpl/TQifaj8AaOw/R4orpsEycON4Hr6ooiuxuJ7UkUFmtT9b5Jz2BlV5IzNd7eMVafqL/KlMVDm96Y4FtyFWsHwf6gydxIzfOnuiJISIrOeXEX56eX5P0RTbDPhFEQNEJ2ifykaVF1hiiMv461VgZxgtPEF5KTuk8s7sHntyPnLwckAfnCH0uQdVuL5khQ6LhWc/AaI1wrNiEEhY6SF/LyWnsKVVytFozn2SplGZg65JhgycfN/Yg7XmEurM5Mr6KMFlYJyBfep8CJDiS20SX+j2OyVXOT4scq5Kqpp1mOsy1LJxXNHsLIUQFkTMjTA3abLP6xRxtEM1K2H94BvrR40QzQMqxr4ZxIUVQm4RoT53jl4eDqLOUEsfhDgKHikdob+SIMQxHcJKI/2JyJihmIlvm49fB7HWBbgwSRKOc8jpohTNhr31G804qsZre9RijRrSNvxKEfgTS64xqLeMyixwUBAh2Ka9zpnDupatb5ZSJDQHAnlTFI68bKnrR8x/LABLP/kvIoBG2oRhAMWCY+Z64SO0CP12gEBmZ3YvjOmmFw8iufRX/QVmgdCrbZzFdS2uXboBRTh2TJsJ4B19MKBWwdZtvOV/858AgA5kG3rma+tkGZ0xS0YcZeCDQDffO/yeObIZq 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:(13230040)(376014)(35042699022)(82310400026)(1800799024)(14060799003)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: stackit.cloud X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2024 14:37:04.0294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5da77063-dea0-475a-1ab0-08dd0e27cc46 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: DB1PEPF000509FC.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR10MB7887 Subject: [ovs-dev] [PATCH v2 1/6] netlink: Support accessing namespaces. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 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" In the future we need to access routing table entries in network namespaces. As netlink has no easy way to get a socket in a network namespace we copy the logic of frr where we: 1. enter the target netns 2. open a socket 3. jump back to our original netns the socket will keep working between these jumps. Tests are added as part of the system testsuite as we need root permissions to switch namespaces. Signed-off-by: Felix Huettner --- v1->v2: reduced changes in other files .github/workflows/build-and-test.yml | 2 +- NEWS | 3 + lib/netlink-socket.c | 122 ++++++++++++++++++++++++--- lib/netlink-socket.h | 8 +- lib/route-table.c | 6 +- tests/automake.mk | 4 +- tests/system-library.at | 10 +++ tests/system-userspace-testsuite.at | 2 + tests/test-netlink-socket.c | 47 +++++++++++ 9 files changed, 184 insertions(+), 20 deletions(-) create mode 100644 tests/system-library.at create mode 100644 tests/test-netlink-socket.c diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 13a6bf3f2..637813144 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -80,7 +80,7 @@ jobs: dependencies: | automake libtool gcc bc libjemalloc2 libjemalloc-dev libssl-dev \ llvm-dev libnuma-dev libpcap-dev selinux-policy-dev libbpf-dev \ - lftp libreswan + lftp libreswan linux-modules-extra-$(uname -r) CC: ${{ matrix.compiler }} DPDK: ${{ matrix.dpdk }} DPDK_SHARED: ${{ matrix.dpdk_shared }} diff --git a/NEWS b/NEWS index 7a9626bf4..12aae088d 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ Post-v3.4.0 -------------------- + - libopenvswitch API change: + * Add nl_ns_transact, nl_ns_transact_multiple and nl_ns_dump_start to + open netlink sockets in other network namespaces. v3.4.0 - 15 Aug 2024 diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c index 976ed15e8..56d29faf5 100644 --- a/lib/netlink-socket.c +++ b/lib/netlink-socket.c @@ -17,6 +17,7 @@ #include #include "netlink-socket.h" #include +#include #include #include #include @@ -25,6 +26,7 @@ #include #include "coverage.h" #include "openvswitch/dynamic-string.h" +#include "openvswitch/shash.h" #include "hash.h" #include "openvswitch/hmap.h" #include "netlink.h" @@ -94,6 +96,7 @@ struct nl_sock { uint32_t pid; int protocol; unsigned int rcvbuf; /* Receive buffer size (SO_RCVBUF). */ + char *netns; }; /* Compile-time limit on iovecs, so that we can allocate a maximum-size array @@ -106,7 +109,7 @@ struct nl_sock { * Initialized by nl_sock_create(). */ static int max_iovs; -static int nl_pool_alloc(int protocol, struct nl_sock **sockp); +static int nl_pool_alloc(const char *, int protocol, struct nl_sock **sockp); static void nl_pool_release(struct nl_sock *); /* Creates a new netlink socket for the given netlink 'protocol' @@ -145,6 +148,7 @@ nl_sock_create(int protocol, struct nl_sock **sockp) *sockp = NULL; sock = xmalloc(sizeof *sock); + sock->netns = NULL; #ifdef _WIN32 sock->overlapped.hEvent = NULL; @@ -294,6 +298,7 @@ nl_sock_destroy(struct nl_sock *sock) #else close(sock->fd); #endif + free(sock->netns); free(sock); } } @@ -1152,6 +1157,9 @@ nl_sock_drain(struct nl_sock *sock) * Netlink socket created with the given 'protocol', and initializes 'dump' to * reflect the state of the operation. * + * The dump runs in the specified 'netns'. If 'netns' is NULL the current will + * be used. + * * 'request' must contain a Netlink message. Before sending the message, * nlmsg_len will be finalized to match request->size, and nlmsg_pid will be * set to the Netlink socket's pid. NLM_F_DUMP and NLM_F_ACK will be set in @@ -1165,13 +1173,21 @@ nl_sock_drain(struct nl_sock *sock) * The caller must eventually destroy 'request'. */ void -nl_dump_start(struct nl_dump *dump, int protocol, const struct ofpbuf *request) +nl_dump_start(struct nl_dump *dump, int protocol, + const struct ofpbuf *request) +{ + nl_ns_dump_start(NULL, dump, protocol, request); +} + +void +nl_ns_dump_start(const char *netns, struct nl_dump *dump, int protocol, + const struct ofpbuf *request) { nl_msg_nlmsghdr(request)->nlmsg_flags |= NLM_F_DUMP | NLM_F_ACK; ovs_mutex_init(&dump->mutex); ovs_mutex_lock(&dump->mutex); - dump->status = nl_pool_alloc(protocol, &dump->sock); + dump->status = nl_pool_alloc(netns, protocol, &dump->sock); if (!dump->status) { dump->status = nl_sock_send__(dump->sock, request, nl_sock_allocate_seq(dump->sock, 1), @@ -1725,39 +1741,100 @@ struct nl_pool { int n; }; +struct nl_ns_pool { + struct nl_pool pools[MAX_LINKS]; +}; + static struct ovs_mutex pool_mutex = OVS_MUTEX_INITIALIZER; -static struct nl_pool pools[MAX_LINKS] OVS_GUARDED_BY(pool_mutex); +static struct shash pools OVS_GUARDED_BY(pool_mutex) = + SHASH_INITIALIZER(&pools); static int -nl_pool_alloc(int protocol, struct nl_sock **sockp) +nl_sock_ns_create(const char *netns, int protocol, struct nl_sock **sockp) { +#ifndef __linux__ + if (netns) { + return -EOPNOTSUPP; + } +#endif + + int ret, ns_fd, ns_default_fd, err; + if (netns) { + ns_default_fd = open("/proc/self/ns/net", O_RDONLY); + if (ns_default_fd < 0) { + VLOG_ERR("something wrong when opening self net fd, %d\n", + errno); + return -errno; + } + char *netns_path = xasprintf("/var/run/netns/%s", netns); + ns_fd = open(netns_path, O_RDONLY); + if (ns_fd < 0) { + VLOG_ERR("something wrong when opening other net fd %s," + " %d\n", netns_path, errno); + return -errno; + } + err = setns(ns_fd, CLONE_NEWNET); + if (err < 0) { + VLOG_ERR("something wrong during setns to target %s, %d\n", + netns_path, errno); + } + free(netns_path); + close(ns_fd); + } + ret = nl_sock_create(protocol, sockp); + if (netns) { + err = setns(ns_default_fd, CLONE_NEWNET); + if (err < 0) { + VLOG_ABORT("something wrong during setns to home, %d\n", + errno); + } + close(ns_default_fd); + if (*sockp) { + (*sockp)->netns = xstrdup(netns); + } + } + return ret; +} + +static int +nl_pool_alloc(const char *netns, int protocol, struct nl_sock **sockp) { + const char * netns_name = netns ? netns : ""; + struct nl_ns_pool *ns_pools; struct nl_sock *sock = NULL; struct nl_pool *pool; - ovs_assert(protocol >= 0 && protocol < ARRAY_SIZE(pools)); + ovs_assert(protocol >= 0 && protocol < ARRAY_SIZE(ns_pools->pools)); ovs_mutex_lock(&pool_mutex); - pool = &pools[protocol]; - if (pool->n > 0) { - sock = pool->socks[--pool->n]; + ns_pools = shash_find_data(&pools, netns_name); + if (ns_pools) { + pool = &ns_pools->pools[protocol]; + if (pool->n > 0) { + sock = pool->socks[--pool->n]; + } } ovs_mutex_unlock(&pool_mutex); if (sock) { *sockp = sock; return 0; - } else { - return nl_sock_create(protocol, sockp); } + return nl_sock_ns_create(netns, protocol, sockp); } static void nl_pool_release(struct nl_sock *sock) { if (sock) { - struct nl_pool *pool = &pools[sock->protocol]; + const char * netns_name = sock->netns ? sock->netns : ""; ovs_mutex_lock(&pool_mutex); + struct nl_ns_pool *ns_pools = shash_find_data(&pools, netns_name); + if (!ns_pools) { + ns_pools = xzalloc(sizeof(*ns_pools)); + shash_add(&pools, netns_name, ns_pools); + } + struct nl_pool *pool = &ns_pools->pools[sock->protocol]; if (pool->n < ARRAY_SIZE(pool->socks)) { pool->socks[pool->n++] = sock; sock = NULL; @@ -1772,6 +1849,9 @@ nl_pool_release(struct nl_sock *sock) * (e.g. NETLINK_ROUTE or NETLINK_GENERIC) and waits for a response. If * successful, returns 0. On failure, returns a positive errno value. * + * The 'request' is send in the specified netns. If 'netns' is NULL the current + * namespace is used. + * * If 'replyp' is nonnull, then on success '*replyp' is set to the kernel's * reply, which the caller is responsible for freeing with ofpbuf_delete(), and * on failure '*replyp' is set to NULL. If 'replyp' is null, then the kernel's @@ -1812,11 +1892,18 @@ nl_pool_release(struct nl_sock *sock) int nl_transact(int protocol, const struct ofpbuf *request, struct ofpbuf **replyp) +{ + return nl_ns_transact(NULL, protocol, request, replyp); +} + +int +nl_ns_transact(const char *netns, int protocol, const struct ofpbuf *request, + struct ofpbuf **replyp) { struct nl_sock *sock; int error; - error = nl_pool_alloc(protocol, &sock); + error = nl_pool_alloc(netns, protocol, &sock); if (error) { if (replyp) { *replyp = NULL; @@ -1853,11 +1940,18 @@ nl_transact(int protocol, const struct ofpbuf *request, void nl_transact_multiple(int protocol, struct nl_transaction **transactions, size_t n) +{ + nl_ns_transact_multiple(NULL, protocol, transactions, n); +} + +void +nl_ns_transact_multiple(const char *netns, int protocol, + struct nl_transaction **transactions, size_t n) { struct nl_sock *sock; int error; - error = nl_pool_alloc(protocol, &sock); + error = nl_pool_alloc(netns, protocol, &sock); if (!error) { nl_sock_transact_multiple(sock, transactions, n); nl_pool_release(sock); diff --git a/lib/netlink-socket.h b/lib/netlink-socket.h index 7852ad052..fb53284a6 100644 --- a/lib/netlink-socket.h +++ b/lib/netlink-socket.h @@ -253,7 +253,11 @@ struct nl_transaction { /* Transactions without an allocated socket. */ int nl_transact(int protocol, const struct ofpbuf *request, struct ofpbuf **replyp); +int nl_ns_transact(const char *netns, int protocol, + const struct ofpbuf *request, struct ofpbuf **replyp); void nl_transact_multiple(int protocol, struct nl_transaction **, size_t n); +void nl_ns_transact_multiple(const char *netns, int protocol, + struct nl_transaction **, size_t n); /* Table dumping. */ #define NL_DUMP_BUFSIZE 4096 @@ -270,8 +274,10 @@ struct nl_dump { struct ovs_mutex mutex; /* Protects 'status', synchronizes recv(). */ }; -void nl_dump_start(struct nl_dump *, int protocol, +void nl_dump_start(struct nl_dump *dump, int protocol, const struct ofpbuf *request); +void nl_ns_dump_start(const char *netns, struct nl_dump *dump, int protocol, + const struct ofpbuf *request); bool nl_dump_next(struct nl_dump *, struct ofpbuf *reply, struct ofpbuf *buf); int nl_dump_done(struct nl_dump *); diff --git a/lib/route-table.c b/lib/route-table.c index c6cb21394..bce29ebb2 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -156,7 +156,7 @@ route_table_wait(void) } static bool -route_table_dump_one_table(unsigned char id) +route_table_dump_one_table(const char *netns, unsigned char id) { uint64_t reply_stub[NL_DUMP_BUFSIZE / 8]; struct ofpbuf request, reply, buf; @@ -172,7 +172,7 @@ route_table_dump_one_table(unsigned char id) rq_msg->rtm_family = AF_UNSPEC; rq_msg->rtm_table = id; - nl_dump_start(&dump, NETLINK_ROUTE, &request); + nl_ns_dump_start(netns, &dump, NETLINK_ROUTE, &request); ofpbuf_uninit(&request); ofpbuf_use_stub(&buf, reply_stub, sizeof reply_stub); @@ -212,7 +212,7 @@ route_table_reset(void) COVERAGE_INC(route_table_dump); for (size_t i = 0; i < ARRAY_SIZE(tables); i++) { - if (!route_table_dump_one_table(tables[i])) { + if (!route_table_dump_one_table(NULL, tables[i])) { /* Got unfiltered reply, no need to dump further. */ break; } diff --git a/tests/automake.mk b/tests/automake.mk index edfc2cb33..abb0d352c 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -178,7 +178,8 @@ SYSTEM_TESTSUITE_AT = \ tests/system-layer3-tunnels.at \ tests/system-traffic.at \ tests/system-ipsec.at \ - tests/system-interface.at + tests/system-interface.at \ + tests/system-library.at SYSTEM_OFFLOADS_TESTSUITE_AT = \ tests/system-common-macros.at \ @@ -500,6 +501,7 @@ if LINUX tests_ovstest_SOURCES += \ tests/test-netlink-conntrack.c \ tests/test-netlink-policy.c \ + tests/test-netlink-socket.c \ tests/test-psample.c endif diff --git a/tests/system-library.at b/tests/system-library.at new file mode 100644 index 000000000..de7f2178f --- /dev/null +++ b/tests/system-library.at @@ -0,0 +1,10 @@ +AT_BANNER([system-library]) + +AT_SETUP([netlink socket]) +AT_SKIP_IF([test "$IS_WIN32" = "yes"]) +AT_SKIP_IF([test "$IS_BSD" = "yes"]) +ADD_NAMESPACES([ns1337]) +NS_EXEC([ns1337], [ip link add vrf1337 type vrf table 1337]) +AT_CHECK([ovstest test-netlink-socket], [0]) +AT_CLEANUP + diff --git a/tests/system-userspace-testsuite.at b/tests/system-userspace-testsuite.at index 2e9659a67..6e456cb09 100644 --- a/tests/system-userspace-testsuite.at +++ b/tests/system-userspace-testsuite.at @@ -27,3 +27,5 @@ m4_include([tests/system-layer3-tunnels.at]) m4_include([tests/system-interface.at]) m4_include([tests/system-userspace-packet-type-aware.at]) m4_include([tests/system-route.at]) + +m4_include([tests/system-library.at]) diff --git a/tests/test-netlink-socket.c b/tests/test-netlink-socket.c new file mode 100644 index 000000000..b4597880f --- /dev/null +++ b/tests/test-netlink-socket.c @@ -0,0 +1,47 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include +#include +#include +#include + +#include "netlink.h" +#include "netlink-socket.h" +#include "ovstest.h" + +static int +try_find_link(const char *netns) { + struct ofpbuf request, *reply; + int err; + ofpbuf_init(&request, 0); + nl_msg_put_nlmsghdr(&request, 0, RTM_GETLINK, NLM_F_REQUEST); + ofpbuf_put_zeros(&request, sizeof(struct ifinfomsg)); + nl_msg_put_string(&request, IFLA_IFNAME, "vrf1337"); + err = nl_ns_transact(netns, NETLINK_ROUTE, &request, &reply); + ofpbuf_uninit(&request); + ofpbuf_delete(reply); + return err; +} + +static void +test_netlink_socket_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) +{ + ovs_assert(try_find_link(NULL) != 0); + ovs_assert(try_find_link("ns1337") == 0); +} + +OVSTEST_REGISTER("test-netlink-socket", test_netlink_socket_main); From patchwork Tue Nov 26 14:36:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Huettner X-Patchwork-Id: 2015465 X-Patchwork-Delegate: echaudro@redhat.com 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=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=BNVJpEvS; dkim=fail reason="signature verification failed" (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=BNVJpEvS; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::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 4XyQC319lrz1yQY for ; Wed, 27 Nov 2024 01:37:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 39A9B4CF79; Tue, 26 Nov 2024 14:37:17 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id PbGh1nN72HXr; Tue, 26 Nov 2024 14:37:15 +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 BA7494B478 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=BNVJpEvS; dkim=fail reason="signature verification failed" (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=BNVJpEvS Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id BA7494B478; Tue, 26 Nov 2024 14:37:15 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 96D0FC08A9; Tue, 26 Nov 2024 14:37:15 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0B150C08A8 for ; Tue, 26 Nov 2024 14:37:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id EE86C4B601 for ; Tue, 26 Nov 2024 14:37:13 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id nLnUYW-a47Hq for ; Tue, 26 Nov 2024 14:37:13 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a01:111:f403:2614::62b; helo=eur05-db8-obe.outbound.protection.outlook.com; envelope-from=felix.huettner@stackit.cloud; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 9BB104B739 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=reject dis=none) header.from=stackit.cloud DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 9BB104B739 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2062b.outbound.protection.outlook.com [IPv6:2a01:111:f403:2614::62b]) by smtp4.osuosl.org (Postfix) with ESMTPS id 9BB104B739 for ; Tue, 26 Nov 2024 14:37:12 +0000 (UTC) ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=aq0dTsHJ2A7nHpfjKnaUMTchJ3wAGPlFwopRDm9PCYmMFnmf/yqLaTZzJvKC5/eX19XdJRqXAWVQxpNDKa9gxQKY1uvLUyLBTYKMXBfLa6o84nHcdUXUtX+iPeyqz7kRK+LBbUmeFdSTJTKZFOzWfo71oJYijJ2nNGOPkswxIoGeIh9cJfvF0a0wWQNpwCSczLj0Qrqap/fqWteHP2fMyWFyAW+N5sKLZfO2VsO90OJWt6LUdZpBE26imsCFLHxT9KHwGMn1n7uc8Up3ozM37doqlYo8w+ULmhh/Bd4v+INp+8O+17YdZn0V/rvRFDbTh703MDAwVlRwwqXfl3FFZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=odlcK7Md+ftWTAToBrT89bBLR09kl19rHms3yJ6XNi8=; b=TvGRPCd2RjWLCZ/7aQeWY5MfKTgYCKu1ZIuoUIixaQXEWJgrcNPNRK66vMfzwZ0IneXg+fZNCAVN+KhIQQ2tgVbsJbJq03Y7WM/qsfWpk3/Vre6ZUkmn7RAaZsFCSp9R3PqBS2YOmMZtU3Huqq/Y7dw9F2KZZgbIA2o94KpDvqhWrKcC9/ZQ+Pvat4KaGyyrfvhfgUQwyr3/nN1xab0jPapf6nFpfxqyeotd8OgVysifDl2/tQSEnRsS8CzLc3TIR1E8752Mt4fkniywK0rRJx7EDOuI6T4FmBRqb5bAwjgcMjMXmv7wE/MGnRQXmtNQltd64NNeZwEdHLXvswldWw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=fail (sender ip is 104.40.229.156) smtp.rcpttodomain=openvswitch.org smtp.mailfrom=stackit.cloud; dmarc=pass (p=reject sp=none pct=100) action=none header.from=stackit.cloud; dkim=pass (signature was verified) header.d=stackit.cloud; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=stackit.cloud] dkim=[1,1,header.d=stackit.cloud] dmarc=[1,1,header.from=stackit.cloud]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackit.cloud; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=odlcK7Md+ftWTAToBrT89bBLR09kl19rHms3yJ6XNi8=; b=BNVJpEvSpVsaMxJ5NCDQ8pIlLhJ4qYrM9goSE0CwuJwP4T9TKf+CexUl989wDf+YGo48/7D3bVz1t/BUqT/iAYc85c0d6qf9fudnV7x1vOLF93tVusJzfNnIa2MhTDJAlP6nx671di5F31ThVv4ymxKqkfzA5h0bYEtKVb5wpWbZXL1Lmbhted339enQNOlmnLg7w7zodyrlcrmjKUAeW44NeR5c9BUjnwGrjMpXbnuQVrXqp6lok/6T0+SplryWPaAOLVQai5Vp+TRQaA7qG9heo0GOyt9U8WGVcGihA1YNJcBlvtc8UCC/vtYKEJ7oz3rZsBSYxLXB2LVAkspCfw== Received: from DU7P189CA0010.EURP189.PROD.OUTLOOK.COM (2603:10a6:10:552::12) by DUZPR10MB8265.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:4e2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.11; Tue, 26 Nov 2024 14:37:08 +0000 Received: from DU2PEPF00028D11.eurprd03.prod.outlook.com (2603:10a6:10:552:cafe::a1) by DU7P189CA0010.outlook.office365.com (2603:10a6:10:552::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.21 via Frontend Transport; Tue, 26 Nov 2024 14:37:08 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 104.40.229.156) smtp.mailfrom=stackit.cloud; dkim=pass (signature was verified) header.d=stackit.cloud;dmarc=pass action=none header.from=stackit.cloud; Received-SPF: Fail (protection.outlook.com: domain of stackit.cloud does not designate 104.40.229.156 as permitted sender) receiver=protection.outlook.com; client-ip=104.40.229.156; helo=eu1.smtp.exclaimer.net; Received: from eu1.smtp.exclaimer.net (104.40.229.156) by DU2PEPF00028D11.mail.protection.outlook.com (10.167.242.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Tue, 26 Nov 2024 14:37:06 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (104.47.17.112) by eu1.smtp.exclaimer.net (104.40.229.156) with Exclaimer Signature Manager ESMTP Proxy eu1.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_DIFFIEHELLMAN_WITH_AES256_NONE); Tue, 26 Nov 2024 14:37:07 +0000 X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 13870772 X-ExclaimerImprintLatency: 10555529 X-ExclaimerImprintAction: 22fe2990dd084ea8be8e0d331a57e750 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VSQKmL3vokRPObQ2ExjLQJeS28NsIOzbDCEZy/VXbodBUFD9PtFt2+RFKz7XCWl0uUDlcFyga3QIEUgBmA1iYbdtnI8WNg/8p2Qm2NU19Gbz8mWhSL4hN8PuBc/4NOhKuSiSD93mQzzzb/hiV7itguOru6vk01EYJwP2J6yl44Mtc7OsuTjinY1hmU1qG68T2qPSW1rNaeG+86bcKB8El4U06g4/BpON6llwfd+05XrQ+Egm+79LVfcGGVlcQedlgxguB5Iw5zdZyJLxCzZurEzIOXP8RqmkDH5IUdCjL1qlAf6MRwNeeDynw83X6bOFvujuJ5sNG30ONLKFA36gpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=odlcK7Md+ftWTAToBrT89bBLR09kl19rHms3yJ6XNi8=; b=YpF2ysCSUQFySD+3EJaMvmPBLKlpxOm84v+ZNo7rxOJ2xbjxCAE0zLdjih6arV7eAj2S5+RguE76gFfwkC8Kt0OcttxoAwzMyc37IP/ae0/f9KTs0ALoSyIKVl6dYKYQhXBK5zeyfNmTkKSw7jRoFaIaVqwAEhvMzGv/RFOVWN1skrxk0kYD4xaKB/DO/POWlP7968mJ/QWs64542bNMGLcyDg6qiwQ0wkhGBsax6L6sN/SaNvI5BgIkip7i/YDwQPrO6w2eVYwUmE1+W2UIMqHhmUkk/1i7LJ2QPn679ba93lBDuA3IUdWv6/4BBrx9kqWcxWYOgBKAnnLi24Ayag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stackit.cloud; dmarc=pass action=none header.from=stackit.cloud; dkim=pass header.d=stackit.cloud; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackit.cloud; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=odlcK7Md+ftWTAToBrT89bBLR09kl19rHms3yJ6XNi8=; b=BNVJpEvSpVsaMxJ5NCDQ8pIlLhJ4qYrM9goSE0CwuJwP4T9TKf+CexUl989wDf+YGo48/7D3bVz1t/BUqT/iAYc85c0d6qf9fudnV7x1vOLF93tVusJzfNnIa2MhTDJAlP6nx671di5F31ThVv4ymxKqkfzA5h0bYEtKVb5wpWbZXL1Lmbhted339enQNOlmnLg7w7zodyrlcrmjKUAeW44NeR5c9BUjnwGrjMpXbnuQVrXqp6lok/6T0+SplryWPaAOLVQai5Vp+TRQaA7qG9heo0GOyt9U8WGVcGihA1YNJcBlvtc8UCC/vtYKEJ7oz3rZsBSYxLXB2LVAkspCfw== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=stackit.cloud; Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) by DB8PR10MB3193.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:114::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12; Tue, 26 Nov 2024 14:37:01 +0000 Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::f00d:feeb:e45e:54f8]) by PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::f00d:feeb:e45e:54f8%4]) with mapi id 15.20.8207.010; Tue, 26 Nov 2024 14:37:01 +0000 Date: Tue, 26 Nov 2024 15:36:59 +0100 To: dev@openvswitch.org Message-ID: Mail-Followup-To: dev@openvswitch.org References: Content-Disposition: inline In-Reply-To: X-please-dont-add-a-signature: thanks X-ClientProxiedBy: FR3P281CA0114.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::6) To PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAVPR10MB6914:EE_|DB8PR10MB3193:EE_|DU2PEPF00028D11:EE_|DUZPR10MB8265:EE_ X-MS-Office365-Filtering-Correlation-Id: 90376631-25b2-49f3-27a0-08dd0e27cdf0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info-Original: nMDnCIu3E7oa3jqu6IE9V/62UKtFHKMpFFmVPHAizgYLC3FDXqiUsZ9f43xvwQE3nTunRO5NEp30uVhZNig8EFmq3bffhZrOThOX4hkGAOjo8ezY6eXrooU1AtiinXdtuOss7ZSe0mK6ODFeYuVEACeM25miemu4FACWiWeUWgWnvbJtDw1ym8jIkrzukrpvxUXnGoTOTPK2tI96hK1qdAmUbFnO/g3J5jzDNdAwuwDnMJHad1Z2xQ8a5jivUYI8nwh/KJ3Iy+LY87h/xXfav5neJ6cp8V1sTmYFz/0+R7PMh314hhWmGPaqsTU4TQGwuPnfcsoInjmkKhuTH4hlYlnQGFhHiW0KWdNZq7ZoAp84rKAw9fzTgrnYjD7Qk+isGQRJZQoj8ezS4/mZAT/A5+0/5mV8IlK9MRkhTEXEqSG4l4Ijijnm86UNwWoI/qaBBH5P15HLZMJsZa3a8oYw1QvSP2y5TM+fhyCebMVRtzFnZMOPymOQFPZDOkYBXXroaX6yjkm/BPVn1V0mXTuMbO4BxgycOfzLvaBZ98PdQb6QNsUGqTv2WAUBboIo7LPaOUplezTZyX9bK1Svzz1uWUi1P60544rhjDMYsTTSex8j3CNIU1QkH4UQFHf/uZ5+UeSJnB1Ve6NVifNATItCxwfgNdn2y8c4HAk3RtN93pAB2W5/vu88ufuqXVTFwGKWX5XL4f9DRXAbF85HdJ0/n6D1zgvz1K1rUL+HV6CYiuX1YNkbxNHRbMnXNMZ9jWAyK22BwAC6cda4xtXlueVSeigZcqawLNJPuw8TpQenp/Ixnk1hZc6MSFl3m1b6YubRAJ20i9F77JNMOJVn5iBfmTby1u+QLC6Us2cADh6lGus09FPcyQhAzLAcyeLBtTgrIrTeVCZVWsotgYuLyMUMKTQAJ9OCFEhmQNElOE6tbtHxhJDwSgs3V/IR32tv2fuaJm1iXnrPBaLmWlSUcTUDCz1VHdFbhYauHVHZiHVIiD+LAgdwuhvzBmXgnDrUNSW3ByYiYxpJXmg9B6UlW0utbWXeuie7+LxyZUGh9suXmxJeo8Z41nKpBU4KCMzN5Qm5rcitVf9gCjVbWpyGcK/bWP84AbKTQmENPev1Sg+E5J1Z/04XrO1p6ydj0/IS4roIlhhVw9NJhCQohjt85chhAOO8aCqHgNXROF0Q4enxVx68i5gppqnKPEpEutasfaCVsZS/QH1Sn+sG1tRmhMbYG8+XUl890cpn1MKmXc99V0umYwklvb5CHu+Hyvbwg7OklLL+G5Q7ZXQ1QsR+EdUcxqI1o+YWQ6ZrMGWkGt2yT02K4RRlS7jiC3cx7JDmI519iGgG16McEkwwQbtdyZGSxg== 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:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR10MB3193 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU2PEPF00028D11.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: dd1d4a0a-9dc0-42df-3da9-08dd0e27ca30 X-Microsoft-Antispam: BCL:0; ARA:13230040|35042699022|376014|82310400026|1800799024|14060799003|36860700013; X-Microsoft-Antispam-Message-Info: GNdguD0EAHxM9TlKNhC4A6ji++IWk2g29dqynmTbFKiEe6kgMps58DKQE+yZA9kPkWHdQb/bHNO0QxstglxazPAvXTs5KC75PBiiWUVRyj6Sx40K3qGQFIK2l8QTE5OM4TCEwfrsPmRb+/114YLXv6sH4LVE9D0BdQiv74usNBEl1oAmNeLPpzS9OZSsnczeLXGouLTAdyxmWqVlir8ICkvI0Xw+dtqjePGeIKMThXmmRf9BhKul8BzU+SjdNOF5ZVPcdBeYGCrxhCTnwiZBsefrjHwPokozwDw7xYPWxmu763v/00X4ivDz8G4EN/gnO/nP/lCf2Q5J390+npSx0y/g4gTG0KNwA5LJqkQGwxrJbmFXac4Ck1bgdnid3IiRWRTewyOfoIQ9tVUkAuQh9RbZmwtDTtAlqMM9A5CbL4MMoem7gGuNO1svBHAJSF6kmDohPStGq+B5yc8oSf/Oz5I1pEouKtVYmunwYaoZRNSk82ePY/nDjPqgJFCyVyUwQ0M91qJkiXvoKQKl0hvaAK45D2vR2/9TTrqh47Qv2SC2IUVFDc2MGvCi8E81j4EAaqjc85fyvLSIoRYeYqtSP4cOC1fFaEBKM2aj1FNea4EP7IMLb+KUdtMRoi2JcwODE7F47XRepxnGNYc8uDCgfZ3Ef48ZQ9tzMFBdHaiJQcrDC+zcP0Q4x99s0xeBbWRrvS7On05ALZcFU2cgowMdYJxalvHqBitHxMAR86w9P9R5z9NTZiTyp7dlTFbpDRhKHXcM7bJVhwVWaV8lfCa5F8d2pEgKohiN1DtfuEI2+cAmV0nf9/tOxyvuvQYojqMVU+BN5I6TP1FMwv48vcvJy0sNvAsom6Ghk3m0MyREK1kVsORBpPunJ/OdGHrskq8LFLAXvw3uptX1E7yBy8ppZCljPoULXFWi56BbSawys6p9vRno0ZFGBZvv8G34WxyiUybLGrcvvO4ZJCG0zjh/Gdnvi6etrBlZJGzuUaapT2tWynIGr4J/62stmQ24MDE+7SLSMSiWrrzS3xW9IpflUrZ6GuU4Io9Y3y1DsM9yMDdef9DIEJpfssKi/vWVUyMnv6nQxmWcFzfqNjWkHT3+cADoC5pqzR6llHQR+3iew4KsJsGcL0b+seMFKcw60dWdco5MFxELVgfaJByR8yP9i5gkD06y3vvioCRB7gnCffNM/J89w8dvPVx4K33aRF+VUQ0YdXkrA0Rd1xcH/66JGktGvyrsPq1jh0vWA9k3d3Wi1PLD4rnOUiYNjwNJ0MJ3SW7Zj0ZII/e5Gp7uGCSTl3OpCHidy4ACvpkZyYgD5oVSqilyN+I9fTk/+Zsgdef+AWA7YOuQOfL1vPBFbom86Ej3F4wgyBJJzQ3HOnpIYBO4bBVNRksQHnzG+S6bAJLUlSGJQ9fhE9tw8LFL6qhLM/JMEYYwNCLQDHNERqiuVwgR01CWNpZJItPPrCTMPZER 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:(13230040)(35042699022)(376014)(82310400026)(1800799024)(14060799003)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: stackit.cloud X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2024 14:37:06.6653 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90376631-25b2-49f3-27a0-08dd0e27cdf0 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: DU2PEPF00028D11.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR10MB8265 Subject: [ovs-dev] [PATCH v2 2/6] netlink-notifier: Support network namespaces. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 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" Extend network namespace support also to the netlink-notifier. This is needed on the OVN side for watching routes. Signed-off-by: Felix Huettner --- lib/netlink-notifier.c | 10 +++++++--- lib/netlink-notifier.h | 8 ++++++-- lib/netlink-socket.c | 2 +- lib/netlink-socket.h | 1 + lib/route-table.c | 10 ++++++---- lib/rtnetlink.c | 5 +++-- tests/test-netlink-conntrack.c | 4 ++-- 7 files changed, 26 insertions(+), 14 deletions(-) diff --git a/lib/netlink-notifier.c b/lib/netlink-notifier.c index 7ea5a4181..c8397ec73 100644 --- a/lib/netlink-notifier.c +++ b/lib/netlink-notifier.c @@ -38,6 +38,7 @@ struct nln { bool has_run; /* Guard for run and wait functions. */ /* Passed in by nln_create(). */ + char *netns; /* The network namespace. */ int protocol; /* Protocol passed to nl_sock_create(). */ nln_parse_func *parse; /* Message parsing function. */ void *change; /* Change passed to parse. */ @@ -58,12 +59,14 @@ struct nln_notifier { * Incoming messages will be parsed with 'parse' which will be passed 'change' * as an argument. */ struct nln * -nln_create(int protocol, nln_parse_func *parse, void *change) +nln_create(const char *netns, int protocol, nln_parse_func *parse, + void *change) { struct nln *nln; nln = xzalloc(sizeof *nln); nln->notify_sock = NULL; + nln->netns = nullable_xstrdup(netns); nln->protocol = protocol; nln->parse = parse; nln->change = change; @@ -84,6 +87,7 @@ nln_destroy(struct nln *nln) if (nln) { ovs_assert(ovs_list_is_empty(&nln->all_notifiers)); nl_sock_destroy(nln->notify_sock); + free(nln->netns); free(nln); } } @@ -106,7 +110,7 @@ nln_notifier_create(struct nln *nln, int multicast_group, nln_notify_func *cb, if (!nln->notify_sock) { struct nl_sock *sock; - error = nl_sock_create(nln->protocol, &sock); + error = nl_sock_ns_create(nln->netns, nln->protocol, &sock); if (error) { VLOG_WARN("could not create netlink socket: %s", ovs_strerror(error)); @@ -187,7 +191,7 @@ nln_run(struct nln *nln) ofpbuf_use_stub(&buf, buf_stub, sizeof buf_stub); error = nl_sock_recv(nln->notify_sock, &buf, NULL, false); if (!error) { - int group = nln->parse(&buf, nln->change); + int group = nln->parse(&buf, nln->change, nln->netns); if (group != 0) { nln_report(nln, nln->change, group); diff --git a/lib/netlink-notifier.h b/lib/netlink-notifier.h index dd0c183de..9ac602323 100644 --- a/lib/netlink-notifier.h +++ b/lib/netlink-notifier.h @@ -37,11 +37,15 @@ typedef void nln_notify_func(const void *change, void *aux); /* Function called to parse incoming nln notifications. The 'buf' message * should be parsed into 'change' as specified in nln_create(). + * If the nln is running in a network namespaces this information is passed as + * the parameter netns. Otherwise it is NULL. * Returns the multicast_group the change belongs to, or 0 for a parse error. */ -typedef int nln_parse_func(struct ofpbuf *buf, void *change); +typedef int nln_parse_func(struct ofpbuf *buf, void *change, + const char *netns); -struct nln *nln_create(int protocol, nln_parse_func *, void *change); +struct nln *nln_create(const char *netns, int protocol, + nln_parse_func *, void *change); void nln_destroy(struct nln *); struct nln_notifier *nln_notifier_create(struct nln *, int multicast_group, nln_notify_func *, void *aux); diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c index 56d29faf5..3fb0a2c70 100644 --- a/lib/netlink-socket.c +++ b/lib/netlink-socket.c @@ -1749,7 +1749,7 @@ static struct ovs_mutex pool_mutex = OVS_MUTEX_INITIALIZER; static struct shash pools OVS_GUARDED_BY(pool_mutex) = SHASH_INITIALIZER(&pools); -static int +int nl_sock_ns_create(const char *netns, int protocol, struct nl_sock **sockp) { #ifndef __linux__ if (netns) { diff --git a/lib/netlink-socket.h b/lib/netlink-socket.h index fb53284a6..f440af5d1 100644 --- a/lib/netlink-socket.h +++ b/lib/netlink-socket.h @@ -207,6 +207,7 @@ struct nl_sock; /* Netlink sockets. */ int nl_sock_create(int protocol, struct nl_sock **); +int nl_sock_ns_create(const char *netns, int protocol, struct nl_sock **sockp); int nl_sock_clone(const struct nl_sock *, struct nl_sock **); void nl_sock_destroy(struct nl_sock *); diff --git a/lib/route-table.c b/lib/route-table.c index bce29ebb2..270ad489a 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -85,7 +85,8 @@ static bool route_table_valid = false; static void route_table_reset(void); static void route_table_handle_msg(const struct route_table_msg *); -static int route_table_parse(struct ofpbuf *, void *change); +static int route_table_parse_ns(struct ofpbuf *, void *change, + const char *netns); static void route_table_change(const struct route_table_msg *, void *); static void route_map_clear(void); @@ -110,7 +111,7 @@ route_table_init(void) ovs_assert(!route6_notifier); ovs_router_init(); - nln = nln_create(NETLINK_ROUTE, route_table_parse, &rtmsg); + nln = nln_create(NULL, NETLINK_ROUTE, route_table_parse_ns, &rtmsg); route_notifier = nln_notifier_create(nln, RTNLGRP_IPV4_ROUTE, @@ -179,7 +180,7 @@ route_table_dump_one_table(const char *netns, unsigned char id) while (nl_dump_next(&dump, &reply, &buf)) { struct route_table_msg msg; - if (route_table_parse(&reply, &msg)) { + if (route_table_parse_ns(&reply, &msg, netns)) { struct nlmsghdr *nlmsghdr = nl_msg_nlmsghdr(&reply); /* Older kernels do not support filtering. */ @@ -222,7 +223,8 @@ route_table_reset(void) /* Return RTNLGRP_IPV4_ROUTE or RTNLGRP_IPV6_ROUTE on success, 0 on parse * error. */ static int -route_table_parse(struct ofpbuf *buf, void *change_) +route_table_parse_ns(struct ofpbuf *buf, void *change_, + const char *netns OVS_UNUSED) { struct route_table_msg *change = change_; bool parsed, ipv4 = false; diff --git a/lib/rtnetlink.c b/lib/rtnetlink.c index 37078d00e..9191032a0 100644 --- a/lib/rtnetlink.c +++ b/lib/rtnetlink.c @@ -190,7 +190,8 @@ rtnetlink_parse(struct ofpbuf *buf, struct rtnetlink_change *change) /* Return RTNLGRP_LINK on success, 0 on parse error. */ static int -rtnetlink_parse_cb(struct ofpbuf *buf, void *change) +rtnetlink_parse_cb(struct ofpbuf *buf, void *change, + const char *netns OVS_UNUSED) { return rtnetlink_parse(buf, change) ? RTNLGRP_LINK : 0; } @@ -210,7 +211,7 @@ struct nln_notifier * rtnetlink_notifier_create(rtnetlink_notify_func *cb, void *aux) { if (!nln) { - nln = nln_create(NETLINK_ROUTE, rtnetlink_parse_cb, &rtn_change); + nln = nln_create(NULL, NETLINK_ROUTE, rtnetlink_parse_cb, &rtn_change); } return nln_notifier_create(nln, RTNLGRP_LINK, (nln_notify_func *) cb, aux); diff --git a/tests/test-netlink-conntrack.c b/tests/test-netlink-conntrack.c index 2a62615b2..160909bf2 100644 --- a/tests/test-netlink-conntrack.c +++ b/tests/test-netlink-conntrack.c @@ -32,7 +32,7 @@ struct test_change { }; static int -event_parse(struct ofpbuf *buf, void *change_) +event_parse(struct ofpbuf *buf, void *change_, const char *netns OVS_UNUSED) { struct test_change *change = change_; @@ -80,7 +80,7 @@ test_nl_ct_monitor(struct ovs_cmdl_context *ctx OVS_UNUSED) unsigned i; - nln = nln_create(NETLINK_NETFILTER, event_parse, &change); + nln = nln_create(NULL, NETLINK_NETFILTER, event_parse, &change); for (i = 0; i < ARRAY_SIZE(groups); i++) { notifiers[i] = nln_notifier_create(nln, groups[i], event_print, NULL); From patchwork Tue Nov 26 14:37:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Huettner X-Patchwork-Id: 2015467 X-Patchwork-Delegate: echaudro@redhat.com 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=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=uJjBWfLW; dkim=fail reason="signature verification failed" (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=uJjBWfLW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::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 4XyQCD2F5rz1yQY for ; Wed, 27 Nov 2024 01:37:28 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 7BA0E6F6DA; Tue, 26 Nov 2024 14:37:26 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id oDrtknKMuzcS; Tue, 26 Nov 2024 14:37:25 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org F0E1F6F751 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=uJjBWfLW; dkim=fail reason="signature verification failed" (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=uJjBWfLW Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id F0E1F6F751; Tue, 26 Nov 2024 14:37:24 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 46395C08B9; Tue, 26 Nov 2024 14:37:24 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 20310C08BC for ; Tue, 26 Nov 2024 14:37:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 057A24349C for ; Tue, 26 Nov 2024 14:37:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id XqBnSy_WFITl for ; Tue, 26 Nov 2024 14:37:18 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a01:111:f403:260c::608; helo=eur03-vi1-obe.outbound.protection.outlook.com; envelope-from=felix.huettner@stackit.cloud; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 72913434C1 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=reject dis=none) header.from=stackit.cloud DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 72913434C1 Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=uJjBWfLW; dkim=pass (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=uJjBWfLW Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on20608.outbound.protection.outlook.com [IPv6:2a01:111:f403:260c::608]) by smtp2.osuosl.org (Postfix) with ESMTPS id 72913434C1 for ; Tue, 26 Nov 2024 14:37:17 +0000 (UTC) ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=LBlYTUqRUR/yytO7WIi7kxrwZCR2T4PV/HVqbPphgKvD7GJOjCKD+R3e+EC6GSrWWm0Il2zNBYnoJcRZwxOVtmy+5UgAA5ZAjSVUvPPdEY61RP4pkl20MalU0lfTnyelSNCp9TMXFnfIafhqbR4uw42+UV3SDgWVbIIiVHD9RXvuYWSCx0owfqak71EnwM4iNpg1NPuwIM2mTEJTcJfD0IFM0p07wSLI3y6IQthFGS4IclgLGNirhBrINAwh7SXUSYiIJyk2ltsg5PoSV9N5M45A86W26EzqHjcNf9iouYTx211rEssqrFd6LO+z1GyIoVLLH/oTjBSWTWcXxUy5Ew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ZlNyVNYrCS7Bm/hmm78KOdUUYQbRpHyEUlet89h28sw=; b=gIItHY32IEg0G/JH5qjxCU//qmbRm8XSQ5n9go4TVCEuSEix630NV0GOCqreKQ031BK+mfhDyklx4XA3xu/drghNbR4MaKB+4kfg5PAWMIT2PZ8wdZgeQOJ23gWuLrWRLW0oAyaYzoFtxiCeoT9Fkuagv+SyHieAGq3JCtSHECCLPbQWsRaPi+cjddHwDdA7q+qUKE5A0y1jpnSLIUQuVHidpx+8ROyd8DTMjC7HGHe7b5ZM9RqRFhGaDbb818FA5h3Vxt897nD2ZtnGTO8Dn06VkRBQyWePzdup1PYU6SaOkRGucYiI4+f0FAXqOv43psCk/lkwvq0IShYiYXlbuQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=fail (sender ip is 104.40.229.156) smtp.rcpttodomain=openvswitch.org smtp.mailfrom=stackit.cloud; dmarc=pass (p=reject sp=none pct=100) action=none header.from=stackit.cloud; dkim=pass (signature was verified) header.d=stackit.cloud; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=stackit.cloud] dkim=[1,1,header.d=stackit.cloud] dmarc=[1,1,header.from=stackit.cloud]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackit.cloud; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZlNyVNYrCS7Bm/hmm78KOdUUYQbRpHyEUlet89h28sw=; b=uJjBWfLWzR4G4LDUbJDeK3qukI3rX1mwWgYfL8YL8z4+n75jTFVjOk2rH61tu2PDCW0OeuANxvnQHHE08DLAnz5/1H6EBugL5BmHlRLUKP9z5FrE6RVQiMKWBfAwI9zBljFLFm+LeFm61xIpbaHBWovgJW3KnfGV2OW9gw0qqTqZ/ykDtWrqNOYcg5HYY8JmYbpciHu9I5x5H1emoAWZXHxIYlSfjTdnWM4D45P41JoO6nohJkWq6FYTbvMWPjLFsA4H28wXM0VhleVyBTHSPbmZ/8EzQ2ZzHqh1aoc1CDdw8Wbj02OHyLgAgJ0cYeAAR9A04/BqvrApr8o6W0nFtA== Received: from DU2PR04CA0007.eurprd04.prod.outlook.com (2603:10a6:10:3b::12) by AM7PR10MB3687.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:135::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12; Tue, 26 Nov 2024 14:37:11 +0000 Received: from DU2PEPF00028D07.eurprd03.prod.outlook.com (2603:10a6:10:3b:cafe::9) by DU2PR04CA0007.outlook.office365.com (2603:10a6:10:3b::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Tue, 26 Nov 2024 14:37:11 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 104.40.229.156) smtp.mailfrom=stackit.cloud; dkim=pass (signature was verified) header.d=stackit.cloud;dmarc=pass action=none header.from=stackit.cloud; Received-SPF: Fail (protection.outlook.com: domain of stackit.cloud does not designate 104.40.229.156 as permitted sender) receiver=protection.outlook.com; client-ip=104.40.229.156; helo=eu1.smtp.exclaimer.net; Received: from eu1.smtp.exclaimer.net (104.40.229.156) by DU2PEPF00028D07.mail.protection.outlook.com (10.167.242.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Tue, 26 Nov 2024 14:37:09 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (104.47.17.112) by eu1.smtp.exclaimer.net (104.40.229.156) with Exclaimer Signature Manager ESMTP Proxy eu1.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_DIFFIEHELLMAN_WITH_AES256_NONE); Tue, 26 Nov 2024 14:37:09 +0000 X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 8302000 X-ExclaimerImprintLatency: 5166027 X-ExclaimerImprintAction: 85bdf06061474e40b77b314f4e2f9b5c ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KqhlBrY0lCXXIwm3WODb6zv60lomJn2xxCWyqkv72DE0YGLjBHiEgSfCZlkhgpDvjzkoi/4/RynoHA1VyjrJ9uZna8yV/FrETXdI2agLqtmQxTH8Q5oy9sMRJQBExkOk9F3Loc1NaXlEmyeJ0QMY3vMsbTEa9as9WkYth/4LEB7a9qFQXk9AEnVcGHCy40d1fKmjzPFiemjfKappZmj1t2j7lUXPJTn0knno3Nj/79qlCcpdqoYGR+P7DbHv1y476MDN8TCSBSZ0k8YZy7JjtQgiljlYtx5XIAmwCAj8pSNuFw+PIsf7qdJBR9/hxjIuNJjVgaivepidhdbfbIbIIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ZlNyVNYrCS7Bm/hmm78KOdUUYQbRpHyEUlet89h28sw=; b=laFVTsoQqviB+7/5KU3GPj0Sajl6e3zyfHE/HVW7Oa6bUVCKKeWb0qiMoOFRcR+rZYReNLXdqQ/kMwbx3Dh7eE3GYhaMjQyjXzpHuRz3nbpiN1vbEU8y3oAGonuf3eLATa53vqQWe/Vs/FXhon5IQ5N0eCaryRJ/4AWb1rRZ8ug7X/lIbIycF/QEm3PesHzrjv7kUdB/wEErx07VsSCOA3I9wkPmBLF5u0d/1mgQUNlWcuw+4yQI9LBgKCQsxr+5Io+FN0p+CVqD64b4EsVF5ZG9U6wyD84iOPEuCUUVMW6fzhXvRZb7uPINu+UesOMnDbg27u6FTNGFqEpdO0d7LQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stackit.cloud; dmarc=pass action=none header.from=stackit.cloud; dkim=pass header.d=stackit.cloud; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackit.cloud; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZlNyVNYrCS7Bm/hmm78KOdUUYQbRpHyEUlet89h28sw=; b=uJjBWfLWzR4G4LDUbJDeK3qukI3rX1mwWgYfL8YL8z4+n75jTFVjOk2rH61tu2PDCW0OeuANxvnQHHE08DLAnz5/1H6EBugL5BmHlRLUKP9z5FrE6RVQiMKWBfAwI9zBljFLFm+LeFm61xIpbaHBWovgJW3KnfGV2OW9gw0qqTqZ/ykDtWrqNOYcg5HYY8JmYbpciHu9I5x5H1emoAWZXHxIYlSfjTdnWM4D45P41JoO6nohJkWq6FYTbvMWPjLFsA4H28wXM0VhleVyBTHSPbmZ/8EzQ2ZzHqh1aoc1CDdw8Wbj02OHyLgAgJ0cYeAAR9A04/BqvrApr8o6W0nFtA== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=stackit.cloud; Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) by DB8PR10MB3193.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:114::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12; Tue, 26 Nov 2024 14:37:03 +0000 Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::f00d:feeb:e45e:54f8]) by PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::f00d:feeb:e45e:54f8%4]) with mapi id 15.20.8207.010; Tue, 26 Nov 2024 14:37:03 +0000 Date: Tue, 26 Nov 2024 15:37:01 +0100 To: dev@openvswitch.org Message-ID: <070caa7d1c655e3603e8a7f258a868b4bd22aa77.1732630344.git.felix.huettner@stackit.cloud> Mail-Followup-To: dev@openvswitch.org References: Content-Disposition: inline In-Reply-To: X-please-dont-add-a-signature: thanks X-ClientProxiedBy: FR3P281CA0109.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::9) To PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAVPR10MB6914:EE_|DB8PR10MB3193:EE_|DU2PEPF00028D07:EE_|AM7PR10MB3687:EE_ X-MS-Office365-Filtering-Correlation-Id: 56380127-94b3-4cc9-71b7-08dd0e27cf3f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info-Original: B5itVYajS4a0+Gx7Q1jweL2sHkSz7Ym9t6d6n5v9cXor44/CtX2w6CszjZu1Z82V3fv0KuiwS1RzhBg1XoZrT40IHMBoAEcDQEjINAgyf3wosdLrxUILIyZHs3YRY+LycIcdEXWR0/iGFJ/BL6ICY36xmGA5UsNE4dBirh7jyc/OuPigd6gOIcQ8d1WeeR8sO+YWZwODb7iu2pchc0DfJ7vhqJMIIOJCok6Vvaywe0WcGcKUdxJukHfDpRzboaQXMtkh1gDVFelXI/vaB/qP8FV6E3H65AxJq+cqCQEILT84mlRDnXX7/2Bcbw+cS0Moe0rIw9CoQa51bZigsihom6d3L3nv6g5Ej8Q84XsfoowInjTCvqUneJxxhMzO4w5wy56A1idZqOdzRyl1LyKZ0FFcj4NXW5cBv17Q+Z4nyrG9z+bFRtiKcRDqNA7sCw+YBbL7/e/elrFpLcejb9bfdDHoZOTyq3vPAo6XFcEdnaaSqmdeAIjUhXuqoUA+Enu0rksIC+DydxR6qLsJtbL8ISYqKRy5kDulZUpEj0Z01tKx65zOMyP/mbLH7p7og++7O+2TK344UbHHMeEuptTcSSYr/d6awtswqUne7EVf23foZZ+1t80ygyM49ViksIblo+oC57DTvG+nVsBN4/hGhvs+nqPEylrjvxrSRIvR7ozNbF096xbWVrYqmnndnFFfmDpjz1SnhAeIJ1tTNviyCZWclUCXqIe+uEyiVUxjR9HUyfWsexOhjjWDrIz3qRreOcDar0TLNcUbNo3bTj1LmGdk4pqs46XDZbg/MECSTEsxTXLyoeQHe95ryLIO7Alr1oFXWbJ/EOLFJlXWnKy1VpFlp3NQnSTHPCod3MQIg947c9kW5eZXjzYxyv+UVNDAmCsFnaxXhwCkyrxILv966YezKGjWB5funrPlNdQt9zjZHcwpuK1TDT6JuZ8PveGvAeOni91/7HPdVQF06f9Y5RkX3l7Z+Esz4Eps6hrUi2fM2iIZkIvcutrqYNfWu8q8VL5rifyPL2Vcte+otzBdxgRbBX4ULN19Ngd2GqEv/RMDmoBoBeGMKAUzukjvZuFY89y3VpM3K2AhRo0MEZA5X/hSTFhTNYKUCt1wcnYM0TmxLJZIyuxEkw/Vz5mTqemtVfA8YIhf4uE6bCRXmbelzXfMJKqLJbKBvQtyZt7afCTF50SxtLx+Xnf18HBOZhPbaiQIKGt0t/+OEQLbH6QlBRsfn6Xrbbd2MlFC2p/GS0FxU4aEdkWxg6cLXxR2e0rEm3Qo2TxoCe1TmTb7jb2cRtQF0VgI1KGeabcLAF0q7rJcwjyBj9q4EdQysJCMcOXWQunT5pJUlDphBLYlMknEeg== 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:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR10MB3193 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU2PEPF00028D07.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: b33b48fa-a6de-4718-1bf3-08dd0e27cb29 X-Microsoft-Antispam: BCL:0; ARA:13230040|14060799003|1800799024|36860700013|376014|35042699022|82310400026; X-Microsoft-Antispam-Message-Info: gsjcE2IK33NIrqvuIfDzVMn6EiImnZVP6z/igvtQ887e5C2LMfLOYRkmLqM/SsOHcFvRPPlF59wp+Fm5G2z5NFyz783BfnYWiJP0JpJ2vTF0pIRBlbuvfSwzvhdxmEBfWEcdXGfCM1+LGx8acAmBlAS95/61kRHZpp7qLpbAuf8FdqNAkfcdTNcEOclTZFTIpL/UrRZbkhdZ+2NRjaEk5AQKdGsS2Jp97s9xY9aQWglsNl1fOn2+tF/HL4FDLWodwjyi0tQy6xPuUOSZnjFSKKPPkdfXNpBspgfT+uRcpHSlFZFCkmmiiU5cShuPCakW4QAV7KfJvKuafIrdOeRPjuzp+wE3/glW2IZiVK0DR/5fvZGt4c8Ufhj5GvayIyCU3LlVLB4h7rS0ni3MiRbWp8hNO9LFe7qThPk/EuJUr1Y1ilY4J3L9j5ftwG2du+IW5olzcI3OGi8qzHCnZ9+IxmJae0E+12su31TPqIh8PlVQnh0Ljy+7DmH45IsJpj6jfsQZsEZJ/zttSihrQ/MBJXqyWhINN98K7cC5w7Ak3yTEJUzLp24MJ/DAIXhH44pUiFEarvvF61kVeyp6iXh4umLtEvRKDdV5dWFH4hh3b81ojsJzBvhhzRMCYcX4U9fYbAlYuxUWyx23+qIr5NwIbGF19nLmqZwYEaJaiTzAwyJ3BvbxLpSlqczwQoUVI/uuAxhb4AG4aFhlamT6MAFXEvS1IB2DFOi0A5zd6xo1PB7kS1Wgwx7LrykqH15a4kssISGCK9IDUTPfsXdSjOZcMZzS4ht0ZZxdbKFhRAnzY+8ygPDo7cCUWE8HM0pWFMa6xs6zpx6ASLEmnW+bs+JUoFdmx2Alba51xmvMseUkY8TtDwZejkIMBZnRQnkS1zGcjAAaFEBMKbJnZOkneUK5uCguIitQbKrT/84Kfa15dfIm/lwdzGRxmlSWURp5uC3uPpUqzhGXowmCGPeLFXVnKMvBrziB/TCG87eIYZjY2iN9w+Fpa7YitmMkIpILcel0FpWA1fDkpc6jA+vxPfjwHaHIZYuG/4zxc6Wo5UfBHDXhhec/efmGODwOvQm6P2yjwO0m+oJilojPWX5jGZEn3t8fE97jIqRlh7qniZPPb8mt/6hvWiVb51eUMvGjJ4Vcna4xKqcyrTLnOImRPz0PaWYRK/3U2wVvfccV06FK1dVSmskTwteAk029wz+pUmItuFDkLxa0ooeIITF8oAR3480i5gkUAbdvTpjqtDHwMkj1aFqt65l/ehQXxkQTOWMnftbL1A76YmJtnmvLgMxZhyAUJb+4Zu6xNdllc3vOENNEWQR0Gt8R7Bk5L+XMdsNG6iuJvXqdMGd29jbuXp9wjI7lRRy9LIy6LI2kgJTWiBd+EruX6Ic9gNW144cbhfORPCz2USoLl9ra/7l/9bgIL0u3DWz8b+bDWOIrpDMQ+UIKYdtWoneyiOvg3jWVcV0E 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:(13230040)(14060799003)(1800799024)(36860700013)(376014)(35042699022)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: stackit.cloud X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2024 14:37:09.4095 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 56380127-94b3-4cc9-71b7-08dd0e27cf3f 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: DU2PEPF00028D07.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR10MB3687 Subject: [ovs-dev] [PATCH v2 3/6] route-table: Expose data to ovn. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 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 data generated in route-table was not exposed to OVN. This is now changed and we expose a few additional fields we get from the kernel. Signed-off-by: Felix Huettner --- lib/route-table.c | 52 +++++++++++++++++++++-------------------------- lib/route-table.h | 31 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 29 deletions(-) diff --git a/lib/route-table.c b/lib/route-table.c index 270ad489a..d7d86f9ae 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -47,27 +47,6 @@ VLOG_DEFINE_THIS_MODULE(route_table); COVERAGE_DEFINE(route_table_dump); -struct route_data { - /* Copied from struct rtmsg. */ - unsigned char rtm_dst_len; - bool local; - - /* Extracted from Netlink attributes. */ - struct in6_addr rta_dst; /* 0 if missing. */ - struct in6_addr rta_prefsrc; /* 0 if missing. */ - struct in6_addr rta_gw; - char ifname[IFNAMSIZ]; /* Interface name. */ - uint32_t mark; -}; - -/* A digested version of a route message sent down by the kernel to indicate - * that a route has changed. */ -struct route_table_msg { - bool relevant; /* Should this message be processed? */ - int nlmsg_type; /* e.g. RTM_NEWROUTE, RTM_DELROUTE. */ - struct route_data rd; /* Data parsed from this message. */ -}; - static struct ovs_mutex route_table_mutex = OVS_MUTEX_INITIALIZER; static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20); @@ -84,7 +63,8 @@ static struct nln_notifier *name_notifier = NULL; static bool route_table_valid = false; static void route_table_reset(void); -static void route_table_handle_msg(const struct route_table_msg *); +static void route_table_handle_msg(const struct route_table_msg *, + void *); static int route_table_parse_ns(struct ofpbuf *, void *change, const char *netns); static void route_table_change(const struct route_table_msg *, void *); @@ -156,8 +136,9 @@ route_table_wait(void) ovs_mutex_unlock(&route_table_mutex); } -static bool -route_table_dump_one_table(const char *netns, unsigned char id) +bool +route_table_dump_one_table(char *netns, uint32_t id, + route_table_dump_callback_t handle_msg, void *data) { uint64_t reply_stub[NL_DUMP_BUFSIZE / 8]; struct ofpbuf request, reply, buf; @@ -171,7 +152,9 @@ route_table_dump_one_table(const char *netns, unsigned char id) rq_msg = ofpbuf_put_zeros(&request, sizeof *rq_msg); rq_msg->rtm_family = AF_UNSPEC; - rq_msg->rtm_table = id; + rq_msg->rtm_table = RT_TABLE_UNSPEC; + + nl_msg_put_u32(&request, RTA_TABLE, id); nl_ns_dump_start(netns, &dump, NETLINK_ROUTE, &request); ofpbuf_uninit(&request); @@ -187,7 +170,7 @@ route_table_dump_one_table(const char *netns, unsigned char id) if (!(nlmsghdr->nlmsg_flags & NLM_F_DUMP_FILTERED)) { filtered = false; } - route_table_handle_msg(&msg); + (*handle_msg)(&msg, data); } } ofpbuf_uninit(&buf); @@ -213,7 +196,9 @@ route_table_reset(void) COVERAGE_INC(route_table_dump); for (size_t i = 0; i < ARRAY_SIZE(tables); i++) { - if (!route_table_dump_one_table(NULL, tables[i])) { + if (!route_table_dump_one_table(NULL, tables[i], + route_table_handle_msg, + NULL)) { /* Got unfiltered reply, no need to dump further. */ break; } @@ -236,6 +221,7 @@ route_table_parse_ns(struct ofpbuf *buf, void *change_, [RTA_MARK] = { .type = NL_A_U32, .optional = true }, [RTA_PREFSRC] = { .type = NL_A_U32, .optional = true }, [RTA_TABLE] = { .type = NL_A_U32, .optional = true }, + [RTA_PRIORITY] = { .type = NL_A_U32, .optional = true }, }; static const struct nl_policy policy6[] = { @@ -245,6 +231,7 @@ route_table_parse_ns(struct ofpbuf *buf, void *change_, [RTA_GATEWAY] = { .type = NL_A_IPV6, .optional = true }, [RTA_PREFSRC] = { .type = NL_A_IPV6, .optional = true }, [RTA_TABLE] = { .type = NL_A_U32, .optional = true }, + [RTA_PRIORITY] = { .type = NL_A_U32, .optional = true }, }; struct nlattr *attrs[ARRAY_SIZE(policy)]; @@ -293,11 +280,14 @@ route_table_parse_ns(struct ofpbuf *buf, void *change_, && table_id != RT_TABLE_MAIN && table_id != RT_TABLE_LOCAL) { change->relevant = false; - } + } + change->rd.rta_table_id = table_id; change->nlmsg_type = nlmsg->nlmsg_type; change->rd.rtm_dst_len = rtm->rtm_dst_len + (ipv4 ? 96 : 0); change->rd.local = rtm->rtm_type == RTN_LOCAL; + change->rd.plen = rtm->rtm_dst_len; + change->rd.rtm_protocol = rtm->rtm_protocol; if (attrs[RTA_OIF]) { rta_oif = nl_attr_get_u32(attrs[RTA_OIF]); @@ -347,6 +337,9 @@ route_table_parse_ns(struct ofpbuf *buf, void *change_, if (attrs[RTA_MARK]) { change->rd.mark = nl_attr_get_u32(attrs[RTA_MARK]); } + if (attrs[RTA_PRIORITY]) { + change->rd.rta_priority = nl_attr_get_u32(attrs[RTA_PRIORITY]); + } } else { VLOG_DBG_RL(&rl, "received unparseable rtnetlink route message"); return 0; @@ -366,7 +359,8 @@ route_table_change(const struct route_table_msg *change OVS_UNUSED, } static void -route_table_handle_msg(const struct route_table_msg *change) +route_table_handle_msg(const struct route_table_msg *change, + void *data OVS_UNUSED) { if (change->relevant && change->nlmsg_type == RTM_NEWROUTE) { const struct route_data *rd = &change->rd; diff --git a/lib/route-table.h b/lib/route-table.h index 3a02d737a..b3d2a8741 100644 --- a/lib/route-table.h +++ b/lib/route-table.h @@ -26,6 +26,31 @@ #include "openvswitch/types.h" +struct route_data { + /* Copied from struct rtmsg. */ + unsigned char rtm_dst_len; + bool local; + + /* Extracted from Netlink attributes. */ + struct in6_addr rta_dst; /* 0 if missing. */ + struct in6_addr rta_prefsrc; /* 0 if missing. */ + struct in6_addr rta_gw; + char ifname[IFNAMSIZ]; /* Interface name. */ + uint32_t mark; + uint32_t rta_table_id; /* 0 if missing. */ + unsigned char plen; + unsigned char rtm_protocol; + uint32_t rta_priority; +}; + +/* A digested version of a route message sent down by the kernel to indicate + * that a route has changed. */ +struct route_table_msg { + bool relevant; /* Should this message be processed? */ + int nlmsg_type; /* e.g. RTM_NEWROUTE, RTM_DELROUTE. */ + struct route_data rd; /* Data parsed from this message. */ +}; + uint64_t route_table_get_change_seq(void); void route_table_init(void); void route_table_run(void); @@ -33,4 +58,10 @@ void route_table_wait(void); bool route_table_fallback_lookup(const struct in6_addr *ip6_dst, char name[], struct in6_addr *gw6); + +typedef void (route_table_dump_callback_t)(const struct route_table_msg *msg, + void *data); +bool route_table_dump_one_table(char *netns, uint32_t id, + route_table_dump_callback_t handle_msg, + void *data); #endif /* route-table.h */ From patchwork Tue Nov 26 14:37:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Huettner X-Patchwork-Id: 2015468 X-Patchwork-Delegate: echaudro@redhat.com 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=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=mLrfK4td; dkim=fail reason="signature verification failed" (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=mLrfK4td; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (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 4XyQCD3bQdz1yQb for ; Wed, 27 Nov 2024 01:37:28 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 741B9434C9; Tue, 26 Nov 2024 14:37:25 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id AG1qKCGs_Evr; Tue, 26 Nov 2024 14:37:23 +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 smtp2.osuosl.org 387614349C Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=mLrfK4td; dkim=fail reason="signature verification failed" (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=mLrfK4td Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 387614349C; Tue, 26 Nov 2024 14:37:23 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B5ED8C08A9; Tue, 26 Nov 2024 14:37:22 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 05099C08AA for ; Tue, 26 Nov 2024 14:37:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 1DDDC4B60F for ; Tue, 26 Nov 2024 14:37:19 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id g5BI-mKAuGvw for ; Tue, 26 Nov 2024 14:37:18 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a01:111:f403:2614::620; helo=eur05-db8-obe.outbound.protection.outlook.com; envelope-from=felix.huettner@stackit.cloud; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 1BFFC4D2E2 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=reject dis=none) header.from=stackit.cloud DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1BFFC4D2E2 Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=mLrfK4td; dkim=pass (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=mLrfK4td Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20620.outbound.protection.outlook.com [IPv6:2a01:111:f403:2614::620]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1BFFC4D2E2 for ; Tue, 26 Nov 2024 14:37:17 +0000 (UTC) ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=aW/RkYSLL81f93U6v4VQgpp2qNQkR8kIdN68lAnQaSBTOY76MD3Zgoee7iIOhAiWbzZCaiLoP3LSC1W15zheMDPN9naEWFAY0CqD7Yd3fgYsTZCkNVtRBF8HA7Y0hyZIownnlk2qNBhVPeb94rLSgQ9Q82styUWfbyUHhT+6b45TTJnlKroPRGWDa9C9b+uTEs2SRRWR67HTVcoHOgMqEB0H80RKHxPc/drBXoGvMAo2/8M8QNH9phSlCDy/3TMGncRp+fPLHb2j0HhySqfIa2RJyKNlBxO7n8tc6u57TJrDz4MmdGHn3Ve6pkm+4aH06iuwyANudBo+Wq3Y/4cFZg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=0Bp12k5Vh9reCez8XKMC7h3IPFUeA2u8lYNcZQXgWxA=; b=fmMjsKSeE4mnWmT75+JiRoPb6+Mf1lySIT5EfJkf8NzBFIboJdTUWvdviyJcQYFOSaEhoe5jT7eKlwjjTzUu4fUVmzHO2zRGgxXuU8Uw6UqBMNSPntNUr5pi2i3ezGet+vM2QtCcVFug3OpB9ztmVvYXK1fOiyLgJDOFxZsCZ9+gIcGt0tYFo57dZK8UiwmKRmUWa/hyIBdiA75eCHMei00xHcgxZWvkXGqUJllOKqRxGF69eJPlsJsw5TauguEgSyXRTEf4H8faEJo4qeRyv28hkgIiSLTo/eKZa778WEvCrnT2ggxYM+B2dcKf/ApCXKeKq/SFW2n2Fhk7kPEnag== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=fail (sender ip is 104.40.229.156) smtp.rcpttodomain=openvswitch.org smtp.mailfrom=stackit.cloud; dmarc=pass (p=reject sp=none pct=100) action=none header.from=stackit.cloud; dkim=pass (signature was verified) header.d=stackit.cloud; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=stackit.cloud] dkim=[1,1,header.d=stackit.cloud] dmarc=[1,1,header.from=stackit.cloud]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackit.cloud; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0Bp12k5Vh9reCez8XKMC7h3IPFUeA2u8lYNcZQXgWxA=; b=mLrfK4tdmA3NAZKg+CW1+l8foGxalXMiBo1AVIS+mkvwmN/xVud8QnATRK9jaVojPjKZjGhPbrml81Wo7eYfJWl+Gf4D+qFgBkDOpF37WpJFM979paAWgYJKspMiUJvPmbnho6X6slTMjpJXjT7hwV6WybI2VLhJ1ezZEkQiEKDKvKQX66P71FK54q55FraVoXXrd9SKrjAy4I4Td5DOOFtrjZ57JiuhFDrl2UeozqoNba1d6q3+pX/VfmBopyUjfjTBC/CJx6WPWotqpVOrpP9F5xdx7Iuetq4ebs+Amq/ojtvGIt9gnV2oBoAZWNm8ed4vHgU3x9DkAI4I2J+89A== Received: from AS8PR04CA0051.eurprd04.prod.outlook.com (2603:10a6:20b:312::26) by DU2PR10MB7725.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:46d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.11; Tue, 26 Nov 2024 14:37:13 +0000 Received: from AM3PEPF0000A79C.eurprd04.prod.outlook.com (2603:10a6:20b:312:cafe::75) by AS8PR04CA0051.outlook.office365.com (2603:10a6:20b:312::26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.20 via Frontend Transport; Tue, 26 Nov 2024 14:37:13 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 104.40.229.156) smtp.mailfrom=stackit.cloud; dkim=pass (signature was verified) header.d=stackit.cloud;dmarc=pass action=none header.from=stackit.cloud; Received-SPF: Fail (protection.outlook.com: domain of stackit.cloud does not designate 104.40.229.156 as permitted sender) receiver=protection.outlook.com; client-ip=104.40.229.156; helo=eu1.smtp.exclaimer.net; Received: from eu1.smtp.exclaimer.net (104.40.229.156) by AM3PEPF0000A79C.mail.protection.outlook.com (10.167.16.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Tue, 26 Nov 2024 14:37:12 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (104.47.17.112) by eu1.smtp.exclaimer.net (104.40.229.156) with Exclaimer Signature Manager ESMTP Proxy eu1.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_DIFFIEHELLMAN_WITH_AES256_NONE); Tue, 26 Nov 2024 14:37:12 +0000 X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 8927832 X-ExclaimerImprintLatency: 3994499 X-ExclaimerImprintAction: 97c379f0927d4cd7a9b894452dde081d ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LqFBfscYAPGBDwTiX0s2qO9F2bLPRU3hh7tUKIlHeRpmmaRb7KaG8EP8fq7bVo9tE2hfGh7C4EeBcSxzDxiohTGZVnyNpSjFMwatyfd8KvQSa29t0r40unwKW4hEWFJspxHY7GuOasxc/fPic4UE1FPxJRXrmrlrkIaFwOzp6CJeYX6QMHo2DOYgyuGiB2B3xlXWk0PW0pKAcrcDPOFNAVTZus9WgnEGGPbLvofTTiiqiBbXtgKH99pSDZYFwzEuBtwUpvYQCuOE75cA6Odnfgk8aLzOcwjF/X00dPa23dSefgf8h498v5Qt7ckzGSXYLQC+gD6f10iS1gBi2yf2kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=0Bp12k5Vh9reCez8XKMC7h3IPFUeA2u8lYNcZQXgWxA=; b=JtkB0hRdnUaoqUMvkY5mzqKG5mZ+szCUSfd89Tg2PrzUHw3NTOB9QtemwU23QWp8G0IQrk0ZG0fZXEWdLs5RsdQXINiXSL4xzre1OoTka96C0KUMo+Dj0hPVwyx3J+BrEGxEWKoh81HH0bsZN6/ZSjESrEqV2ls9UrMii8y+CY5Ytw6q22U3hPy+C1745r3S3JC71rsFYavS88s8Z1X4asOabLxS5rY9O7PddV3nNGekxCyYWw09RufxakGbB5/ay8KyQo9RvXXoPNBx7xkn2vqgnvkOC6ONocPBhf2MQVkezPljG39WiFdh5USfNkhKuF4w5bpCmOqfKnX6U/UvOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stackit.cloud; dmarc=pass action=none header.from=stackit.cloud; dkim=pass header.d=stackit.cloud; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackit.cloud; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0Bp12k5Vh9reCez8XKMC7h3IPFUeA2u8lYNcZQXgWxA=; b=mLrfK4tdmA3NAZKg+CW1+l8foGxalXMiBo1AVIS+mkvwmN/xVud8QnATRK9jaVojPjKZjGhPbrml81Wo7eYfJWl+Gf4D+qFgBkDOpF37WpJFM979paAWgYJKspMiUJvPmbnho6X6slTMjpJXjT7hwV6WybI2VLhJ1ezZEkQiEKDKvKQX66P71FK54q55FraVoXXrd9SKrjAy4I4Td5DOOFtrjZ57JiuhFDrl2UeozqoNba1d6q3+pX/VfmBopyUjfjTBC/CJx6WPWotqpVOrpP9F5xdx7Iuetq4ebs+Amq/ojtvGIt9gnV2oBoAZWNm8ed4vHgU3x9DkAI4I2J+89A== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=stackit.cloud; Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) by DB8PR10MB3193.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:114::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12; Tue, 26 Nov 2024 14:37:05 +0000 Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::f00d:feeb:e45e:54f8]) by PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::f00d:feeb:e45e:54f8%4]) with mapi id 15.20.8207.010; Tue, 26 Nov 2024 14:37:04 +0000 Date: Tue, 26 Nov 2024 15:37:03 +0100 To: dev@openvswitch.org Message-ID: Mail-Followup-To: dev@openvswitch.org References: Content-Disposition: inline In-Reply-To: X-please-dont-add-a-signature: thanks X-ClientProxiedBy: FR3P281CA0108.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::11) To PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAVPR10MB6914:EE_|DB8PR10MB3193:EE_|AM3PEPF0000A79C:EE_|DU2PR10MB7725:EE_ X-MS-Office365-Filtering-Correlation-Id: 6413b8f3-29fd-4683-8d6e-08dd0e27d0e1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info-Original: zRUU8ij/vcAyxLJ+6mQGsB8ZM4YLBokZI+lOncz98XadZV+hHqq4jRY5iCkwpRpfxLE4WI4SpYM6MmObFQ8VigaByStvSyCm1EGwn37eqrX3kbbX2QnlVvIYMKShKuw9WvYvnVaGrOtoh6fLLKYhL6K18WuCclVGTAWBr/dQpJWSRt1U9gqYt7x2Gc2hjAlmxNUkhNgNNydIM0yY3Wp6gTHelQ0j5fjQTC/TCCMAz0iO+Jssly5JPy8m4s9i8l3s5CrFh4onDO/AoVIdYy4mYL6kddpTAdoCVgs8v/SSvfSOPU+d4cwStBTHL4BWMuCOk8v/HkXiIHVDHSFMk4qTc0VEZ09QEfkdMlpSg+MfDpbF266gDNcOZEVdngxkOwmZx/oXGxfSjBMnY1M2p7SZOdVGbtVDnfBX/iMEeN6GY0SWG+tppOqxEj44IADfKrgT1YexRrvyMoTWl36Ec0uAXWhmJAOLvGFSFFe1DIwPUawOEtZixFHn2g55gVk6C2GKMZoJDKiT6VtBsEJUf7roXojZUM/KWncp1+oNRN0QXYYYrCud4Y6MUKMYGn22+KngB9pJwkT3ohauQE2Y1nhmsqw2bWwuyHQiWVZhCp7UUmlcYFoasxaGz3TQLDBhnpwEWm4utVu7Hds9HKC8sJVnvD5YsxNL9ksqy9UTkanB+JqOLzPAYDasWeXriUojq+Yx8KZwNpZ0uOQz3/cD1LX+6sQ35h3B1M06byuhfpCFL6Z+I0oWXqod0u+Nrdwcvw8oXYmb3TAV834Bo8PTrPTFf3FX6C2ylGWXTFAHw4tWZA8nuWuapFRdzowJU+8YMLKF9rlf5/MffdzN1ClkRNFNwJcGKY+B7yfs/K7SSVPn/f1jFs2UYtFz92aEaCWtUaKG2IG9fDMj0QhtYZneR+hwYsnlNe1BQ5kbwbPO/MfLTdVBgE8CFEWiHd+Hpq6WFYEtDJrC8o9pQBVXWHpUifkb/pUxlR4Dm1d77Qk888UWrMU8kM00DSrneeJZ+AqkjPT88PRtSVlWYZzoObSgTf31ROp2uRlO6+ZzGfeEA6AosUIw0/WBd5x2t1CAz+qZzTrqKs9ZPu6MPG6OEMiyYXmVgVPWjoxyMRrxOHHSiPCFQnzj5wr3XMkL0bm9g+w8nXsw4/f2JA9FWVJmrb0BvKCfdrJxdbJmKBtiksH0T1goju3q2CfnJoOiAvfZyWuC51JnlUGObsno+LB2fspGj7Ow5+5g1sAlp6/yQr6dJ95JMpT/id8wp6WVf3Q+fI6r1GaPYeVP5O52oCUMPZblnfIa4yw5/LAiQzK0nOg1g6sHOZ+kPOeoMDT3kYHwvTgEHNYQ5Ifj7PLapa6naROFCgmN+w== 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:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR10MB3193 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM3PEPF0000A79C.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ca0b1367-2391-456b-60bb-08dd0e27cc27 X-Microsoft-Antispam: BCL:0; ARA:13230040|35042699022|376014|82310400026|1800799024|14060799003|36860700013; X-Microsoft-Antispam-Message-Info: chwJ2Ji8mcFJR5bdFYq2L4dmmM4EOCnAj7xKAulgfZETo/stjyJHZ0Bc9iBNyxEf28sCx0LbzohwvRfKt8+i3fqavsVlOkqPsPIkXmtlSWrllw4z/pDFbrq1X7NP1SMtswSbMFBf3aqB0xMoaYHzr3z7opTFVY3Zfg7a6aKv334gzmi5cL0lfYyblbFD485KneDTpm3iziQR650guZ2u5+jdWP28h2IC+cgYJC/kAne0j8L8KC4GduOWWiakVhpTvhOXCfxgNo5ZbjeEsDIrBUPs0h/PWb2XytfBUOEnym0ZbPSN0Illrcg5h03wt/AHTLESEcoj9eUfZRIUkEmZKRjdBv2tzeq2DWEJNHxGAMsMyj8nwOswssIe5sVlla3qJ6B5sLelfOazM0cDx9bRHDzl83vxJH1mY9w6o+CiCUJdEGB70wu5vkMN0Jw18FzMFWG07IdxRRaabiIXWWIkdzBmQjyq5+WWKmPx/uuc9ssldrsPys2fh7FD17wCxp9P9tj1x9g1F98qjk0XGE33JlBUlJa2mLbfAw+b07NodeY6cUa+I5ivgKRsUD85GnymcYgn2NIbcBzDHBab+YEmTCSygzJ6oNKUWr96dFucO0sM6+LNOtudcrZ+inBfdKGsUavvoGuwzHTVJca75deQAfs1AW71de5f2H4yeYLzgD2yviA0g1Ta0BeLDXyYKPqCjWWlZdZmDcOesyAYsB8vHclqdRiqgEyv8F3XkR18LVPITfhW5BFREwG3ALFNvYdLvrOqnzYVkZuPZI5B6mL+rCgZtzxQn3kNxIwXC5H5fhreRdg4ZpJnodUbCQ5cwh7qpvflD3fZBnyT0ouigjk8/uALsOXkAj+8YS/BQZMQ0hq+4VZwipHw8wgaf44n2qdt+m0QlOPIaDwEbpwZpOay4wyieiYjrlPBBJJPXotTlJTUmR+aZyuw1QnSRCLqKne2O53hGYQwrqVSONyV3NvoAHZN4Pt27ZW2fcei/6Iqm770x3rzjaBkyQ82DOE+pA3ysEA0oy3XPX2JdLF9K+GzmyWxdnrwvVZ6DyDuNs2lpr0HF2jteSWXBRBxnNna9n6e7iFTVUY3iMBuFfoUAusFPCEJ1A308SBXiCVJtciBfe24X2dkAdbtZlXjr2HDPPtbE1O4Koup1oiwylU3BVeZiQJn1fUOiih1JOSDrC/FvPXCfKke5qOuZIic7c4tIiECCSsrldvuvDllgQAC4yelDQWJRS9Y7JQbQ0yW65aVMJkg/ZiCaMPyMmmx37ZohlqtHr+z+IQkKtGa13BO2ygzq6/PgG66kTa6pUGJy6d61teWGH7o9gY1wBCyLhmSZIyg2o+bhgTv3PzIonmTcrzF2K1NsZVqfqp5OUsMTWYBPiER+G67Z+xkWkNb1U9DbeLEaaGTmIKQJQon+ivTVWDmigzrtNlX8T+abeh/UBogCr90JTSiMEO5r9mkh0jyRWnk 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:(13230040)(35042699022)(376014)(82310400026)(1800799024)(14060799003)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: stackit.cloud X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2024 14:37:12.1028 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6413b8f3-29fd-4683-8d6e-08dd0e27d0e1 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: AM3PEPF0000A79C.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR10MB7725 Subject: [ovs-dev] [PATCH v2 4/6] route-table: Expose route_table_parse_ns. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 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" This will be also used on the OVN side to parse route table updates. Signed-off-by: Felix Huettner --- lib/route-table.c | 4 +--- lib/route-table.h | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/route-table.c b/lib/route-table.c index d7d86f9ae..a9a9c6b85 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -65,8 +65,6 @@ static bool route_table_valid = false; static void route_table_reset(void); static void route_table_handle_msg(const struct route_table_msg *, void *); -static int route_table_parse_ns(struct ofpbuf *, void *change, - const char *netns); static void route_table_change(const struct route_table_msg *, void *); static void route_map_clear(void); @@ -207,7 +205,7 @@ route_table_reset(void) /* Return RTNLGRP_IPV4_ROUTE or RTNLGRP_IPV6_ROUTE on success, 0 on parse * error. */ -static int +int route_table_parse_ns(struct ofpbuf *buf, void *change_, const char *netns OVS_UNUSED) { diff --git a/lib/route-table.h b/lib/route-table.h index b3d2a8741..1e9f51a98 100644 --- a/lib/route-table.h +++ b/lib/route-table.h @@ -24,7 +24,7 @@ #include #include -#include "openvswitch/types.h" +#include "openvswitch/ofpbuf.h" struct route_data { /* Copied from struct rtmsg. */ @@ -55,6 +55,7 @@ uint64_t route_table_get_change_seq(void); void route_table_init(void); void route_table_run(void); void route_table_wait(void); +int route_table_parse_ns(struct ofpbuf *, void *change, const char *netns); bool route_table_fallback_lookup(const struct in6_addr *ip6_dst, char name[], struct in6_addr *gw6); From patchwork Tue Nov 26 14:37:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Huettner X-Patchwork-Id: 2015469 X-Patchwork-Delegate: echaudro@redhat.com 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=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=sOCB0pOe; dkim=fail reason="signature verification failed" (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=sOCB0pOe; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::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 4XyQCR1KhCz1yQY for ; Wed, 27 Nov 2024 01:37:39 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 6DDCB4EBC9; Tue, 26 Nov 2024 14:37:37 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id gQScTaFe6X7f; Tue, 26 Nov 2024 14:37:35 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 87AAF4EBF9 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=sOCB0pOe; dkim=fail reason="signature verification failed" (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=sOCB0pOe Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 87AAF4EBF9; Tue, 26 Nov 2024 14:37:35 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 741BCC08AA; Tue, 26 Nov 2024 14:37:35 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2FCDDC08B9 for ; Tue, 26 Nov 2024 14:37:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 1F74C434D5 for ; Tue, 26 Nov 2024 14:37:25 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id hbkAs4GFfOOK for ; Tue, 26 Nov 2024 14:37:23 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a01:111:f403:2613::61f; helo=eur05-vi1-obe.outbound.protection.outlook.com; envelope-from=felix.huettner@stackit.cloud; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org E5497434C7 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=reject dis=none) header.from=stackit.cloud DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org E5497434C7 Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=sOCB0pOe; dkim=pass (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=sOCB0pOe Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2061f.outbound.protection.outlook.com [IPv6:2a01:111:f403:2613::61f]) by smtp2.osuosl.org (Postfix) with ESMTPS id E5497434C7 for ; Tue, 26 Nov 2024 14:37:22 +0000 (UTC) ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=kLbvMN4rGgd+bW6/YAZKz1ahDvDayLajEzY+0vPHlQOvdUC5To6AZWKrhvNUdjfaivmz1DIZ3q2PRXFE5+Kk93SuCJHKf8mrXBB7TpFFWqi1T7jaNI3gw+iLe70p6FC8vFp9FsU5oA9v2F1+cbpmaXj5Z5Se9CLLoWHobepH1elnnzhWfueGjSPyg7dqgJ+6lJNd1Y3v3kdsIMgtGrXmr/STG5RSToJhzq2nbDGhFwbdph0HRSCiSUH63pAsP8lJH02QkAcDhPLsm+3sZkkZVWdOEwZOuhdSwoiumCKlR7fdJVMgT0llerF3GD2c+BwzoIpO1Yyum07+MLqCsi1vtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=kZmK2bkclNxeGQJg3JOpUq5Xk6PeMxy9OvL6ruR+Tds=; b=ii+mNyAz3fRwPuZKNbS9i8EA5Eny/QiUKpQ3RZX38QcCgCgIE+dGCmWSvp2DvuACUcdrziDVUhcSgEFYqk5kTKBFrOJ2U2IYt0Dtv4FTCHlTneFCQqECAHAxWxbXveaUG4EVUOPgfehCXuXQaYSA36OjxAONoUAf/tY/usQSCtUd3saeA8nWy66Dr/UY3rO7rXg05H27EOXWXaH7yslOBy+HjfBxmuaGCe4g0UQ6yskZH5mLbuwa8cbJgdn7QVOkvyP98sMBLIJkZDQl2slRg8ZzrK8qRNt7naUjrWIuR/O6m1Wim6x/39WOfv7lqnK6kpvA6s+E51u5iJCtqgpGzw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=fail (sender ip is 104.40.229.156) smtp.rcpttodomain=openvswitch.org smtp.mailfrom=stackit.cloud; dmarc=pass (p=reject sp=none pct=100) action=none header.from=stackit.cloud; dkim=pass (signature was verified) header.d=stackit.cloud; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=stackit.cloud] dkim=[1,1,header.d=stackit.cloud] dmarc=[1,1,header.from=stackit.cloud]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackit.cloud; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kZmK2bkclNxeGQJg3JOpUq5Xk6PeMxy9OvL6ruR+Tds=; b=sOCB0pOeeb+6a2N9krNxSR92AJgmo1B/tK8/W8ydeWMLURiHi4YJZ0BVw9naAiHVULzbCbDeEiCanlVa8wJibvyex/8OPzd4ZtBhOmOX9rv7CDxvPRAVFVdd415fVQEG6qaT1mADEMHgWVh5vQLtrLL3JLQH2Pj25utOOTWGpzFIvnjzoe58FxjCdf8jcX0S7BhAAMu0u1j0ZDPhQoLRWUKtvhThMlyKxbmTDSyRRk40M/GQYqgv3EZHu0/a9X512jbzQLuZLEti3soes7JL08wNYIgh7kLs0FC5MvgXUvHLLXt6BimOAIrcsxxvwJEfhUs16Dw6Oztmkc2cVjDcNQ== Received: from AS9PR06CA0137.eurprd06.prod.outlook.com (2603:10a6:20b:467::29) by AS8PR10MB7524.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5af::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.11; Tue, 26 Nov 2024 14:37:15 +0000 Received: from AM3PEPF0000A79A.eurprd04.prod.outlook.com (2603:10a6:20b:467:cafe::89) by AS9PR06CA0137.outlook.office365.com (2603:10a6:20b:467::29) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.19 via Frontend Transport; Tue, 26 Nov 2024 14:37:15 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 104.40.229.156) smtp.mailfrom=stackit.cloud; dkim=pass (signature was verified) header.d=stackit.cloud;dmarc=pass action=none header.from=stackit.cloud; Received-SPF: Fail (protection.outlook.com: domain of stackit.cloud does not designate 104.40.229.156 as permitted sender) receiver=protection.outlook.com; client-ip=104.40.229.156; helo=eu1.smtp.exclaimer.net; Received: from eu1.smtp.exclaimer.net (104.40.229.156) by AM3PEPF0000A79A.mail.protection.outlook.com (10.167.16.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Tue, 26 Nov 2024 14:37:14 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (104.47.17.112) by eu1.smtp.exclaimer.net (104.40.229.156) with Exclaimer Signature Manager ESMTP Proxy eu1.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_DIFFIEHELLMAN_WITH_AES256_NONE); Tue, 26 Nov 2024 14:37:14 +0000 X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 6998567 X-ExclaimerImprintLatency: 5409239 X-ExclaimerImprintAction: 1b6d590077cc4f0ab3f9706d763518f2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bh9IKjsL86QQCQsAunUAvWD1jtdbfmqyQxNMvLbJxMelCmwgKG9ESB8z8ROU9r5fudbsteW58PSZD7KB6iH4cFbftccLPASOq6FIrPxBBdn8RIxbCuS+6paBO1Ks8DaeMneTmXv6ZXiAeW9cv77FIMPACfuFDzWgQgue11g5HmgU+XhIOKWJ2hVXYAQli59YcGUO4aNRPGY7wNmaQ6333wmNN4sT3zA28dpTIK8bN0g4dR9HdGO0KSeN6vwqyo/1vuXtE6rpHx2Y+Kakf5Xd3L43Q2PjKVFV8jJfGhZwBGur3CcC16NdaFY1QOZ95FMpdR8foXbHQauqQc6lSuOjbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=kZmK2bkclNxeGQJg3JOpUq5Xk6PeMxy9OvL6ruR+Tds=; b=IGDb3/6MwXz7FSMSPxefj/C9ikLg3C8D8OZvO3Tr4Q3h8ckCogCZ5wLEJAykw4TB53r+FK5jSkRRixjyCJmsnDAcyihvbC7Vze7EOJN/FGmUNJ+qyiv1v7HYvTNkIZsIGG7HaNoAWbujgCIEjG8SeoJchZjWOxdt0KcJjSq0ami9hBEJiWKY71y9RxN2RADwvZ4NDeQA7s/YPhr3fUNugDEtUUOvDwhcP7I+J/pUdIPebrQzsPooS8vkfIUeFcqX61ZQaQHRTL/UaP2UtLMxTv57+0wlntMXsc9m1ATS0NA2IQhN4BOb/6Vto+C6JtG06e+Me/9CKEjlIh5Jr1Ok5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stackit.cloud; dmarc=pass action=none header.from=stackit.cloud; dkim=pass header.d=stackit.cloud; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackit.cloud; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kZmK2bkclNxeGQJg3JOpUq5Xk6PeMxy9OvL6ruR+Tds=; b=sOCB0pOeeb+6a2N9krNxSR92AJgmo1B/tK8/W8ydeWMLURiHi4YJZ0BVw9naAiHVULzbCbDeEiCanlVa8wJibvyex/8OPzd4ZtBhOmOX9rv7CDxvPRAVFVdd415fVQEG6qaT1mADEMHgWVh5vQLtrLL3JLQH2Pj25utOOTWGpzFIvnjzoe58FxjCdf8jcX0S7BhAAMu0u1j0ZDPhQoLRWUKtvhThMlyKxbmTDSyRRk40M/GQYqgv3EZHu0/a9X512jbzQLuZLEti3soes7JL08wNYIgh7kLs0FC5MvgXUvHLLXt6BimOAIrcsxxvwJEfhUs16Dw6Oztmkc2cVjDcNQ== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=stackit.cloud; Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) by DB8PR10MB3193.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:114::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12; Tue, 26 Nov 2024 14:37:06 +0000 Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::f00d:feeb:e45e:54f8]) by PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::f00d:feeb:e45e:54f8%4]) with mapi id 15.20.8207.010; Tue, 26 Nov 2024 14:37:06 +0000 Date: Tue, 26 Nov 2024 15:37:05 +0100 To: dev@openvswitch.org Message-ID: <8c6c957ddd81ecd7a1242a3b5c8daed8527732bc.1732630344.git.felix.huettner@stackit.cloud> Mail-Followup-To: dev@openvswitch.org References: Content-Disposition: inline In-Reply-To: X-please-dont-add-a-signature: thanks X-ClientProxiedBy: FR3P281CA0107.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::17) To PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAVPR10MB6914:EE_|DB8PR10MB3193:EE_|AM3PEPF0000A79A:EE_|AS8PR10MB7524:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f6d43a4-4b23-4a17-3bc2-08dd0e27d20a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info-Original: qwngEkoCfuI9aW8FyvNYGD4gwtLRzcORJy7GzLoK7thCLYqycWrYjJvWXN565zWxPQEKmMDbtoIhVHcqkGlG1Ea7sLWsA8im7/6hQIYloYU+dbsG7ZX2DXEmclphohZWCcPfgP9LYiTBMrxnnNV4EyvzSZDz5y6bOeiv5xXyBN1arMgPwQp9R3M6m15NCOuBHu0MXJPfg+I/cUAfSFWW1eeAZ1B+AZRy9I/noBzv0mLQJ+4clopg0AP7KQ173iH16zy/UIemUU5h/DQs4LOD4OS+6Ols/3y9I3+fydwoc21VIupwAtZfdN8xLlIJuVC1Adb1/V0AAOHfQoMnYtYyk6d7h0H5ayyBTesG3uRu+wOf4YLfehv1iMpB+WdvFhCpBR3fA3CxLVfJQb1P8nsPOBJRpC9TcbKglFJ2jt2zVfYlCcWZMZj4vKDhVt2to4QO37BYPd1XLI33FtEUYqx7w+0COJJoOBjrdmf4zWTT8Zf08JXYi0nP2DXUVNJkcmBYI2avd6c5TdwB5b5rfhYAvbTWyYfn5l3Akv5dc+UazSYumqKxdmRhIjkeggsbtryswNJW5vyjDLETkvmbL1cGndn8f1tEF0dEhNH1s0Ik/2qB5FS+LuQGODm/XmBOYFWbY7VW4ClitQxTTLt0I6IdHrh7nNxQ11UBej2KAUT7k/ouAJ3/SX9whi/040M4PXxFJr8a3bjut6qFJPnZxEoNS4tEB7vREBW99ehgDodrbnr1DtiJaWIqagaGrjmWvn26E0OWzH3vLRizqhTi0Tj+BEFPz+Uq1SQFuGh7VrSRRBEu4ZrNdVn203TjVPDrhKVPy/+E1zdMMi4F5ULwV50XVIj2JoFNFGjbzyuLjKsaSHybOTlVCSOYSo13T/DTHmtEYPBZoE1i26gAYEjc7fvX+UW5N42PplC4u8FthTqxmF6dCJLvf0cG04+sZP7GccS7QGce0fXub9Zhzl7W0hv1N7/tATd6s1fsAwi9AMP5o609gh71p9F+t9sfejQylu2hNKDn+h+5dbEnwRTzCijhSuVgFw6Xuln4pnlY4SnhQ9dEWzEaZGnZKaSvNQfBHFvJGgSN5sFhqd4iwXgauN+uOQKkNFuhcZdIEQrvq40VnqxMVzmknKSlY/hpeyYMXuMjspRTrW6sAA7HU8RC2GX6neshDIy1nDpZ7xtuKYzcahW7GZBdYHSI2ANOze1CP5XMWyXqt7pLVBSOZZXvDeK6x/ESaYqO7oFpJSm1gnoaCEDALQs32lQYtOQq8OhoDSCqg85sze0KnvmriawNhk94G/3rBo8vrmLP8i+e1LMk+j3k3IxvDNoHrsTSfBViFujNGCPH7VErzqaJQ540ya88Fw== 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:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR10MB3193 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM3PEPF0000A79A.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 1d346fdc-59f1-41cf-e86c-08dd0e27cd37 X-Microsoft-Antispam: BCL:0; ARA:13230040|35042699022|376014|82310400026|1800799024|14060799003|36860700013; X-Microsoft-Antispam-Message-Info: TVTIC7zeQCn9m0aoB3wwlpomMd62OaorUfAMh0ywn7JKJ7bwyiBQKMBgwzRkog/J8EzXsDpn/ptFMI9O/tnnKh6SS0OHHjuXo5FCmgDXKdlZvugCaQp98o8XEL+dbLzi1NjEJxVM5HU5T2NLW2Y/UIohxWcQWd0H/v83ezum10VqRWelIGvwA7lfA9wRlTZVn2a34NvfD7q7ZUdr/MR618aJzGFEdAAEcj6xYSxH48yMYfyKSSNBv9JtfE7GYXT1iul98y+BSpyNHpK7eU7MO+vEbOBpyWPkcGOGrLKCNAk2C0islYYBG9fF+AZ85+ezEEINxdbP1V0by9bPVUPtXt90x7gKYoSRIFL1BI4OJ66MZIYUiRxNAeWUoZGgzbh1LTosSPwyeLIZv47jSPFDiLTc2A+DOCdftdfG4rpm0HHJzSe1OIH3YW7MLMjpAj0Z2D8Y5kXdSwfmfwOOJ/Ub7EmHbVPD3r+ACxUy7GPuMOaXCCYAacFWX2u6+6I07cQu+aoh9UZKmi5XEJaBqfZ0DOTzVXII/AJTEwxvWXx79b9ockE79y7oq8ykkYXBwoM46JPDdYppbkSYhDI6htygSirehyKO1Edo7inZeA354mRXjBBGV9DXW95zruJdtGn5rVxVO2xI0TBG1c7RlWowjDWBoHQsDq5ka/Q8ppsWVkbQ6zC5FL87TruwHKAa+Y/8+vb5yQP1/nYTFkNp7fpDx2P4FG5sy8oAtZvu2Te0Exo6o0gnlsyGvwBwIveS2hfa2PjVqU0EatVsVo2L+TW/BXS0lotyn5flrrYWOpYl/Tp17CyocpJwT/3Vtq/NhhzSDEsye4FPYhJWWTWE+7/uVJPyvNhDqj5L2BrGU8QOssfACiNp5mDSxf0WvGZ4ri4fWIT3++8ARHClKlbd1rCCM8KNBJNq+wE3/0gaZLoXyXaT9OHR+USQA0Lkc7o2RHNR9UY3BXYypiY5Z2S4IPSh2nzZuLTbSb5cjtPVVrgUDJVIiDrOKbBSHOpRU4XdJtBxoroErXcHYepZSdVotRuyCOA1mQyJJ3rrjGWEPee32s1hO/3vAJLg0VU4gx/apxItaddpzOColw4xWhuabudonoB3PW7PD3F5PDra1uVKiBxGEtigCCcLEFsaNHtoc05LoLdH9pg2RWbJWi1MsN/ozwLv11ohFVsHcgLex8u44QFYl6egTIhXjg3KC/BheOr4s9ayrC9llUMC/bxVa6++ByvGmsDFgH0yjWl3P36Av0rLDXqWQKPEOl+6EAYq5X6ASQHQ9kd5OXolfxQ6qMT6ZMXV/rRlg5ZyDElkYZ2FB3RMcAS+Ja0VtDGaEZfCJTnrS3YPivCGwfvz3xIH01lc9YicrjGcAK9UN+eaiyMcLuqoQ7Asp/Jr36zsFZqUF7tGyLjH7dMxQIGy3HEjeG/czi95LX4H8KYDdGuB8AcpE8knI5j/ClZZl0OK5rTX+qgv 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:(13230040)(35042699022)(376014)(82310400026)(1800799024)(14060799003)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: stackit.cloud X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2024 14:37:14.1252 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7f6d43a4-4b23-4a17-3bc2-08dd0e27d20a 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: AM3PEPF0000A79A.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR10MB7524 Subject: [ovs-dev] [PATCH v2 5/6] route-table: Support parsing multipath routes. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 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" Multipath routes have separate structures for each of the nexthops. Previously if a multipath route was received it was treated as a route without a nexthop. Now these nexthops are parsed (up to a limit) and the ovs router uses the first route in the list. OVN will use the other routes. Signed-off-by: Felix Huettner --- lib/route-table.c | 151 +++++++++++++++++++++++++++++++++++++--------- lib/route-table.h | 12 +++- 2 files changed, 134 insertions(+), 29 deletions(-) diff --git a/lib/route-table.c b/lib/route-table.c index a9a9c6b85..06e391184 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -203,6 +203,110 @@ route_table_reset(void) } } +static bool +route_table_add_nexthop(struct route_table_msg *change, + bool ipv4, + struct nlattr *nl_gw, + uint32_t ifindex) +{ + if (change->rd.n_nexthops >= MAX_ROUTE_DATA_NEXTHOP) { + VLOG_DBG("tried to add more nexthops to a route than possible"); + return false; + } + + struct route_data_nexthop *nh = &change->rd.nexthops[ + change->rd.n_nexthops]; + + if (nl_gw) { + if (ipv4) { + ovs_be32 gw; + gw = nl_attr_get_be32(nl_gw); + in6_addr_set_mapped_ipv4(&nh->rta_gw, gw); + } else { + nh->rta_gw = nl_attr_get_in6_addr(nl_gw); + } + } + + if (ifindex && !if_indextoname(ifindex, nh->ifname)) { + int error = errno; + + VLOG_DBG_RL(&rl, "Could not find interface name[%u]: %s", + ifindex, ovs_strerror(error)); + if (error == ENXIO) { + change->relevant = false; + } else { + return false; + } + } + change->rd.n_nexthops++; + return true; +} + + +/* The following function uses the RTNH defines of rtnetlink.h + * As these rely on casts from char * to struct rtnexthop * clang will issue + * a warning about alignment even though the defines will ensure that the data + * is alligned. */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcast-align" +#endif + +static bool +route_table_parse_multipath(struct route_table_msg *change, + struct nlattr *multipath, + bool ipv4) +{ + static const struct nl_policy policy[] = { + [RTA_GATEWAY] = { .type = NL_A_U32, .optional = true }, + }; + + static const struct nl_policy policy6[] = { + [RTA_GATEWAY] = { .type = NL_A_IPV6, .optional = true }, + }; + + struct nlattr *attrs[ARRAY_SIZE(policy)]; + + size_t len = RTA_PAYLOAD((struct rtattr *) multipath); + struct rtnexthop *rtnh = RTA_DATA(multipath); + + while (len >= sizeof(*rtnh) && len >= rtnh->rtnh_len && + change->rd.n_nexthops < MAX_ROUTE_DATA_NEXTHOP) { + + struct ofpbuf buf; + bool parsed; + + ofpbuf_use_const(&buf, RTNH_DATA(rtnh), + rtnh->rtnh_len - sizeof(*rtnh)); + if (ipv4) { + parsed = nl_policy_parse(&buf, 0, policy, attrs, + ARRAY_SIZE(policy)); + } else { + parsed = nl_policy_parse(&buf, 0, policy6, attrs, + ARRAY_SIZE(policy6)); + } + + if (!parsed) { + VLOG_DBG_RL(&rl, "received unparseable rtnetlink route message"); + return false; + } + + if (!route_table_add_nexthop(change, ipv4, attrs[RTA_GATEWAY], + rtnh->rtnh_ifindex)) { + return false; + } + + len -= RTNH_ALIGN(rtnh->rtnh_len); + rtnh = RTNH_NEXT(rtnh); + } + + return true; +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + /* Return RTNLGRP_IPV4_ROUTE or RTNLGRP_IPV6_ROUTE on success, 0 on parse * error. */ int @@ -220,6 +324,7 @@ route_table_parse_ns(struct ofpbuf *buf, void *change_, [RTA_PREFSRC] = { .type = NL_A_U32, .optional = true }, [RTA_TABLE] = { .type = NL_A_U32, .optional = true }, [RTA_PRIORITY] = { .type = NL_A_U32, .optional = true }, + [RTA_MULTIPATH] = { .type = NL_A_NESTED, .optional = true }, }; static const struct nl_policy policy6[] = { @@ -230,6 +335,7 @@ route_table_parse_ns(struct ofpbuf *buf, void *change_, [RTA_PREFSRC] = { .type = NL_A_IPV6, .optional = true }, [RTA_TABLE] = { .type = NL_A_U32, .optional = true }, [RTA_PRIORITY] = { .type = NL_A_U32, .optional = true }, + [RTA_MULTIPATH] = { .type = NL_A_NESTED, .optional = true }, }; struct nlattr *attrs[ARRAY_SIZE(policy)]; @@ -252,7 +358,6 @@ route_table_parse_ns(struct ofpbuf *buf, void *change_, if (parsed) { const struct nlmsghdr *nlmsg; uint32_t table_id; - int rta_oif; /* Output interface index. */ nlmsg = buf->data; @@ -286,21 +391,6 @@ route_table_parse_ns(struct ofpbuf *buf, void *change_, change->rd.local = rtm->rtm_type == RTN_LOCAL; change->rd.plen = rtm->rtm_dst_len; change->rd.rtm_protocol = rtm->rtm_protocol; - if (attrs[RTA_OIF]) { - rta_oif = nl_attr_get_u32(attrs[RTA_OIF]); - - if (!if_indextoname(rta_oif, change->rd.ifname)) { - int error = errno; - - VLOG_DBG_RL(&rl, "Could not find interface name[%u]: %s", - rta_oif, ovs_strerror(error)); - if (error == ENXIO) { - change->relevant = false; - } else { - return 0; - } - } - } if (attrs[RTA_DST]) { if (ipv4) { @@ -323,21 +413,28 @@ route_table_parse_ns(struct ofpbuf *buf, void *change_, nl_attr_get_in6_addr(attrs[RTA_PREFSRC]); } } - if (attrs[RTA_GATEWAY]) { - if (ipv4) { - ovs_be32 gw; - gw = nl_attr_get_be32(attrs[RTA_GATEWAY]); - in6_addr_set_mapped_ipv4(&change->rd.rta_gw, gw); - } else { - change->rd.rta_gw = nl_attr_get_in6_addr(attrs[RTA_GATEWAY]); - } - } if (attrs[RTA_MARK]) { change->rd.mark = nl_attr_get_u32(attrs[RTA_MARK]); } if (attrs[RTA_PRIORITY]) { change->rd.rta_priority = nl_attr_get_u32(attrs[RTA_PRIORITY]); } + + if (attrs[RTA_GATEWAY] || attrs[RTA_OIF]) { + uint32_t ifindex = 0; + if (attrs[RTA_OIF]) { + ifindex = nl_attr_get_u32(attrs[RTA_OIF]); + } + if (!route_table_add_nexthop(change, ipv4, attrs[RTA_GATEWAY], + ifindex)) { + return 0; + } + } else if (attrs[RTA_MULTIPATH]) { + if (!route_table_parse_multipath(change, + attrs[RTA_MULTIPATH], ipv4)) { + return 0; + } + } } else { VLOG_DBG_RL(&rl, "received unparseable rtnetlink route message"); return 0; @@ -364,8 +461,8 @@ route_table_handle_msg(const struct route_table_msg *change, const struct route_data *rd = &change->rd; ovs_router_insert(rd->mark, &rd->rta_dst, rd->rtm_dst_len, - rd->local, rd->ifname, &rd->rta_gw, - &rd->rta_prefsrc); + rd->local, rd->nexthops[0].ifname, + &rd->nexthops[0].rta_gw, &rd->rta_prefsrc); } } diff --git a/lib/route-table.h b/lib/route-table.h index 1e9f51a98..5a0e317df 100644 --- a/lib/route-table.h +++ b/lib/route-table.h @@ -26,6 +26,13 @@ #include "openvswitch/ofpbuf.h" +#define MAX_ROUTE_DATA_NEXTHOP 8 + +struct route_data_nexthop { + struct in6_addr rta_gw; + char ifname[IFNAMSIZ]; /* Interface name. */ +}; + struct route_data { /* Copied from struct rtmsg. */ unsigned char rtm_dst_len; @@ -34,13 +41,14 @@ struct route_data { /* Extracted from Netlink attributes. */ struct in6_addr rta_dst; /* 0 if missing. */ struct in6_addr rta_prefsrc; /* 0 if missing. */ - struct in6_addr rta_gw; - char ifname[IFNAMSIZ]; /* Interface name. */ uint32_t mark; uint32_t rta_table_id; /* 0 if missing. */ unsigned char plen; unsigned char rtm_protocol; uint32_t rta_priority; + + size_t n_nexthops; + struct route_data_nexthop nexthops[MAX_ROUTE_DATA_NEXTHOP]; }; /* A digested version of a route message sent down by the kernel to indicate From patchwork Tue Nov 26 14:37:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Huettner X-Patchwork-Id: 2015470 X-Patchwork-Delegate: echaudro@redhat.com 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=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=CxIzbVnu; dkim=fail reason="signature verification failed" (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=CxIzbVnu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::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 4XyQCk3YYTz1yQY for ; Wed, 27 Nov 2024 01:37:54 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 38BA56F6A9; Tue, 26 Nov 2024 14:37:52 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id aCxOAtPoSqnu; Tue, 26 Nov 2024 14:37:47 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org EF75D6FA46 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=CxIzbVnu; dkim=fail reason="signature verification failed" (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=CxIzbVnu Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id EF75D6FA46; Tue, 26 Nov 2024 14:37:46 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C70C1C08AA; Tue, 26 Nov 2024 14:37:46 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 22338C08AA for ; Tue, 26 Nov 2024 14:37:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 35F62434CC for ; Tue, 26 Nov 2024 14:37:29 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 3Dmgkt2cAE34 for ; Tue, 26 Nov 2024 14:37:23 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a01:111:f403:2614::60e; helo=eur05-db8-obe.outbound.protection.outlook.com; envelope-from=felix.huettner@stackit.cloud; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 464C54349E Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=reject dis=none) header.from=stackit.cloud DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 464C54349E Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=CxIzbVnu; dkim=pass (2048-bit key) header.d=stackit.cloud header.i=@stackit.cloud header.a=rsa-sha256 header.s=selector1 header.b=CxIzbVnu Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2060e.outbound.protection.outlook.com [IPv6:2a01:111:f403:2614::60e]) by smtp2.osuosl.org (Postfix) with ESMTPS id 464C54349E for ; Tue, 26 Nov 2024 14:37:22 +0000 (UTC) ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=pV1qIgjSNOj1apb9ocgPHhSJKx7T6ug3rONuFOsyLjQ1n58D+nlzZM1eZb8epMX3XfDEDzHul/+xxsFqRxndqY1a34/alyyPBJeyMU/SDRFsbNTg/RXpcGnvZiOWkyaM24d0LXplQt3oQg1xKxzhx92hduxw7taG+yeE3xGaK7utIywC898qbhMNfG5+/SGyl0Y2PBcu0hfIqdqmkgOba5zEEysTtxyI+KQEKExSIm6WXv9QUT7W/N+8GYvYOsx0vzkwcTlBxop2gcEex9oU20qBi7JbV27KEY4QRci++E6POkvD1680wN2u2RJg+uN5KiqJHtAJXaGbSR4jP7o47g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/BNJNKBt24z72NOGw6dix1ZoFXxwIL+Pq7zwWCr6+Cw=; b=NV3OUzZ36kWTnO/pRViTEQTapxTSq4cfHTZOBdx70foBj+uRYjRypCv+oCMBAslnenRkV+GOB1RC6Q67j18DOCsG3kA5q7kwwvLMab8L3z/0xLFYGOnyBN7zBX2GxNeSRbUqOELK5lz2kNN3836keLqIDfGggXf6VeY7icMHxhXCHeY/YHVlLrGTHHpSvi26UBV8/K59oPIy7K7sIqyXQXqSsFkcW5STQ6ECtBkMjgDelE5VAIZuZb2kfSDRGflpD1/fjVISQsZFUkCq1eJTt2zq/dQ95U0IUjw8w9kAczDyEkOfyO+YCLy3MVK/ATTHOvAzo+PGYEU43VMZ/oA07A== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=fail (sender ip is 104.40.229.156) smtp.rcpttodomain=openvswitch.org smtp.mailfrom=stackit.cloud; dmarc=pass (p=reject sp=none pct=100) action=none header.from=stackit.cloud; dkim=pass (signature was verified) header.d=stackit.cloud; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=stackit.cloud] dkim=[1,1,header.d=stackit.cloud] dmarc=[1,1,header.from=stackit.cloud]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackit.cloud; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/BNJNKBt24z72NOGw6dix1ZoFXxwIL+Pq7zwWCr6+Cw=; b=CxIzbVnuI1msmnsQU1rmzINrturkBV+BKRxRm3zxWupo0yVF1vy3iBP1WnksoCfVyaeWvs+57Y5JhEDzbpD/eVkr2Kq2Uif7Z9N9sJ3p3xwqT6wNwBlfyfbAuIHATMNQ+fD9zzNDx0iZ/Gb1AnSwSWqVfRq6vL23TGFcyUHCNqXQVXxV0mj6n54/5OEB84rnCEUMo6MCYnXItDvtjGv1XaN3MNJEiUKAlT/6e+M3ytdPFw4fq5Azg7r+CVHOeGzwhQOVraG8xIrz3y8sqpjdPK2huUojXD4Hrv7isuFmjj7miYERHEpCnfuRVkJ3eCg2bmbfUHQhwE4yCFcE5ZQAOA== Received: from AM0PR02CA0201.eurprd02.prod.outlook.com (2603:10a6:20b:28f::8) by GV2PR10MB7029.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150:dc::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.11; Tue, 26 Nov 2024 14:37:17 +0000 Received: from AM3PEPF0000A78E.eurprd04.prod.outlook.com (2603:10a6:20b:28f:cafe::34) by AM0PR02CA0201.outlook.office365.com (2603:10a6:20b:28f::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.20 via Frontend Transport; Tue, 26 Nov 2024 14:37:17 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 104.40.229.156) smtp.mailfrom=stackit.cloud; dkim=pass (signature was verified) header.d=stackit.cloud;dmarc=pass action=none header.from=stackit.cloud; Received-SPF: Fail (protection.outlook.com: domain of stackit.cloud does not designate 104.40.229.156 as permitted sender) receiver=protection.outlook.com; client-ip=104.40.229.156; helo=eu1.smtp.exclaimer.net; Received: from eu1.smtp.exclaimer.net (104.40.229.156) by AM3PEPF0000A78E.mail.protection.outlook.com (10.167.16.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Tue, 26 Nov 2024 14:37:15 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (104.47.17.112) by eu1.smtp.exclaimer.net (104.40.229.156) with Exclaimer Signature Manager ESMTP Proxy eu1.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_DIFFIEHELLMAN_WITH_AES256_NONE); Tue, 26 Nov 2024 14:37:16 +0000 X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 7250078 X-ExclaimerImprintLatency: 4598957 X-ExclaimerImprintAction: c61cc340654948d1b3742b31e30038ca ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MCfH9WET2pD5xp9g8OItUvEep+6BOK6xq7QL1p/xQwV6Vc0ArrxYJvoviBAxmOd+/Fm0Sj0nkxykfGPqOjb+Wl8aeEmLx7U4c4Tjacq0YlhlliO3aSIfXW1sgCxeBIi/FI3aAuyW76NJXCWalupE2vrY32/mw0wZmW/eOGaUnxa99bzrb/wQvDzCfyvo4xPCzDcYj3P+caK1waBQ4vllXK6cdNrC2C9rsqIgMGattl4KNAS/iYF1Ky1FqtUJmoUNkHmfhLPYepasoyyHqjWcMr7vjWqrAn+HCMfqG2tbq6HJX2keTvMQUGB0SviReffu952YvXk2BH4UuvnOfWZpKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/BNJNKBt24z72NOGw6dix1ZoFXxwIL+Pq7zwWCr6+Cw=; b=ZImtRwWmdvioq4l0HtV1vLeTwkda8zEBsM7rSxI7qKEBbIW5RdTt7GOVBXG9eDDlHoEd3SCDzxkH+NcpyaB5HFf8aQ5s7G0MK0QLQPrPRtR32YwT+076Y6GQn6sS59+4Kv32xpSXDv6z0wIqaDZPYAHDMQDLi/8VM5MAcA1OSZ755Cxnd3K9E2ituaMllwMwPwWh0z+rOfbXY85vtoxrdMT6JNycTjSOO+Ie6PkpYypAWNZ3PeyQfzuB6PJUWilsmt1j9edJZ5N5quBTDZDdYqk+4u1WNkvTxVnKPQ+xyOio2g2H2YitZleF4JfUKhkMqLnnoSDlvG5a+6B+aRFMWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stackit.cloud; dmarc=pass action=none header.from=stackit.cloud; dkim=pass header.d=stackit.cloud; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackit.cloud; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/BNJNKBt24z72NOGw6dix1ZoFXxwIL+Pq7zwWCr6+Cw=; b=CxIzbVnuI1msmnsQU1rmzINrturkBV+BKRxRm3zxWupo0yVF1vy3iBP1WnksoCfVyaeWvs+57Y5JhEDzbpD/eVkr2Kq2Uif7Z9N9sJ3p3xwqT6wNwBlfyfbAuIHATMNQ+fD9zzNDx0iZ/Gb1AnSwSWqVfRq6vL23TGFcyUHCNqXQVXxV0mj6n54/5OEB84rnCEUMo6MCYnXItDvtjGv1XaN3MNJEiUKAlT/6e+M3ytdPFw4fq5Azg7r+CVHOeGzwhQOVraG8xIrz3y8sqpjdPK2huUojXD4Hrv7isuFmjj7miYERHEpCnfuRVkJ3eCg2bmbfUHQhwE4yCFcE5ZQAOA== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=stackit.cloud; Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) by DB8PR10MB3193.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:114::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12; Tue, 26 Nov 2024 14:37:08 +0000 Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::f00d:feeb:e45e:54f8]) by PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::f00d:feeb:e45e:54f8%4]) with mapi id 15.20.8207.010; Tue, 26 Nov 2024 14:37:08 +0000 Date: Tue, 26 Nov 2024 15:37:06 +0100 To: dev@openvswitch.org Message-ID: Mail-Followup-To: dev@openvswitch.org References: Content-Disposition: inline In-Reply-To: X-please-dont-add-a-signature: thanks X-ClientProxiedBy: FR3P281CA0107.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::17) To PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAVPR10MB6914:EE_|DB8PR10MB3193:EE_|AM3PEPF0000A78E:EE_|GV2PR10MB7029:EE_ X-MS-Office365-Filtering-Correlation-Id: ad0b8fd5-af71-484a-2122-08dd0e27d315 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info-Original: qM+MRq95KUyzfHvLlk+m4TC3WVo+k6TGu+CYIjm15wrE2zQvAXgzNwmdJ1avaFC+TZe2/ZFafgtY0UU1/5zKXpZlCDPHzsMOQfQOtPfz2+11aPSFCKUvXel4a5w61tiO3xfRrcpQzmCCMxFNyloendCexpMHG8lDrP1PigJHAjvcgE51v81qHhkAZp5SmzITLhnybNjW+7jR06HqvRPXk/bqHB1zJ1nDZuvP15TJ34QTwNVP2kJSyPJgDp160BDF3wVMv3NB0yOAPNygQV/Zl6Wuf2IQcGRqKX4TB7U29SilCJAxLGr7wVhXk1Lt2NJ0/aaGzPHhQvZjSRlqre76Q4Qa/44MGUPAhfQcpCE/8YcU9Iw0h7A5mvnea1XjVRGk2JTdabUoDEfFSpJCiFQS8NcpSGPTQb77Vw0X58cymzrlXLTU6as5SqtI2wauaoMjmzKXiUUbHwd10Nadnsgc3A2URTqlwanufF46mpq7GJUmKOC+t1jjpaK/3mISvh4+zTCHCR6rXwMjBNnxKcuq1r5jivmMYuUTsR/xQWeB/JRdvB659vnV+yWiy5OEkHXSfc2H8DZrK9p4IZ4536SsWvqH1N0niXDVRXx27Azz4dLhuJ2TM4BQZdNP/5ok6ozOK0gpUl2p6reHzC11PsZQYDo7GF8wWYyzjcDwYKbav/UZubmMDJ6DNfCj/EWdU0OwBbSH7iFr7sVwVOQKqoUMpA1cujB+9P2lZ1xz8G/fksTMFWGh1cqpJ0nXZPC+ElJnL7+2+mibttE7gZO0ncuy4nlEvya/fz5eK/TXP/9mQAfujbUqhf58EVSiBr+TXZRWuSE+PUlSzY+68avy6Loz0eb6R9uifGs7SqzupvNN3KzVlrvgqHv4Y6vwBuekbQiUTh4iPR/SVE5hnZk/gqUrOr8qb4G/bmQp1yHwLMGCG+xaMAMSnmJGpevcsZThURXVbGbcbmdDw9hPDbl8Xz2/NKCZjOO4Os5zI4zUjgxpY6XDZkBMVO60g5Ao2b/SqIsepk2P6LWCT5Hxm/4DNV0a7dU95yz5ud/mKHZdFIbKvhKi9xAGBvhAMJntLXoFiO8/FC0Ub21lJA/pWVhg84guZjCFM5UtstnAjjua6oWlx7BlsTlGMdj3OIamZNZ0oLqR6dkdyRaHkYglcJjhlRvcjhQENSa/yZoAUX0wIxkBEZJTqtUGqKRla7MuVwDGO5T0lyRvq8Zffz4hcdgBtr6WZPO1qpvnJIdPnw9r5fLKbcOHO6rzpXh4twXU3mimiYlPiFEYGQ20fm8ExGpvOt0xt9a+PDQPRayztUYEyArwys/EruyOBrYUVPwEcPum+mvtwsDcvpHExQgSNxZK7GV0lPl3JsVnIFs6uVtidlDdbjg= 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:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR10MB3193 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM3PEPF0000A78E.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 932f42ce-e264-49f7-b222-08dd0e27ce3f X-Microsoft-Antispam: BCL:0; ARA:13230040|35042699022|376014|82310400026|1800799024|14060799003|36860700013; X-Microsoft-Antispam-Message-Info: 1sdkduteQHb+7nmtCPwVktR10L+OQ8S4LqXupkQDpuPeniraCMK41mNNkU166Alp3wyCHVxLMyJ+fmyqcw10gqVqG18QO+8+KURro51eniy8kmi5JC1Gqnd4PfROBM7UElGlcJslXHwhYd4mHax1syosVdcW3ORrW2mrYBwzYs9p3pM8BDqJfEN9YZ2bUCZ37jOhb4y7JrzSmnqNeeDctvTC90VVNquD9HzFQsf5adB3UFqPZRl9pdzHdt7tVAkv6CbZRGzoH2cihtngDeIJznqPzh9Q8C32WRN6rutazaYyEINqoGWa3YcPErR06J72/+3kWxnhr8l/UD6iweYfOHUzny4R8+je1OssxqB9SQSidtkaP5cpdZtzQKmwJ9Q1jm/6h9GZQd9IO02jM3X6yj1v2j0fVWP65/mZFRRMqRcQ7hSWvY4RU/iMUsEZ1dgDcWKG2aEzKVHyq6LvN7PVnonSk+SAa5wf/2CebCUVIvy38XTsD/GphQQPdxUqv79kev2AyJlLLSG47cxmbN5EOcIMbpKxN6Jn2++QlieRGaoIKXfdVL4sHivTCN5BcM+nEOolHzTWYTVT0U4SXJonZIEQsg7EuNEkbYoSdtNGQaV8ygYM25j0+rSUhCbsW6CHAKbpY+gsMkGjU4aLSfah9jyHIaWps9gKvdMtDTasoUIRQFoRwvsZxgsxQy6i+jIT4Zjd5/RYwXr9xNl1rFRc7WGRW4POMkyXMS8CxfsYhds7k9MLUWF873okPMicSLTgHIprTFL9LzSp2iQVkcWNKHyonmpioOOFQ1m/UjDFNvN0ZQSEtaWRf3oElM519RoLBLaCao/Z9SnAWuG8fa/zwKS6DCHk4Hs0EX2hHVMHPA1MCCkqmqKv2xk6avqyd4MkGIEOPnDrT7TQijD1RslprpSuCHsmMtHZm+EO6ZoPWTt8XSP3bmWNhHtgU2uUp2VXKXx4sIMRisIL3RonPLYnhtS9LASldAKaMl8xgUkPrm+xFq7+gTRnRYPbhe/EI5YrSpt1zXCv3gQEDAJj0DRzP95zwXUKHRyN1xolQpww90GUAATS/GQrJXHIMWfHAOkfqLjq8FuT4Po6NFgoxYfjzhQHMGDYo5OgT47+62Xf9zpbWVSZdZ6+DVLszt6PwVxGCk8wraaSIlHfilHzeJrm66fPWQVu43mH82+eyZhqzzoPuJBTJ/pE+ypmOL/W3hK2REIMGXiJpioQvwp+ByUrWOu4KJ1dd/OnxMqFNjS+bw/q6M6S8xHr3z5gDzEnmuJ3+koRU2RTIhNmx4ZXreagolzN6gqgxykIssgdUOK6vcoIT+ZpAYDgVbz0jl+EzSaQ5CkpzOmfKoAn0NaXn1srjwT3SslHM4/rb5xcUo4CzjPEKebZd+5+MGLLiAkDCaDxbmM8um8XecznhKN2q5My5bvN2fikZ+Suhk0aliW9c8t+2GxFh3+6XV7fT2BlX9b7 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:(13230040)(35042699022)(376014)(82310400026)(1800799024)(14060799003)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: stackit.cloud X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2024 14:37:15.9525 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad0b8fd5-af71-484a-2122-08dd0e27d315 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: AM3PEPF0000A78E.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR10MB7029 Subject: [ovs-dev] [PATCH v2 6/6] route-table: Support network namespaces. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 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" When dumping a routing table from a network namespace we can not lookup interface names using if_indextoname. In these cases we switch to using a netlink request. Signed-off-by: Felix Huettner --- v1->v2: complete rework to now translate ifindex also to ifname in network namespaces lib/route-table.c | 75 +++++++++++++++++++++++++++++++++------- tests/automake.mk | 1 + tests/system-library.at | 13 +++++++ tests/test-route-table.c | 43 +++++++++++++++++++++++ 4 files changed, 119 insertions(+), 13 deletions(-) create mode 100644 tests/test-route-table.c diff --git a/lib/route-table.c b/lib/route-table.c index 06e391184..f28e08995 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -203,12 +203,57 @@ route_table_reset(void) } } +static int +route_table_index_to_name(uint32_t ifindex, const char *netns, + char ifname[IFNAMSIZ]) +{ + if (!ifindex) { + return false; + } + if (netns) { + struct rtnetlink_change rtnl_change; + struct ifinfomsg *ifinfo; + struct ofpbuf request; + struct ofpbuf *reply; + int err; + + ofpbuf_init(&request, 0); + nl_msg_put_nlmsghdr(&request, + sizeof(struct ifinfomsg), + RTM_GETLINK, NLM_F_REQUEST); + ifinfo = ofpbuf_put_zeros(&request, sizeof(struct ifinfomsg)); + ifinfo->ifi_index = ifindex; + + err = nl_ns_transact(netns, NETLINK_ROUTE, &request, &reply); + if (err != 0) { + ofpbuf_uninit(&request); + return err; + } + if (!rtnetlink_parse(reply, &rtnl_change)) { + ofpbuf_uninit(&request); + ofpbuf_delete(reply); + return -1; + } + ovs_strlcpy(ifname, rtnl_change.ifname, IFNAMSIZ); + ofpbuf_uninit(&request); + ofpbuf_delete(reply); + } else { + if (!if_indextoname(ifindex, ifname)) { + return errno; + } + } + return 0; +} + static bool route_table_add_nexthop(struct route_table_msg *change, bool ipv4, struct nlattr *nl_gw, - uint32_t ifindex) + uint32_t ifindex, + const char *netns) { + int err; + if (change->rd.n_nexthops >= MAX_ROUTE_DATA_NEXTHOP) { VLOG_DBG("tried to add more nexthops to a route than possible"); return false; @@ -227,12 +272,11 @@ route_table_add_nexthop(struct route_table_msg *change, } } - if (ifindex && !if_indextoname(ifindex, nh->ifname)) { - int error = errno; - + err = route_table_index_to_name(ifindex, netns, nh->ifname); + if (err != 0) { VLOG_DBG_RL(&rl, "Could not find interface name[%u]: %s", - ifindex, ovs_strerror(error)); - if (error == ENXIO) { + ifindex, ovs_strerror(err)); + if (err == ENXIO) { change->relevant = false; } else { return false; @@ -255,7 +299,7 @@ route_table_add_nexthop(struct route_table_msg *change, static bool route_table_parse_multipath(struct route_table_msg *change, struct nlattr *multipath, - bool ipv4) + bool ipv4, const char *netns) { static const struct nl_policy policy[] = { [RTA_GATEWAY] = { .type = NL_A_U32, .optional = true }, @@ -287,12 +331,15 @@ route_table_parse_multipath(struct route_table_msg *change, } if (!parsed) { - VLOG_DBG_RL(&rl, "received unparseable rtnetlink route message"); + VLOG_DBG_RL(&rl, "received unparseable rtnetlink multipath " + "nexthop"); return false; } if (!route_table_add_nexthop(change, ipv4, attrs[RTA_GATEWAY], - rtnh->rtnh_ifindex)) { + rtnh->rtnh_ifindex, netns)) { + VLOG_DBG_RL(&rl, "received unparseable rtnetlink multipath " + "nexthop"); return false; } @@ -310,8 +357,7 @@ route_table_parse_multipath(struct route_table_msg *change, /* Return RTNLGRP_IPV4_ROUTE or RTNLGRP_IPV6_ROUTE on success, 0 on parse * error. */ int -route_table_parse_ns(struct ofpbuf *buf, void *change_, - const char *netns OVS_UNUSED) +route_table_parse_ns(struct ofpbuf *buf, void *change_, const char *netns) { struct route_table_msg *change = change_; bool parsed, ipv4 = false; @@ -426,12 +472,15 @@ route_table_parse_ns(struct ofpbuf *buf, void *change_, ifindex = nl_attr_get_u32(attrs[RTA_OIF]); } if (!route_table_add_nexthop(change, ipv4, attrs[RTA_GATEWAY], - ifindex)) { + ifindex, netns)) { + VLOG_DBG_RL(&rl, "received unparseable route nexthop"); return 0; } } else if (attrs[RTA_MULTIPATH]) { if (!route_table_parse_multipath(change, - attrs[RTA_MULTIPATH], ipv4)) { + attrs[RTA_MULTIPATH], ipv4, + netns)) { + VLOG_DBG_RL(&rl, "received unparseable route multipath"); return 0; } } diff --git a/tests/automake.mk b/tests/automake.mk index abb0d352c..f0756f98e 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -502,6 +502,7 @@ tests_ovstest_SOURCES += \ tests/test-netlink-conntrack.c \ tests/test-netlink-policy.c \ tests/test-netlink-socket.c \ + tests/test-route-table.c \ tests/test-psample.c endif diff --git a/tests/system-library.at b/tests/system-library.at index de7f2178f..cc36efe94 100644 --- a/tests/system-library.at +++ b/tests/system-library.at @@ -8,3 +8,16 @@ NS_EXEC([ns1337], [ip link add vrf1337 type vrf table 1337]) AT_CHECK([ovstest test-netlink-socket], [0]) AT_CLEANUP +AT_SETUP([route table]) +AT_SKIP_IF([test "$IS_WIN32" = "yes"]) +AT_SKIP_IF([test "$IS_BSD" = "yes"]) +ADD_NAMESPACES([ns1337]) +NS_EXEC([ns1337], [ip link set lo up]) +NS_EXEC([ns1337], [ip link add br-test type bridge]) +NS_EXEC([ns1337], [ip link set br-test up]) +NS_EXEC([ns1337], [ip addr add 192.168.0.10/24 dev br-test]) +NS_EXEC([ns1337], [ip route add 172.16.0.0/16 via 192.168.0.1]) +NS_EXEC([ns1337], [ip route add 172.17.0.0/16 nexthop via 192.168.0.1 nexthop via 127.0.0.1]) +AT_CHECK([ovstest test-route-table], [0]) +AT_CLEANUP + diff --git a/tests/test-route-table.c b/tests/test-route-table.c new file mode 100644 index 000000000..1c72cc718 --- /dev/null +++ b/tests/test-route-table.c @@ -0,0 +1,43 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include "route-table.h" +#include "ovstest.h" + +static void +count_br_test(const struct route_table_msg *msg, void *data) +{ + int *count = data; + if (msg->rd.plen != 16) { + return; + } + + for (int i = 0; i < msg->rd.n_nexthops; i++) { + if (!strcmp(msg->rd.nexthops[i].ifname, "br-test")) { + *count = *count + 1; + } + } +} + +static void +test_route_table_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) +{ + int count = 0; + route_table_dump_one_table("ns1337", 0, count_br_test, &count); + ovs_assert(count == 2); +} + +OVSTEST_REGISTER("test-route-table", test_route_table_main);