Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753656AbdLMRVq (ORCPT ); Wed, 13 Dec 2017 12:21:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39858 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753266AbdLMRVn (ORCPT ); Wed, 13 Dec 2017 12:21:43 -0500 Date: Wed, 13 Dec 2017 15:21:40 -0200 From: Marcelo Ricardo Leitner To: Brendan McGrath Cc: "David S . Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ipv6: ip6mr: Recalc UDP checksum before forwarding Message-ID: <20171213172140.GC3531@localhost.localdomain> References: <1513164048-21368-1-git-send-email-redmcg@redmandi.dyndns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1513164048-21368-1-git-send-email-redmcg@redmandi.dyndns.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 13 Dec 2017 17:21:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1773 Lines: 59 Hi, On Wed, Dec 13, 2017 at 10:20:48PM +1100, Brendan McGrath wrote: > Currently, when forwarding from a Virtual Interface to a Physical > Interface, ip_summed is set to a value of CHECKSUM_UNNECESSARY and > the UDP checksum has not been calculated. > > When the packet is then forwarded by a Multicast Router, the checksum > value is left as is and therefore rejected by the receiving > machine(s). > > This patch ensures the checksum is recalculated before forwarding. > > Signed-off-by: Brendan McGrath > --- > > It's a bit ugly putting UDP specific code in this spot - but I'm not > aware of any other protocols that are: > a) multicast; > b) forwarded; and > c) checksummed > > net/ipv6/ip6mr.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c > index 890f9bda..ee4370a 100644 > --- a/net/ipv6/ip6mr.c > +++ b/net/ipv6/ip6mr.c > @@ -2077,6 +2077,13 @@ static int ip6mr_forward2(struct net *net, struct mr6_table *mrt, > ipv6h = ipv6_hdr(skb); > ipv6h->hop_limit--; > > + if (ipv6h->nexthdr == NEXTHDR_UDP && > + skb->ip_summed != CHECKSUM_PARTIAL) { ^ This indentation is wrong. The 2nd line should start right after the ( column in the 1st line, like: + if (ipv6h->nexthdr == NEXTHDR_UDP && + skb->ip_summed != CHECKSUM_PARTIAL) { Adjust with spaces as needed. Running the patch through scripts/checkpatch.pl before posting will catch these. > + struct udphdr *uh = udp_hdr(skb); > + udp6_set_csum(false, skb, &ipv6_hdr(skb)->saddr, > + &ipv6_hdr(skb)->daddr, ntohs(uh->len)); ^ same deal here. > + } > + > IP6CB(skb)->flags |= IP6SKB_FORWARDED; > > return NF_HOOK(NFPROTO_IPV6, NF_INET_FORWARD, > -- > 2.7.4 >