From patchwork Fri Jun 18 13:53:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brendan Doyle X-Patchwork-Id: 1494296 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2020-01-29 header.b=k/BPJVqt; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-oracle-onmicrosoft-com header.b=t68/AzPB; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G60kX3QnDz9sT6 for ; Fri, 18 Jun 2021 23:53:24 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id AD21760AE6; Fri, 18 Jun 2021 13:53:21 +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 LCAZ0aMPH3dv; Fri, 18 Jun 2021 13:53:20 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id A21516061A; Fri, 18 Jun 2021 13:53:19 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 75308C000D; Fri, 18 Jun 2021 13:53:19 +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 6859FC000B for ; Fri, 18 Jun 2021 13:53:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4A3236062C for ; Fri, 18 Jun 2021 13:53:18 +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 4HkRgI_gSxVd for ; Fri, 18 Jun 2021 13:53:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by smtp3.osuosl.org (Postfix) with ESMTPS id 9AD416061A for ; Fri, 18 Jun 2021 13:53:16 +0000 (UTC) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15IDlsn2015785 for ; Fri, 18 Jun 2021 13:53:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : from : subject : message-id : date : content-type : mime-version; s=corp-2020-01-29; bh=NXSUYY+kpdRqaEA7kxb2+YicIcsLXypdfXW+qsdoHcw=; b=k/BPJVqtPbziYzTk6H7/bLsjOZgUzQrSSmloInMFMSxec+vkxW01T5PMaRSVobcsU9+E skx1u2x890MGKIp7hOr2xolsVQ5WsMRwZwI31C0Gq/TeMVK4gBsxXJTTHTwcZtjM/hWl RNecRYgTPI8GIvk/NnWiFWVUsM2b0Ad107PPCFInVosK6hNM+Lref/RBQihA/klBiV1w mXkbHoGz/gn0OR9F/8Pb/kz8+uYAcD8My9gyX++ZFpI3OLDs0JSpnE7pVdVJOneGyksx /rOqRUd6yaZszG+KUVge3Tqk870wG9sPksczyCF4QGAWPOw38xMnxLDN4hsPAm3iblYR Zg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 397w1y39t9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 18 Jun 2021 13:53:15 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 15IDpbml020519 for ; Fri, 18 Jun 2021 13:53:14 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2041.outbound.protection.outlook.com [104.47.57.41]) by userp3020.oracle.com with ESMTP id 396wayvafe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 18 Jun 2021 13:53:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GNillW95SDgg3hgtPGJwXzYoJiUQNlzS3Sd0xEvbjWqS6/hwwWZcV3vxBD5Y2qKtWW3W1w4wN7Oo3QgJrmQ0zyf3ant8KoSMxXKtLPB/A+96v8eqP/s/mGH7s3WcAIejvMfIAm2hloITZ6yI8VtxoLaHQcWmFSHQLUkMQ9P+V1Dv/r1hQWnVnxvuRqKupKgc0apgMbDJm+0aUK/CyokzVuiVCj2bP4QrKgX6rzbBLvf+4japQJWKrRtEg8YsvarDFAlViwY0vQqRQ8wGo3OysutbOXZHyywO8LCTZwOuq0bZNtkAOwg3R9ZT+KtS8XVDE6NbspXn7a3j1ocXonW6Cw== 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-SenderADCheck; bh=NXSUYY+kpdRqaEA7kxb2+YicIcsLXypdfXW+qsdoHcw=; b=oaUjTjeilkV9ciif137ToTlDfJrV8B0XbauDy1JTqdv6jy6LPx0xhcqphtZ7Cqp2kjTTYZ0lzkTEUrAccp83ON6T6FXa/9tZrr6B55RHFo6vUYosxsl/nopgJewEssaQsbkqLJKeQ3v80ZqN5Kb+4LPZYRldjfmjBQLqJ2dYNP+6f5JqvfEmVroq9EddLM9r66GCikJYYNfHe35KdPyGLRebD1ygCx/I8DdDgg6iQkjh+8NItv80Rz0fQBEXg0OUU9VPIleF6rBbPILEhontC1J0vr2SiEQCF2sDx4bksBt2o8hWMY4xlfrArXCZakDvvsuRmS5qGlrgylWdKnZ8Aw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NXSUYY+kpdRqaEA7kxb2+YicIcsLXypdfXW+qsdoHcw=; b=t68/AzPBcMEtxdbeDQGoSHZ9yzmH2dWF2svPWjMqFLr2VXJgxvKEzULy1KEWnv5BuD0ywG69orfccyz2dVvz9mNK6hN6HE/5BszH+5IwEBkXBLif/TRv24LGaWn+9CfgImzAo6P9L1hDHoDhQbM9iWakn7YjWMdWo9R3E201Xls= Authentication-Results: openvswitch.org; dkim=none (message not signed) header.d=none; openvswitch.org; dmarc=none action=none header.from=oracle.com; Received: from CO1PR10MB4723.namprd10.prod.outlook.com (2603:10b6:303:9c::20) by MWHPR10MB2045.namprd10.prod.outlook.com (2603:10b6:300:109::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.21; Fri, 18 Jun 2021 13:53:11 +0000 Received: from CO1PR10MB4723.namprd10.prod.outlook.com ([fe80::21f9:4329:3b5a:bff]) by CO1PR10MB4723.namprd10.prod.outlook.com ([fe80::21f9:4329:3b5a:bff%3]) with mapi id 15.20.4242.021; Fri, 18 Jun 2021 13:53:11 +0000 To: dev@openvswitch.org From: Brendan Doyle Organization: Oracle Corporation Message-ID: Date: Fri, 18 Jun 2021 14:53:05 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 Content-Language: en-US X-Originating-IP: [138.3.204.10] X-ClientProxiedBy: LO4P123CA0289.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:196::6) To CO1PR10MB4723.namprd10.prod.outlook.com (2603:10b6:303:9c::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.175.80.138] (138.3.204.10) by LO4P123CA0289.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:196::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.15 via Frontend Transport; Fri, 18 Jun 2021 13:53:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 20c44a9c-4fc1-4466-f0d0-08d93260692f X-MS-TrafficTypeDiagnostic: MWHPR10MB2045: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1247; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2QbpW9O6Ea6XdTq2HeUbvbCZr/+29+szHRjeF0/rY/1UnF4NgIIcuiLwpDWOVh5BEBLg7YKt98hU0Fcp1XiLfpDOLZa5BXAl7iLu3l3jB9wVMyDJJdQt4cSMheg2cd7OV+LZjLT2p6XJHnLj4lQCpvrtK1B4cP2PAlQiB9B3vGokn/yjd6GsJR1NFD/4lWc2x1KiScrSDwfJeHBzAhVC3sTZID7Vztz/IveW9gXXubPmbMBGrxCwr6V1ePPIkPrBEQyjk8eVYE962j3NDQ8F9vwiTHPT6qYSiC/puf+a2ooe9vnbBKTcpH66psaMvW7vQqIO1tN/7ZKkYp7HoYlz3NrFocu5Ab0XO5+mM+KwXkqSHYy/BXnwJ20h9TdWcVYCicKDqKUT7pABc6h1G3tAfLnp/lp7sOoc3aXNYvlUk950YGXa6ZP6qNvFbtzJ8exKGTYNpBXPi2ZafAqWuG6damulLoCpRz6js7yh5Oc9Hc+5SjY4eJio2nUx4QTV9F2+xtZQRnwGZKzevOhSQ3QD4MzqzZYfNjSOq7o5AMfPuDLl729Ai42ImPoTVll6oWCH/wAjrSaVQ+7TPfYG9vg69/+zjCfkkkVWaglCYMJS91LeEteNQWSy6L++xsaONk/afUTHm6mw+5JcDIeJjPIbacxRmTF+wLFz7DgGsUDcoYMGTdspViozbtAlfvxjGq0C X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO1PR10MB4723.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(366004)(136003)(39860400002)(346002)(376002)(26005)(316002)(30864003)(6916009)(36916002)(956004)(8676002)(86362001)(2616005)(8936002)(478600001)(16576012)(44832011)(31686004)(66946007)(6666004)(53546011)(2906002)(5660300002)(33964004)(66556008)(66476007)(36756003)(6486002)(31696002)(66574015)(83380400001)(16526019)(186003)(38100700002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?xxRM6JJCqXaXQkaqfSlD0ZLsa38G?= =?utf-8?q?nKXTnirDQObIOxhZ4tdHoayV18LdWG9l4BBioEnRASROfO5kJZWAAZvMC0IxKp0RN?= =?utf-8?q?14VL7ysySg/tqDeiGRdg3iHScXxXQ6CORBY1xiP5lHm+gyDr4sDjMJN1Z4POn0nme?= =?utf-8?q?p+E0sRqWVeeQ/YTvgVPMqWbsclE03/3l+qQoFZBcAJ3TVkIWj+JOVuPosrYhOPnTM?= =?utf-8?q?Jc2j5j+OcO5O7YQnyrVOVfFs8Xb10Kheo0DTtpIOIrh/wi7NYrL8pFMm84Np3lHzu?= =?utf-8?q?UKL4XXTUg7KKMRrg86jhBJwNZf4ukpf+fdLeeeHwbnqY8xcFgsguAhiTcf9hkuDID?= =?utf-8?q?//jrMEBYHB2yl9x6AxImNQop2IrCobABZvqDsfGZ4mJ/yZ9xNbClvMMU6R8hY7lsV?= =?utf-8?q?DLeBhYAOAZWrZI/HeSdYX7bWRNgvK7GhZJSF0f61QEAbfqwAck5bPRzVVvPcEE3wU?= =?utf-8?q?uM1cUE2Awyxsdgj7z/sCu6+UBLvJDYuMQpxLAqOkGtcbIW86qMq7QZkIYIotTIKLj?= =?utf-8?q?uz+oqlNa3veYj+Zr38oZBiUeFrgF1LLuJ2LNtj5HND49HBppXxx0lidpvDjXcRL0P?= =?utf-8?q?xXO1V37yvEZYJbtg+x9J8f5beyKWZbtGjhC1aDiBYtG0NW/YwUMxTDxtUiekThav9?= =?utf-8?q?kneZQ78RXYFkNJFRVlWUJCvD85Sjv+HTSCHGZGiltgBxPIvYVjbZnJ/K5hIqFLCoh?= =?utf-8?q?wtlb/zGBodev41Dhv2B9ztQ8wzw7a+QSHc1wxoZrMNVSpKnABwGN7mFblz8/rs5mA?= =?utf-8?q?+IN6nxzlqllt0zHWM3nLjlVKiSblzSR0ub2ICl7XyH9tbNID6hFaigyg5WI+5OJ0v?= =?utf-8?q?Cz3PeFm25xnzOwG8x/t9N4FkobjcHhVEc44Tq1tMO75DDW8sPqtNVKaq1pjFKZNYn?= =?utf-8?q?bCZr4tN4SU4iaCJuqnt9EjDrDxw9/ShYfrAqsTe6UjIKrcNPu8te6VGXRq6ofdbsZ?= =?utf-8?q?PY54vnw1MjSAmIgWN/vdre8yjJ3BrZ1GUo9ZAuOv5EzI+K6apEH53lCYXyVjPKbhY?= =?utf-8?q?JIHee2HWSVzp/xjtlm9K5elli7qre4mLfjEP0CH9YJx71EWPZA7pQnrlObMrsQFQ2?= =?utf-8?q?C9UGdaZdGkRHUp6XK6/bHbtnI6gVo8UXUaTsdi2NEwkOV9ToZR8p9igJ+4v8Plf79?= =?utf-8?q?f4gybBX6VybrZYF0co6SqjPndnaBM9iwau7yy0ps6tJYjqL1NcgG6tBObXBLHyQwD?= =?utf-8?q?aQz00k0rNU8Z2iVisuxzMztsx77/pL+3G5NJ67NrAKCJgyNetdwKWrI/z1s4iYe2y?= =?utf-8?q?aDQrhGZ3ux+pCvaQ?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20c44a9c-4fc1-4466-f0d0-08d93260692f X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4723.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2021 13:53:11.5203 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: B5dj/bHxt1R0yeGCkrl74n0mZ8f/O7/4qduDSiijZUHj3JNG0ZFCrJsxRjjKN/enRhgr5D4RFrqpyo8uHHigheo2o+dJ2NPw+4vrlw84/hA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB2045 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10019 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106180081 X-Proofpoint-ORIG-GUID: tfbeLfT55Qa4nQlwb3XpjTrk7B23i2tk X-Proofpoint-GUID: tfbeLfT55Qa4nQlwb3XpjTrk7B23i2tk X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [ovs-dev] [PATCH ovn v3] ovn-northd.c: Add proxy ARP support to OVN 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" From 634fd88b726700b30cb76203ca45f1e9c041368a Mon Sep 17 00:00:00 2001 From: Brendan Doyle Date: Fri, 28 May 2021 10:01:17 -0700 Subject: [PATCH ovn] ovn-northd.c: Add proxy ARP support to OVN This patch provides the ability to configure proxy ARP IPs on a Logical Switch Router port. The IPs are added as Options for router ports. This provides a useful feature where traffic for a service must be sent to an address in a logical network address space, but the service is provided in a different network. For example an NFS service is provide to Logical networks at an address in their Logical network space, but the NFS server resides in a physical network. A Logical switch Router port can be configured to respond to ARP requests sent to the service "Logical address", the Logical Router/Gateway can then be configured to forward the traffic to the underlay/physical network. Signed-off-by: Brendan Doyle --- northd/ovn-northd.c | 46 +++++++++++++++++++++++ ovn-nb.xml | 9 +++++ tests/ovn.at | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 158 insertions(+) diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 0e5092a..2bc6f28 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -6943,6 +6943,7 @@ build_lswitch_arp_nd_responder_known_ips(struct ovn_port *op, struct ds *match) { if (op->nbsp) { + const char *arp_proxy; if (!strcmp(op->nbsp->type, "virtual")) { /* Handle * - GARPs for virtual ip which belongs to a logical port @@ -7096,6 +7097,51 @@ build_lswitch_arp_nd_responder_known_ips(struct ovn_port *op, } } } + + /* + * Add responses for ARP proxies. + */ + arp_proxy = smap_get(&op->nbsp->options,"arp_proxy"); + if (arp_proxy && op->peer) { + struct lport_addresses proxy_arp_addrs; + int i = 0; + + if (extract_ip_addresses(arp_proxy, &proxy_arp_addrs)) { + /* + * Match rule on all proxy ARP IPs. + */ + ds_clear(match); + ds_put_cstr(match, "arp.op == 1 && ("); + + for (i = 0; i < proxy_arp_addrs.n_ipv4_addrs; i++) { + if (i > 0) { + ds_put_cstr(match, " || "); + } + ds_put_format(match, "arp.tpa == %s", + proxy_arp_addrs.ipv4_addrs[i].addr_s); + } + + ds_put_cstr(match, ")"); + destroy_lport_addresses(&proxy_arp_addrs); + + ds_clear(actions); + ds_put_format(actions, + "eth.dst = eth.src; " + "eth.src = %s; " + "arp.op = 2; /* ARP reply */ " + "arp.tha = arp.sha; " + "arp.sha = %s; " + "arp.tpa <-> arp.spa; " + "outport = inport; " + "flags.loopback = 1; " + "output;", + op->peer->lrp_networks.ea_s, + op->peer->lrp_networks.ea_s); + + ovn_lflow_add_with_hint(lflows, op->od, S_SWITCH_IN_ARP_ND_RSP, + 50, ds_cstr(match), ds_cstr(actions), &op->nbsp->header_); + } + } } } diff --git a/ovn-nb.xml b/ovn-nb.xml index 02fd216..e4a8114 100644 --- a/ovn-nb.xml +++ b/ovn-nb.xml @@ -848,6 +848,15 @@ + + + Optional. A list IPv4 addresses that this + logical switch router port will reply to ARP requests. + Example: 169.254.239.254 169.254.239.2. The + 's logical router should + have a route to forward packets sent to configured proxy ARP IPs to + an appropriate destination. + diff --git a/tests/ovn.at b/tests/ovn.at index 2c3c36d..ffbb594 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -26527,3 +26527,106 @@ AT_CHECK([test $(ovn-appctl -t ovn-controller coverage/read-counter lflow_run) = OVN_CLEANUP([hv1]) AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([ovn -- proxy-arp: 1 HVs, 1 LSs, 1 lport/LS, 1 LR]) +AT_KEYWORDS([proxy-arp]) +ovn_start + +# Logical network: +# One LR - lr1 has switch ls1 (192.16.1.0/24) connected to it, +# and and one HV with IP 192.16.1.6. + +ovn-nbctl lr-add lr1 +ovn-nbctl ls-add ls1 + +# Connect ls1 to lr1 +ovn-nbctl lrp-add lr1 ls1 00:00:00:01:02:f1 192.16.1.1/24 +ovn-nbctl lsp-add ls1 rp-ls1 -- set Logical_Switch_Port rp-ls1 \ + type=router options:router-port=ls1 addresses=\"00:00:00:01:02:f1\" + +# Create logical port ls1-lp1 in ls1 +ovn-nbctl lsp-add ls1 ls1-lp1 \ +-- lsp-set-addresses ls1-lp1 "00:00:00:01:02:03 192.16.1.6" + + +# Create one hypervisor and create OVS ports corresponding to logical ports. +net_add n1 + +sim_add pa-hv +as pa-hv +ovs-vsctl add-br br-phys +ovn_attach n1 br-phys 192.16.0.1 + +# Note: tx/rx are with respect to the LS port, so +# tx on switch port is HV rx, etc. +ovs-vsctl -- add-port br-int vif1 -- \ + set interface vif1 external-ids:iface-id=ls1-lp1 \ + options:tx_pcap=pa-hv/vif1-tx.pcap \ + options:rxq_pcap=pa-hv/vif1-rx.pcap \ + ofport-request=1 + +# And proxy ARP flows for 69.254.239.254 and 169.254.239.2 +# and check that SB flows have been added. +ovn-nbctl --wait=hv add Logical_Switch_Port rp-ls1 \ +options arp_proxy='"169.254.239.254 169.254.239.2"' +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) + +AT_CHECK([ovn-sbctl dump-flows | grep ls_in_arp_rsp | grep "169.254.239.2" | wc -l], [0], [dnl +1 +]) + +# Remove and check that the flows have been removed +ovn-nbctl --wait=hv remove Logical_Switch_Port rp-ls1 options arp_proxy='"169.254.239.254 169.254.239.2"' + +AT_CHECK([ovn-sbctl dump-flows | grep ls_in_arp_rsp | grep "169.254.239.2" | wc -l], [0], [dnl +0 +]) + +# Add the flows back send arp request and check we see an ARP response +ovn-nbctl --wait=hv add Logical_Switch_Port rp-ls1 \ +options arp_proxy='"169.254.239.254 169.254.239.2"' + +ls1_p1_mac=00:00:00:01:02:03 +ls1_p1_ip=192.16.1.6 + +ls1_ro_mac=00:00:00:01:02:f1 +ls1_ro_ip=192.168.1.1 + +proxy_ip1=169.254.239.254 +proxy_ip2=169.254.239.2 + +bcast_mac=ff:ff:ff:ff:ff:ff + +# Send ARP request for 169.254.239.254 +packet="inport==\"ls1-lp1\" && eth.src==$ls1_p1_mac && eth.dst==$bcast_mac && + arp.op==1 && arp.sha==$ls1_p1_mac && arp.spa==$ls1_p1_ip && + arp.tha==$bcast_mac && arp.tpa==$proxy_ip1" + +as pa-hv ovs-appctl -t ovn-controller inject-pkt "$packet" + +ovs-ofctl dump-flows br-int| grep 169.254.239.254 | grep priority=50 > debug1 +AT_CAPTURE_FILE([debug1]) + + +# Check if packet hit the ARP reply ovs flow +AT_CHECK([ovs-ofctl dump-flows br-int | \ + grep "169.254.239.254" | \ + grep "priority=50" | \ + grep "arp_op=1" | \ + grep "n_packets=1" | wc -l], [0], [dnl +1 +]) + +# Check that the HV gets an ARP reply +expected="eth.src==$ls1_ro_mac && eth.dst==$ls1_p1_mac && + arp.op==2 && arp.sha==$ls1_ro_mac && arp.spa==$proxy_ip1 && + arp.tha==$ls1_p1_mac && arp.tpa==$ls1_p1_ip" +echo $expected | ovstest test-ovn expr-to-packets > expected + +OVN_CHECK_PACKETS([pa-hv/vif1-tx.pcap], [expected]) + +OVN_CLEANUP([pa-hv]) +AT_CLEANUP +])