From patchwork Wed Feb 28 08:24:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TGVuYSBXYW5nICjnjovlqJwp?= X-Patchwork-Id: 13575002 X-Patchwork-Delegate: kuba@kernel.org Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (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 854C72C850; Wed, 28 Feb 2024 08:25:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=60.244.123.138 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709108711; cv=fail; b=B4bhjLL59KdRmTTZoL/46Pkyh3dGke76mtiSkAGBrL6RrgxXX2iiuQXLEiViaY1j4vHZ7RJ9/SNEBJgXZ6rQ63SCdjza8uFBe2PbJXR3oG7Z8uClBdAUFSb7Rh1QvQDmC2eOaffoAfEJ3nafaVLcr57bZsy25jnwu/asgN/MA5E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709108711; c=relaxed/simple; bh=t6xkaoKhbk+uZroIocb0PIICoS4/ZNFEPBnqdYJ541k=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=KWpxMCdu2tNG6q8cLymqgcKlATqIy5Jt+JPfaXeyhW8cpLp3w3GuTHIBNli7vEFKlJXReVFDdWUqXZ1FSx4+izgftQOO7DQhYw/IsdVt1VYqUkHTbmkxit+Orb2X1rTeVCWtEdyxtYSrMF73jNvtE4+eemEd61Wm17tIM8LAmOg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=LYwyLrc2; dkim=pass (1024-bit key) header.d=mediateko365.onmicrosoft.com header.i=@mediateko365.onmicrosoft.com header.b=an3zQwNI; arc=fail smtp.client-ip=60.244.123.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="LYwyLrc2"; dkim=pass (1024-bit key) header.d=mediateko365.onmicrosoft.com header.i=@mediateko365.onmicrosoft.com header.b="an3zQwNI" X-UUID: de2691a4d61211eeb8927bc1f75efef4-20240228 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=MIME-Version:Content-Transfer-Encoding:Content-ID:Content-Type:In-Reply-To:References:Message-ID:Date:Subject:CC:To:From; bh=t6xkaoKhbk+uZroIocb0PIICoS4/ZNFEPBnqdYJ541k=; b=LYwyLrc2x16gO2VvaKnohxqjGoHvBvHsw3f6lsYqXN8lfawvE0p9KnditQ6M2ITIHcx4M9O9NWYS1+aXXxnIF3Qv9ThjrqQWCePBlDkQQewvHRiAHh7/3NyostRBmyXuOfxJ4dGir5SHM2O+3UOAp5wT3PSJmcRh7E4wTrf4ITk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:f9dcfe03-9a49-453f-96c4-a07d156692f8,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6f543d0,CLOUDID:3101ce8f-e2c0-40b0-a8fe-7c7e47299109,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1, SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: de2691a4d61211eeb8927bc1f75efef4-20240228 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1062476270; Wed, 28 Feb 2024 16:25:01 +0800 Received: from mtkmbs10n1.mediatek.inc (172.21.101.34) by MTKMBS14N1.mediatek.inc (172.21.101.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 28 Feb 2024 16:25:00 +0800 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (172.21.101.237) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 28 Feb 2024 16:25:00 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oYBfPNsAQzYrmd6Ylfe01W64QYXnt2Peze2osDkzDVx6ktzVbQfbECC5+eoUxspNsNwF6kd3VvdK0CIeLhFG3L5orAtfn4XbkGhRdKflkMUSRRLyYuQRW4iMzQ6UhGbdGIQ/LmCCCdqUKEaHrNnj/DHf0Jj1dBcSIT7bdz5Hxnu7A7NAI8JeKCYFsA2fjCuL1ZnIJOmoaXlZI7nz/PyFlxz3MXe9WCLcQW2UMgLFgRAWvm+uBEHhvXmDgMHb5jbH4EyhA+ajOF4EzPGA8FyEYpq0j7YdcGlwkC90UW1FBXa2DOSLlsPmQMFl0PxjXFQ6a1huwTJXDCDTQCdQFfR6LQ== 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=t6xkaoKhbk+uZroIocb0PIICoS4/ZNFEPBnqdYJ541k=; b=boBfeoQHHEB1eJEEKgJucT4WoVfeE+28XPdLjwrvuN5cVLH0s0DEFecUYkgoLGmW8TvFJGZrLaVSm0lsGSvXx5iCBaXn/nwBfybX/x242wvNImJC+czS6ApjJ8uEJzth/iKzBPG4SUjEzUrJvOyFjxODM3IrReNNTNqAzd4FeogQFFurCBiKocpa9NdDcxL6PU6orD39HswqbbMj/QIve7/MU8uBiVKgqR9k8CpV7f1HcJkjLZHR87p2ZTbPJg28P6aVLdxRHefv8/QJx3bhgfuv27ek4gywFXS20ApiyO9HvjCgI12IBmdBXNr7qJs9MBnbAHrdbnq7yeTzS55F8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mediatek.com; dmarc=pass action=none header.from=mediatek.com; dkim=pass header.d=mediatek.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mediateko365.onmicrosoft.com; s=selector2-mediateko365-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t6xkaoKhbk+uZroIocb0PIICoS4/ZNFEPBnqdYJ541k=; b=an3zQwNIWC3bQ6+8Fwyjj6sTojpO17CcYRvDyyFZejbLzNXfNtP0WMA/OSuFvPvsfGkrhXF3I/O+CmwuWje80Rm3IGE7GsutfI4uOwfBzQ51VGDfUVRs8x3A71SgFRm5mzaAzhU1Hd92jwZMaVowAR2rnIutIwiXNNVNXwi69K4= Received: from SEZPR03MB6466.apcprd03.prod.outlook.com (2603:1096:101:4a::8) by SEYPR03MB6879.apcprd03.prod.outlook.com (2603:1096:101:b6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Wed, 28 Feb 2024 08:24:55 +0000 Received: from SEZPR03MB6466.apcprd03.prod.outlook.com ([fe80::8814:cbff:5bbb:98ea]) by SEZPR03MB6466.apcprd03.prod.outlook.com ([fe80::8814:cbff:5bbb:98ea%2]) with mapi id 15.20.7316.035; Wed, 28 Feb 2024 08:24:55 +0000 From: =?utf-8?b?TGVuYSBXYW5nICjnjovlqJwp?= To: "davem@davemloft.net" , "kuba@kernel.org" , "pabeni@redhat.com" , "dsahern@kernel.org" , "edumazet@google.com" CC: "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , =?utf-8?b?U2hpbWluZyBD?= =?utf-8?b?aGVuZyAo5oiQ6K+X5piOKQ==?= Subject: [PATCH net v2] Net:cache didn't flush when ipv6 rule changed Thread-Topic: [PATCH net v2] Net:cache didn't flush when ipv6 rule changed Thread-Index: AQHaah+c6oKxRhQg9Uub4r5oXRowsw== Date: Wed, 28 Feb 2024 08:24:55 +0000 Message-ID: <696e39599c7a5e793a9d96aceef0e34817ab0bb2.camel@mediatek.com> References: <3efcbaf0872481d1a842eb9e18fa368b4b94d940.camel@mediatek.com> In-Reply-To: <3efcbaf0872481d1a842eb9e18fa368b4b94d940.camel@mediatek.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mediatek.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SEZPR03MB6466:EE_|SEYPR03MB6879:EE_ x-ms-office365-filtering-correlation-id: b24006d9-3f4c-4820-acfb-08dc3836be9a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: DD/Xcninj9MBWxUSgAn/23mdtCR7Rjuk6cX1IZytrslbtMrJEDZKSTHusDPxhlJfSTzA9E7gqHvUB3nVqKlnn4WQvbfYbs7C8D1xMAiOQFjp6rrvzTwLqDzZ37UotqejwpIfQOFkCrRZRGKsYnJOxDw+zytU4dsVBdTL2Ny+5ihfIj+6B4u+VYHtB9RHz9ZOFejPJvXBAs6z1L8tLi2ACdQ4PtRThSRk50CR+F69pZ8BmOJ0xLgERGwS6tyBRIkoKcwuzmAnLcPqcUpRH8OMJCf+9yHhFP0zo1Q+TASDPin0svMGMMEJnrLhWFms/plynxLSiXvJu9KFMlveOR/SbYti6KeFrIh5le0Zi58Xdc6y6ZRvBBb3v6PV+EnukDQVslACS7p3gNmSv5v08adt3XlXKZvB4PgtoVcK8bSyxeE6ow84BhtgFgv6nH2Ubi+IJVqp1ZtIVfstPkRxhG7RPUEWpRI7VE5gXNwLfCuErUUiZj+P/crShm/waWJTCGB4i7jJOra8Smu3znLUIvc0q+X8mpkUFTCvor/IPlGtAwWA77bacu3zrwL5vJfUq3j1NiaZ/INT2FUEH/WE4/sZIAewDm+K242j+XG3XnAEtc2C0vAP0kF8IaRS8yyuJrOhgA7Uh+QtqSk5E8tkRuSRjizygaHQ70nCBsQWgfeDjLf1Dhu/J3InlBfW4KJPjfwekinyTJH8VnfHK73gkv0ngg/J2zi4QND83PVUVMa9Kc8= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR03MB6466.apcprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?Y/gBk7xptpd2Wd3+M0cIGt/y6151?= =?utf-8?q?yVCQsQp8FrTRNESJegQKK4TEZvxjlNz8PfKQRBUvwf/9I2DsVG6RtPDc2x3vIKnf9?= =?utf-8?q?Cb5rHYMYKnEQqMb3KArCBn+ouT4ZthokLYXNUyUobHEvemQ9aEXG8nX6TIJKFHM4f?= =?utf-8?q?Vm5cx2gum2QYXYxuhIr60RGqynEHJKpwnJvwTLQJAO2tJD/mxq5CfwbxvW5nJwc1H?= =?utf-8?q?tVeFUZ9uVo7IcXSoSFvnhZrRkYfEobXH7aW0gBAzx5Hil25JHFlG/D9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J0ocqpSp8cn1/0ZhF3?= =?utf-8?q?qnC4gSjkztw7cS7JvniEbmBkwk6BCx8MloWmuxXPjQ/OqBVpydqBnWMv+yNLWYs3Y?= =?utf-8?q?e24z4UGPkG3s9SCmtQGpt2w0E3iMJFPwmpHmdT6xDJyCU6+Ex7th229KPgzRJnFgz?= =?utf-8?q?7b+hnQF1nSRggFTZrLSDhqVd4ZOBf/XGYl0f0TNoqJUaEGYTdz0ox33T1+nrVa1ZC?= =?utf-8?q?YJMjASR/8K+8VG7U/AncoVKxkmLAH7vZDhskvxfUbewLLd9NmGabnSYymt1PTCwh/?= =?utf-8?q?t+BYDvcBqinM81/qJY41SA105ORyYZXORVKEvr1a2UOVxmx2wYnJAIJY1k7VDJmj0?= =?utf-8?q?n7vNpDZF5I921Lj4/eAPUOHP0Wn0Pv+RtcRKG2XWPGiMLzbAFHm0Da63SetVaQBAX?= =?utf-8?q?pujvLWNDPmZAd9N9TV72/ogcGqUPIwSDQw=3D=3D?= Content-ID: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SEZPR03MB6466.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b24006d9-3f4c-4820-acfb-08dc3836be9a X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Feb 2024 08:24:55.6763 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a7687ede-7a6b-4ef6-bace-642f677fbe31 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: fnD8NGxGQthL5j8brUI5FHPFzHFargYVXTxHxo3MoQ4OS4V5ZtcVGBeaWcJ8IXKczypSjSsUaNNB27vSa6zn5w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR03MB6879 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--8.495200-8.000000 X-TMASE-MatchedRID: 8O9XrlnJpuwUN/8aAzvyJfVFR4sC8dPyWYu9PKwvg8/+TXZJvYxoecCS 2AMm1nQCqeCFN03ZT0c18T+UX/k6C4moXedGE6+KjWe5HOFKvuO+OYU/Hm95Gd9zZd3pUn7KmBy ZR5gLLj478mRVMHEjG17ZOWlZyFCqzB1CJ6qmdNpor4yxPAz7WUyQ5fRSh265CqIJhrrDy2/8/L 2o6LnOl1PEBxhgY10jzPswo+b23xfvk9E0156d6KDH6drx3JPVfS0Ip2eEHnylPA9G9KhcvZkw8 KdMzN86KrauXd3MZDV4aBaaKovc7xmgJDpdISDeemgtuhDgV3pkO0DDJG8LV4Z6qqfuZrRa X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--8.495200-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: C92A945A6C14ECA83A1ECC3391208E8901DDC4F6EDD524C81638397F2A132D732000:8 X-Patchwork-Delegate: kuba@kernel.org From bf53859b379a653eec8a14fbb3f29286f9f888fb Mon Sep 17 00:00:00 2001 From: shiming cheng Date: Mon, 26 Feb 2024 20:17:58 +0800 Subject: [PATCH net v2] Net:cache didn't flush when ipv6 rule changed When changed from old rule&route configure to new one as below, ipv6 cache dst_entry did not change to new route table as no cache flush callback function, then forward to wrong out interface. When fib6_check dst_entry, the fib6_node version[fn_sernm] is always the same with socket dst_cookie, old cache dst_entry is always used and no chance to update. So we need to update fib6_node version when rule changed and flush cache to avoid dispatching a wrong interface. Signed-off-by: shiming cheng --- v2: 1. Add the fix tag. 2. Changes according to David Ahern's suggestions, modify flush functions same way as ipv4 flush cache and use tabs to aligh with existing code. --- --- net/ipv6/fib6_rules.c | 6 ++++++ 1 file changed, 6 insertions(+) .family = AF_INET6, .rule_size = sizeof(struct fib6_rule), @@ -461,6 +466,7 @@ static const struct fib_rules_ops __net_initconst fib6_rules_ops_template = { .compare = fib6_rule_compare, .fill = fib6_rule_fill, .nlmsg_payload = fib6_rule_nlmsg_payload, + .flush_cache = fib6_rule_flush_cache, .nlgroup = RTNLGRP_IPV6_RULE, .owner = THIS_MODULE, .fro_net = &init_net, diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index 7523c4baef35..52c04f0ac498 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c @@ -449,6 +449,11 @@ static size_t fib6_rule_nlmsg_payload(struct fib_rule *rule) + nla_total_size(16); /* src */ } +static void fib6_rule_flush_cache(struct fib_rules_ops *ops) +{ + rt_genid_bump_ipv6(ops->fro_net); +} + static const struct fib_rules_ops __net_initconst fib6_rules_ops_template = {