From patchwork Wed Sep 2 23:44:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 513700 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id CF0961401F0 for ; Thu, 3 Sep 2015 09:44:57 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 5EE07106F8; Wed, 2 Sep 2015 16:44:27 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id DD32E10704 for ; Wed, 2 Sep 2015 16:44:25 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 5626A1E0436 for ; Wed, 2 Sep 2015 17:44:25 -0600 (MDT) X-ASG-Debug-ID: 1441237464-09eadd4ef358620001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com with ESMTP id 0YH4YNBcsjpkQ0PW (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 02 Sep 2015 17:44:24 -0600 (MDT) X-Barracuda-Envelope-From: blp@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO mail-pa0-f49.google.com) (209.85.220.49) by mx1-pf1.cudamail.com with ESMTPS (RC4-SHA encrypted); 2 Sep 2015 23:44:24 -0000 Received-SPF: unknown (mx1-pf1.cudamail.com: Multiple SPF records returned) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.49 Received: by pacwi10 with SMTP id wi10so26164657pac.3 for ; Wed, 02 Sep 2015 16:44:24 -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=ZupFR1P56Hg0svhM2AVY8luQgFLk2HINXbklSJmtO54KQ+iUAc6yBK+xE38/MeG/nb QRN9RIevNYnPkzlKZ5W1zLx8ioO6VwR7dkZm89D5W6eXWxQtNj6713dZf2YZSVU5CgnW QPgPQ5CKgnGJZlMfil0jQhkpW21M23U39F5gA+TJUnEfkfzH4fJgzjvll6g1AuTSQszp cVz5v6DSdH5Ds0qTVBjAFFJNHugYYIEcZhYFS0dZG0FrJdai/M7TQx6X05xGCy1/43iB W4AtXKX84w9PYGDQXORXMWuzDHuT4oBFEdAqnZ+KiKw8B7lRga2DYn7DWk9odg8NLdeT RMTg== X-Gm-Message-State: ALoCoQn+wJY+TBTqd9N4yV7UC6+sBzNjFcrTVrLuD7FWKjqGMRe45QSbKmOCYT5AbORkV0w2JaJz X-Received: by 10.66.219.5 with SMTP id pk5mr60047958pac.111.1441237464175; Wed, 02 Sep 2015 16:44:24 -0700 (PDT) Received: from sigabrt.benpfaff.org ([208.91.2.4]) by smtp.gmail.com with ESMTPSA id f5sm23046151pas.23.2015.09.02.16.44.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Sep 2015 16:44:23 -0700 (PDT) X-CudaMail-Envelope-Sender: blp@nicira.com X-Barracuda-Apparent-Source-IP: 208.91.2.4 From: Ben Pfaff To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E1-901091856 X-CudaMail-DTE: 090215 X-CudaMail-Originating-IP: 209.85.220.49 Date: Wed, 2 Sep 2015 16:44:02 -0700 X-ASG-Orig-Subj: [##CM-E1-901091856##][PATCH v2 05/14] [RFC] ovn-controller: Attach local_ip to each tunnel. Message-Id: <1441237451-17940-5-git-send-email-blp@nicira.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1441237451-17940-1-git-send-email-blp@nicira.com> References: <1441237451-17940-1-git-send-email-blp@nicira.com> X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1441237464 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 v2 05/14] [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); } }