From patchwork Thu Oct 2 04:46:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Herbert X-Patchwork-Id: 395799 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 8B2C31400E9 for ; Thu, 2 Oct 2014 14:47:25 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752522AbaJBErU (ORCPT ); Thu, 2 Oct 2014 00:47:20 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:57556 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751992AbaJBErS (ORCPT ); Thu, 2 Oct 2014 00:47:18 -0400 Received: by mail-pa0-f51.google.com with SMTP id lj1so1553133pab.24 for ; Wed, 01 Oct 2014 21:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=icAn1IOo9Jn0p7+bYUL/FE2aec+hrM6JFSj3sozmzAM=; b=TCK9h2+Y720YIt2DFKS+dT9aKsRIIJww97ppIZDLsTvJm4fOu5UozXX3XftEQXMwUw MRTxAjXMm2XbZNHX4A5i06L9aO+xhuL1rIIW0aIQ2afsXMEaJA9M4y5t0f9M9eQ5PAYQ q6KSHRWdPiuJjGsW/xcSEDe7XWq2aKWcdO8/fD6MoP6J46DuVv1ynf3roQnct9uSgL/C e6ZneGz2bsh3trq6gwgTy20Bnl2YPAYiBPWiYc6bZQmazWvklJ39P2EgWMlwv1p/zUjb OfXRxUxDWxv0iBWxZFVrwR1Hva95Z+mp/bTKJz+8t5pk4kdClQfbcBz25ot3SeceOiWH je2g== 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=icAn1IOo9Jn0p7+bYUL/FE2aec+hrM6JFSj3sozmzAM=; b=UPJr1sGSL+SfnnPVa0yuwWqj4uMCV00gXAdHLNv2N7B1WKaDCbIy3qxc02CKSRbdFp DNjZIo2/DIs1BTbZx5jgSJ/ZEXnOYDwr5zC0TjpV9KIQL6FkUvL9ROrUJXNgDT+acaab x+YDeV15Hb/5XPaXAj4bznnM6KZIlo13ANg5ZBs1HtXC/W30FIE4V9A2jFUjExvd9TzH TFk8CYbxIWvIylS+uyIFfL+wMASgjxo6YSJPdmhbClsf0npq264gcZ2LExeQVd3y1WGy 8oq6qim0bLLYwOUk+XFR/qhPRHR8XfgeMH5/uoCsShFcmKpvRy6YwYqYOHH5C5ROub+p jzKA== X-Gm-Message-State: ALoCoQm+BZs/mAURyoGBszbdFjtyTOLZbQhQPzZQBASTDJbJiWcPYEYEhpD7dtHEPs5OU+nhvxZI X-Received: by 10.70.64.130 with SMTP id o2mr696882pds.107.1412225237901; Wed, 01 Oct 2014 21:47:17 -0700 (PDT) Received: from tomh.mtv.corp.google.com (tomh.mtv.corp.google.com [172.18.117.126]) by mx.google.com with ESMTPSA id n2sm2378053pdh.30.2014.10.01.21.47.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 01 Oct 2014 21:47:17 -0700 (PDT) From: Tom Herbert To: davem@davemloft.net, netdev@vger.kernel.org Subject: [PATCH net-next 4/4] ip_tunnel: Add GUE support Date: Wed, 1 Oct 2014 21:46:39 -0700 Message-Id: <1412225199-24942-5-git-send-email-therbert@google.com> X-Mailer: git-send-email 2.1.0.rc2.206.gedb03e5 In-Reply-To: <1412225199-24942-1-git-send-email-therbert@google.com> References: <1412225199-24942-1-git-send-email-therbert@google.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch allows configuring IPIP, sit, and GRE tunnels to use GUE. This is very similar to fou excpet that we need to insert the GUE header in addition to the UDP header on transmit. Signed-off-by: Tom Herbert --- include/uapi/linux/if_tunnel.h | 1 + net/ipv4/ip_tunnel.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h index 7c832af..280d9e0 100644 --- a/include/uapi/linux/if_tunnel.h +++ b/include/uapi/linux/if_tunnel.h @@ -64,6 +64,7 @@ enum { enum tunnel_encap_types { TUNNEL_ENCAP_NONE, TUNNEL_ENCAP_FOU, + TUNNEL_ENCAP_GUE, }; #define TUNNEL_ENCAP_FLAG_CSUM (1<<0) diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index 54ace25..79f2ac0 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c @@ -56,6 +56,7 @@ #include #include #include +#include #if IS_ENABLED(CONFIG_IPV6) #include @@ -495,6 +496,8 @@ static int ip_encap_hlen(struct ip_tunnel_encap *e) return 0; case TUNNEL_ENCAP_FOU: return sizeof(struct udphdr); + case TUNNEL_ENCAP_GUE: + return sizeof(struct udphdr) + sizeof(struct guehdr); default: return -EINVAL; } @@ -546,6 +549,15 @@ static int fou_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e, skb_reset_transport_header(skb); uh = udp_hdr(skb); + if (e->type == TUNNEL_ENCAP_GUE) { + struct guehdr *guehdr = (struct guehdr *)&uh[1]; + + guehdr->version = 0; + guehdr->hlen = 0; + guehdr->flags = 0; + guehdr->next_hdr = *protocol; + } + uh->dest = e->dport; uh->source = sport; uh->len = htons(skb->len); @@ -565,6 +577,7 @@ int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t, case TUNNEL_ENCAP_NONE: return 0; case TUNNEL_ENCAP_FOU: + case TUNNEL_ENCAP_GUE: return fou_build_header(skb, &t->encap, t->encap_hlen, protocol, fl4); default: