Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2281466ybc; Wed, 13 Nov 2019 11:49:34 -0800 (PST) X-Google-Smtp-Source: APXvYqzpKGtT4LRYn1PMHcpodruQCx8T5y+VHkHImGkkhJIKQ8FzZ+bVB85Q3MNiMaJMhu+/dQad X-Received: by 2002:a17:906:1505:: with SMTP id b5mr4626296ejd.195.1573674574219; Wed, 13 Nov 2019 11:49:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573674574; cv=none; d=google.com; s=arc-20160816; b=BPmYHy4ZwLN5i0+B294mrn4ibBGA54mqAbRruXQ9OSTbLiF90xgwgkSL68PyfAtjA7 QSFrEwTidUMmBYT5bZLtyz7rd+Vj5Z0Djnft01fK4nofrStYHkdsZgLmvb5tF0FvGtl9 dv6g7QXBKZIS23kpr/N1yuVl9SWsDPr5Th7eCHQj1TSqaLrFPot6/Ti1mBuhGKbhwM3h saPiM497hvqGS59XWkimLZv1n2rRfveaP4bxZFc9dS4F5hb6K8Qbfg+AUk2aXOy4zmJs 97ftLVl7Ptt7Pq1/F+E33/S5dT6UuKwCScN3oGXLz9Pki+c0RkNBIIAnlWaM1SBaZ9vj yw3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=so0mTn5OEiGzp4zKvHE4ycnK6oXIWBo3p7t9MqA/sXU=; b=XB7z3QJJ+v1ybFXoS8o/ZQUbag7FOxqQKnkLbFcRmPUPhpXyupB4U2cOk1Yz1/T0mC +Qr/Q5U9S3/nrtL9WnNZNKyYqgElhRzL6s7M39sZHb/8DpQZRfmRPGmjyn6ua/0UAKcy Z9aSizQuQ/qFPgGeDixqG4YOTeQvEoiQyy3zxi6gqBhtIE0Sl/rGzIn/SV0brC4D8Fjm Oi29pOYYZAn3brvWN4jEg+ZwYhxYDOa1Tai9PjTiR2VJJmGI0r2Ss9pTly2HZOrX/6Th Ku/0uSpwtgz5Z9GmYZwvQT6m1RttH3hjilskvGadnZKHPL1MvOkIrVu3WSSdc4Iu96Ee fhAw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=uniroma2.it Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w32si2153921edc.443.2019.11.13.11.49.09; Wed, 13 Nov 2019 11:49:34 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=uniroma2.it Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727036AbfKMTsL (ORCPT + 99 others); Wed, 13 Nov 2019 14:48:11 -0500 Received: from smtp.uniroma2.it ([160.80.6.16]:57695 "EHLO smtp.uniroma2.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbfKMTsJ (ORCPT ); Wed, 13 Nov 2019 14:48:09 -0500 X-Greylist: delayed 1019 seconds by postgrey-1.27 at vger.kernel.org; Wed, 13 Nov 2019 14:47:58 EST Received: from localhost.localdomain ([160.80.103.126]) by smtp-2015.uniroma2.it (8.14.4/8.14.4/Debian-8) with ESMTP id xADJTimm023525 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 13 Nov 2019 20:31:03 +0100 From: Andrea Mayer To: "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , David Lebrun , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andrea Mayer Subject: [net-next, 2/3] seg6: set skb transport_header properly after decap_and_validate() Date: Wed, 13 Nov 2019 20:29:11 +0100 Message-Id: <20191113192912.17546-3-andrea.mayer@uniroma2.it> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191113192912.17546-1-andrea.mayer@uniroma2.it> References: <20191113192912.17546-1-andrea.mayer@uniroma2.it> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.100.0 at smtp-2015 X-Virus-Status: Clean Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org in the receive path (more precisely in ip6_rcv_core()) the skb->transport_header is set to skb->network_header + sizeof(*hdr). As a consequence, after routing operations, destination input expects to find skb->transport_header correctly set to the next protocol (or extension header) that follows the network protocol. However, decap behaviors (DX*, DT*) remove the outer IPv6 and SRH extension and do not set again the skb->transport_header pointer correctly. For this reason, the patch sets the skb->transport_header to the skb->network_header + sizeof(hdr) in each DX and DT* behavior. Signed-off-by: Andrea Mayer --- net/ipv6/seg6_local.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c index e187dec2eed1..948a4c2a59f2 100644 --- a/net/ipv6/seg6_local.c +++ b/net/ipv6/seg6_local.c @@ -340,6 +340,8 @@ static int input_action_end_dx6(struct sk_buff *skb, if (!ipv6_addr_any(&slwt->nh6)) nhaddr = &slwt->nh6; + skb_set_transport_header(skb, sizeof(struct ipv6hdr)); + seg6_lookup_nexthop(skb, nhaddr, 0); return dst_input(skb); @@ -369,6 +371,8 @@ static int input_action_end_dx4(struct sk_buff *skb, skb_dst_drop(skb); + skb_set_transport_header(skb, sizeof(struct iphdr)); + err = ip_route_input(skb, nhaddr, iph->saddr, 0, skb->dev); if (err) goto drop; @@ -389,6 +393,8 @@ static int input_action_end_dt6(struct sk_buff *skb, if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) goto drop; + skb_set_transport_header(skb, sizeof(struct ipv6hdr)); + seg6_lookup_nexthop(skb, NULL, slwt->table); return dst_input(skb); -- 2.20.1