From patchwork Wed Apr 29 16:05:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1279496 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.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IkoRApf+; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49C3K04G1Xz9sPF for ; Thu, 30 Apr 2020 02:05:55 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id EA66786B39; Wed, 29 Apr 2020 16:05:53 +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 4H6tDPctXXKb; Wed, 29 Apr 2020 16:05:51 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5784686B19; Wed, 29 Apr 2020 16:05:51 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3F376C0172; Wed, 29 Apr 2020 16:05:51 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 178D5C0172 for ; Wed, 29 Apr 2020 16:05:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 04A2887834 for ; Wed, 29 Apr 2020 16:05:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WQgxOUx3M0-D for ; Wed, 29 Apr 2020 16:05:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by whitealder.osuosl.org (Postfix) with ESMTPS id DA90E8696A for ; Wed, 29 Apr 2020 16:05:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588176346; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9fiwuRhI6hIbUAzFDCTcm3oTMShOoSWp1g13/xag4WE=; b=IkoRApf+TtHfOxpS8ieDMcUPA9DKamwQ7t6ej2/fF3cSngIT+aln6+d2DYT3vrVJNO6RUB 4cJ3YYFP0dyTYJdNFkYgjwoYfxrhl/khVm11EgPutAzXOm1dxG1fm19ruMkD0KyDw1R7wq X41rjREKmZD2pBvYPoNJ+79Phiv+Y5c= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-412-FcDLwHdeOgi4PuxDBQXySw-1; Wed, 29 Apr 2020 12:05:44 -0400 X-MC-Unique: FcDLwHdeOgi4PuxDBQXySw-1 Received: by mail-wr1-f72.google.com with SMTP id p16so1962949wro.16 for ; Wed, 29 Apr 2020 09:05:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/lvqE733DC5ndoDR0etJVBR8U5US7m1/YOj1ahQBXhw=; b=miqUg30tNcrW5kZmT3GGlvDajX/MGgzbHUAYG3qFxBCaw7PYdFDc7cwQTR9pZW7Fzy U3chqGIcuLRyaan5rp1gsz/QQE1VpsPTTLPRRugz4siEL7zl2skYg7H5s+DREyvVt0ce OVxjwh2aJ9F6S6IrZ+viieiyTJTd9fUVWjJe0Ju+regZcG32Xt/XLlyMz0lN7/J2zO5x SF9La1h7SfLekedtPV/+xGcqPwrmj75JYQX4CDBoUtX+K9vx1QwxRc81t0zFP1euoK8m dliIOxYe6mAIPM9uR08i9OE+jR9EIwDIVW3bBoCoGbhAhwrN2+87WvRPEsS7douxtn03 RwwQ== X-Gm-Message-State: AGi0PuZ+DqvqWXHn/J4A4fPhVc4zqdd7yjal5Br5kqPi2CVURiwJaGnQ pNe87j9L2aa3Yuo47KFP7zQSk7Anja9AJev8B2ehpGNx5NyY1UHBoddZOmalbhc1kFTQDPouqDI xRqJdMJlm36odqs5E9Q== X-Received: by 2002:a7b:c38b:: with SMTP id s11mr3997428wmj.55.1588176343107; Wed, 29 Apr 2020 09:05:43 -0700 (PDT) X-Google-Smtp-Source: APiQypK9IhODxRMOMmwYbFx6uLlOYeHbjkFTo9QHkiQxLHU6DyiiVKhWgen8Vqv9kRFEwIEraDcqJw== X-Received: by 2002:a7b:c38b:: with SMTP id s11mr3997412wmj.55.1588176342934; Wed, 29 Apr 2020 09:05:42 -0700 (PDT) Received: from localhost.localdomain.com ([151.66.196.206]) by smtp.gmail.com with ESMTPSA id k184sm8564207wmf.9.2020.04.29.09.05.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 09:05:42 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Wed, 29 Apr 2020 18:05:30 +0200 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 1/2] controller: add garbage collector for ipv6_prefixd 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" Introduce a garbage collector for stale entries in ipv6_prefixd that are no longer managed by the controller (e.g. if the processing has been disabled setting ipv6_prefix_delegation to false on all logical router ports) Tested-by: Jianlin Shi Signed-off-by: Lorenzo Bianconi --- controller/pinctrl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/controller/pinctrl.c b/controller/pinctrl.c index 3230bb386..f0d63b9a6 100644 --- a/controller/pinctrl.c +++ b/controller/pinctrl.c @@ -578,6 +578,7 @@ enum { struct ipv6_prefixd_state { long long int next_announce; + long long int last_used; struct in6_addr ipv6_addr; struct eth_addr ea; struct eth_addr cmac; @@ -1128,11 +1129,13 @@ fill_ipv6_prefix_state(struct ovsdb_idl_txn *ovnsb_idl_txn, sbrec_port_binding_set_options(pb, &options); smap_destroy(&options); } + pfd->last_used = time_msec(); } return changed; } +#define IPV6_PREFIXD_STALE_TIMEOUT 180000LL static void prepare_ipv6_prefixd(struct ovsdb_idl_txn *ovnsb_idl_txn, struct ovsdb_idl_index *sbrec_port_binding_by_name, @@ -1210,6 +1213,15 @@ prepare_ipv6_prefixd(struct ovsdb_idl_txn *ovnsb_idl_txn, } } + struct shash_node *iter, *next; + SHASH_FOR_EACH_SAFE (iter, next, &ipv6_prefixd) { + struct ipv6_prefixd_state *pfd = iter->data; + if (pfd->last_used + IPV6_PREFIXD_STALE_TIMEOUT < time_msec()) { + free(pfd); + shash_delete(&ipv6_prefixd, iter); + } + } + if (changed) { notify_pinctrl_handler(); } From patchwork Wed Apr 29 16:05:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1279497 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.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Cd9ZqU7Z; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49C3K113JTz9sP7 for ; Thu, 30 Apr 2020 02:05:57 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2D78986B34; Wed, 29 Apr 2020 16:05:55 +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 R804Z2zadbg4; Wed, 29 Apr 2020 16:05:53 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3330686B2A; Wed, 29 Apr 2020 16:05:53 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1BD1FC0864; Wed, 29 Apr 2020 16:05:53 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id B2E65C0172 for ; Wed, 29 Apr 2020 16:05:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A894287813 for ; Wed, 29 Apr 2020 16:05:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gV6MYtsQfMJb for ; Wed, 29 Apr 2020 16:05:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by whitealder.osuosl.org (Postfix) with ESMTPS id BB7A68770C for ; Wed, 29 Apr 2020 16:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588176347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v7aXIr5ep/QsKufcMtzz/nSFoBCwKF+zyt1iUUHtyIk=; b=Cd9ZqU7ZVswV4q4rzPi7qZLTndznpHE1/lDxVYyynaFWZk4TaF84TM8czStjPw9IOsUxq1 mqd4v4m2h/NXzuS7WdIkPNB09Yfsm5X/p9DKFmdvGPMTml5iTjpLV9IlfdRKzItrOWBwbF pscwzT5h34Z3YIefVwCNots5Un1uz5s= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-303-WwC6a6LBMk6jZVNF6gl5hw-1; Wed, 29 Apr 2020 12:05:45 -0400 X-MC-Unique: WwC6a6LBMk6jZVNF6gl5hw-1 Received: by mail-wm1-f71.google.com with SMTP id t62so1428659wma.0 for ; Wed, 29 Apr 2020 09:05:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h8nYhxbBE3eDnVXRE0iYGmsX7nAIdK3+rkncSm8U7ks=; b=jIV9tO/zB5ksg0oE2tfHOWPVqEpWxZPqke24qJssgwBLo/CuDdbBvNbbiDjD9pOkSl /0PSkkVWZAp6sA7FVTaQPX/ewPUl7TMG2H6DI+0St6PJEW8/HaONy490zRqNRnBHriBN Uk9Shq2xgC6I7XFa2WB8hTWWsH53hGnSpZGnzeeE3qOx7PiMh4G5OYpBYYOZ4uyjeukX vtL77tSecAWZSye2C5To6Kv3i0up0binUZqNXd0aavWE8xwx24AsTLd2JPF3d2KbDU/I UyDqhDKJPwUzNAckYU33IXgwinaxyWFi+yNYWxcXY5rq0qEft0ApSrcOErQsvNmFiqX4 IM2g== X-Gm-Message-State: AGi0Pub19fh27DI7fCTtkHdxvD/cL5ec72BBfy0XoE2Wv7bO4MW0kFNq mroJW1YSi2ELg6XwKeYxCQLYnFLshZVZUqOZsaRNHGfsGWavuN+y6OaqEf0gz2TfbzZ6mbckBk7 BRZX38kihYQ5PKX00wQ== X-Received: by 2002:a1c:2dc7:: with SMTP id t190mr3837649wmt.129.1588176344694; Wed, 29 Apr 2020 09:05:44 -0700 (PDT) X-Google-Smtp-Source: APiQypKNfBnCtRZlcs8rHV8P6Sx5cKtWok+PmSpdtPbuhfqJGLL0Tr+zIB/0tIxiQzC9cLYxJvJHkw== X-Received: by 2002:a1c:2dc7:: with SMTP id t190mr3837636wmt.129.1588176344519; Wed, 29 Apr 2020 09:05:44 -0700 (PDT) Received: from localhost.localdomain.com ([151.66.196.206]) by smtp.gmail.com with ESMTPSA id k184sm8564207wmf.9.2020.04.29.09.05.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 09:05:44 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Wed, 29 Apr 2020 18:05:31 +0200 Message-Id: <90cee3df05060decc1296b6134342b0af2450806.1588176268.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 2/2] IPv6 PD: disable pd processing if the router port is disabled 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" Disable IPv6 processing if the logical router port is disabled Tested-by: Jianlin Shi Signed-off-by: Lorenzo Bianconi --- northd/ovn-northd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 742aad85e..e31794c4b 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -9382,12 +9382,18 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, /* enable IPv6 prefix delegation */ bool prefix_delegation = smap_get_bool(&op->nbrp->options, "prefix_delegation", false); + if (!lrport_is_enabled(op->nbrp)) { + prefix_delegation = false; + } smap_add(&options, "ipv6_prefix_delegation", prefix_delegation ? "true" : "false"); sbrec_port_binding_set_options(op->sb, &options); bool ipv6_prefix = smap_get_bool(&op->nbrp->options, "prefix", false); + if (!lrport_is_enabled(op->nbrp)) { + ipv6_prefix = false; + } smap_add(&options, "ipv6_prefix", ipv6_prefix ? "true" : "false"); sbrec_port_binding_set_options(op->sb, &options);