From patchwork Mon Sep 14 09:03:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Ivanov X-Patchwork-Id: 1363444 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.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cambridgegreys.com Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BqgR102C6z9sTM for ; Mon, 14 Sep 2020 19:04:28 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 78C9487172; Mon, 14 Sep 2020 09:04:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0y+2nr9H13ZJ; Mon, 14 Sep 2020 09:04:21 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 280608716D; Mon, 14 Sep 2020 09:04:21 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D6F37C089F; Mon, 14 Sep 2020 09:04:20 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7525BC0859 for ; Mon, 14 Sep 2020 09:04:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4484A85BAE for ; Mon, 14 Sep 2020 09:04:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id idx03HaIoYpz for ; Mon, 14 Sep 2020 09:04:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.kot-begemot.co.uk (ivanoab7.miniserver.com [37.128.132.42]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 8EAE285B09 for ; Mon, 14 Sep 2020 09:04:16 +0000 (UTC) Received: from tun252.jain.kot-begemot.co.uk ([192.168.18.6] helo=jain.kot-begemot.co.uk) by www.kot-begemot.co.uk with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kHkPH-0001If-6T; Mon, 14 Sep 2020 09:04:15 +0000 Received: from jain.kot-begemot.co.uk ([192.168.3.3]) by jain.kot-begemot.co.uk with esmtp (Exim 4.92) (envelope-from ) id 1kHkPE-0003Dx-E9; Mon, 14 Sep 2020 10:04:14 +0100 From: anton.ivanov@cambridgegreys.com To: dev@openvswitch.org Date: Mon, 14 Sep 2020 10:03:54 +0100 Message-Id: <20200914090404.12225-5-anton.ivanov@cambridgegreys.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200914090404.12225-1-anton.ivanov@cambridgegreys.com> References: <20200914090404.12225-1-anton.ivanov@cambridgegreys.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett Cc: i.maximets@ovn.org, Anton Ivanov Subject: [ovs-dev] [PATCH ovn 04/14] ovn-northd: move admission control to a separate function 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: Anton Ivanov Signed-off-by: Anton Ivanov --- northd/ovn-northd.c | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index de1245489..06699b332 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -6613,6 +6613,12 @@ static void build_lswitch_forwarding_group_lflows_od( struct ovn_datapath *od, struct hmap *lflows); +/* Logical switch ingress table 0: Admission control framework (priority + * 100). */ +static void +build_lswitch_admission_control_od( + struct ovn_datapath *od, struct hmap *lflows); + /* * Do not remove this comment - it is here as a marker to * make diffs readable. @@ -6641,23 +6647,8 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports, build_lswitch_forwarding_group_lflows_od(od, lflows); } - /* Logical switch ingress table 0: Admission control framework (priority - * 100). */ HMAP_FOR_EACH (od, key_node, datapaths) { - if (!od->nbs) { - continue; - } - - /* Logical VLANs not supported. */ - ovn_lflow_add(lflows, od, S_SWITCH_IN_PORT_SEC_L2, 100, "vlan.present", - "drop;"); - - /* Broadcast/multicast source address is invalid. */ - ovn_lflow_add(lflows, od, S_SWITCH_IN_PORT_SEC_L2, 100, "eth.src[40]", - "drop;"); - - /* Port security flows have priority 50 (see below) and will continue - * to the next table if packet source is acceptable. */ + build_lswitch_admission_control_od(od, lflows); } build_lswitch_input_port_sec(ports, datapaths, lflows); @@ -7331,6 +7322,26 @@ build_lswitch_forwarding_group_lflows_od( build_fwd_group_lflows(od, lflows); } } + +static void +build_lswitch_admission_control_od( + struct ovn_datapath *od, struct hmap *lflows) +{ + if(od->nbs) { + + /* Logical VLANs not supported. */ + ovn_lflow_add(lflows, od, S_SWITCH_IN_PORT_SEC_L2, 100, "vlan.present", + "drop;"); + + /* Broadcast/multicast source address is invalid. */ + ovn_lflow_add(lflows, od, S_SWITCH_IN_PORT_SEC_L2, 100, "eth.src[40]", + "drop;"); + + /* Port security flows have priority 50 (see below) and will continue + * to the next table if packet source is acceptable. */ + } +} + /* Returns a string of the IP address of the router port 'op' that * overlaps with 'ip_s". If one is not found, returns NULL. *