From patchwork Tue Jun 14 05:01:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Subash Abhinov Kasiviswanathan (KS)" X-Patchwork-Id: 12880430 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CA82C433EF for ; Tue, 14 Jun 2022 05:02:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232163AbiFNFCo (ORCPT ); Tue, 14 Jun 2022 01:02:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232363AbiFNFCn (ORCPT ); Tue, 14 Jun 2022 01:02:43 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF165193C7 for ; Mon, 13 Jun 2022 22:02:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1655182962; x=1686718962; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Vokrsk0aYjfy16R7vHXnT639HL9n+gLL0qQwwHQEexE=; b=cbmjHhDbNFR16ZNYZtkJOVpazZAkT3QsZeoBpjL8ROLsTd6crqIRq3Ek XTQ5ehvA4nGxFbLHLeanK738Ruig+DlTjumZA/gyTiYCf06M4tP+7ew7k JWXZK3S12D50iRn8toNqXLUsoas3qld3M1LHPcQm6wqExWGFJwTPpB6cb w=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 13 Jun 2022 22:02:41 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2022 22:02:41 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 13 Jun 2022 22:02:40 -0700 Received: from subashab-lnx.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 13 Jun 2022 22:02:39 -0700 From: Subash Abhinov Kasiviswanathan To: , , , , , CC: Kaustubh Pandey , Sean Tranchetti , Subash Abhinov Kasiviswanathan Subject: [PATCH net v2 1/2] ipv6: Honor route mtu if it is within limit of dev mtu Date: Mon, 13 Jun 2022 23:01:54 -0600 Message-ID: <1655182915-12897-2-git-send-email-quic_subashab@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1655182915-12897-1-git-send-email-quic_subashab@quicinc.com> References: <1655182915-12897-1-git-send-email-quic_subashab@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Kaustubh Pandey When netdevice MTU is increased via sysfs, NETDEV_CHANGEMTU is raised. addrconf_notify -> rt6_mtu_change -> rt6_mtu_change_route -> fib6_nh_mtu_change As part of handling NETDEV_CHANGEMTU notification we land up on a condition where if route mtu is less than dev mtu and route mtu equals ipv6_devconf mtu, route mtu gets updated. Due to this v6 traffic end up using wrong MTU then configured earlier. This commit fixes this by removing comparison with ipv6_devconf and updating route mtu only when it is greater than incoming dev mtu. This can be easily reproduced with below script: pre-condition: device up(mtu = 1500) and route mtu for both v4 and v6 is 1500 test-script: ip route change 192.168.0.0/24 dev eth0 src 192.168.0.1 mtu 1400 ip -6 route change 2001::/64 dev eth0 metric 256 mtu 1400 echo 1400 > /sys/class/net/eth0/mtu ip route change 192.168.0.0/24 dev eth0 src 192.168.0.1 mtu 1500 echo 1500 > /sys/class/net/eth0/mtu Fixes: e9fa1495d738 ("ipv6: Reflect MTU changes on PMTU of exceptions for MTU-less routes") Signed-off-by: Kaustubh Pandey Signed-off-by: Sean Tranchetti Signed-off-by: Subash Abhinov Kasiviswanathan --- v1 -> v2: Update the exception route logic as mentioned by David Ahern. Also add fixes tag. net/ipv6/route.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index d25dc83..6f7e8c5 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1991,19 +1991,11 @@ static bool rt6_mtu_change_route_allowed(struct inet6_dev *idev, /* If the new MTU is lower than the route PMTU, this new MTU will be the * lowest MTU in the path: always allow updating the route PMTU to * reflect PMTU decreases. - * - * If the new MTU is higher, and the route PMTU is equal to the local - * MTU, this means the old MTU is the lowest in the path, so allow - * updating it: if other nodes now have lower MTUs, PMTU discovery will - * handle this. */ if (dst_mtu(&rt->dst) >= mtu) return true; - if (dst_mtu(&rt->dst) == idev->cnf.mtu6) - return true; - return false; } @@ -4914,8 +4906,7 @@ static int fib6_nh_mtu_change(struct fib6_nh *nh, void *_arg) struct inet6_dev *idev = __in6_dev_get(arg->dev); u32 mtu = f6i->fib6_pmtu; - if (mtu >= arg->mtu || - (mtu < arg->mtu && mtu == idev->cnf.mtu6)) + if (mtu >= arg->mtu) fib6_metric_set(f6i, RTAX_MTU, arg->mtu); spin_lock_bh(&rt6_exception_lock); From patchwork Tue Jun 14 05:01:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Subash Abhinov Kasiviswanathan (KS)" X-Patchwork-Id: 12880431 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BAB1C43334 for ; Tue, 14 Jun 2022 05:02:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232363AbiFNFCu (ORCPT ); Tue, 14 Jun 2022 01:02:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232833AbiFNFCq (ORCPT ); Tue, 14 Jun 2022 01:02:46 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 963C6220C7 for ; Mon, 13 Jun 2022 22:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1655182965; x=1686718965; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=tkrUAPK/YoSGl+QBJ9FtwlvwlbE8T2LZhxW9lzJW1bI=; b=E9JwVNZz+mR4kX5tpfdQcue0EEhPVllIs7hLub65Z0SuPvt/XKYtnxsS VMcCcl0i9pkpYb8FYGccYIuIjUvOCHBvO8CCLQKjpG5HP5OYKQ7RgDl5P 6UXVf5CDfm4DUH2GDDJyGSOlxE9irwvlQx/r+Yc2A7xsH3Fwt8h95iglv w=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-02.qualcomm.com with ESMTP; 13 Jun 2022 22:02:44 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg02-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2022 22:02:44 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 13 Jun 2022 22:02:44 -0700 Received: from subashab-lnx.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 13 Jun 2022 22:02:43 -0700 From: Subash Abhinov Kasiviswanathan To: , , , , , CC: Subash Abhinov Kasiviswanathan , "Sean Tranchetti" Subject: [PATCH net v2 2/2] tools: selftests: Update tests for new IPv6 route MTU behavior Date: Mon, 13 Jun 2022 23:01:55 -0600 Message-ID: <1655182915-12897-3-git-send-email-quic_subashab@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1655182915-12897-1-git-send-email-quic_subashab@quicinc.com> References: <1655182915-12897-1-git-send-email-quic_subashab@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The IPv6 route MTU no longer increases in case the interface MTU is increased. Update the tests pmtu_ipv6_exception and pmtu_vti6_exception to account for this behavior. Suggested-by: David Ahern Signed-off-by: Sean Tranchetti Signed-off-by: Subash Abhinov Kasiviswanathan --- v2: New patch added to the series tools/testing/selftests/net/pmtu.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh index 736e358..dac2101 100755 --- a/tools/testing/selftests/net/pmtu.sh +++ b/tools/testing/selftests/net/pmtu.sh @@ -1067,11 +1067,15 @@ test_pmtu_ipvX() { pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst2})" check_pmtu_value "1500" "${pmtu_2}" "changing local MTU on a link not on this path" || return 1 - # Increase MTU, check for PMTU increase in route exception + # Increase MTU, check for PMTU increase in route exception for IPv4 only mtu "${ns_a}" veth_A-R1 1700 mtu "${ns_r1}" veth_R1-A 1700 pmtu_1="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst1})" - check_pmtu_value "1700" "${pmtu_1}" "increasing local MTU" || return 1 + if [ ${family} -eq 4 ]; then + check_pmtu_value "1700" "${pmtu_1}" "increasing local MTU" || return 1 + else + check_pmtu_value "1300" "${pmtu_1}" "no change in local MTU" || return 1 + fi # Second exception shouldn't be modified pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst2})" check_pmtu_value "1500" "${pmtu_2}" "changing local MTU on a link not on this path" || return 1 @@ -1637,10 +1641,10 @@ test_pmtu_vti6_exception() { pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})" check_pmtu_value "3000" "${pmtu}" "decreasing tunnel MTU" || fail=1 - # Increase tunnel MTU, check for PMTU increase in route exception + # Increase tunnel MTU, confirm no PMTU increase in route exception mtu "${ns_a}" vti6_a 9000 pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})" - check_pmtu_value "9000" "${pmtu}" "increasing tunnel MTU" || fail=1 + check_pmtu_value "3000" "${pmtu}" "no change in tunnel MTU" || fail=1 return ${fail} }