From patchwork Mon Jun 24 14:15:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathis Marion X-Patchwork-Id: 13709581 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 D77C219AA75; 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=M0vEabnBvqvUREy5phD8jndA61GZDjUc9H53wzjOcy6K/pmoClQK/tw+T+j/MxS2whfaziu4HqnB8P2S3TQCs4tPCmvOmFwaHbzKxVAIu4iaOZvCFl9bb8jE0/EZum5BZ32CtThfaMKWGUiuwHsFMzTn1obIdkUYLwhGfzDzctg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719239558; c=relaxed/simple; bh=QqtdTgNKDbGi8f3sjq6SGjA6IAg+4fwges695fR2Y8A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=jY1l3lzFrlkW6pfN3KLhp58XSJ80myB0YcYpXwzGTt9M09fMyqFNe1cbEW2Nuxu5GhlWlo7g8FHRFGhE735NUxXxCE0lMlOCfICXxj6GVfjos/aIVrCjUDpWBOv4CgTov4OB9WoGULc21EPwmYCOsge8DkL5/cDHxpMXqXzZbRE= 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=OSTu6s6C; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b=eIIltfhT; 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="OSTu6s6C"; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b="eIIltfhT" 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 45ODYZZr011774; Mon, 24 Jun 2024 09:16:59 -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=QqtdTgNKDbGi8f3sjq6SGjA6IAg+4fwges695fR2Y8A=; b=OSTu6s6CTwqz mm/shboKOOxR0rY2RUYjZ3sus8a/SN2NSvhnN/g+7w8A6xhQp770lmhsdVHGw/ZR +Hsq1eteUrjQzDB+J+wJLUsSiH4lep+vIrqMpXEcrZ52xBE3T6bXwP07e5Dm9QI8 hf3sZA8EWUjKEs054x0nzX5WXcejiv7yZutX3SNghQFjNfnD3b/caKHOSTutPbK0 s/nEQBypQcspDj9jlhgUA+5T8lKyLc9AEqVKiYKvefldAxytlX7iZI5H73UlYE2n jEugDFYin6Sdd8u+NayzmkI0e9Wq0wq0igN492RA+Cm9YcGIC2irVOggFUmvckwz 70grcoiQvw== 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-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2024 09:16:58 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O/0Y9GyAT7/FGT0aGalTE0hEea3U5VFV6I0fUD66xpNEg688/6AL0BOWAbUpHNWBjSxia0i8A7ZO3XIW/irklaVmz2Go6HKxWRJQAwazJb5geyggj/oxEP9on//OpO1SFKDuEQ04WsFWrz3PPBlcv0Krg87d+Feqgx4cvlP9Zjy+sQs6fBC03jy5tJ8fuAhjVbavONDo3A3POykpF+rd6QFtLOkY1SdzibGKidrGotpM9Z+S7ZDJlrXdJGg2BxogdqlfSL1nEY0gvubRItt0zzMehzO7HV5Sk3LzxcW7d2WAMCCDLTFv+aJgFgpDfRYGwg1i+UbegNunWitNr5/Drw== 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=QqtdTgNKDbGi8f3sjq6SGjA6IAg+4fwges695fR2Y8A=; b=ZFwoSVsLldoeOvPkDArLLGCYoC0NDiDg+3KFOoDwbuu1t4QkFtZrpRfe0jLa+4py7zTNRWlo/Ja+k0i6FHeA7xFLUu39SvAm2pvIAeUVkRTia/NCDl7nA69O0Br2eoVwl3TVhlb7Yt1Qoq70i3KCiVxSq61HyOW8d2/aslnXZswl9uUWi0lpoAtJ+XkzbXYGSuOQ88BvNiqoI7dka/YMnxIJhsPjTdE12zTE2+WyTCQVIeeA5f3WsY9eFekS0+MM759JwHPUBIlSXRg+4q0U3s8VRwteI1iDST9Bb/ep3fpZOx4eO7n9XG4MhRHy10tGffF9jnedNR7o69JHgYNLKg== 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=QqtdTgNKDbGi8f3sjq6SGjA6IAg+4fwges695fR2Y8A=; b=eIIltfhTqMmIntWi+4M7Ab6ktc3p7cYuGz1ksCRlcynNE6pObBhypAM6Hl5bPO99MfeIJJnIyyIqMnXJIQLytPML/eqWAL5qY8Irt+EyRzsqOG317ZzNoF8ybPoVa1LJ7lJ2O6FjRmdUtNz+doK0PmPoUfwHeplZ+MmtConle14= 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:55 +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:55 +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 2/2] ipv6: always accept routing headers with 0 segments left Date: Mon, 24 Jun 2024 16:15:33 +0200 Message-ID: <20240624141602.206398-3-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: 284320b9-0cda-4ecc-1a9e-08dc94584d3a 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: 4JWu0cNAExAuYGbp0ejJX3nQmQzRfaGzilxWJiihPNgjrbHi4LrPh40a1vhbCYH5solMtsz3echFxBIpGaN354ibRIb1TEVkarcoT9FSPsUwVBuTG3/YBqN1IEVAV5m2WtTVbWsTsjdx7wl0Jta07//+yF8vNG5IFVlv4kvYw7tov/djrHh7+I54Vek4NBjgf/lrgDKS5KB6PGgwl/vl0wqy9cBfWPe06yj1YxdEmgaC4NIwWkmBXQ0D9RpdJoIwz8sU4rsDkTAKMZf2XFkfh6buRA6ZEAqiYJH57bMY69Gy0VfRkPI20NKhw8bjA7oJeg4yx1tY9F7IETzxaf9sT0ysOSXXfWEKoLNX/vABPKTWTlv+INrk0lSE2bbaCdEcPrQ57AwNBLWTd7Q01e1qNeicLsxarfElvsQsBBaRCwSw/n7M2zCIKjO7sSCnon1AyQam1GzcEu7LVvkDPX/CHDe399HjHtWCsaypJhU7sK0zo099lGBNx4gk0HJ8wNzoIOhYfptM/JtU6q1PNvs4gfAfD13awKmsg5gw5AudrNTCu/yrscnSrkmJa9T4o2uc/lLjxKq0Hm0s3lmWJKtz27Y/ppepooz0b3fQCZDCB2VEpbArqBJJx33hGesBW7ZJS2lV5NiWuPGq1arbCWnzwg3EkP9XebSdobEvUQT+c9Ij4SwOCL+mRtA/Be4gzVZeJjdHjAeM2Sdn+Wkf8X62fy66pr9XbQY3HpJw2SY6ZpoewvPk2BkJCfVrTi8dK1edOahg9aSjpPFrKnemPiunbBNPPoiNvAW7dAL32+KKrYAHMEGBoizTBy9pLorh5t/5Ka+BLIEPkSRtRaZgsYHHpaSbyRrHgg+wN87tdLn21XUoPcuhIG8N+zuZerKxOLDCMcaeeE74lXobUcy5Z3tPfYL2jFAaxw3QCcaHi3M3atby8PuMsyjLcyHRul7mpl+FXBKJDPqIxoKdzBPlxnBlGBD3lf/0V2v3yhpHoYKCK3bBklzfoXwNq/ANvPxKIn000WBBlEnXjH3TQlTxzN8Jx+CiTPjLreZgFHC4w1WYpUsTPPoBmIuPsoj9/tcAX1poHW6HL31l2YQZ5vHDMf1TCLCgojkY2xJY3np5cHFPmbok8hdB/KDzqR6a3NppFQGWshB0d8a7WaJOFDSuD2dysstw1fWlbplo8p6ipkQp8RbPUxtnMqLTeiXBvV2zR9F0TL75KetJrUsrGObPmZKovG06WC2XBsiHWeAHIjfvkBgn3DbkrTn4h1YENt/2ZMbMT1GXM9kh4OjmBgtYWB7QkJr0XKr7iyMxQLMj2y+Zz+pXrwOcVlwc/1Sx0wanJlBzHFCxOqQEHqEtf6P7qlYIl47K/lZ93bhEETUAdWCK4rA= 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: S+VpGuHl36j4HQHPSbu8q4HbD4mgWb1geQxrMi3vt9cRFOml2Cf7Q3kQbmNRxpsBNcFRSDDQmT+fKrEnBHpjIj2GGzWhT7S0VZDDKeUDa5p0JCp2V16LpMHLLZt3UqtCsWcYo5mAU4XhcZSXMJhGQoClbFs0TV5m4ufpErLdPr7twA61bcsHs64dtEGLooXuLhEhyTrnBZSpi32UnjwF0EfLftrtI91/a/1RKm6hz+Ir4k5r0yVM9JGPw5lGr8mi51a0tJWvk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McbimBZzQfXYfKGKBn+pQmQbsKiH0P1EE5xqSWpmkW4/Se4+fNRszRoxoqFgj+205FpAcIigwMDuV8h5g836IGsNjktkZSBnTdNNRznmZ77Z7sKhVmP8+ayMYmbKIqYIfZO1vufb5kGli/I4uvmY6X6uEppk6/113RvYiZwvOvP1sJYHq4ED1JtgRNuOb0riGKSt6ZoJQJjmsKdrb+fqZ8s7W8VH+CkCDA5QHUM/50umKaKKa1H/kqj+Zt8LDgvI/Wd2Co X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 284320b9-0cda-4ecc-1a9e-08dc94584d3a 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:55.4769 (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: nce6Jk3nMYImjMDIRfEniXSpzC5nueeX5OERQ/qIemS6aLbYtGwJds/26aeQC5RLtcDb9J/zCKZKUW8eifNR9g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR11MB8765 X-Proofpoint-GUID: DGy_j0N5su2MPzWiPPzvS90sb2zP7eiO X-Proofpoint-ORIG-GUID: DGy_j0N5su2MPzWiPPzvS90sb2zP7eiO 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=999 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 Routing headers of type 3 and 4 would be rejected even if segments left was 0, in the case that they were disabled through system configuration. RFC 8200 section 4.4 specifies: If Segments Left is zero, the node must ignore the Routing header and proceed to process the next header in the packet, whose type is identified by the Next Header field in the Routing header. Signed-off-by: Mathis Marion --- net/ipv6/exthdrs.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index 083dbbafb166..913160b0fe13 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c @@ -662,17 +662,6 @@ static int ipv6_rthdr_rcv(struct sk_buff *skb) return -1; } - switch (hdr->type) { - case IPV6_SRCRT_TYPE_4: - /* segment routing */ - return ipv6_srh_rcv(skb); - case IPV6_SRCRT_TYPE_3: - /* rpl segment routing */ - return ipv6_rpl_srh_rcv(skb); - default: - break; - } - looped_back: if (hdr->segments_left == 0) { switch (hdr->type) { @@ -708,6 +697,12 @@ static int ipv6_rthdr_rcv(struct sk_buff *skb) } break; #endif + case IPV6_SRCRT_TYPE_3: + /* rpl segment routing */ + return ipv6_rpl_srh_rcv(skb); + case IPV6_SRCRT_TYPE_4: + /* segment routing */ + return ipv6_srh_rcv(skb); default: goto unknown_rh; }