From patchwork Wed Mar 2 11:20:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Sutter X-Patchwork-Id: 590953 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 56D52140326 for ; Wed, 2 Mar 2016 22:21:04 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755038AbcCBLU6 (ORCPT ); Wed, 2 Mar 2016 06:20:58 -0500 Received: from orbyte.nwl.cc ([151.80.46.58]:58900 "EHLO mail.nwl.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755034AbcCBLU5 (ORCPT ); Wed, 2 Mar 2016 06:20:57 -0500 Received: from mail.nwl.cc (orbyte.nwl.cc [127.0.0.1]) by mail.nwl.cc (Postfix) with ESMTP id 5CEB76739B; Wed, 2 Mar 2016 12:20:56 +0100 (CET) Received: from xsao (localhost [IPv6:::1]) by mail.nwl.cc (Postfix) with ESMTP id 406456020E; Wed, 2 Mar 2016 12:20:56 +0100 (CET) From: Phil Sutter To: Stephen Hemminger Cc: netdev@vger.kernel.org Subject: [iproute PATCH 3/3] tc: pedit: Fix retain value for ihl adjustments Date: Wed, 2 Mar 2016 12:20:31 +0100 Message-Id: <1456917631-18447-4-git-send-email-phil@nwl.cc> X-Mailer: git-send-email 2.7.2 In-Reply-To: <1456917631-18447-1-git-send-email-phil@nwl.cc> References: <1456917631-18447-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..10e4bebc71d94 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) {