From patchwork Fri Apr 22 07:02:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Fernando_Luis_V=C3=A1zquez_Cao?= X-Patchwork-Id: 92504 X-Patchwork-Delegate: davem@davemloft.net 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 70561B6F67 for ; Fri, 22 Apr 2011 17:26:17 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752289Ab1DVH0N (ORCPT ); Fri, 22 Apr 2011 03:26:13 -0400 Received: from serv2.oss.ntt.co.jp ([222.151.198.100]:58889 "EHLO serv2.oss.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751962Ab1DVH0M (ORCPT ); Fri, 22 Apr 2011 03:26:12 -0400 Received: from serv2.oss.ntt.co.jp (localhost [127.0.0.1]) by serv2.oss.ntt.co.jp (Postfix) with ESMTP id A480E24829C; Fri, 22 Apr 2011 16:02:39 +0900 (JST) Received: from serv1.oss.ntt.co.jp (serv1.oss.ntt.co.jp [172.19.0.2]) by serv2.oss.ntt.co.jp (Postfix) with ESMTP id 9001E248299; Fri, 22 Apr 2011 16:02:39 +0900 (JST) Received: from [172.17.2.23] (unknown [172.17.2.23]) by serv1.oss.ntt.co.jp (Postfix) with ESMTP id 776AF260423; Fri, 22 Apr 2011 16:02:39 +0900 (JST) Subject: [PATCH] netfilter/IPv6: fix DSCP mangle code From: Fernando Luis Vazquez Cao To: netdev@vger.kernel.org Cc: davem@davemloft.net, yoshfuji@linux-ipv6.org, jengelh@medozas.de Organization: =?iso-2022-jp?Q?NTT=1B$B%*!=3C%W%s%=3D!=3C%9=1B=28B?= =?iso-2022-jp?Q?=1B$B%=3D%U%H%&%'%=22%=3B%s=1B=28B?= =?iso-2022-jp?Q?=1B$B%=3F=1B=28B?= Date: Fri, 22 Apr 2011 16:02:39 +0900 Message-ID: <1303455759.2023.39.camel@nausicaa> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The mask indicates the bits one wants to zero out, so it needs to be inverted before applying to the original TOS field. Signed-off-by: Fernando Luis Vazquez Cao --- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -urNp linux-2.6.37-orig/net/netfilter/xt_DSCP.c linux-2.6.37/net/netfilter/xt_DSCP.c --- linux-2.6.37-orig/net/netfilter/xt_DSCP.c 2011-01-05 09:50:19.000000000 +0900 +++ linux-2.6.37/net/netfilter/xt_DSCP.c 2011-04-21 16:01:25.801890733 +0900 @@ -99,7 +99,7 @@ tos_tg6(struct sk_buff *skb, const struc u_int8_t orig, nv; orig = ipv6_get_dsfield(iph); - nv = (orig & info->tos_mask) ^ info->tos_value; + nv = (orig & ~info->tos_mask) ^ info->tos_value; if (orig != nv) { if (!skb_make_writable(skb, sizeof(struct iphdr)))