From patchwork Fri Apr 3 23:05:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 1266279 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=LlRzLlki; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48vFsk2S8Bz9sPF for ; Sat, 4 Apr 2020 10:06:02 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728645AbgDCXGB (ORCPT ); Fri, 3 Apr 2020 19:06:01 -0400 Received: from mail-eopbgr20069.outbound.protection.outlook.com ([40.107.2.69]:53598 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728432AbgDCXGA (ORCPT ); Fri, 3 Apr 2020 19:06:00 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BQVa5RQ0NvsxNClUT6yneLcr54o/1BO1HqRX+5xcRdGxbs9rfiza1En0XgjW/b0uEkxgPGh4HuuzRgNdyCNT0nGcONZz57bVHxb9RPl2koKZhqWHnlJpqkP05YUetv7qAkopvdMChXCkWTUf72cw8y4vLNIjbsfuRFDEAeoRgq1c9gFfiWuDd9kFe5WvK9mB7dLH2MWk/kTRcZ/SwDNCxRVPx/AU6ujQL4QVKNojZ1r1mJophuWtEq7iDV9z2go1lLA177R7wKSso19g7+RP/aT8fShTjxQFmmGW/WTekZMrTkVjvtmtD0xuXe1bcn9kgg7ffo7cpBHu4jgHLoXQag== 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-SenderADCheck; bh=W7Hq+MlMeGeXjR0KiPz5QyHWurxyWZF+u6pUygI7tP4=; b=lfPghZQcycxlDOhC+eI8wtlhbLgFhmtq/XfyLNwganSxPyoLDNgAQYI3eNqUN8bpyhYz4lbFpIG7mMMcmyjYPYMUeK/DJoO2Hi4MC2Ufkwp3Kpd9mntWnLzSjExuxYY9qZRJPeeyPRx0QXvpHr6UX14qE35mwjaOFMDJoVAY9ZrRs2TpQZoiVqf/m30yVy+hYPHCbw2hX0vUIp2sdg56Fn3ExioJO/Inv/+vISqOAfirzzAkwR7cKzETsjmwmRPEaGyzFPceJjO+RuH0Me7NScgR5rTeidkrqMVpHPs+SJd8t4x/SJnU65cRR3bfGE8e328b+CXvB+mdo8YpDGxtJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W7Hq+MlMeGeXjR0KiPz5QyHWurxyWZF+u6pUygI7tP4=; b=LlRzLlkioeE4oTkYO6c1TsCKLyClCHh1g2EHPKWXH5rd3Juh0AZ3us+JQjXntXzJJAzLtF13OnW6aI3W6ToWXJZezfUiyNwF+AdpegktcICCQbbj1BtkVpYSVS/jBEtrv4kzEQfX6df7tfZ0PtjztQydl8aqoAtDBdjhffAVBlE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from HE1PR05MB4746.eurprd05.prod.outlook.com (2603:10a6:7:a3::22) by HE1PR05MB4652.eurprd05.prod.outlook.com (2603:10a6:7:99::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.17; Fri, 3 Apr 2020 23:05:55 +0000 Received: from HE1PR05MB4746.eurprd05.prod.outlook.com ([fe80::e9a8:7b1c:f82a:865b]) by HE1PR05MB4746.eurprd05.prod.outlook.com ([fe80::e9a8:7b1c:f82a:865b%6]) with mapi id 15.20.2856.019; Fri, 3 Apr 2020 23:05:55 +0000 From: Petr Machata To: netdev@vger.kernel.org Cc: Petr Machata , Stephen Hemminger , David Ahern Subject: [PATCH iproute2-next v2 1/3] tc: p_ip6: Support pedit of IPv6 dsfield Date: Sat, 4 Apr 2020 02:05:29 +0300 Message-Id: <3ed04b5d061b87d2310ac394284dbd88c2014b5a.1585954968.git.petrm@mellanox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: X-ClientProxiedBy: PR3P193CA0039.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:51::14) To HE1PR05MB4746.eurprd05.prod.outlook.com (2603:10a6:7:a3::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dev-r-vrt-156.mtr.labs.mlnx (37.142.13.130) by PR3P193CA0039.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:51::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.16 via Frontend Transport; Fri, 3 Apr 2020 23:05:54 +0000 X-Mailer: git-send-email 2.20.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e7bdc3e0-8a2f-4395-cb92-08d7d823904f X-MS-TrafficTypeDiagnostic: HE1PR05MB4652:|HE1PR05MB4652: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-Forefront-PRVS: 0362BF9FDB X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR05MB4746.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(396003)(376002)(366004)(39860400002)(136003)(346002)(54906003)(6916009)(2616005)(956004)(36756003)(86362001)(81166006)(52116002)(2906002)(5660300002)(8676002)(8936002)(478600001)(81156014)(16526019)(186003)(66556008)(6506007)(6486002)(316002)(26005)(66476007)(66946007)(6666004)(4326008)(6512007); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +QBWuEVPXf40o6XAx31GJFHp5RWSVRpSZoUUlalipvucX3uB0947Jrwmv67LtQVmwo90PLEDMk+lkBVw7g7W1Wzse5hX+CsV1KJUVb8ChhUSxU43wsXqCnqUkAl3GmgMwRxFkwK6XedF4+77HWdxnN5miDBdMzb/wcTLycxb8w0hfvI7YW/vQ3mqIr4AvTC0CqfsdI2vZOLkFYZOAM+OdgohQvapaWlpBEPtztcSgh3JpvdgIQ0SLCVpHN3mw+SsiLE78I524DsP2vmkNN880J8HQfHUuECkLGCU+p8LKz3TqfW7w54js7mtMzGDO6kQX2psZykI8uyIBPrbzHuitPAZA3YTbOGcVNmHA/aVq+ke2jFGhxyntUQZBBYy64+RfG64HvronPbMiB+0DEY+42ezPsw+KoYIbf1U7FxySmht0hwLx2wChPoXC2CzUdYR X-MS-Exchange-AntiSpam-MessageData: JdjfST90RLyAZ6dI5sOHWKwZqa0DrgGSaKVJzbhP3JUUl1hVfqnOHPxrwVaGrzIPd1fs+l5zzxk/f+6DnIqeGw4amxPy0ip9VCDFcZCmDWQrRgf89VvYkPU7J9NIczFrUimbiCat2jT3r5POauur4w== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7bdc3e0-8a2f-4395-cb92-08d7d823904f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2020 23:05:55.7665 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lvJ1WzGQEhqQvnorCq74d0tg6xaHtTJ4ancRa4A98JUIG8K4WyQW37/Okj/NAE2vNk7MfrS3ncC1r1Ea2QEMcw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB4652 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Support keywords dsfield, traffic_class and tos in the IPv6 context. Signed-off-by: Petr Machata --- Notes: v2: - Only accept 'traffic_class'. - Move the if-branch that matches it to the end of the list. - man: Drop the untrue statement that the traffic_class field needs to be sandwiched between two 4-bit zeroes. man/man8/tc-pedit.8 | 6 ++++-- tc/p_ip6.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/man/man8/tc-pedit.8 b/man/man8/tc-pedit.8 index bbd725c4..3f6baa3d 100644 --- a/man/man8/tc-pedit.8 +++ b/man/man8/tc-pedit.8 @@ -60,8 +60,8 @@ pedit - generic packet editor action .ti -8 .IR IP6HDR_FIELD " := { " -.BR src " | " dst " | " flow_lbl " | " payload_len " | " nexthdr " |" -.BR hoplimit " }" +.BR src " | " dst " | " traffic_class " | " flow_lbl " | " payload_len " | " +.BR nexthdr " | " hoplimit " }" .ti -8 .IR TCPHDR_FIELD " := { " @@ -229,6 +229,8 @@ are: .TQ .B dst .TQ +.B traffic_class +.TQ .B flow_lbl .TQ .B payload_len diff --git a/tc/p_ip6.c b/tc/p_ip6.c index 7cc7997b..71660c61 100644 --- a/tc/p_ip6.c +++ b/tc/p_ip6.c @@ -74,6 +74,21 @@ parse_ip6(int *argc_p, char ***argv_p, res = parse_cmd(&argc, &argv, 1, TU32, RU8, sel, tkey); goto done; } + if (strcmp(*argv, "traffic_class") == 0) { + NEXT_ARG(); + tkey->off = 1; + res = parse_cmd(&argc, &argv, 1, TU32, RU8, sel, tkey); + + /* Shift the field by 4 bits on success. */ + if (!res) { + int nkeys = sel->sel.nkeys; + struct tc_pedit_key *key = &sel->sel.keys[nkeys - 1]; + + key->mask = htonl(ntohl(key->mask) << 4 | 0xf); + key->val = htonl(ntohl(key->val) << 4); + } + goto done; + } return -1; From patchwork Fri Apr 3 23:05:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 1266280 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=qOHAOJsc; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48vFsm2ZT6z9sPF for ; Sat, 4 Apr 2020 10:06:04 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728688AbgDCXGD (ORCPT ); Fri, 3 Apr 2020 19:06:03 -0400 Received: from mail-eopbgr20069.outbound.protection.outlook.com ([40.107.2.69]:53598 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728610AbgDCXGC (ORCPT ); Fri, 3 Apr 2020 19:06:02 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WaP2YBNBT3JBV7o/AI9ZCbWDvIKhSfLKkHdF2w4vc0oMwMuP6CzvUobpy6tiIqmtDukwiMkx42UjlFaYhKCAXKfTLmbQuLI5eIv6ZuEplMAXzcjmJGElsSfOenjlOvJWNnwQjZ1+NS6gX6J5r1kmjd2+ZwFvLxLX1GSC8m/cDVMbubJZvg+n1TmvZPjqkpgzisnFw1EknrshSZ5wS0xIJTfUVXVFTqket4Nb2EzO7mgjZ6IdVMAv8Tf39kGSXnyT7JNrVPfNDGkjVqtwwHKBmRWKeRhLICZ6JC/kAKo3vxCXuhR5wYRq8hulL8LHLzMZA2TtcJLyt9QYN6uBIzWl0Q== 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-SenderADCheck; bh=6JDJOUaRMSv7ZbFl2X3koP+J1yzfgLYGiJOBzXc7ycY=; b=LWw36iSGnpuqNFy9BDYoItqolaNJ78g5QqfcSTQzkNzodAA1PxgsBYYPUS0oQuxWZgu9khJKk/aT1qMl73w9GYRky1iCpvzGwf1QjJYdREAQy7qxB9r0D3A3W3IMc5tGuT2XvwLmcMwGENdiGv1sJvJvqssag988QbaVWqU2cCavYeLYeBVvlOTPP9oiEGzFO5IfkNsI8ivGdvcKi1RmHtU2VDs8heU55NFcC+RBD7bvYalx1L+vo9Pr4kngHi6V+vaUVr1YQdVfRyoaHXqxwarkDXRO8pEE59ItZLEjOJmzbxwBAc4n/TzEX8PReiGYWhW1vzdySE6IKtuyYq98+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6JDJOUaRMSv7ZbFl2X3koP+J1yzfgLYGiJOBzXc7ycY=; b=qOHAOJscBIqtUh9JZBLerpCRmokm8NA6CDJpsv+SBzLUQNEE9dndRKjsQ94eVA/cOvG+/W2Mdwixk/2S6zbwA7rO674wuUfA7B63ndcxYm5JY7PDI9HkhUw8uYlBK/TIZ1Hy514Oo+y7fzkXyWNOvbfhOD6T7xVgBsJJB8FWi54= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from HE1PR05MB4746.eurprd05.prod.outlook.com (2603:10a6:7:a3::22) by HE1PR05MB4652.eurprd05.prod.outlook.com (2603:10a6:7:99::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.17; Fri, 3 Apr 2020 23:05:57 +0000 Received: from HE1PR05MB4746.eurprd05.prod.outlook.com ([fe80::e9a8:7b1c:f82a:865b]) by HE1PR05MB4746.eurprd05.prod.outlook.com ([fe80::e9a8:7b1c:f82a:865b%6]) with mapi id 15.20.2856.019; Fri, 3 Apr 2020 23:05:57 +0000 From: Petr Machata To: netdev@vger.kernel.org Cc: Petr Machata , Stephen Hemminger , David Ahern Subject: [PATCH iproute2-next v2 2/3] man: tc-pedit: Add examples for dsfield and retain Date: Sat, 4 Apr 2020 02:05:30 +0300 Message-Id: <4a1f881e2dce535e3848dd87914db41f80fd0d57.1585954968.git.petrm@mellanox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: X-ClientProxiedBy: PR3P193CA0039.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:51::14) To HE1PR05MB4746.eurprd05.prod.outlook.com (2603:10a6:7:a3::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dev-r-vrt-156.mtr.labs.mlnx (37.142.13.130) by PR3P193CA0039.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:51::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.16 via Frontend Transport; Fri, 3 Apr 2020 23:05:56 +0000 X-Mailer: git-send-email 2.20.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9307a56c-50e0-4c16-579b-08d7d8239131 X-MS-TrafficTypeDiagnostic: HE1PR05MB4652:|HE1PR05MB4652: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-Forefront-PRVS: 0362BF9FDB X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR05MB4746.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(396003)(376002)(366004)(39860400002)(136003)(346002)(54906003)(6916009)(2616005)(956004)(36756003)(86362001)(81166006)(52116002)(2906002)(5660300002)(8676002)(8936002)(478600001)(81156014)(16526019)(186003)(66556008)(6506007)(6486002)(316002)(26005)(66476007)(66946007)(6666004)(4326008)(6512007); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sP/JUwiIM6dFe6E2xnD378yAqCJGhVveSvXdirUdwUX5eBY1bTkvl1u8Xd+RSICNA92AmQ3YAKJdN8HNArPjeLBFyIUnmSmWFhd58Uwd73wlZXW9r+StAkgN4mvsxUN53JZVHDh1WN1/61Im6Jkn4Mqu0r6MRKoFZeVTv79wjfntfj+HO/O8qFV6hfE29N8gFqsx4LtqYhhLKjr01aY9RbIhOpHFmVW5sXjXWV6HReeWNpnOx6xKHyU5sHm6yxCA6v429zbOzmIfCA5EXthuzD54YFT0j72nqUbACrfb+maVC4bQ8l0MarLC9n6fGn3+qQfK2DvqGh4q7kJJWCYMhjQfnzf0dGBI7G63QTA4UFG/XcaIPdO2QbevoGQp7QO4CfPPpxtp/UEKg7UXdatURvo4gyNdSCYuXcVV0IHNeQMs5FtgOW6Dw2j3DJXfYnHU X-MS-Exchange-AntiSpam-MessageData: UylB5tM4Fc0KFO0V8s3uot+nphQbPi/fP7GzG13zNnGGF2dUT+fGo6tllW5IrsZ+qvA496QJAATKmB7LOGW2DohxfgjjNXA6bEUiEl3B9wGllvxbD+EDYWDCpyQ6xfsNT462P5LPmVajwaFLjfbm8g== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9307a56c-50e0-4c16-579b-08d7d8239131 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2020 23:05:57.3156 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: S6tS2L6EAt+0jPTh/RrCbwiszpMWzCDBk34B+y4xCdjhj4HGe1pIcpQMRazBaWTs/POwSQvPKJuxjRD0y1DfcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB4652 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Describe a way to update just the DSCP and just the ECN part of the dsfield. That is useful on its own, but also it shows how retain works. Signed-off-by: Petr Machata --- man/man8/tc-pedit.8 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/man/man8/tc-pedit.8 b/man/man8/tc-pedit.8 index 3f6baa3d..d2b37ef0 100644 --- a/man/man8/tc-pedit.8 +++ b/man/man8/tc-pedit.8 @@ -369,6 +369,28 @@ tc filter add dev eth0 parent ffff: u32 \\ action pedit ex munge tcp dport set 22 .EE .RE + +To rewrite just part of a field, use the +.B retain +directive. E.g. to overwrite the DSCP part of a dsfield with $DSCP, without +touching ECN: + +.RS +.EX +tc filter add dev eth0 ingress flower ... \\ + action pedit ex munge ip dsfield set $((DSCP << 2)) retain 0xfc +.EE +.RE + +And vice versa, to set ECN to e.g. 1 without impacting DSCP: + +.RS +.EX +tc filter add dev eth0 ingress flower ... \\ + action pedit ex munge ip dsfield set 1 retain 0x3 +.EE +.RE + .SH SEE ALSO .BR tc (8), .BR tc-htb (8), From patchwork Fri Apr 3 23:05:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 1266281 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=B/4OJ6V6; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48vFsp3wsgz9sPF for ; Sat, 4 Apr 2020 10:06:06 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728720AbgDCXGF (ORCPT ); Fri, 3 Apr 2020 19:06:05 -0400 Received: from mail-eopbgr20069.outbound.protection.outlook.com ([40.107.2.69]:53598 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728589AbgDCXGE (ORCPT ); Fri, 3 Apr 2020 19:06:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GLJDHagkZheXOoKIkoKB7GuMybDeR70Ih4goVb/Jd1Qn+SdnPXZbfl84AZUpOpO1GMdAoEYRhrpM0wMRmFJ/FHn0MfBMytxkPMnRJLnXp00uDCrd4nLyrZe5dBXVqHCOIolzSILgat3ecH6lWCK9sE6fJRPHzS6naGuqdGxJI7jaSGxT8kc/e1QkrKRFuxDsuI6mlMGMcXvw7CG4YLiBCWvho/ZjZ8qMzXcuL6nUdU42hi4LE9QJxmTE3IgpWneFPpMpIUfcJ85La+YKUKOhS7kHzMLmEugTuOb0HZTbVFE11sQ7F+Sm3tqTTmdvz6oV3oU7RW89OYAKyIIH0T1cqA== 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-SenderADCheck; bh=WkCLE/16/oHyoGapVluiY7V6/Sfh/8p89aqDkkq7heg=; b=hXkb1Gc2hrdCu9hbov4bWi8kkonowntcpCVHDOWAn5M2RZm6DqSWUhrCfMnDGpbEqV4d7A3UVxDiavay9BCaIXR35xlnKFCRbaWfLwA94FBBDbm+Jx3UT29N5hLivBCvYZbBgBDgFtKWquOvO9bLk4zcYFBk6VtrgiGFSl0W4xGSjxAWtTbZQl8ZwIlAUskkiXR6c9XfMOZ4LjOd/SBLrf8JIJVF/unXwtAXCdBAEAyxfLQQCP/Ouirgp3dLSGvd0hVIBUDPBRqynlheMnltq1wozk6uXcz34W5gpOJkDkxVGp4OuqONaQzo0N81lccOOitFtPciJLwrkM7rS9u2yQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WkCLE/16/oHyoGapVluiY7V6/Sfh/8p89aqDkkq7heg=; b=B/4OJ6V6gX7DTKeXwaKCXorjDcbBXqetNApU33xDyNKSRsxfyHDgEPy8Yp+KBnkeSvoPn+1LMmen8rsH1g9aEg1hGTRfyoCj5IFkW/fZjXPyPApDIF5za2ZClDKMojAtjsOhabkeqVl1zj09JRac+/qmVjl7S4iOETCBQAqsB8w= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from HE1PR05MB4746.eurprd05.prod.outlook.com (2603:10a6:7:a3::22) by HE1PR05MB4652.eurprd05.prod.outlook.com (2603:10a6:7:99::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.17; Fri, 3 Apr 2020 23:05:59 +0000 Received: from HE1PR05MB4746.eurprd05.prod.outlook.com ([fe80::e9a8:7b1c:f82a:865b]) by HE1PR05MB4746.eurprd05.prod.outlook.com ([fe80::e9a8:7b1c:f82a:865b%6]) with mapi id 15.20.2856.019; Fri, 3 Apr 2020 23:05:59 +0000 From: Petr Machata To: netdev@vger.kernel.org Cc: Petr Machata , Stephen Hemminger , David Ahern , Ido Schimmel Subject: [PATCH iproute2-next v2 3/3] man: tc-pedit: Drop the claim that pedit ex is only for IPv4 Date: Sat, 4 Apr 2020 02:05:31 +0300 Message-Id: <70688719f6ed31ad78c2ef92018851d3d706e5e7.1585954968.git.petrm@mellanox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: X-ClientProxiedBy: PR3P193CA0039.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:51::14) To HE1PR05MB4746.eurprd05.prod.outlook.com (2603:10a6:7:a3::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dev-r-vrt-156.mtr.labs.mlnx (37.142.13.130) by PR3P193CA0039.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:51::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.16 via Frontend Transport; Fri, 3 Apr 2020 23:05:57 +0000 X-Mailer: git-send-email 2.20.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7589ff7d-e71f-4c7a-e8c4-08d7d8239244 X-MS-TrafficTypeDiagnostic: HE1PR05MB4652:|HE1PR05MB4652: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 0362BF9FDB X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR05MB4746.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(396003)(376002)(366004)(39860400002)(136003)(346002)(4744005)(54906003)(6916009)(107886003)(2616005)(956004)(36756003)(86362001)(81166006)(52116002)(2906002)(5660300002)(8676002)(8936002)(478600001)(81156014)(16526019)(186003)(66556008)(6506007)(6486002)(316002)(26005)(66476007)(66946007)(6666004)(4326008)(6512007); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8BGCQl6Z2EkfciPiCSOpRg4Ef/k2NpELoJpVWnCWG+usSBrNPUqypFbgpomkhixre5enGnhIDqGiSfpVfxVCwdDeGeBwcPuhE96T7e+K129867sPhnxnfbAVwTehFC2ueAzIeTCveGKmsabvsAqvXE/q0+WVwqqKLKXoNW+BC7uT7Tqksez/jE9YtiEhZG2dYfieTJKXXxzO/KHUUcKyD0HDxv+j7IpdKmEy9osgld6k//ClVG3Fuma4U/55kQrN0IbFjAWOoRz0eC19rWuyFBGHkTknzl2RQUkN02cAtS6kckvv3gj+YO1opIsKgiPzA6CAMvyx91cQfuS6Yw+8/EQPVO0KVNEP7WozzB9Fk4Nu63li1eaFjE7Z8MfEwRx+lTMxZLLaFXo+zLNBSeYcfoRXU/W8bTw10ZKAw5mgcdwgBDjRWcoHpLWhyKmWUYbt X-MS-Exchange-AntiSpam-MessageData: t3cfcV8O4epfV072WMOLgEKNfKeZqNzxxiEg1vNRTsSZIl+DXmYZiAtKxKBlAvvs9XXuKnWvJYzK7ZQwNLxPPwLmhyD5EjkZTXL5HVaTonqCEFRWhErHFI4tVO6NT+F9h4h3xOtDIfJ8Tvx8mlFXpw== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7589ff7d-e71f-4c7a-e8c4-08d7d8239244 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2020 23:05:58.9666 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 83q4eojFqLsOARKCk6uUr7q297eDm6y5Hbgwin3Hvd/KX3c9tCAr2mYLxvU9DyWt5lndlh8Ua8b11o/0rAv6sg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB4652 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This sentence predates addition of extended pedit for IPv6 packets. Reported-by: Ido Schimmel Signed-off-by: Petr Machata --- man/man8/tc-pedit.8 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/man/man8/tc-pedit.8 b/man/man8/tc-pedit.8 index d2b37ef0..376ad4a8 100644 --- a/man/man8/tc-pedit.8 +++ b/man/man8/tc-pedit.8 @@ -90,8 +90,7 @@ action can be used to change arbitrary packet data. The location of data to change can either be specified by giving an offset and size as in .IR RAW_OP , or for header values by naming the header and field to edit the size is then -chosen automatically based on the header field size. Currently this is supported -only for IPv4 headers. +chosen automatically based on the header field size. .SH OPTIONS .TP .B ex