Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4014514imm; Sat, 25 Aug 2018 07:19:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbaaDxr00iWSVJqxRkndaAiolsahDscbWEU5vnk1fZxyeWUp7qlLimvqTyk3ehZO5pMEeA6 X-Received: by 2002:a65:5545:: with SMTP id t5-v6mr5828017pgr.157.1535206781962; Sat, 25 Aug 2018 07:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535206781; cv=none; d=google.com; s=arc-20160816; b=ErpE/i6XYPHMMB4WhJvL0LGt4rM3fF/K1h2/GHSMuJvSKT0Z/aKhvrY/IYtw0TKKVo hm3Qz+wasuhIIRGouq5UpY6uby4Cp+GEyyJmWAF5p239c4a6V3oY4oQmoJnoLBfgMg6K Z0s2NhFOnUIzZuuEVLFwtqRcuPvxetfmm9KM0Q7fWy3RhwL9HQf0bnZIZvY/AotdVV+X gLiae41ff8wXVJVFpDUsgjdJnAA5eKNgCEUKWLB2Ya+gN0XrXfJh+pZVNVtzaHylqcY6 Mse/+G50sDqjQWnR6p9KPk2lrpme7Vz+hL8EwBPyDyN0u3YyszW3hkMn2hK2ojKOKPqL s6ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=s/lezIyIiPkTk9bWADp/s4dd+qQ7Vdsz2ayDh8LCkzI=; b=DiecsS1L6HeuC9vCIG4LJGLRVx1tG0B374quv8t/Jb8rK0y/6KzDf0hhHbZs3tkWU6 +c14ZZIO7a62aef5zWXSMiiNTT73obJLWLuFfJBxWtJBjcRbj57mirc7mBEp+9zZCiAt nhJ28nci8Km88tY3J4CWJXfD3NaVzFewwgpIROD2Y5oIc4M+cm0PZlxLDHalzp2+Pml+ +jSLV2/G+Xu6a8AtXOPCpyazCbbn8kNe6Z8cEAkub7sWlj+3bTkRh8X5bRHmRsl0xF53 vD57sdc13FKLsE/dS9wIaTPNELM7Od4IJ/HkGBP0Hdmkj59yd/KRb+dPgKV3KW0giSlB Ae8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lZAgYI4U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m21-v6si9797693pgh.664.2018.08.25.07.19.08; Sat, 25 Aug 2018 07:19:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lZAgYI4U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726887AbeHYRyz (ORCPT + 99 others); Sat, 25 Aug 2018 13:54:55 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35878 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726555AbeHYRyz (ORCPT ); Sat, 25 Aug 2018 13:54:55 -0400 Received: by mail-wm0-f67.google.com with SMTP id j192-v6so4173315wmj.1; Sat, 25 Aug 2018 07:15:49 -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=s/lezIyIiPkTk9bWADp/s4dd+qQ7Vdsz2ayDh8LCkzI=; b=lZAgYI4UeVli0StX/yfQEKbaVLZr3qdX9/i08fw6ibOxIPJZdFHMtBLkbABYfIrDLc 8z8pVuebOw/JxpOjzGPDLo6XCvZpUhJYFuRcBkHsnTTzos/frJ1L1sr9x23Oj5EPf+ZN PDYO2UHzc822eRIZKKLfJrWyfxfh1wLVZ13j5EFL0G5vqQC1yKzRyFSPjZfh8igzm1Co ORm1Zjl8gBZ9XCJCqweG+VH7HjOKxZsn9gSRzjcTkVg9raBRtLanQ7Jq6FStku+KIfq+ MOF0gPLnIfe6TQEF9vm4O6pnZCiEmSsNllrYc7I1lV/PtPx2mJFRTCqH0JFTVclGFKAN zmUg== 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=s/lezIyIiPkTk9bWADp/s4dd+qQ7Vdsz2ayDh8LCkzI=; b=WVW+6C03ZxTE2boPbVyigQhcmCXnXvFLFiUvmRowNiI464W41cIPBU+MG2CmH6SEbN Ejq9vEnRSGlQK5M/OAPm/OmAKaHZBguPMmgnFe2QPudWBP0Xx5kiAxAFvk5XlHDXrNno 59UDJ02jHrGyCzItl3pcZKqY00B4RcKP0abscPW7qrXk5NG3k9qCZTCwjMfzhlg6ypl5 Z8ozOpknGTYWLhfaoP52kCc75/++qts781G7FCRKNkxafaPY9f7tE0txfn2QvthRp6mO bS4i7FQ2WyyOnWeSs9m9rOrdXZ/02o+276I3AwtLv9lys4L1Phcz0/Jxvksy7rNww7Jm WXow== X-Gm-Message-State: APzg51C3zr4EvUJs6InwGw1X616ZN6BPg8lRqYPXigcjsQPR9UIFw2G1 d8tmisBMiMgkJshYQ11fC/0= X-Received: by 2002:a1c:1188:: with SMTP id 130-v6mr1235500wmr.138.1535206548440; Sat, 25 Aug 2018 07:15:48 -0700 (PDT) Received: from localhost.localdomain ([192.135.27.140]) by smtp.gmail.com with ESMTPSA id u65-v6sm5791361wmd.31.2018.08.25.07.15.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Aug 2018 07:15:47 -0700 (PDT) From: Ahmed Abdelsalam To: davem@davemloft.net, dlebrun@google.com, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, amsalam20@gmail.com Subject: [net-next] ipv6:sr: Use the right next-hop value for neighbor discovery in End.DX4 Date: Sat, 25 Aug 2018 16:15:41 +0200 Message-Id: <20180825141541.960-1-amsalam20@gmail.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The SRv6 End.DX4 behaviour supports the use-case of L3VPN, where a FIB lookup in a specific tenant table at the egress PE is not required [1]. In the implementation of the behaviour, after the packet being decapsulated, the lookup in the routing sub-system is done based on next-hop specified form the control plane (using iproute2) or the destination address of the packet. However, the neighbour discovery process always fall back on the destination address of the packet (in ip_finish_output2 ()), if "rt_gateway" value is not present in the "struct rtable rt". nexthop = (__force u32) rt_nexthop(rt, ip_hdr(skb)->daddr); This patch makes sure that "rt_gateway" has the value of the next-hop configured from the control plane. The patch is tested for inner IPv4 packets having destination address different from the next-hop configured using iproute2 [1] https://tools.ietf.org/html/draft-filsfils-spring-srv6-network-programming-05 Signed-off-by: Ahmed Abdelsalam --- net/ipv6/seg6_local.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c index 60325dbfe88b..d346f0d19c09 100644 --- a/net/ipv6/seg6_local.c +++ b/net/ipv6/seg6_local.c @@ -374,6 +374,8 @@ static int input_action_end_dx4(struct sk_buff *skb, if (err) goto drop; + ((struct rtable *)skb_dst(skb))->rt_gateway = nhaddr; + return dst_input(skb); drop: -- 2.11.0