From patchwork Wed Oct 21 07:24:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Pettit X-Patchwork-Id: 533624 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 4B75D140787 for ; Wed, 21 Oct 2015 18:25:40 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id A6351106B5; Wed, 21 Oct 2015 00:24:58 -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 DCBC510688 for ; Wed, 21 Oct 2015 00:24:56 -0700 (PDT) Received: from bar4.cudamail.com (bar2 [192.168.15.2]) by mx3v1.cudamail.com (Postfix) with ESMTP id 67746618ADE for ; Wed, 21 Oct 2015 01:24:56 -0600 (MDT) X-ASG-Debug-ID: 1445412296-03dc210f7a15dd30001-byXFYA Received: from mx3-pf3.cudamail.com ([192.168.14.3]) by bar4.cudamail.com with ESMTP id 7ywNwHk03fQG7XuK (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 21 Oct 2015 01:24:56 -0600 (MDT) X-Barracuda-Envelope-From: jpettit@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.3 Received: from unknown (HELO mail-pa0-f53.google.com) (209.85.220.53) by mx3-pf3.cudamail.com with ESMTPS (RC4-SHA encrypted); 21 Oct 2015 07:24:55 -0000 Received-SPF: unknown (mx3-pf3.cudamail.com: Multiple SPF records returned) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.53 Received: by pacfv9 with SMTP id fv9so48630814pac.3 for ; Wed, 21 Oct 2015 00:24:55 -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:subject:date:message-id:in-reply-to :references; bh=8P0WzbFuP+OZwyGreO8uCiUlU7dxv+veH5xVgd+8yVg=; b=QjhvZ3xN0VrlxoK2wjCbAXW/ZgOCIL/V8MvVZ6BWvUud/52qdRAqwRZLWyKle1dtO5 a/bRV68cUn2jvCjxFvHniJJglhjqKLjMjUb1/C8VCNpfTRW/UyKrCwCykya+xtQNAJA5 YJArucL3Ig1TL+Oxg3xvTWcbr4U0hiac0kehJrvqGXvOnjlsGMIMggD0Y9wS3a7qXELf o8YNQR8LlBqkjNy3Y5b450ij5hj9FQAR8/AvF2GVdIX0d12HRwlu1a1+DUPbNRoFJevX T6OKCcw4BAf1JW7cFks9b3VvHKMJQ0HByz3nla9wP1XfbyGvRhMKBBHzhqgrXqSFFE/4 HfIQ== X-Gm-Message-State: ALoCoQmmwM4m2scqJDGTuvJV09uOVjkoIFQKPL5bSygKZdx5aUH9UxsgsPx/uLePPWCuTLprYkTL X-Received: by 10.68.105.193 with SMTP id go1mr8819314pbb.59.1445412295463; Wed, 21 Oct 2015 00:24:55 -0700 (PDT) Received: from localhost.localdomain (c-67-161-8-206.hsd1.ca.comcast.net. [67.161.8.206]) by smtp.gmail.com with ESMTPSA id x6sm7469097pbt.3.2015.10.21.00.24.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Oct 2015 00:24:54 -0700 (PDT) X-CudaMail-Envelope-Sender: jpettit@nicira.com X-Barracuda-Apparent-Source-IP: 67.161.8.206 From: Justin Pettit To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V3-1020001294 X-CudaMail-DTE: 102115 X-CudaMail-Originating-IP: 209.85.220.53 Date: Wed, 21 Oct 2015 00:24:31 -0700 X-ASG-Orig-Subj: [##CM-V3-1020001294##][PATCH 10/10] ovn-northd: Support pinging logical router ports. Message-Id: <1445412271-22019-10-git-send-email-jpettit@nicira.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1445412271-22019-1-git-send-email-jpettit@nicira.com> References: <1445412271-22019-1-git-send-email-jpettit@nicira.com> X-Barracuda-Connect: UNKNOWN[192.168.14.3] X-Barracuda-Start-Time: 1445412296 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 Subject: [ovs-dev] [PATCH 10/10] ovn-northd: Support pinging logical router ports. 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" Signed-off-by: Justin Pettit --- ovn/northd/ovn-northd.8.xml | 5 +---- ovn/northd/ovn-northd.c | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ovn/northd/ovn-northd.8.xml b/ovn/northd/ovn-northd.8.xml index 6f0a420..e7dec72 100644 --- a/ovn/northd/ovn-northd.8.xml +++ b/ovn/northd/ovn-northd.8.xml @@ -340,6 +340,7 @@ ip4.dst = ip4.src; ip4.src = S; ip.ttl = 255; icmp4.type = 0; +inport = \"\"; /* Allow sending out inport. */ next; @@ -348,10 +349,6 @@ next; each individual inport, and use the same actions in which S is a function of inport.

- -

- Not yet implemented. -

  • diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index 1404ed6..a59f551 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -1295,8 +1295,6 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, /* This flow table structure is documented in ovn-northd(8), so please * update ovn-northd.8.xml if you change anything. */ - /* XXX ICMP echo reply */ - /* Logical router ingress table 0: Admission control framework. */ struct ovn_datapath *od; HMAP_FOR_EACH (od, key_node, datapaths) { @@ -1383,12 +1381,31 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, match, "drop;"); free(match); + /* ICMP echo reply. These flows reply to ICMP echo requests + * received for the router's IP address. */ + match = xasprintf( + "inport == %s && (ip4.dst == "IP_FMT" || ip4.dst == "IP_FMT") && " + "icmp4.type == 8 && icmp4.code == 0", + op->json_key, IP_ARGS(op->ip), IP_ARGS(op->bcast)); + char *actions = xasprintf( + "ip4.dst = ip4.src; " + "ip4.src = "IP_FMT"; " + "ip.ttl = 255; " + "icmp4.type = 0; " + "inport = \"\"; /* Allow sending out inport. */ " + "next; ", + IP_ARGS(op->ip)); + ovn_lflow_add(lflows, op->od, S_ROUTER_IN_IP_INPUT, 90, + match, actions); + free(match); + free(actions); + /* ARP reply. These flows reply to ARP requests for the router's own * IP address. */ match = xasprintf( "inport == %s && arp.tpa == "IP_FMT" && arp.op == 1", op->json_key, IP_ARGS(op->ip)); - char *actions = xasprintf( + actions = xasprintf( "eth.dst = eth.src; " "eth.src = "ETH_ADDR_FMT"; " "arp.op = 2; /* ARP reply */ "