All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gerd v. Egidy" <lists@egidy.de>
To: jamal <hadi@cyberus.ca>
Cc: netdev@vger.kernel.org
Subject: xfrm by MARK: expected behavior of masking
Date: Thu, 14 Oct 2010 15:15:41 +0200	[thread overview]
Message-ID: <201010141515.41654.lists@egidy.de> (raw)

Hi,

while looking at the xfrm by MARK code I found a case where the masking of 
marks does not work as I would it expect to work.

Take for example a mark value of 5 and a mask of 0xfffffffe
->
src 192.168.5.0/24 dst 192.168.1.0/24 
        dir out priority 1760 ptype main 
        mark 5/0xfffffffe
        tmpl src 172.16.1.131 dst 172.16.1.130
                proto esp reqid 16384 mode tunnel

The code to check the marks always (e.g. in xfrm_policy.c, but several other 
places too) looks like this:

(fl->mark & pol->mark.m) != pol->mark.v

This means that a flow marked with 5 will actually never match. You have to 
use the first number in the mask (4 in this case) to make the policy work.

Is this expected behavior?

I'd expect that the kernel would either
a) still match those packets
or
b) refuse to configure such a policy

Kind regards,

Gerd

-- 
Address (better: trap) for people I really don't want to get mail from:
jonas@cactusamerica.com

                 reply	other threads:[~2010-10-14 13:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201010141515.41654.lists@egidy.de \
    --to=lists@egidy.de \
    --cc=hadi@cyberus.ca \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.