From patchwork Wed Mar 20 14:39:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Yerramneni X-Patchwork-Id: 1914128 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=yeq+tA6+; 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=nyErL8h9; 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 4V0B8M25rmz23r9 for ; Thu, 21 Mar 2024 01:40:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 0AE0A60BEB; Wed, 20 Mar 2024 14:40:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OS17w36Fxtyv; Wed, 20 Mar 2024 14:40: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 smtp3.osuosl.org 5493D60662 Authentication-Results: smtp3.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=yeq+tA6+; 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=nyErL8h9 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 5493D60662; Wed, 20 Mar 2024 14:40:15 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 27F1CC0072; Wed, 20 Mar 2024 14:40:15 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 53560C0037 for ; Wed, 20 Mar 2024 14:40:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 35896408E5 for ; Wed, 20 Mar 2024 14:40:14 +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 fQXZUxLrhrpL for ; Wed, 20 Mar 2024 14:40:13 +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 8C46C408FF 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 8C46C408FF 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=yeq+tA6+; dkim=pass (2048-bit key, unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=nyErL8h9 Received: from mx0a-002c1b01.pphosted.com (mx0a-002c1b01.pphosted.com [148.163.151.68]) by smtp4.osuosl.org (Postfix) with ESMTPS id 8C46C408FF for ; Wed, 20 Mar 2024 14:40: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 42KAGiM9028024; Wed, 20 Mar 2024 07:40: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=j4A88XMKm4q E6c1sS6o9yvqJvO6tNWbYII/ZM4HaoDw=; b=yeq+tA6+IycJVPJPM4ltX+baJKn a5QcnH4f/pRkwhDVnim2/8WE47vht1lbK8/Pv22lUjNJLTSi3Ty2Z9kyknunIQXb RF21hwGgNXDgdgQERg/av02e+imsDunc5kyjwF8H/iElwxTzHTfOUvPcjqE//I5I 9pA8rT9OoLfsUwj6V5vIShgYi+EMv5dj+MaxWylKH1k5nqFcWG0qtGDRv2avEPmU 79QBCY0VdO/Y2BW8MF2OL1GlKddN5E480pNHyiTriZEqU6ZSVmIvPU8Np8jqODht R7uVtKYwHLgRSRrSQXG8cS3r67VhayfumvEYxRpSAdxwbvSf3yRaeVeJp6Q== Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3wyhqmstx8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Mar 2024 07:40:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KRMjfkMnzTqxMe/6qp3B1o48nE3v/KnTDtstagkvTjTXSw5zHN2sdQLF01EiIWpCkb0RDcByV1AvpzfAh9lC0t4+WT+HQYSHj9quyVkXvrKHYJv0+UnJcgc/yav0N70MB6XyxuyeP90ueCMaMUG9rU2nzCqqQ0JZ40xdSiPWtzbOy21K4F2g2zjDoSF1eMXwYDcaWpOKm+RPsaYny4qWWIHegwNE5Vu/ssMqzDK4ny7PK+zM4PJ+76vAlgXJ0XMvpCh1SzM5fi2gcxEf9OHTykvqdQR0MM6Ok3OhgB0mSAE+sKlbOtxWtwiWFExXcCrAsCRqJCmcgOLScz2kxmUVtQ== 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=j4A88XMKm4qE6c1sS6o9yvqJvO6tNWbYII/ZM4HaoDw=; b=JOVGot9tqqHg/AFVio51yYSnnIu9TZUaIFBUL55myrt0CsA8RgycpMpJCl2cVxZYObnr2lTH8JhXHupr7Ic2qVbE4oJ255qYuTdNN3BpjU2S2DJ3tulyMSLIuw3cAi689hDKiUm3+Y+pk6ubp4vsLbxTcKknk3po1+gKmjhp2T03/gCEmjtvzngA4DTxtKFsY8wDtajdZ+FWcneFiRb73PM4uMw21gPnKA+RjL5gAm2tF4vU0yQe1G0JlNoDvBsHX9qN9lx6d+1YJElHz3LisFOW4J89HhUWaceOeQiAhRAkfQpiDMbg9RKDziF43ePX4vPmK2+oXOKUPgmSi4T7Iw== 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=j4A88XMKm4qE6c1sS6o9yvqJvO6tNWbYII/ZM4HaoDw=; b=nyErL8h9/XPwlsDQzvSvstz4tfzQSurNKKQ87x8jWapSF0ST+jYikGyexs9GSRHDcYf+3BMKSujQi2LzAd7iLGjJFiTxau0VPiPRT1Gk/FUYGX0qYBYr30H3eeDDLxMRX768AKqR4ed7DdkthCEpFVPYBIIY4wgHCUz/jwSuUgJuEwtVXPTqOM7jhgNohHl6xiNT0gXzP46FRqyGqn5RAIaBtftA+t16DPIXs/+OKdAVzlag8msTFz6V3VPKiABVh0wB3BFPi03S2U9RG0yNc1U8fbFklnD1dz96JACDmL9gy+e4RJ58suGc6gMr1inN7QuWlne4ylZ+hHT2bC+63w== Received: from SJ0PR02MB7808.namprd02.prod.outlook.com (2603:10b6:a03:326::16) by SJ2PR02MB9705.namprd02.prod.outlook.com (2603:10b6:a03:53d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.31; Wed, 20 Mar 2024 14:40: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; Wed, 20 Mar 2024 14:40:08 +0000 From: Naveen Yerramneni To: dev@openvswitch.org Date: Wed, 20 Mar 2024 14:39:54 +0000 Message-Id: <20240320143958.39052-1-naveen.yerramneni@nutanix.com> X-Mailer: git-send-email 2.36.6 X-ClientProxiedBy: PH8PR15CA0005.namprd15.prod.outlook.com (2603:10b6:510:2d2::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_|SJ2PR02MB9705:EE_ X-MS-Office365-Filtering-Correlation-Id: 958fb4e4-e99c-4b42-5361-08dc48eba3a7 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: 77Zs5hdBj4bztVUCkLDuHvVjit8KeIgKXlaQJjlnuPikkvTODH9Ll5S4D1/CcuTq80Uwjp27kbPZ1tT5DYK8s790V3rho110wipYU5yiji8d8ke2NQBp5Hl3lKWDVRSMhSyaYjxZMnMyIhojQph+urwhdAp1+rqgmY4n7UN0ksX8XSn4KkwYn1/5kGwkIP0ZemdHnBOdUAvqQvgWetlDxpiRHD2140OTmwRPj4YMwujtHt3jBMNINLkocRCqjEBftbryWL8ibq9rfji8DGFQRSOwXlHGkopv2/uXS/6vukdSJjHkKYua4l5yvaPAUckV+B3bV9hjbpXzEGikXbnQbBDGRdlYIZCGFFn5igch7vkPSK4nMvd/4NhjRv833umfTEXlYurEGbqcHLTIwz2/6HCGwLTTLNqWRL3RRPf5diXALgFPKa+J2Yy0b3DeqWNGALhGERHg4GWg9WgGAFN4+vW/pNIFeyv+2iOLMA332Wl0gkcJJosEJpha4kKdLsYxSmPA1RRNNEGEJ5HAXUcgHXbHwpwFQ8Uoh6l65SmNlT6Do9pCI6l88Id7IkDIp88oCiZYpi2IbjDF3INX3R40JagVJGmK/359NdefTNDG2jymxaICv9lno1sZN3efWKAuTagM4nCN9ZSDHdIK+N0/HYEKNwPBBneSAz8Un2xi2Z9u25g2A52ENkPfPLO1uFWCMSPyUVNuD8Aoje+7/QF8ILAmeThrf9WpHGovmHPTX+A= 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)(366007)(52116005)(1800799015)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QwSty7JxLlGYTP9mTkr1/c0NuiKnWF2a/3EGPQpAAUNml6KleokH3OeSjLp6I0R4EhZ3L2F3fGaaE1aS98/Ctpc3u0KYT6QXblRb3jb1ig5wJ/gH8rFW7TTb0lYWTxbAnjRVhE8+3oMWig+x5yYKAvPvhPyalOS6g2V0OQl6Az10zI3Ay/IEfbSYYCw3IpRSPHjAKHCVDL2PQ/p+AGVsB1wXWOMEquZmvijhpbIJqzmjV5TtOUGFOBddwBuuVKAcb2eynalF4Cy1fkKI1b/NiZVk+PDPutXjSloqjJ5/vgWnvAFKjdQEXfc37p9NqcU1MS77mcRkyp64kKZrOfHMx4FHabsyiEiAUHRcPaZyp/Av/eFuojL2yOiChp+jLYoaIRLI1vXq/+u43XPJrWvENzaA2jM6ZLnw8gwaUEyh6dv6I+tzXSUhTc27s2eX/p+Dw9b+Ikw5kqW82aBlZFINuhdyvkpNnnhpZwcfdoZI2QhCsPtA6rC1g2yNhlXEVzANgx9AUJZcgtHGh5JX5VqGSD9mvfz9Jfz4UZGfaz13ZZ6VlYTSYPGkg8LNen4c5aXIDPpgj2u7UCPk9QmgmG/+V+eIeuXYUvay7SYW5X3A/lzk5oXHBH/X3+Qg7OXS7PSs4jmucDe+L+aQv1WMKKlm2qaRpCRiEO/hh8kWIn8+n/CWNltfxtVNEobycUkktiG3HYZ6vC+ziBMg7Hs1683szJeKE7attbQMaWmOwE3k84umtxg6wSmKpO5LWNi75/9TM1spaI5XkKC+8OnCZq6PVh/QzSNMdPYZo1GX+2YyYuaB/SqxQyO5yX4hth4p9Y5XcFpcYt6uCDU0Eyel7w8upkYVkn2L5+U2/Hn9TdudFXnYgRh1GeLhSDf846NcOpHzQBL/PAKtt6fKj9tA5JF1RVHC8ZtYORHnylyX+3BkHDJio3YxkV181jluuPXCwHUAfj+EEZ6Sm8f6RejYNqD1RFFO7fTJB7hoJqTbptZmimrYOyHn+RNnUpANBBBPF2hO2jTRgYgeSyAilyslStLzYUlVa9uCLNXDC0ei3qhUaxbkkLpr1DNKxMq7ogXiOcCvodGubj9sO8cpv6HYYW/3hNHVPpbpRa6Tz4PLFaCYTm+0o2wtlgGr4zLXLjnU+q0bqLlQ0udRx9HxZQDxc1hXUCh6RoCQKdwJnVQJSs5OkkahjbIml4Dlgv6CIgBnWBylxzJ+jZNJCK/9sq3ndoGnr5hfocQYqLUrZlYnW/7qoacXrYq8EJZXb5a+heuRL1HbBkX9F+wNbE4lZ5Dra1StPXe9jlRrY163BKOIl7s53pv+NAATDSt9wFmePgrEF88ON4g1rEvfK5/PNODCNNbZ+/yQMpbiSMemQNwKL7GmUoQ8xJMRrxCsjg5CtpBVlnPn+ow5Czr/TkzHMxdxpBm0WKgXmiGPfRazdblEK6//MNFI3e5qsH91ZQWawqyn+VHp/qipQEIDjQRg89BhFnwbGgNzapyK/yv4qEfQBdG7y7mJWIa2GMYIlTxnrc63tsec2Ef9moTq5loS2AWlHoD2APBOgWWvBuJLeuzoNwo/DyagAVtu/WhRSHIwi22n7uj7HtJKEUDn8HnTB6Ok7fce5m933PZ5SaCjwDas2FwNlYU= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 958fb4e4-e99c-4b42-5361-08dc48eba3a7 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR02MB7808.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2024 14:40:08.1783 (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: g0SDnD/MGClzcuN5P1g6SOcI71m3SIJ3CGcFKnpiANO4VHXXwWLJW8pSbaZ9976y01hYDA1IZ9ReugZS9lYspcvRwGtQMV0K/RwngFGhMR0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR02MB9705 X-Proofpoint-ORIG-GUID: 1hGOhSoYuyDgTSUlA_HRparvRECX4Lxv X-Proofpoint-GUID: 1hGOhSoYuyDgTSUlA_HRparvRECX4Lxv 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-20_10,2024-03-18_03,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Cc: huzaifa.c@nutanix.com Subject: [ovs-dev] [PATCH OVN v5 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. V5: - Fix test failures. 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 | 271 ++++++++++++++++++- 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, 1566 insertions(+), 92 deletions(-)