From patchwork Tue Mar 19 07:54: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: 1913390 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=MqbspuPm; 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=QF85crIq; 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 4TzPCd72wYz1yWv for ; Tue, 19 Mar 2024 18:55:25 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 79D6860A49; Tue, 19 Mar 2024 07:55:19 +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 CZrg0t7yWcFJ; Tue, 19 Mar 2024 07:55:17 +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 9E72360A3D Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=MqbspuPm; 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=QF85crIq Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 9E72360A3D; Tue, 19 Mar 2024 07:55:17 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6B95FC0072; Tue, 19 Mar 2024 07:55:17 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id F1906C0037 for ; Tue, 19 Mar 2024 07:55:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id E5ABE60A39 for ; Tue, 19 Mar 2024 07:55:15 +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 7c1Aj7JH_S_p for ; Tue, 19 Mar 2024 07:55:14 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=148.163.155.12; helo=mx0b-002c1b01.pphosted.com; envelope-from=naveen.yerramneni@nutanix.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 61E2E60828 Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=nutanix.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 61E2E60828 Received: from mx0b-002c1b01.pphosted.com (mx0b-002c1b01.pphosted.com [148.163.155.12]) by smtp3.osuosl.org (Postfix) with ESMTPS id 61E2E60828 for ; Tue, 19 Mar 2024 07:55:13 +0000 (UTC) Received: from pps.filterd (m0127844.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42IHN2vL014341; Tue, 19 Mar 2024 00:55:13 -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=xBm7dwrMYQn 16nObIOEJNAnq4M5zOKlBx/S5vG/s9GE=; b=MqbspuPmB+NZFNWHHML3zyrtfZW fL3SkL4P7EgCfsRi8sObKOqQ6xVGYWVL+79vmsBXq30+2UWI1eCF6PgCB0u0uLVi bgk4DB14VLSu3bWdJh5alZ2OHXKiG9chCUqClYc471U2ASx54GQ4DprNLbxWHRCv fK8oNriwFPtEPY8o0ouIS6UOM3yAyZhO4iEIZH8JJ4HDuBtBYKNty4KDrBKyAN2+ gJg8jON58rqNsxm5SNHNzrpHCZ5QmajOp/zpvMp6aTz2IN0qFWj+pRlPaUt08Uv8 gNnFJLekGOvdvRBipjqbt5O8hDmanXy4iOyazILi0O0AAwMWIFV9LeV0jDQ== Received: from byapr05cu005.outbound.protection.outlook.com (mail-westusazlp17011010.outbound.protection.outlook.com [40.93.1.10]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3wwaxx51cx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Mar 2024 00:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KWQ7PAIgzZvpNfOtlcVvBCP6lSfE2F8w4STuOLHr17NPVZdDmY2ZxbfIpLPpdZrg6dkWKFRtPhUMf8DBR2dCqMHDc11MWe7PMgMC4DVJCZb8W2Y5zXFTqXpAKt8mZyq8Tv3/mcAPb4lbknXntKXxfYkmk3WW+kbk4b5jE7mZteGmYbDBiH81C8Z9binqPHmkVq2/dqALvXtbCfMT4z7tiOkIFpO51IBJbLCd7gtBnGOp0d4ipJ3OQT3+JU2SixOWwpNuBAXF3RzYw7ydt+gh+khKK0pBOsZFJNVEZUUX7QYwRKQb7C2sfe65OxMBVdCYkMymDbO25M4P44E12zEiuA== 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=xBm7dwrMYQn16nObIOEJNAnq4M5zOKlBx/S5vG/s9GE=; b=gaPS4BDMLqhqrQQ0mznxk8ilO/Z9CxhxVGQzjCQbBtnhkif1ebeMwJn5jKRc1+dY3/1m/ksHeVShSt1Rqk8Ki9NSi8j141XUDsZKelc5g6miLF7F2DkSEnwgMWkjH08ALVeZhJnElW1vl130goQbvksUlLGeuO+T4pC9Gt7Rw6JT1jmfvUgl6y8QJraV7rQKZBapjl5QoJ1PQVk+63CNfiQsMNp4pTJj1QsiADIPSnOWs7su81ZzoB6P7nBNdDj61oI+EBGEc1d/5uPWQhyXXqepLKp9KnhFb0rBtXM5pQ0fCCFSUQFYS6HHZ4O0b7KYMN1Tp1ombbViwnEnpCsa9w== 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=xBm7dwrMYQn16nObIOEJNAnq4M5zOKlBx/S5vG/s9GE=; b=QF85crIqugHhuZAQWuYRQv00hlecFbNpaCqu4d8hJOc9YEv/ydeAerNo6xJpv1XJt9qu3NAEh3kKKdtvFmx9OmmipRfuzfUsFxJiB/wPLVDhrD83qAUg6a8iDZMZwXHTTsOxDSvo/UsuEl54trK6dIj0N96ufIm3vbuveG4ku5u5PdX+zEEi8FZ2AIma5Kfv/ktviHXKRLW2dOqkGUc3Mk1Ccq0/m/LTx4jtGerMGYXSaYo62G0Yel3qYNjFs37VxC1sMjeh0oEb7r6UFD3Ubo7fmoEX/Pf6gllS5Qb1nkn2m3qsa+2s92L36DAQq7LkuLyM6qwS+wlzeFsRBD9IYg== Received: from SJ0PR02MB7808.namprd02.prod.outlook.com (2603:10b6:a03:326::16) by SA2PR02MB7788.namprd02.prod.outlook.com (2603:10b6:806:135::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.27; Tue, 19 Mar 2024 07:55:10 +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 07:55:10 +0000 From: Naveen Yerramneni To: dev@openvswitch.org Date: Tue, 19 Mar 2024 07:54:54 +0000 Message-Id: <20240319075458.49166-1-naveen.yerramneni@nutanix.com> X-Mailer: git-send-email 2.36.6 X-ClientProxiedBy: SJ0PR03CA0201.namprd03.prod.outlook.com (2603:10b6:a03:2ef::26) To SJ0PR02MB7808.namprd02.prod.outlook.com (2603:10b6:a03:326::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR02MB7808:EE_|SA2PR02MB7788:EE_ 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: V1BVylstmvuvcNlfcP0YEobnDSWmzotBwQ96pYemhE+hxgZV94UgTK/o3shBj/YCdzkgZHR3RGIA5i0mBD9oMrJA/70ggScY1o4+5jb+VLzSrVu+fhoaFAga1wcWyszdma5d+/tVvZwgq7BjiqbNjo5DPCpFiWSu5qlB1gQqd3wJ0BzwYzJKsGfdk9VMaWJitDf23xj/hWqfEzOglyauvn9KXN9A/ko2ylKv4gEVvxWElL2z+D6Sz3xhxkV7xm4UWdvfmYO0PRS1O5dVXectAGOgVyjRVqwj7rNXHBKGlojptyLMHIJ0XpxU+ghRy+TsqJe8J3JmCRGfVv6Svvm4Oe0hTdYnWu0d4Z9HWqED57OJY+pHXIG1QfsO9Akf6ShtU306kMmY2/sg238adMomNcH14HUVRVpn4rzzsHnj8ecyfBbaYNhILIkyJRnBcfPziSY1Z5sIZx0D0gbO3mXWUdu6qFaeLwG/FZVntFm+1hXBajfhW+js81yx/WTic8DCGjyAzyhfLPOQn4xisKdrFP6HtLheqVNtQq2eDJ2lpPAfe+NOycGFlK79o9/MdPMRRS3MnUKRBZlB28lAspz70DiTooc1XvVbBvO+vn3cqpVwA4ek0GoBO4Y7y8tAx5NfitYeWI4vXW3+JF8oQzlZwSLloO9NO1GuDZWM6K69k/LCxJLidCPdFDefBxecGkYRULi6/TxMi0rOLyY+Lk6HMaG9u6D3syQ3WFpUuVZj8tk= 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)(1800799015)(52116005)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BVP+8p4KkZbkU11+sweJk5qiNWKqtImYNKCMEnIHzQe1sHC2FHccGM/xRX+YBzLm4VexDE5UDiZA4MFfnYrm9I9hjvmQH3IcBWpHTpeHVfgB83B++T8bGuO9k3wkCk0Zu7+TIoK1T91G70so+ao1e0/+Ss4xVDznHe4NjU1HYCQmLQu4fy5wsFjeYQyaRRQR3EorcD62cbZ5Z/5V6eC0CAMKB5anOImEqfN+MEKZDUpdb3qmofKiYzB6MhiLEADLsNwCKt5YyHaGKuYj2HnOntf+F3E4EW+mOna+8ck/VZYu2J50UP4PGQlJCQH7pe3TCo4NJbuHttp7k44qKVRcjzNxdfZZlV45yR4Vc9bynvURSdTfFe6jCYcdSat/jRf0R9tzaFv5VMHmiZTpoac/AtMjNdqLCeSSHouQRelBAnRLldf+FaKbQo0IknwaHKVUZEu7wODb8hye53F5663AE1xfgsP5ihxL36NwgloDfh1Sj6NOZSDaMmNHhUGwStXTmMS2aG3Iml3ql3R4kOPoPGmGECzSnpT9e8MDlCInK/df4g99qinCA9yysqCEmLia67pw7B9c7mJOM/iVxyvRENGH+7Y9QnwEaA4jYWr8EhFTlCt5wBvfOtY/2K4OSWqVw0GLHbpr3mS5q62N2kmodhKVCGNuTBUE2u3RwhNEMAhnySLlsC0/ofG+wW5mzYPB299p1pdHn1t2ji3UWaoohWIa+xM7KpR6UkmvjdYpqpS0ISn5SYRrGZ5hLlxnt/ay719G2Ec+aHedFVMAEfkxemif5DiwSjfioQfbBGBlTh2DyO3EaWe+plkck5/Izh1PnRJu6+MGMKQYB6f2B1FTYqmSIFCaXv8twByLaISyeFZc84VBVEmn9UnM8qng+giIwH2C1K4BZstjhAzUdkE8zOOCPSm0pedBlv1pRD9tEG2nsR8CbsfIKP/4dnCTp4EUX0JD4NMe3ZftcCLehSneuID6jkf6Z2mR3n6nCoxkhRMI5dR/gOM0fNSSJZnMcyVIiNqGH8F7m+Nv4D7oXCOoHYLBie6TC95cWFTCj0f+FYxVcPt3L4hReBKlU8zKXSWxxuuRCCsN0irOYsD1xd+8VDMcYeaJcn7JPgn7T6CLePQQav7KqsWvA0WnKXzrUo6r1H9Wmk1r8pKNQP5xl8sugSDcbw2iQxtMwfeAE+kdDq91jwWac1nx3W9E0Ln3CN73OHQ+ycni9HA7G4d0LJi0m75QnBjDBz5I+LQsMApyc7ocWPLgr5Y81wCVGQoSrBSQ+0WvTbCE4VNZCRXMlbPhqFbwsn69bbLSXL9cVwQKlRkzif/fQKEtuEdELb/22lmBACnI4pAIPQMPxwSmtOzzm1Y0gzchbA+Nb1r/qqlEylC+fkwucXJ+4nl8PH2tUvgNuaIynJRwLqW5jJYNwlbOijnNVVuJlFPiLCndYbbpaj1Umeh6LsIg8491mY1tbhiQAD0fkotAKk9ifGZsxJcCJD/VMxr1Z5MhpDTOvmnrSaZQu3vuhHpkWo4Z9+emck42in7vxheT30XtBG8VqVLwIqRPemamrFSKUSNQfRMeM3LDs+FFnO7TStUTxwjmCMbi3nsnCY4FwV4A/pfB8Z2eJyTBP5wlHnNv6Dq2D8vv6hE= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0e25fab-f468-497a-f6d9-08dc47e9e6b1 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR02MB7808.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2024 07:55:10.4453 (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: NnR6hbjQJtWPXv8Fe4MVxyQwT35zxTI1zMQ35jBbBgxUTdEvLxRRLWgh599AlTqtIfqXYdbawId1/mp6QAYaHQO9F/423uTySKq2rhs4nd0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR02MB7788 X-Proofpoint-ORIG-GUID: OCNnuLk2usSEp3GiJT_BeIFLA3U1-t2v X-Proofpoint-GUID: OCNnuLk2usSEp3GiJT_BeIFLA3U1-t2v 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-18_12,2024-03-18_03,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Cc: huzaifa.c@nutanix.com Subject: [ovs-dev] [PATCH OVN v3 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. Naveen Yerramneni (4): controller: DHCP Relay Agent support for overlay IPv4 subnets. actions: 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 | 293 +++++++++++++++++++-- tests/system-ovn.at | 148 +++++++++++ utilities/ovn-trace.c | 67 +++++ 13 files changed, 1576 insertions(+), 111 deletions(-)