From patchwork Mon Jun 24 14:15:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathis Marion X-Patchwork-Id: 13709582 X-Patchwork-Delegate: kuba@kernel.org Received: from mx0a-0024c301.pphosted.com (mx0a-0024c301.pphosted.com [148.163.149.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D780D19AA7F; Mon, 24 Jun 2024 14:32:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.149.154 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719239558; cv=fail; b=Kj1gSGUTP3JgYraRV5UzgSaARfM5Ext+kHsiwgmx506GeIAqr0vCnN4BqS7xDnFcCLQJnxvMGOhYY0pKUkXnVEQ2tOiMJI2o0/A5zfuqUvakB3LIVVe72jqpw/3e3XsAjVbRoqy+cO5sfqmqbQrBypuHdmoTiXprWs74htGiIPM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719239558; c=relaxed/simple; bh=UsHNUw7NnubdlyS+khngAJbLx9mDlzjwZUXC61i6N0s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=D+0kxg8j+iHbbQJz8hWznAhpbWopdhYnbT04hMC8HIvNd6sh5pCk9UWf1Ntd2T1yEdbSXMvnBexJatPf/RYnzyaOoZBib4D9wpQVFWj3AyHWmc2hsjoFm10VmjxYlxtfHRKlQDPtaMkh93dz+cZ3t49nsk4mt4LT1/RvMqEM4JM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=silabs.com; spf=pass smtp.mailfrom=silabs.com; dkim=pass (2048-bit key) header.d=silabs.com header.i=@silabs.com header.b=Pw2olDuL; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b=S2iMAbTu; arc=fail smtp.client-ip=148.163.149.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=silabs.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=silabs.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=silabs.com header.i=@silabs.com header.b="Pw2olDuL"; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b="S2iMAbTu" Received: from pps.filterd (m0101743.ppops.net [127.0.0.1]) by mx0a-0024c301.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45ODYZZo011774; Mon, 24 Jun 2024 09:16:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pps12202023; bh=UsHNUw7NnubdlyS+khngAJbLx9mDlzjwZUXC61i6N0s=; b=Pw2olDuL9QR7 VXVazgOsidR5uO63veGalZQoeyLRZ5AcXV5mk0CD1nanaJeNkELcd6/UKgR7BseG Y4YjwaXnVg0BiIhOsDXlXWxkWZSjYKSZhjvlm1vsZK88LbWlkAG7GLczmaInsmF/ 31P3DRr4f6iBJTnshh7sV6RoC+6/a2We0mOtWtvpM+S74B6a+sfzzzhJNxDpAzjl LuWgknocXZ17pm2a0wSDQg6ElLdjpfeUmgc684rBIdbSyROBJrj3oHFY09jpG05V x6IJcFgNa7cA3syXs+mcldKcULS5xtZRA6OSVjU6m6GdaOCfY2h1fk93Gd9+R2MZ j55MVZpXeg== Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by mx0a-0024c301.pphosted.com (PPS) with ESMTPS id 3ywtx92e3d-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2024 09:16:56 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jkSvnmhQIqETa2vjAxxPVfCiRwY5KIKuwVWgikakUBdo/h6Xre4jNozaFXtZpLWNTnrgHxAQo3paakH+qksTDuZAJFiSnHcdO4fMq1hwuK2pME8jXWvNwLN8KEo7XzkCndiyI34JUvQ4So9cTJD89Oocj+rx+EaJzJwD9dWELpgify91OEgkq+bw4lfaaW0MGFjMPAA7NY6JSqATk2AMNb+uHGXbwk1U6IesLx5jZPTH6Psfvcx5JFHnRupxUMh1NQF5u3swqK3c41ydwuDjcOjWbXmM9o6t7D4NTS0iPXYq43az+Hxy/HimsGpIyF7i6pjMjAGwyPLSxUI3GVqycA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UsHNUw7NnubdlyS+khngAJbLx9mDlzjwZUXC61i6N0s=; b=WeHYiqeefQkemGNhWRMTJXv/FckMMA2UwIyoCmoj+udyCbFQl0yxtJfvM+Am0T21/WjZa5DT/zpgGLqxY3F6OTDM4Zj7etejXb1+HF67qwcs+gjzgVW4sRaYOAPJ6jz4zz5eIV8ZoDf80svoEyutvwjQQvoK9ld6O1aQzh50Fzc/68fThMln3g93k4f6HD+83QV+839S7YD325EKjkTl2ur3rGVYC06E4wqgFZGfFmZsbaOLKhqQo6RqdzFBggZP7KG6hDsdGpRXrx8fqWESOt3SK3chyrAv9Vote73r+jV7xC66oGivlWn4MDGtNkDQS4FdJgYF2aKlONrGHe3bng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UsHNUw7NnubdlyS+khngAJbLx9mDlzjwZUXC61i6N0s=; b=S2iMAbTuifCFSeuleEZYUAAN+C2H+B7Vf6Ap1uzES9TteW78QyzYOQah4oY7zp2NVw9jrgo+hHanN+QfK4ewhLnVhHt0PNIIopbIWBwpjTuR3unc1dSLZfwQOU2KcZQiEhRIaZ20cNixRltADV3BXmZNJYs1FJHUyDZjJykgfMg= Received: from MN2PR11MB4711.namprd11.prod.outlook.com (2603:10b6:208:24e::13) by LV3PR11MB8765.namprd11.prod.outlook.com (2603:10b6:408:21d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.28; Mon, 24 Jun 2024 14:16:53 +0000 Received: from MN2PR11MB4711.namprd11.prod.outlook.com ([fe80::592e:a53b:e0b4:5da7]) by MN2PR11MB4711.namprd11.prod.outlook.com ([fe80::592e:a53b:e0b4:5da7%5]) with mapi id 15.20.7698.025; Mon, 24 Jun 2024 14:16:53 +0000 From: Mathis Marion To: "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?SsOpcsO0?= =?utf-8?b?bWUgUG91aWxsZXI=?= , Kylian Balan , Alexander Aring , Mathis Marion Subject: [PATCH v1 1/2] ipv6: introduce ipv6_rthdr_rcv_last() Date: Mon, 24 Jun 2024 16:15:32 +0200 Message-ID: <20240624141602.206398-2-Mathis.Marion@silabs.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240624141602.206398-1-Mathis.Marion@silabs.com> References: <20240624141602.206398-1-Mathis.Marion@silabs.com> X-ClientProxiedBy: LO4P265CA0273.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:37a::10) To MN2PR11MB4711.namprd11.prod.outlook.com (2603:10b6:208:24e::13) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR11MB4711:EE_|LV3PR11MB8765:EE_ X-MS-Office365-Filtering-Correlation-Id: 710ed98b-e27a-41b5-fac1-08dc94584c48 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|366013|52116011|376011|1800799021|38350700011; X-Microsoft-Antispam-Message-Info: 4j+wvJtH8Ote7fKsdYMU+xss3LYNgbL3We97QP732lKID5wwxWaxJM2g/LFObZMAzW6yyjIEW6xPLfQE5yUynJGzvN7ldsBmKvprphYdyglLhWL+vfuQT2d7yKnb+09ESqZRgmw0MsPLvTENyiBA3QIwsBLPx8qqmXSmX64iZK/LgHJRS4zQK8J0OzLwvvfqggpESnOQsohay28tJsMw1M1jy+t+rZuO/bvtrCE+8oyaAG5Gir+U3cR6NNLO0UTLp2CflgptBaVHgMJxbuYtfJGfdjds6S3Cj376pwFi66QzocRZBHBH9oDOTfQES4BUC7rZ9GIUG7YuX0P3zxJsOEY12EKVh/i88Ba3nW0XkL7MMLyYlwqJWe94AmcfnI5t14N3a6WTZM4pEjEF2AhjGQMO85WWkvJSAsMFnOrRk8EW3xz2bH4RqrgGU54Dwm6lzDWnvPHOhOJGLBEXYn9i4bnqCIzEfV14a+osh+wSWbxhN5kex3kciIoimpLfm4npXXogJF6ssRJIgV1nyGfQXPS/mC8WAAKB+YwELhKIEWXwLJAFdJlbubo7X5r9cFQo+Ds/p8Qh3oD0LzTNK9vLLoC+TlfUZeWooKvIVBZcpuayYPWssVvn/GJxkrN1ldhoraymAIXQXm1c0RktAVcHbsj5CyYT1Cqd5UweEXQxk1csjtUEQtoHETxK0RpY+4qH6eN49am/RExGw/1bgQYhWCYTVjdbxEvmZ27O0dWgruH/ADPnFpuGeNVoCYukeWOumfWSZnNMqak1+XhmL7BFjb3OrKgLA2ZfcbC5jOgj8SAi7gcyQBaCEv/YryGg25zZLq+RzjLzRP+O7sXIWlS1nPOklzVM+ae5q8NWI/YjpkumFgjMkmmH3ZdkjJ10GVZQMasewHZ3J5Su2L3EcpMKphiSoIWVmUfuBE8AbS9vFakmvQ64ZjignfUmXn2JdpUlwXL1ffW8QCNgKipLo5wuyyiDFQacfyQBzZ9GtN7Ja4vaZRs9HD/heMbZkZ/U0I1Ow9S+G1h5J09hz3/znBGFE74scjzlA+GmoBgP8X2IxuJC80AHCoVFE5c/HsE67dN5GTf2FbOgjcklSgvo8q8V6NI3aQVLUy0kGqxIYTAtpJNBdi9u322q+PHYVXRp5gPxgi/hSI3GH8/PhHJV5H3antC3R0UDHHvvgzphGB4Bgy9fhiB7qtGJbmhsVdBUacx71OQyNSMvoTwZz2qXI+fLuDopj3HcNV0d/tw17/Zj9u3PnnRlrPL1Yrda8qv2Srlf12Z6tk3QNx7Z+Bwxkj6+kJmc/ERh1PUCClBW27xSsCYouYqwQFvybP3hFhTb0j3N9LFu15OdBOgSNqNaxHKq0LRU4te+Sn+iXXlmEfLXd7A= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR11MB4711.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230037)(366013)(52116011)(376011)(1800799021)(38350700011);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Hn5I/HmvBMRHyqfOj3ZhD6EPwjTrae/6+l5j2HWlC/Le99DYWR4Tn+Vvyy4GeGDHLoFqO9yPchfWqZWTP+F0+qxEFJgMA4Hns9mnIFOTKsBZF3xty2gCnf/SCazkN9RraRUIsa9XOeJ2s2ASe6UYXU4qQzM/V1nxJxR1CP7WVO66UZhqrABIdFtpEwJZpxH+eECkAzbCAkjp0lQJ7S+EL8rTULws05VhEa0qoe1WXXcqptTz9uWGRigAa/sF9zacU1QDy+/6LEXe7lU/5BLGhwuiNm0B5B1XinEeaoJi5TK03htUqj5n4KoXMaJMrNQE2H+PpHwKle39rQjqZbXalOEZeOk3M9XfHUq4nvc12zqZegIONkKuYpCB2xmmZP5gmqhlaOboJhZwkoheEuhCVSG73vJprP4rA+axj8FlzELA0Bj1y3jaV/yiVKjSLE45qK2MYZTFhbGUilLJRoKM3htBbLY5/6O4EmzKS2dzzmWhEegfuVaiKwul2iBX+4w9TaZv0wsFB1MtRWJzIr0/0a6tSUfPjsycI5VlLRDO4cb0n8WKxvQtcyxmuWwdpat9U6LBu2MUna1719gw8Log+txZie8wvCGswVuMIlk/7GMIut2a5V3klufN323J4pJ12URGHwUtiavpEtGZoMDoV7bC6kgGs/ZTyoFtEDyLgH8gLRqBg7KIJrIfYK9UBHBthabN2QJtH5XLKrpY3MdeAI0T2oEV9bpiLsKS+hALfIKImQ2yUTVD/X/QZyouUeNVXI920eeA1zjy1BvZ+7i0H9ach+LHurLzVvSa+cueRx6YLkFIJXz0CNboEV09yd7M4acPKxP3Ryei/VBETttLyHFsusy+7N1dr+Pl94NxCk7ZXVcpQUjG5Bt4tmW2q7U1Is8+EI7vihQRrWlni3kb6EoRRoJg/yLdkskTPqocBzFLuGy1ZDxbVHkqXS/INjRrcnXY65+vwFz1bc3HDxlFEKIa+bC4wZ34TH9MXL8eiRIcvgDvmppFTPXWvYCdhroVIlj6gB4cSMyJmcQ2uYpN8k+feciscNxMGWdlVG3uL/ZojSMdOQkqQNumLYzgNcuSFQvhXNeEDVWM74Pu69d40pZQEDLt6wQHu0S+sNJVzM+ZD6VOfAjE2A8lTrwEzMtJvsPrKtYGyupEr9c5azA9YcOVVWaBzjKWhV+Mny6HtjUaquOZ59LeMus61lFRQAY+JGkGyUD+jIfwYWZ3UOK/7xT1NwmXxWq4JmJnjlpupZG+w7hf1OWU5+hHc3Uaencz89DKxrF5iCa+yfmtx5goPD3u59t2rnZnzbi2+Xu5NovXqwqzH80duj5YlMplrJV6c/AVJRnqFmDpp7CKJSovKpjTzIoMww44n0Q3sZMYZp8norC8VD097Vf1v59skbO8WKccjHTlPd+2aR9BaDAnP2mAGLroVdZ8E27JdY6qoLCuzrf6RSLkiDTk3YZXrr5BUJU3880uQpIC2nZo9HknS9t+mnQAPKxradaZsy5J16iom/6KqpZHT4Db/Yj3XpB3gnyRcOQfYKkVjTa5fl0RIV75+cZLazlo01gndMfov9SWCuZpwmJFe1x4mUXJZDgh X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 710ed98b-e27a-41b5-fac1-08dc94584c48 X-MS-Exchange-CrossTenant-AuthSource: MN2PR11MB4711.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 14:16:53.8726 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Y/WDuVk/IRwa/SrRV38Zqpz3xETFeRe4tQWi26nqEsGiRn03IV7Fb9kQWjF27XA8rUavPcKgIcoO2rLZJp4rzQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR11MB8765 X-Proofpoint-GUID: UuVjjltVgkmlu-zlHvqjJoeYWaX6OYJG X-Proofpoint-ORIG-GUID: UuVjjltVgkmlu-zlHvqjJoeYWaX6OYJG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-24_11,2024-06-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 mlxlogscore=980 mlxscore=0 suspectscore=0 bulkscore=0 phishscore=0 adultscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406240114 From: Mathis Marion This factorizes some code between ipv6_srh_rcv(), ipv6_rpl_srh_rcv() and ipv6_rthdr_rcv(). Note that: - IPv4-in-IPv6 was previously only supported by ipv6_srh_rcv(). - IPv6-in-IPv6 was previously not supported in ipv6_rthdr_rcv(). Signed-off-by: Mathis Marion --- net/ipv6/exthdrs.c | 107 ++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 65 deletions(-) diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index 6789623b2b0d..083dbbafb166 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c @@ -366,9 +366,45 @@ static void seg6_update_csum(struct sk_buff *skb) (__be32 *)addr); } -static int ipv6_srh_rcv(struct sk_buff *skb) +static int ipv6_rthdr_rcv_last(struct sk_buff *skb) { struct inet6_skb_parm *opt = IP6CB(skb); + struct net *net = dev_net(skb->dev); + const struct ipv6_rt_hdr *hdr; + + hdr = (struct ipv6_rt_hdr *)skb_transport_header(skb); + + if (hdr->nexthdr == NEXTHDR_IPV6 || hdr->nexthdr == NEXTHDR_IPV4) { + int offset = (hdr->hdrlen + 1) << 3; + + skb_postpull_rcsum(skb, skb_network_header(skb), + skb_network_header_len(skb)); + skb_pull(skb, offset); + skb_postpull_rcsum(skb, skb_transport_header(skb), offset); + + skb_reset_network_header(skb); + skb_reset_transport_header(skb); + skb->encapsulation = 0; + if (hdr->nexthdr == NEXTHDR_IPV4) + skb->protocol = htons(ETH_P_IP); + __skb_tunnel_rx(skb, skb->dev, net); + + netif_rx(skb); + return -1; + } + + opt->srcrt = skb_network_header_len(skb); + opt->lastopt = opt->srcrt; + skb->transport_header += (hdr->hdrlen + 1) << 3; + opt->dst0 = opt->dst1; + opt->dst1 = 0; + opt->nhoff = (&hdr->nexthdr) - skb_network_header(skb); + + return 1; +} + +static int ipv6_srh_rcv(struct sk_buff *skb) +{ struct net *net = dev_net(skb->dev); struct ipv6_sr_hdr *hdr; struct inet6_dev *idev; @@ -395,34 +431,8 @@ static int ipv6_srh_rcv(struct sk_buff *skb) #endif looped_back: - if (hdr->segments_left == 0) { - if (hdr->nexthdr == NEXTHDR_IPV6 || hdr->nexthdr == NEXTHDR_IPV4) { - int offset = (hdr->hdrlen + 1) << 3; - - skb_postpull_rcsum(skb, skb_network_header(skb), - skb_network_header_len(skb)); - skb_pull(skb, offset); - skb_postpull_rcsum(skb, skb_transport_header(skb), - offset); - - skb_reset_network_header(skb); - skb_reset_transport_header(skb); - skb->encapsulation = 0; - if (hdr->nexthdr == NEXTHDR_IPV4) - skb->protocol = htons(ETH_P_IP); - __skb_tunnel_rx(skb, skb->dev, net); - - netif_rx(skb); - return -1; - } - - opt->srcrt = skb_network_header_len(skb); - opt->lastopt = opt->srcrt; - skb->transport_header += (hdr->hdrlen + 1) << 3; - opt->nhoff = (&hdr->nexthdr) - skb_network_header(skb); - - return 1; - } + if (hdr->segments_left == 0) + return ipv6_rthdr_rcv_last(skb); if (hdr->segments_left >= (hdr->hdrlen >> 1)) { __IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS); @@ -482,7 +492,6 @@ static int ipv6_srh_rcv(struct sk_buff *skb) static int ipv6_rpl_srh_rcv(struct sk_buff *skb) { struct ipv6_rpl_sr_hdr *hdr, *ohdr, *chdr; - struct inet6_skb_parm *opt = IP6CB(skb); struct net *net = dev_net(skb->dev); struct inet6_dev *idev; struct ipv6hdr *oldhdr; @@ -506,33 +515,8 @@ static int ipv6_rpl_srh_rcv(struct sk_buff *skb) looped_back: hdr = (struct ipv6_rpl_sr_hdr *)skb_transport_header(skb); - if (hdr->segments_left == 0) { - if (hdr->nexthdr == NEXTHDR_IPV6) { - int offset = (hdr->hdrlen + 1) << 3; - - skb_postpull_rcsum(skb, skb_network_header(skb), - skb_network_header_len(skb)); - skb_pull(skb, offset); - skb_postpull_rcsum(skb, skb_transport_header(skb), - offset); - - skb_reset_network_header(skb); - skb_reset_transport_header(skb); - skb->encapsulation = 0; - - __skb_tunnel_rx(skb, skb->dev, net); - - netif_rx(skb); - return -1; - } - - opt->srcrt = skb_network_header_len(skb); - opt->lastopt = opt->srcrt; - skb->transport_header += (hdr->hdrlen + 1) << 3; - opt->nhoff = (&hdr->nexthdr) - skb_network_header(skb); - - return 1; - } + if (hdr->segments_left == 0) + return ipv6_rthdr_rcv_last(skb); n = (hdr->hdrlen << 3) - hdr->pad - (16 - hdr->cmpre); r = do_div(n, (16 - hdr->cmpri)); @@ -648,7 +632,6 @@ static int ipv6_rpl_srh_rcv(struct sk_buff *skb) static int ipv6_rthdr_rcv(struct sk_buff *skb) { struct inet6_dev *idev = __in6_dev_get(skb->dev); - struct inet6_skb_parm *opt = IP6CB(skb); struct in6_addr *addr = NULL; int n, i; struct ipv6_rt_hdr *hdr; @@ -709,13 +692,7 @@ static int ipv6_rthdr_rcv(struct sk_buff *skb) default: break; } - - opt->lastopt = opt->srcrt = skb_network_header_len(skb); - skb->transport_header += (hdr->hdrlen + 1) << 3; - opt->dst0 = opt->dst1; - opt->dst1 = 0; - opt->nhoff = (&hdr->nexthdr) - skb_network_header(skb); - return 1; + return ipv6_rthdr_rcv_last(skb); } switch (hdr->type) {