From patchwork Tue Oct 8 12:56:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Gouault X-Patchwork-Id: 281472 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 D76572C0091 for ; Wed, 9 Oct 2013 00:05:00 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753855Ab3JHNEp (ORCPT ); Tue, 8 Oct 2013 09:04:45 -0400 Received: from 33.106-14-84.ripe.coltfrance.com ([84.14.106.33]:52974 "EHLO proxy.6wind.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752665Ab3JHNEn (ORCPT ); Tue, 8 Oct 2013 09:04:43 -0400 X-Greylist: delayed 470 seconds by postgrey-1.27 at vger.kernel.org; Tue, 08 Oct 2013 09:04:43 EDT Received: from bliss.dev.6wind.com (unknown [10.16.0.36]) by proxy.6wind.com (Postfix) with ESMTPS id 0FAB2282B2; Tue, 8 Oct 2013 14:56:52 +0200 (CEST) Received: from gouault by bliss.dev.6wind.com with local (Exim 4.80) (envelope-from ) id 1VTWqJ-0003FX-LS; Tue, 08 Oct 2013 14:56:51 +0200 From: Christophe Gouault To: shemminger@vyatta.com Cc: netdev@vger.kernel.org, Christophe Gouault Subject: [PATCH iproute2] xfrm: enable to set non-wildcard mark 0 on SAs and SPs Date: Tue, 8 Oct 2013 14:56:06 +0200 Message-Id: <1381236966-12436-1-git-send-email-christophe.gouault@6wind.com> X-Mailer: git-send-email 1.7.10.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ip xfrm considers that the user-defined mark is "any" as soon as (mark.v & mark.m == 0), which prevents from specifying non-wildcard marks that include the value 0 (typically 0/0xffffffff). Yet, matching exactly mark 0 is useful for instance to separate vti policies from global policies. Always configure the user mark if mark.m != 0. Signed-off-by: Christophe Gouault --- ip/xfrm_policy.c | 2 +- ip/xfrm_state.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c index 36e33c9..a8d8b98 100644 --- a/ip/xfrm_policy.c +++ b/ip/xfrm_policy.c @@ -373,7 +373,7 @@ static int xfrm_policy_modify(int cmd, unsigned flags, int argc, char **argv) (void *)tmpls_buf, tmpls_len); } - if (mark.m & mark.v) { + if (mark.m) { int r = addattr_l(&req.n, sizeof(req.buf), XFRMA_MARK, (void *)&mark, sizeof(mark)); if (r < 0) { diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c index f4ad4cb..c4d2bf6 100644 --- a/ip/xfrm_state.c +++ b/ip/xfrm_state.c @@ -528,7 +528,7 @@ static int xfrm_state_modify(int cmd, unsigned flags, int argc, char **argv) exit(1); } - if (mark.m & mark.v) { + if (mark.m) { int r = addattr_l(&req.n, sizeof(req.buf), XFRMA_MARK, (void *)&mark, sizeof(mark)); if (r < 0) {