From patchwork Fri Nov 1 16:07:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1188123 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.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Gz3liOeK"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 474RtV2zlCz9sPT for ; Sat, 2 Nov 2019 03:08:02 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id A5B85F5E; Fri, 1 Nov 2019 16:08:00 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id B23D1E3D for ; Fri, 1 Nov 2019 16:07:59 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 72ECD87C for ; Fri, 1 Nov 2019 16:07:59 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id p12so6764998pgn.6 for ; Fri, 01 Nov 2019 09:07:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=5c0xGQ+S6mcIiO+Qv1ds1MwL6foGnktZwXCnQJkfGmU=; b=Gz3liOeKd4dgwJom0RnbY07ZY2X3jBPPyCSj50Ixs6LUlv3hxSNPfKudPm8ragR8+1 rJ43UgKGfVmCeCr/MiGNTA+zYA/dZ8OQtjsXWriKMRYgURsz+ffv5MccBG2wj6vvz5xm ho/twF9h7S79FOlOJ9qJCEdq+uo29An94mn4JVoLDikpjrXH8vTEUBi0768gYghQ9Pj3 ncQWG+CiXT151Y04/0YcG8IrU2tvGzo/xBDqAc+ygpSpPOPweJZidi1JLtLQFGXHMCpm AVuextXfCuyQ1Eo+vVy8JIE9ddmVNTN9CsEVYih/o6+y0hTTvJ3WUGHBpPbz+OrSl+FX /hGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5c0xGQ+S6mcIiO+Qv1ds1MwL6foGnktZwXCnQJkfGmU=; b=dd07b+D5ZB42HvJ24Q7LBbWbHvMLGuZX6ww9eq3726L+5+o8LTvows6/k4Yqff/5wA AYyXlR3rFyxUKJXKGl6KwkkPeSTTsPalSgIZt4RudtdDUW+seQMh9cvoM+r2p0uN08Va l7kDaq2u0H3YpzOWLm1fvvLawwfmE4snlQSQnboS6JWHaS8fhROuqZei7d+oskFpiH/s y6+h5qSCE/kB8hEbDi8fLTjfM6nGyPaIsoX3JQ2EjqRa2gLKvUBNWNVAIEaCuo3LeagB I5BkTJCuAqXXF0AiQ3w3FJxei1gYsJIUhZSouo8CaQBFgirCoeQKbLdqrkRyVn9hTex+ Q1Lw== X-Gm-Message-State: APjAAAUdrB7ADunuyNdBpWYDHQEpk1QfEp03xf74O79evRMZU78ADPhT zTjNSWZ1jtQnjmSiQHC+agyrYfmUIk8= X-Google-Smtp-Source: APXvYqzjz0QHX97hjB+RR48Sv8aquf6PiNdwvggFUsroKGh2ZdGJYCt3VU58bRa8+Ckc9Y0W3Kwm9w== X-Received: by 2002:a63:d754:: with SMTP id w20mr14016558pgi.156.1572624478545; Fri, 01 Nov 2019 09:07:58 -0700 (PDT) Received: from gizo.domain (97-115-74-198.ptld.qwest.net. [97.115.74.198]) by smtp.gmail.com with ESMTPSA id x2sm10065981pfj.90.2019.11.01.09.07.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Nov 2019 09:07:57 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Fri, 1 Nov 2019 09:07:54 -0700 Message-Id: <1572624474-24209-1-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] Revert "ip_gre: Remove even more unused code" X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This reverts commit 42a059e02bf343787951be2824c579e1c9a26e12. Not all the necessary ipgre prefixed code was removed that should have been. Another patch will follow with the correct removed code. Signed-off-by: Greg Rose --- datapath/linux/compat/ip_gre.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c index 8536241..3b7e607 100644 --- a/datapath/linux/compat/ip_gre.c +++ b/datapath/linux/compat/ip_gre.c @@ -922,6 +922,44 @@ static int erspan_tunnel_init(struct net_device *dev) return ip_tunnel_init(dev); } +static int ipgre_header(struct sk_buff *skb, struct net_device *dev, + unsigned short type, + const void *daddr, const void *saddr, unsigned int len) +{ + struct ip_tunnel *t = netdev_priv(dev); + struct iphdr *iph; + struct gre_base_hdr *greh; + + iph = (struct iphdr *)__skb_push(skb, t->hlen + sizeof(*iph)); + greh = (struct gre_base_hdr *)(iph+1); + greh->flags = gre_tnl_flags_to_gre_flags(t->parms.o_flags); + greh->protocol = htons(type); + + memcpy(iph, &t->parms.iph, sizeof(struct iphdr)); + + /* Set the source hardware address. */ + if (saddr) + memcpy(&iph->saddr, saddr, 4); + if (daddr) + memcpy(&iph->daddr, daddr, 4); + if (iph->daddr) + return t->hlen + sizeof(*iph); + + return -(t->hlen + sizeof(*iph)); +} + +static int ipgre_header_parse(const struct sk_buff *skb, unsigned char *haddr) +{ + const struct iphdr *iph = (const struct iphdr *) skb_mac_header(skb); + memcpy(haddr, &iph->saddr, 4); + return 4; +} + +static const struct header_ops ipgre_header_ops = { + .create = ipgre_header, + .parse = ipgre_header_parse, +}; + static int ipgre_tunnel_init(struct net_device *dev) { struct ip_tunnel *tunnel = netdev_priv(dev);