From patchwork Wed Sep 2 06:42:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 513319 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id DFAFB1401F0 for ; Wed, 2 Sep 2015 16:43:34 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 7D78A10A5D; Tue, 1 Sep 2015 23:43:06 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v1.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 3E5E710A70 for ; Tue, 1 Sep 2015 23:43:03 -0700 (PDT) Received: from bar3.cudamail.com (bar1 [192.168.15.1]) by mx3v1.cudamail.com (Postfix) with ESMTP id B0B1B61857D for ; Wed, 2 Sep 2015 00:43:02 -0600 (MDT) X-ASG-Debug-ID: 1441176181-03dd7b127c418910001-byXFYA Received: from mx3-pf2.cudamail.com ([192.168.14.1]) by bar3.cudamail.com with ESMTP id w7sY68dTLKsECz26 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 02 Sep 2015 00:43:01 -0600 (MDT) X-Barracuda-Envelope-From: blp@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.1 Received: from unknown (HELO mail-pa0-f54.google.com) (209.85.220.54) by mx3-pf2.cudamail.com with ESMTPS (RC4-SHA encrypted); 2 Sep 2015 06:43:01 -0000 Received-SPF: unknown (mx3-pf2.cudamail.com: Multiple SPF records returned) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.54 Received: by pacwi10 with SMTP id wi10so950697pac.3 for ; Tue, 01 Sep 2015 23:43:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=V+Wjd+PqXLKHryNUm7AG+rTjYLtXCkgRbx37eFhkpzY=; b=KAYRESNHdKyMBEgdpA3fz5nKQSr+4cFByR9Kr+NsI50lEPVC3jVvuk+kuuGNRJfO9Q VDTZ+TQp1p4h9f4rwLSM3h4x/1iOcSjG8x03nWmAbXtZxctuj9Jn1Ep4ULqIVgYatVvx 5eF5nEZldktyUlkq/NhQTajdb8b+/PHf+I4C7Mnb/hMRa1nuOggff0KHN43PIiL+h5ck aBtUaBj6+Ne2hPAiVQdzMt8VE1LEcEzv4Znl/pdUzDuJSyZO7BdvBmjaaGU+BFkJckFn B8akjLdUOQsEKSPTBczDSNw66YyHqQwIBCJJPucR8dd8Rv5LCNh/Ejqw6GF8zyuAj332 CilQ== X-Gm-Message-State: ALoCoQllMcMJxRKphRTvfa+6y39QB7fg2Gs12MrwjPGgDVW3jo6L+1JhRwklm4MsAteIM8S5ZrGL X-Received: by 10.66.248.162 with SMTP id yn2mr53460934pac.85.1441176180976; Tue, 01 Sep 2015 23:43:00 -0700 (PDT) Received: from sigabrt.benpfaff.org (173-228-112-192.dsl.dynamic.fusionbroadband.com. [173.228.112.192]) by smtp.gmail.com with ESMTPSA id pt3sm20317992pbb.38.2015.09.01.23.42.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Sep 2015 23:42:59 -0700 (PDT) X-CudaMail-Envelope-Sender: blp@nicira.com X-Barracuda-Apparent-Source-IP: 173.228.112.192 From: Ben Pfaff To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V2-901000583 X-CudaMail-DTE: 090215 X-CudaMail-Originating-IP: 209.85.220.54 Date: Tue, 1 Sep 2015 23:42:47 -0700 X-ASG-Orig-Subj: [##CM-V2-901000583##][PATCH 5/6] [RFC] ovn-controller: Attach local_ip to each tunnel. Message-Id: <1441176168-27960-5-git-send-email-blp@nicira.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1441176168-27960-1-git-send-email-blp@nicira.com> References: <1441176168-27960-1-git-send-email-blp@nicira.com> X-Barracuda-Connect: UNKNOWN[192.168.14.1] X-Barracuda-Start-Time: 1441176181 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 5/6] [RFC] ovn-controller: Attach local_ip to each tunnel. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" This avoids packet duplication when native tunneling is used. The right solution is to adjust the native tunneling code so that it discards packets not directed to the current host. I expect to see a patch for that correct solution soon, see: http://openvswitch.org/pipermail/dev/2015-September/059528.html --- ovn/controller/encaps.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ovn/controller/encaps.c b/ovn/controller/encaps.c index 070b741..74b0e87 100644 --- a/ovn/controller/encaps.c +++ b/ovn/controller/encaps.c @@ -113,7 +113,7 @@ tunnel_create_name(struct tunnel_ctx *tc, const char *chassis_id) static void tunnel_add(struct tunnel_ctx *tc, const char *new_chassis_id, - const struct sbrec_encap *encap) + const struct sbrec_encap *encap, const char *encap_ip) { struct port_hash_node *hash_node; @@ -167,6 +167,7 @@ tunnel_add(struct tunnel_ctx *tc, const char *new_chassis_id, ovsrec_interface_set_name(iface, port_name); ovsrec_interface_set_type(iface, encap->type); smap_add(&options, "remote_ip", encap->ip); + smap_add(&options, "local_ip", encap_ip); smap_add(&options, "key", "flow"); ovsrec_interface_set_options(iface, &options); smap_destroy(&options); @@ -235,6 +236,18 @@ encaps_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int, return; } + const struct ovsrec_open_vswitch *cfg = ovsrec_open_vswitch_first(ctx->ovs_idl); + if (!cfg) { + VLOG_INFO("No Open_vSwitch row defined."); + return; + } + + const char *encap_ip = smap_get(&cfg->external_ids, "ovn-encap-ip"); + if (!encap_ip) { + VLOG_INFO("Need to specify an encap ip"); + return; + } + const struct sbrec_chassis *chassis_rec; const struct ovsrec_bridge *br; @@ -278,7 +291,7 @@ encaps_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int, VLOG_INFO("No supported encaps for '%s'", chassis_rec->name); continue; } - tunnel_add(&tc, chassis_rec->name, encap); + tunnel_add(&tc, chassis_rec->name, encap, encap_ip); } }