From patchwork Thu Sep 28 16:34:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amine Kherbouche X-Patchwork-Id: 819677 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=6wind-com.20150623.gappssmtp.com header.i=@6wind-com.20150623.gappssmtp.com header.b="TfrX7qFo"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3y30fQ3MVXz9t3R for ; Fri, 29 Sep 2017 02:35:10 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752144AbdI1QfI (ORCPT ); Thu, 28 Sep 2017 12:35:08 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:51164 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751950AbdI1QfH (ORCPT ); Thu, 28 Sep 2017 12:35:07 -0400 Received: by mail-wm0-f44.google.com with SMTP id u138so3436510wmu.5 for ; Thu, 28 Sep 2017 09:35:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=gehSUMo7lwU3y5HKrTVan6AAIH5wAbJpZijv8yijlk0=; b=TfrX7qFoou2WuuSaL4ZIi8zfETO+z7wAzW4d474F9FgetY0gJvxj5An44gNF6IOfIc HoeM6qI7zJwrM8ErQgvBZ3Dtvfx2ddVAhSxltK+T1PE/vopzqZnPBG4nxTf6f/RDsHfC qGPBThswV2iRybD6osaSqK6yHLkdzzaqnXkirNd4bY2aNWv8L+7/GWujxxB03CPJK4Hv dj8rGzYg/Vc7AFhK23UJA2OjuIFBeNE6pa4JlBo34CQz5O8+X8ExhF+2eJWlRg9/LNAM xIXNL/gCRXc1R46eZb7sBRYKHSGuv17uPYRb1XuRQL95Q1LqRi6dn+EHBIf0ufCU7dHv qPUQ== 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=gehSUMo7lwU3y5HKrTVan6AAIH5wAbJpZijv8yijlk0=; b=MOd7SgFOdV5IRZdCvkL5PVrdBgXAQYWRJznfNAmfMA9M3m3pdxWGlCmQIgkaFvqo6G qVGEKAyAH70+L3N9QwnNcp3mt72XhkpWX3DDzPTVMBCJtMRnzrFedvo2pvG+Aw6IDpRw ZwxpNWGNPb+J9SStjWdyzidreCKEUwgTXAz/aCfZB7CzjI2vTsjNpQWqjV3QbwWIKbzL VHEB67qwKaH4xVgbg428hRSMPTw3rdnS3XtgPWE7z30nmYChDuVpaCCxrQsMz4TcSZSX qr1SNsFt2Aozb+KHiPSpGCJ1gj9sJ62SAcuhfEXbL4JtwFCs4tTTEEhu1SXzKYM+ssvv +C3w== X-Gm-Message-State: AHPjjUiGDfobVO8a2oyay+oOrivpfCuBJakVEyo+1DlBEjT9j8/OCk+H AUoT6ic8/8eFpHV5NLJbME9e6JeR X-Google-Smtp-Source: AOwi7QD9vSUFs8k9Zj9DchXdqqL8oDA+rJ8zgiuyJA7T7SNA2Y3Qv/yfoFxJsV1C4vaP3Ay5ldpaZw== X-Received: by 10.80.211.18 with SMTP id g18mr6336222edh.85.1506616505810; Thu, 28 Sep 2017 09:35:05 -0700 (PDT) Received: from griffon.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id r30sm1745488edb.59.2017.09.28.09.35.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Sep 2017 09:35:05 -0700 (PDT) From: Amine Kherbouche To: netdev@vger.kernel.org, davem@davemloft.net, xeb@mail.ru, roopa@cumulusnetworks.com Cc: amine.kherbouche@6wind.com, equinox@diac24.net Subject: [PATCH v5 0/2] Introduce MPLS over GRE Date: Thu, 28 Sep 2017 18:34:37 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This series introduces the MPLS over GRE encapsulation (RFC 4023). Various applications of MPLS make use of label stacks with multiple entries. In some cases, it is possible to replace the top label of the stack with an IP-based encapsulation, thereby, it is possible for two LSRs that are adjacent on an LSP to be separated by an IP network, even if that IP network does not provide MPLS. Changes in v5: - Reword first commit title. Changes in v4: - Bring back mpls_forward() function exportation patch. - Move back mpls_gre_rcv() to gre module file and wrap it under ifdef. Changes in v3: - remove mpls_forward() function exportation patch. - wrap efficiently mpls iptunnel add/del functions and dependent function/structure. - move mpls_gre_rcv to af_mpls.c file and export it. - remove unnecessary functions. Changes in v2: - wrap ip tunnel functions under ifdef in mpls file. - fix indentation. - check return code. An example of configuration: node1 LER1 LER2 node2 +-----+ +------+ +------+ +-----+ | | | | | | | | | | | |p3 GRE tunnel p4| | | | | |p1 p2| +-------------------+ |p5 p6| | | +-------------+ +-------------------+ +------------+| | | |10.100.0.0/24| | | |10.200.0.0/24| | | |fd00:100::/64| | 10.125.0.0/24 | |fd00:200::/64| | | | | | fd00:125::/64 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +-----+ +------+ +------+ +-----+ ### node1 ### ip link set p1 up ip addr add 10.100.0.1/24 dev p1 ### LER1 ### ip link set p2 up ip addr add 10.100.0.2/24 dev p2 ip link set p3 up ip addr add 10.125.0.1/24 dev p3 modprobe mpls_router sysctl -w net.mpls.conf.p2.input=1 sysctl -w net.mpls.conf.p3.input=1 sysctl -w net.mpls.platform_labels=1000 ip link add gre1 type gre ttl 64 local 10.125.0.1 remote 10.125.0.2 dev p3 ip link set dev gre1 up ip -M route add 111 as 222 dev gre1 ip -M route add 555 as 666 via inet 10.100.0.1 dev p2 ### LER2 ### ip link set p5 up ip addr add 10.200.0.2/24 dev p5 ip link set p4 up ip addr add 10.125.0.2/24 dev p4 modprobe mpls_router sysctl -w net.mpls.conf.p4.input=1 sysctl -w net.mpls.conf.p5.input=1 sysctl -w net.mpls.platform_labels=1000 ip link add gre1 type gre ttl 64 local 10.125.0.2 remote 10.125.0.1 dev p4 ip link set dev gre1 up ip -M route add 444 as 555 dev gre1 ip -M route add 222 as 333 via inet 10.200.0.1 dev p5 ### node2 ### ip link set p6 up ip addr add 10.200.0.1/24 dev p6 Now using this scapy to forge and send packets from the port p1 of node1: p = Ether(src='de:ed:01:0c:41:09', dst='de:ed:01:2f:3b:ba') p /= MPLS(s=1, ttl=64, label=111)/Raw(load='\xde') sendp(p, iface="p1", count=20, inter=0.1) Amine Kherbouche (2): mpls: export mpls_forward() ip_tunnel: add mpls over gre encapsulation include/linux/mpls.h | 4 ++++ include/net/gre.h | 1 + include/uapi/linux/if_tunnel.h | 1 + net/ipv4/gre_demux.c | 27 +++++++++++++++++++++++++++ net/ipv4/ip_gre.c | 3 +++ net/ipv6/ip6_gre.c | 3 +++ net/mpls/af_mpls.c | 41 +++++++++++++++++++++++++++++++++++++++-- 7 files changed, 78 insertions(+), 2 deletions(-)