From patchwork Wed Mar 2 18:45:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Sutter X-Patchwork-Id: 591086 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4DEAA140D35 for ; Thu, 3 Mar 2016 05:46:32 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756488AbcCBSqR (ORCPT ); Wed, 2 Mar 2016 13:46:17 -0500 Received: from orbyte.nwl.cc ([151.80.46.58]:47305 "EHLO mail.nwl.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756359AbcCBSqO (ORCPT ); Wed, 2 Mar 2016 13:46:14 -0500 Received: from mail.nwl.cc (orbyte.nwl.cc [127.0.0.1]) by mail.nwl.cc (Postfix) with ESMTP id 3FA026739B; Wed, 2 Mar 2016 19:46:13 +0100 (CET) Received: from xsao (localhost [IPv6:::1]) by mail.nwl.cc (Postfix) with ESMTP id 25F4E6020E; Wed, 2 Mar 2016 19:46:13 +0100 (CET) From: Phil Sutter To: Stephen Hemminger Cc: netdev@vger.kernel.org Subject: [iproute PATCH v2 3/4] tc: pedit: Fix retain value for ihl adjustments Date: Wed, 2 Mar 2016 19:45:42 +0100 Message-Id: <1456944343-19058-4-git-send-email-phil@nwl.cc> X-Mailer: git-send-email 2.7.2 In-Reply-To: <1456944343-19058-1-git-send-email-phil@nwl.cc> References: <20160302095414.45a928df@xeon-e3> <1456944343-19058-1-git-send-email-phil@nwl.cc> X-Virus-Scanned: ClamAV using ClamSMTP Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Since the IP Header Length field is just half a byte, adjust retain to only match these bits so the Version field is not overwritten by accident. The whole concept is actually broken due to dependency on endianness which pedit ignores. Signed-off-by: Phil Sutter --- tc/p_ip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/p_ip.c b/tc/p_ip.c index 08fdbaa41fbf4..8f0649134566b 100644 --- a/tc/p_ip.c +++ b/tc/p_ip.c @@ -58,7 +58,7 @@ parse_ip(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_ke if (strcmp(*argv, "ihl") == 0) { NEXT_ARG(); tkey->off = 0; - res = parse_cmd(&argc, &argv, 1, TU32,RU8,sel,tkey); + res = parse_cmd(&argc, &argv, 1, TU32, 0x0f, sel, tkey); goto done; } if (strcmp(*argv, "protocol") == 0) {