From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 151DDC4360F for ; Thu, 4 Apr 2019 17:50:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D337F20820 for ; Thu, 4 Apr 2019 17:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554400206; bh=6DI+57n08EXzv/1pkNpuO1mHfMTG3CdKf5TOTaZGiUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WXbBL2kB7GCve8/TZ0LYmbpNpXAuHbpcyr4FzQpO93mVshVqSQ6cY/2iomTJc3bdj gF0KP/x+q7qg2dYIDh38ZY2n1vl4RavJDifhNl812EF45v0gDEkLPPmuRTkdHoUOBL EimBdfV2cWt/41FopYwQ17EiTcmkeS+E169bpgUM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729393AbfDDRuG (ORCPT ); Thu, 4 Apr 2019 13:50:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:36366 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729178AbfDDRuC (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 0CDF720882; 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=6DI+57n08EXzv/1pkNpuO1mHfMTG3CdKf5TOTaZGiUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E85k6LmRREolcwY7VGdLTludycjRRWRdYM3RduwQREZQXome4/Nemm3e2G/bfWSjY QgvA+tGE6vEI8hpyA6KLOZvBLeDikYzzUbN4VAO+1fzfq+epqCKrXdS7pefytJc2uQ SFSLKMmpffrHRN351ov6XLR9Vy0TGlN0uoe0BUIo= From: David Ahern To: davem@davemloft.net, netdev@vger.kernel.org Cc: idosch@mellanox.com, jiri@mellanox.com, David Ahern Subject: [PATCH net-next 14/18] ipv4: Handle ipv6 gateway in fib_detect_death Date: Thu, 4 Apr 2019 10:50:03 -0700 Message-Id: <20190404175007.8150-15-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_detect_death to handle an ipv6 gateway. Signed-off-by: David Ahern --- net/ipv4/fib_semantics.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index acbdf0ed6ff8..f3f11f55e905 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -457,10 +457,18 @@ static int fib_detect_death(struct fib_info *fi, int order, struct fib_info **last_resort, int *last_idx, int dflt) { + const struct fib_nh_common *nhc = fib_info_nhc(fi, 0); struct neighbour *n; int state = NUD_NONE; - n = neigh_lookup(&arp_tbl, &fi->fib_nh[0].fib_nh_gw4, fi->fib_dev); + if (likely(nhc->nhc_gw_family == AF_INET)) + n = neigh_lookup(&arp_tbl, &nhc->nhc_gw.ipv4, nhc->nhc_dev); + else if (nhc->nhc_gw_family == AF_INET6) + n = neigh_lookup(ipv6_stub->nd_tbl, &nhc->nhc_gw.ipv6, + nhc->nhc_dev); + else + n = NULL; + if (n) { state = n->nud_state; neigh_release(n); -- 2.11.0