Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp412576pxb; Wed, 3 Mar 2021 06:30:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxl7GYwGRJFhf/ChDLCklyc138iKnEAcClqMNVTJFOeM5cMpr7NNq9W9quWtI+lpGTokGVG X-Received: by 2002:aa7:c944:: with SMTP id h4mr25431724edt.233.1614781855565; Wed, 03 Mar 2021 06:30:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614781855; cv=none; d=google.com; s=arc-20160816; b=vQpLPzLuCpjgXBbkNfPbdOJK9a0vENWQxcIT6jeK3X4s1CG82CM+72f9F7Z5PfeOS+ U9QjnSu3fbBfnRYER1rYzl4fjliNtzwSzGSmQqQ+YmWJVYniDfWbs9yaBWT+opVbAyff dVYhRdeLc1Dv+maQDCW7vMoTBAlLs6IIMSTRcCcmhIjS+4DN339j0RyGE4b8UlrEoFnx 9meBlPq5NrRGs+oBeZUnZPDE61L049JRy7AC6yF/CcYHQYtYTK1dxv8rZErek7LZl9PG aJt5no74K4g09NoINJRGX5MoQCamgK91NOy2+8Iw+cMbhChNZJ28yOwezSXZa+TdgJNO J0Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ij5TAtBaIzy1XI5uaqUThAkaorSlgEWLGJ3NRXaehIk=; b=ctICiWjlJuYnuAkGGakjLRCxCnL0ckteVWGIX/VA8Bv+7JKn9pwp0LWJlIDZ0pQPP2 QckdzjJYyfQTHPJ7+YzNlqb3Am5By6FtfSJNeqMpp/mIAVobmlNeJ81uz0XLKIGA8Eng aTUS/8gEWZHXdXQEu2TqO+g8LRv4Z3AUEI29cP3K8OnG9FYr0hPfURWrsevE6V7ZQCE9 KniLhCRrstKQbC/pbbFDOQ4IuAY6xgfqicNSfXZO4x7PLbM0RSyRgCMv4MReWcgS4s2z Gh1tyE9FPzfi9luNKxq4Dh5XytOp6vsLti9WYtJNqzbCo6MyGKymL6nKm9AwtsmPL6it qH3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BjtzmEMo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t14si16435960edd.161.2021.03.03.06.30.21; Wed, 03 Mar 2021 06:30:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BjtzmEMo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243567AbhCAVcp (ORCPT + 99 others); Mon, 1 Mar 2021 16:32:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:36910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233651AbhCARSg (ORCPT ); Mon, 1 Mar 2021 12:18:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D2CA564ECE; Mon, 1 Mar 2021 16:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614617211; bh=452moKIc6TwuzRdS9Pe3ofv+4LHyBGggXPdSMhgEIeI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BjtzmEMoJAKzqxihE8fszac49s00DkHwRVApSZWRmcez+U8FJQYBCrl0ADUafhJai cVtiOI38uIUXnNiJ1/L8UEiS8HFOnZb7z6Wpfls82xFO0PRyZF6fvpE3dEbsN2ydU6 4J3/YsuhQI/u0ANlXcXrPMJVFoU+I3LBUfLfAt1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Shannon Nelson , "David S. Miller" Subject: [PATCH 4.19 241/247] sunvnet: use icmp_ndo_send helper Date: Mon, 1 Mar 2021 17:14:21 +0100 Message-Id: <20210301161043.504566677@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jason A. Donenfeld commit 67c9a7e1e3ac491b5df018803639addc36f154ba upstream. Because sunvnet is calling icmp from network device context, it should use the ndo helper so that the rate limiting applies correctly. While we're at it, doing the additional route lookup before calling icmp_ndo_send is superfluous, since this is the job of the icmp code in the first place. Signed-off-by: Jason A. Donenfeld Cc: Shannon Nelson Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/sun/sunvnet_common.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) --- a/drivers/net/ethernet/sun/sunvnet_common.c +++ b/drivers/net/ethernet/sun/sunvnet_common.c @@ -1353,27 +1353,12 @@ sunvnet_start_xmit_common(struct sk_buff if (vio_version_after_eq(&port->vio, 1, 3)) localmtu -= VLAN_HLEN; - if (skb->protocol == htons(ETH_P_IP)) { - struct flowi4 fl4; - struct rtable *rt = NULL; - - memset(&fl4, 0, sizeof(fl4)); - fl4.flowi4_oif = dev->ifindex; - fl4.flowi4_tos = RT_TOS(ip_hdr(skb)->tos); - fl4.daddr = ip_hdr(skb)->daddr; - fl4.saddr = ip_hdr(skb)->saddr; - - rt = ip_route_output_key(dev_net(dev), &fl4); - if (!IS_ERR(rt)) { - skb_dst_set(skb, &rt->dst); - icmp_send(skb, ICMP_DEST_UNREACH, - ICMP_FRAG_NEEDED, - htonl(localmtu)); - } - } + if (skb->protocol == htons(ETH_P_IP)) + icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, + htonl(localmtu)); #if IS_ENABLED(CONFIG_IPV6) else if (skb->protocol == htons(ETH_P_IPV6)) - icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu); + icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu); #endif goto out_dropped; }