From patchwork Tue Mar 19 19:17:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Yerramneni X-Patchwork-Id: 1913756 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=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=BQg/3cre; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=jEcX3h2c; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.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 4TzhMf20n9z1yWs for ; Wed, 20 Mar 2024 06:18:20 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 508D84148A; Tue, 19 Mar 2024 19:18:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WdH63MggzWNO; Tue, 19 Mar 2024 19:18: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 smtp2.osuosl.org 771AA4117C Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=BQg/3cre; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=jEcX3h2c Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 771AA4117C; Tue, 19 Mar 2024 19:18:15 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 628D9C0072; Tue, 19 Mar 2024 19:18: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 E3CD1C0037 for ; Tue, 19 Mar 2024 19:18:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B94ED40710 for ; Tue, 19 Mar 2024 19:18:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QHVPxMfotYbn for ; Tue, 19 Mar 2024 19:18:12 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=148.163.151.68; helo=mx0a-002c1b01.pphosted.com; envelope-from=naveen.yerramneni@nutanix.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 0091840743 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=nutanix.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0091840743 Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=BQg/3cre; dkim=pass (2048-bit key, unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=jEcX3h2c Received: from mx0a-002c1b01.pphosted.com (mx0a-002c1b01.pphosted.com [148.163.151.68]) by smtp4.osuosl.org (Postfix) with ESMTPS id 0091840743 for ; Tue, 19 Mar 2024 19:18:11 +0000 (UTC) Received: from pps.filterd (m0127838.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42JIVJAo008603; Tue, 19 Mar 2024 12:18:10 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= from:to:cc:subject:date:message-id:content-transfer-encoding :content-type:mime-version; s=proofpoint20171006; bh=gbeItb7WJze qz3jCVKjeve5xwpWD49/AkCawABch7NY=; b=BQg/3creDwvAi1XrhISfpBSEXAL 3UlODwU739n/G/F8fOMZ9vSm8DRKhHcrXvjHEwE16przWOBxFetEtv4UglRIFvw5 nzR1HUINsO8E1kvHKqKzs7ITW5uQUz63pe3hYFCl5TR7d7xmCeJIipbPjjwBOsv8 oTC/udOhgeAn3TjGWzZOoT7gwk4Bw0NJ2xjf3fe7oy4Uh4LSnBGTRXSCvQnIwCgH 6SxEVIwOEeNBpgsQGWtzcaAswNhPFGt7inmb/N+YfUKyONvD2W7yuoTkTdD2oERe BKh3E4W+G/yoiClCF0+yh3w3JydEVYrTSnEflR2XTHBeMBBjOE1L2TLK7cg== Received: from dm5pr21cu001.outbound.protection.outlook.com (mail-centralusazlp17014045.outbound.protection.outlook.com [40.93.13.45]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3wwayy6q11-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Mar 2024 12:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fp7Si817ArZ3de9EMp3DecXlHLSK7W8IdnXIBgffJdJECVX9DtgAWAJ/JwzWG55Zaacw9blC9aUMvDQtiQWuY8ciOtIdCC6CM+IVEREfa4TL1PNuDNGkIm8Wnq0AZs2fl4o5DQ1W6xWSdJe1Qq7+yQojpa+r0borDGcUBk0u6FPAb0d8B8n2KEBSuGUQu2CSYbzxMmAoQ/+LxqrLwc1D+bGF/E7JlG0m0D2wfBtuLGNxe7963NlHbxKtc83zNARfb/3fUb15/t2mzVrYX0GCGIoF55XtYsXmKrVRRHmWPmSEiMAmyOW+zn38Fj4Os04upM3W4AFWEyAMUEONHyKoWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gbeItb7WJzeqz3jCVKjeve5xwpWD49/AkCawABch7NY=; b=DCR7WtMj6UHWMWVZ6t9FDfd64xJsYF27J4mKGQp5f8qbbOPB3kzawvJw/v+BZfjXcmFKMINEr0v1NAaQs8tqL5KVRgXlNsBuwbgr0x8l00WU7UIE2v1ZIskkh8foFhyjFX/S1yQYGNs0LJGxByOXJMEiBRBGJX8qGVHsXipZZk/Aax5lIjpJBBfraulLrtC6WveQjB1b2a+WaG+KYqDqYRkGuuOY8XHn+u/VCgWATtz3Duau4GoCKl5/o4pSW0+2mohOr/J0RdSe0z04gVIS5codJ469rwAnlBCRjmcx0qzoqGMmOA37pz6sd4As63OnF0Zt65MGiTlxspJk/+56rg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gbeItb7WJzeqz3jCVKjeve5xwpWD49/AkCawABch7NY=; b=jEcX3h2cT9flV0c5QI7+dNcUPHdgFRovKiRmXpfzKU03TFnzmDF6GE24iGAToUTElhHVIhHcZufRybLEAVnrLxBsJfGzsrLR3wuwjBjF7BXgO24RI8Twc6B0YMZECTtiLIJwZq048YPCZi+tK9qOrbfIwT/GPVTh0BTrHLqjjWvLRXhimGo+9fLrx2VxwcXoR2PpXohDTrMvI8ekdpkx/CWTZHSGqN387y3GaM9u1hLRI3DGSOOabGXKmkvAjOq9LL9QV/AIeokAc6XEdvMMt6dnyWg54dnUmc6y6qi9bCaktfSHwumv+9HSrb+6suTInAx/nCYI0NQAPsxNzUUEDg== Received: from SJ0PR02MB7808.namprd02.prod.outlook.com (2603:10b6:a03:326::16) by CO6PR02MB8770.namprd02.prod.outlook.com (2603:10b6:303:141::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Tue, 19 Mar 2024 19:18:08 +0000 Received: from SJ0PR02MB7808.namprd02.prod.outlook.com ([fe80::d95e:4ad8:aa24:7c4]) by SJ0PR02MB7808.namprd02.prod.outlook.com ([fe80::d95e:4ad8:aa24:7c4%3]) with mapi id 15.20.7386.025; Tue, 19 Mar 2024 19:18:08 +0000 From: Naveen Yerramneni To: dev@openvswitch.org Date: Tue, 19 Mar 2024 19:17:22 +0000 Message-Id: <20240319191726.165359-1-naveen.yerramneni@nutanix.com> X-Mailer: git-send-email 2.36.6 X-ClientProxiedBy: SJ0PR03CA0097.namprd03.prod.outlook.com (2603:10b6:a03:333::12) To SJ0PR02MB7808.namprd02.prod.outlook.com (2603:10b6:a03:326::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR02MB7808:EE_|CO6PR02MB8770:EE_ X-MS-Office365-Filtering-Correlation-Id: f5871cec-7bbf-4242-be27-08dc48494f60 x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZD1zxjrqRE6qAc1pLrt+c/afdwJs/1EKRC2pKq0B8ZmR13ougwHL7GIh3IIBMZQXZqoCvloZWBVSxAW6AfHlM4ibffYhgFMtbV3H6TgfuR5OLWDZ/PFfyq0rYA++Ulp12naAbF3vZB4LaD3WYT9ydLmCvvApmyczXhCLH7VEfZaKKkzttHgLfjez+85EMD1zqaJ6ndA2Jm8yyidekeKHY3fRHFE3xgxWbddq6C/Uzz7eXKvr4s9uujcDfE7elQst3zeEY8Uj3KOjFJ1m1EmVm901toMxfNikqGwWsOoiYxP6t9gasm4q4FYSuYoovDEJ7DtzXiRZUNed1VLmRg7gpSOHCxGZd0LI9PGHNXXerFRfZKlBTvBtzW36YaTaHz98fq1+CT6Jah2PyM5MqkJZ4KRb5sfWbIv9vpMlMERXTV4FME8eZrOo0wMu4hs+bpiDBrIB5w1TdsEJwO42eAhkVxruRrvBALA54zqFGVBoQqmu6fmqOpqVTlINpse/6rtrH5g99WJUEe1nqtoCzbocnoX2zuDUVkit42DvuAFk6E/LWwRf19xlawx3o3UL7DFhQ+CZgZJYck76ibkjixTuT7B4stYwjukMBWh51Vx1Q/i5fYGy5Udu9lyb1vgDbbDEf8rtj2KaYaOOjZPNVIaQ6We5SNmWc7/4D+xIsj3aAViipNcjVnmbTb8ZLkDSQgV2LKskLsm+WdhMNJQ1Rb22AP226/nI0tdFStrnzLWr2vY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR02MB7808.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(52116005)(1800799015)(366007)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Z8TkwN3ojvA/I39GF3j+4+QzanbzDG9Ei6NxwKqxoCnssdxZM/yuYWw6oKDwC4ls6rHTHvpHv5VDo9ff75P9ABj/hMQBw5TEaXS1m6FJoxdV/WCOagYwzdf2c8xsfDgOZFbcWefMWoiVqIpU6BkX/ltGoN8dQzNPXfJwLV2HevjtvJ/dp/ICsP3+kG7YBKHtAC57jTSJzN1iZ1wkKu54llLVgpWenTLtnxFxq9F5CxAom/NZ2C1SGA23FCMbzwOkF3ROWJ2BWOAtbisGz64QVguSI7l3HCgNnlFF0Bt5dOqQMd8zohKDcOuJU8f6EXDdclKPZccJMXKeqDhAwxtKhw24dF60qNyZbPubZdj6cfQh22PJmUZN7I3QCg2BKJA7fuZLje+90PNTfp3HVwCgoSZTtYfGXStm1F4iTy15gRl0zRZV8LN2HAsii4+rlZyWZk/q62ATTYLfFFc8wsZGMvc3SfwIeAEm7I0l1mgkIJflSn8xuEp12mkHkn0kTOYmwS10NyVtl5BP3QBkvM3touboly4nswgnLlDKf5Ww1jQl89/n6RQ9KzisQnIh6m9uVfcXRswfVubJtRllh6WTSsuvltkFMhV6j8vkykkRGcDuhQNQHcIypBxzYuvcU99Xe+MVY9cIz7P94hmy4CRA+ZOWAPuNf/TxqSnZsD9XpWaAaR6cLqouTSRMafJvfsZpeWXs61VHm9Dc7uRDWW/QMwxweASnnM1kWqx4lFTn9S/odNMyMuG4mjA5NT88aEck2f7ndrR+TKU4TPESsOzSnvIST45XpXvutiDpudj0JS5nL0F22gmnWtzA4dCiZBpnLxAOURb7UPfIKPoHzRkfmzYwI8fGG9IKBp90roaQvDHrfqMu1l8+w/+mwINfWJlGlghY2HOWWQMDyIE/bNi+BgcVHgizkwocZ7yAixmsfleT51+/WwggjFTm9nHIGeF4UEmsTDFLdGV48JbRAXis45gTNCglkhk7rzCnag4MonXWAqKQPjnyhCgHU2rIycAjuaTIjxjri6vgiRaw5K+1THvIfihB3D7RVpYG3KTDY9gnX3x9PvAIyREcAVFrEHV4A9UGW1nXd1YZM+Kj7w95iB9fc0noOXKinXVv3Bb/fIEQJgoIt9BxucZytOKlv0XMWwaUAH2ILe8AD7maA8/dd5ghlSsG9qVWt6Q544x+z6P9Dw4NgHcfu6ok0MNu7RJGJktR+0voIgo6AIKiNapiHiDDj53tecMfqrVXpiAWjiWssUzE0D7yYWFWCzgYhNHyT0aS+OqIsNcKzeyrAaG1SGt+Lg/K+oTS+fCMNG8lL+XbX8Nm6zDmB820CwwgaPh40w4Lb4SQuU184h1dNYMjFEB3cPq5+fzJ5R6pqzfTd4B652NlD7j6IwBpd+FGBiSG1jFlQFTRXS1kdqJRRDNWRr7AoEO3SXZJETYuNnyaVzQurNtg1Z0jNs5SDwykKDzPBUlg4kNz1ZhPa6I3oiADvh1QEfNfjabmwYFQXNYmd3t7pmSPr+3q2SrMguWJ7d8navxxYpwxbkPBeXZiEuYHlxpZtmY12oED5+1kNFcePcrkcYav0D6+XyB+KAu5ybZUI0BFDrRJmORqby/p3P3qQgzZxo109E6ckmdwU2U3DE8= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5871cec-7bbf-4242-be27-08dc48494f60 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR02MB7808.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2024 19:18:08.2772 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8zdUvDg6NkG4XAg4Dohm7Jybt+qg8M5SLIVXfkVnfhNPGPcJ3cHkHbwEY3AArdIWMhFUdnpcZHRdz/BnTA61YKPCpnWB6viFPmR/dltRawI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR02MB8770 X-Proofpoint-ORIG-GUID: MNlywB9odwr0ShXb2tISvKmBOFLGQD6x X-Proofpoint-GUID: MNlywB9odwr0ShXb2tISvKmBOFLGQD6x X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-19_08,2024-03-18_03,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Cc: huzaifa.c@nutanix.com Subject: [ovs-dev] [PATCH OVN v4 0/4] DHCP Relay Agent support for overlay subnets. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This patch contains changes to enable DHCP Relay Agent support for overlay subnets. USE CASE: ---------- - Enable IP address assignment for overlay subnets from the centralized DHCP server present in the underlay network. PREREQUISITES -------------- - Logical Router Port IP should be assigned (statically) from the same overlay subnet which is managed by DHCP server. - LRP IP is used for GIADRR field when relaying the DHCP packets and also same IP needs to be configured as default gateway for the overlay subnet. - Overlay subnets managed by external DHCP server are expected to be directly reachable from the underlay network. EXPECTED PACKET FLOW: ---------------------- Following is the expected packet flow inorder to support DHCP rleay functionality in OVN. 1. DHCP client originates DHCP discovery (broadcast). 2. DHCP relay (running on the OVN) receives the broadcast and forwards the packet to the DHCP server by converting it to unicast. While forwarding the packet, it updates the GIADDR in DHCP header to its interface IP on which DHCP packet is received and increments hop count. 3. DHCP server uses GIADDR field to decide the IP address pool from which IP has to be assigned and DHCP offer is sent to the same IP (GIADDR). 4. DHCP relay agent forwards the offer to the client. 5. DHCP client sends DHCP request (broadcast) packet. 6. DHCP relay (running on the OVN) receives the broadcast and forwards the packet to the DHCP server by converting it to unicast. While forwarding the packet, it updates the GIADDR in DHCP header to its interface IP on which DHCP packet is received. 7. DHCP Server sends the ACK packet. 8. DHCP relay agent forwards the ACK packet to the client. 9. All the future renew/release packets are directly exchanged between DHCP client and DHCP server. OVN DHCP RELAY PACKET FLOW: ---------------------------- To add DHCP Relay support on OVN, we need to replicate all the behavior described above using distributed logical switch and logical router. At, highlevel packet flow is distributed among Logical Switch and Logical Router on source node (where VM is deployed) and redirect chassis(RC) node. 1. Request packet gets processed on the source node where VM is deployed and relays the packet to DHCP server. 2. Response packet is first processed on RC node (which first recieves the packet from underlay network). RC node forwards the packet to the right node by filling in the dest MAC and IP. OVN Packet flow with DHCP relay is explained below. 1. DHCP client (VM) sends the DHCP discover packet (broadcast). 2. Logical switch converts the packet to L2 unicast by setting the destination MAC to LRP's MAC 3. Logical Router receives the packet and redirects it to the OVN controller. 4. OVN controller updates the required information(GIADDR, HOP count) in the DHCP payload after doing the required checks. If any check fails, packet is dropped. 5. Logical Router converts the packet to L3 unicast and forwards it to the server. This packets gets routed like any other packet (via RC node). 6. Server replies with DHCP offer. 7. RC node processes the DHCP offer and forwards it to the OVN controller. 8. OVN controller does sanity checks and updates the destination MAC (available in DHCP header), destination IP (available in DHCP header) and reinjects the packet to datapath. If any check fails, packet is dropped. 9. Logical router updates the source IP and port and forwards the packet to logical switch. 10. Logical switch delivers the packet to the DHCP client. 11. Similar steps are performed for Request and Ack packets. 12. All the future renew/release packets are directly exchanged between DHCP client and DHCP server NEW OVN ACTIONS --------------- 1. dhcp_relay_req_chk(, ) - This action executes on the source node on which the DHCP request originated. - This action relays the DHCP request coming from client to the server. Relay-ip is used to update GIADDR in the DHCP header. 2. dhcp_relay_resp_chk(, ) - This action executes on the first node (RC node) which processes the DHCP response from the server. - This action updates the destination MAC and destination IP so that the response can be forwarded to the appropriate node from which request was originated. - Relay-ip, server-ip are used to validate GIADDR and SERVER ID in the DHCP payload. FLOWS ----- Following are the flows added when DHCP Relay is configured on one overlay subnet, one additonal flow is added in ls_in_l2_lkup table for each VM part of the subnet. 1. table=27(ls_in_l2_lkup ), priority=100 , match=(inport == && eth.src == && ip4.src == 0.0.0.0 && ip4.dst == 255.255.255.255 && udp.src == 68 && udp.dst == 67), action=(eth.dst=;outport=;next;/* DHCP_RELAY_REQ */) 2. table=3 (lr_in_ip_input ), priority=110 , match=(inport == && ip4.src == 0.0.0.0 && ip4.dst == 255.255.255.255 && ip.frag == 0 && udp.src == 68 && udp.dst == 67), action=(reg9[7] = dhcp_relay_req_chk(, );next; /* DHCP_RELAY_REQ */) 3. table=3 (lr_in_ip_input ), priority=110 , match=(ip4.src == && ip4.dst == && udp.src == 67 && udp.dst == 67), action=(next;/* DHCP_RELAY_RESP */) 4. table=4 (lr_in_dhcp_relay_req), priority=100 , match=(inport == "lrp1" && ip4.src == 0.0.0.0 && ip4.dst == 255.255.255.255 && udp.src == 68 && udp.dst == 67 && reg9[7]), action=(ip4.src=;ip4.dst=;udp.src=67;next; /* DHCP_RELAY_REQ */) 5. table=4 (lr_in_dhcp_relay_req), priority=1 , match=(inport == && ip4.src == 0.0.0.0 && ip4.dst == 255.255.255.255 && udp.src == 68 && udp.dst == 67 && reg9[7] == 0), action=(drop; /* DHCP_RELAY_REQ */) 6. table=18(lr_in_dhcp_relay_resp_chk), priority=100 , match=(ip4.src == && ip4.dst == && ip.frag == 0 && udp.src == 67 && udp.dst == 67), action=(reg2 = ip4.dst;reg9[8] = dhcp_relay_resp_chk(, );next;/* DHCP_RELAY_RESP */) 7. table=19(lr_in_dhcp_relay_resp), priority=100 , match=(ip4.src == && reg2 == && udp.src == 67 && udp.dst == 67 && reg9[8]), action=(ip4.src=;udp.dst=68;outport=;output; /* DHCP_RELAY_RESP */) 8. table=19(lr_in_dhcp_relay_resp), priority=1 , match=(ip4.src == && reg2 == && udp.src == 67 && udp.dst == 67 && reg9[8] == 0), action=(drop; /* DHCP_RELAY_RESP */) NEW PIPELINE STAGES ------------------- Following stage is added for DHCP relay feature. Some of the flows are fitted into the existing pipeline tages. 1. lr_in_dhcp_relay_req - This stage process the DHCP request packets coming from DHCP clients. - DHCP request packets for which dhcp_relay_req_chk action (which gets applied in ip input stage) is successful are forwarded to DHCP server. - DHCP request packets for which dhcp_relay_req_chk action is unsuccessful gets dropped. 2. lr_in_dhcp_relay_resp_chk - This stage applied the dhcp_relay_resp_chk action for DHCP response packets coming from the DHCP server. 3. lr_in_dhcp_relay_resp - DHCP response packets for which dhcp_relay_resp_chk is sucessful are forwarded to the DHCP clients. - DHCP response packets for which dhcp_relay_resp_chk is unsucessful gets dropped. REGISTRY USAGE --------------- - reg9[7] : To store the result of dhcp_relay_req_chk action. - reg9[8] : To store the result of dhcp_relay_resp_chk action. - reg2 : To store the original dest ip for DHCP response packets. This is required to properly match the packets in lr_in_dhcp_relay_resp stage since dhcp_relay_resp_chk action changes the dest ip. NB SCHEMA CHANGES ---------------- 1. New DHCP_Relay table "DHCP_Relay": { "columns": { "name": {"type": "string"}, "servers": {"type": {"key": "string", "min": 0, "max": 1}}, "external_ids": { "type": {"key": "string", "value": "string", "min": 0, "max": "unlimited"}}}, "options": {"type": {"key": "string", "value": "string", "min": 0, "max": "unlimited"}}, "isRoot": true}, 2. New column to Logical_Router_Port table "dhcp_relay": {"type": {"key": {"type": "uuid", "refTable": "DHCP_Relay", "refType": "strong"}, "min": 0, "max": 1}}, Commands to enable the feature: ------------------------------ ovn-nbctl create DHCP_Relay name= servers= ovn-nbctl set Logical_Router_port dhcp_relay= ovn-nbctl set Logical_Switch other_config:dhcp_relay_port= Example: ------- ovn-nbctl ls-add ls0 ovn-nbctl lsp-add ls0 vif0 ovn-nbctl lsp-set-addresses vif0 #Only MAC address has to be specified when logical ports are created. ovn-nbctl lsp-add ls0 lrp1-attachment ovn-nbctl lsp-set-type lrp1-attachment router ovn-nbctl lsp-set-addresses lrp1-attachment ovn-nbctl lsp-set-options lrp1-attachment router-port=lrp1 ovn-nbctl lr-add lr0 ovn-nbctl lrp-add lr0 lrp1 #GATEWAY IP is set in GIADDR field when relaying the DHCP requests to server. ovn-nbctl lrp-add lr0 lrp-ext ovn-nbctl ls-add ls-ext ovn-nbctl lsp-add ls-ext lrp-ext-attachment ovn-nbctl lsp-set-type lrp-ext-attachment router ovn-nbctl lsp-set-addresses lrp-ext-attachment ovn-nbctl lsp-set-options lrp-ext-attachment router-port=lrp-ext ovn-nbctl lsp-add ls-ext ln_port ovn-nbctl lsp-set-addresses ln_port unknown ovn-nbctl lsp-set-type ln_port localnet ovn-nbctl lsp-set-options ln_port network_name=physnet1 # Enable DHCP Relay feature ovn-nbctl create DHCP_Relay name=dhcp_relay_test servers= ovn-nbctl set Logical_Router_port lrp1 dhcp_relay= ovn-nbctl set Logical_Switch ls0 other_config:dhcp_relay_port=lrp1-attachment Limitations: ------------ - All OVN features that needs IP address to be configured on logical port (like proxy arp, etc) will not be supported for overlay subnets on which DHCP relay is enabled. References: ---------- - rfc1541, rfc1542, rfc2131 V1: - First patch. V2: - Addressed review comments from Numan. V3: - Split the patch into series. - Addressed review comments from Numan. - Updated the match condition for DHCP Relay flows. V4: - Fix sparse errors - Reorder patch series Naveen Yerramneni (4): actions: DHCP Relay Agent support for overlay IPv4 subnets. controller: DHCP Relay Agent support for overlay IPv4 subnets. northd: DHCP Relay Agent support for overlay IPv4 subnets. tests: DHCP Relay Agent support for overlay IPv4 subnets. controller/pinctrl.c | 596 +++++++++++++++++++++++++++++++++++++----- include/ovn/actions.h | 27 ++ lib/actions.c | 149 +++++++++++ lib/ovn-l7.h | 2 + northd/northd.c | 265 ++++++++++++++++++- northd/northd.h | 41 +-- ovn-nb.ovsschema | 19 +- ovn-nb.xml | 39 +++ tests/atlocal.in | 3 + tests/ovn-northd.at | 38 +++ tests/ovn.at | 258 +++++++++++++++++- tests/system-ovn.at | 148 +++++++++++ utilities/ovn-trace.c | 67 +++++ 13 files changed, 1560 insertions(+), 92 deletions(-)