From patchwork Thu Apr 4 17:50:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Ahern X-Patchwork-Id: 1077548 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@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; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="zteMbYSP"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44Zr7h6Kpxz9sP6 for ; Fri, 5 Apr 2019 04:50:08 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729325AbfDDRuI (ORCPT ); Thu, 4 Apr 2019 13:50:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:36390 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729184AbfDDRuC (ORCPT ); Thu, 4 Apr 2019 13:50:02 -0400 Received: from kenny.it.cumulusnetworks.com. (fw.cumulusnetworks.com [216.129.126.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4C5522147C; Thu, 4 Apr 2019 17:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554400202; bh=Qr6OKCH1Qo0DdL6NxG90w9VLAMt1RERTQDXCfCfd7nU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zteMbYSPmZ0Ie6aarqrTlQE9RcSIq6ebPKwPdchMr6vqt1wFOveiCFkVnsUNKIZTR /pzSe7bWCVqRwY2q9JOKsgDZDnd/DbITJTSfPPtO7DABUkEvXjB9Jnng4iwObToD29 CzZx7JelSw9HIenT+A9jGrhHSwt0e9BOFXxVPq84= From: David Ahern To: davem@davemloft.net, netdev@vger.kernel.org Cc: idosch@mellanox.com, jiri@mellanox.com, David Ahern Subject: [PATCH net-next 15/18] ipv4: Handle ipv6 gateway in fib_good_nh Date: Thu, 4 Apr 2019 10:50:04 -0700 Message-Id: <20190404175007.8150-16-dsahern@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190404175007.8150-1-dsahern@kernel.org> References: <20190404175007.8150-1-dsahern@kernel.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: David Ahern Update fib_good_nh to handle an ipv6 gateway. Signed-off-by: David Ahern --- net/ipv4/fib_semantics.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index f3f11f55e905..6b48a0b92eef 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -1909,8 +1909,14 @@ static bool fib_good_nh(const struct fib_nh *nh) rcu_read_lock_bh(); - n = __ipv4_neigh_lookup_noref(nh->fib_nh_dev, - (__force u32)nh->fib_nh_gw4); + if (likely(nh->fib_nh_gw_family == AF_INET)) + n = __ipv4_neigh_lookup_noref(nh->fib_nh_dev, + (__force u32)nh->fib_nh_gw4); + else if (nh->fib_nh_gw_family == AF_INET6) + n = __ipv6_neigh_lookup_noref_stub(nh->fib_nh_dev, + &nh->fib_nh_gw6); + else + n = NULL; if (n) state = n->nud_state;