All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Álvaro Neira Ayuso" <alvaroneay@gmail.com>
To: Florian Westphal <fw@strlen.de>
Cc: Patrick McHardy <kaber@trash.net>, netfilter-devel@vger.kernel.org
Subject: Re: [nftables PATCH v2] src: Replace TOS support for using DSCP support
Date: Mon, 02 Jun 2014 20:57:08 +0200	[thread overview]
Message-ID: <538CC904.3080705@gmail.com> (raw)
In-Reply-To: <20140602085826.GA17858@breakpoint.cc>

El 02/06/14 10:58, Florian Westphal escribió:
> Álvaro Neira Ayuso <alvaroneay@gmail.com> wrote:
>>>> Now, when we add a rule with DSCP, in the code generation step, nftables
>>>> compares 1 bytes but it should compare 6 bits. I think that the problem should
>>>> be in the code generation.
>>>
>>> I don't really see how this patch changes this. The kernel operates in units
>>> of bytes. For anything smaller nftables will have to generate appropriate
>>> bitwise operations. Please explain in more detail how this patch changes this.
>>>
>>
>> Now, nothing. For that it's stopped. I'm working for doing a patch
>> for operating in the kernel not only with units of bytes like you
>> say. In a couple of days, I'm going to send it to the list.
>
> Are you sure this is the right approach?
>
> It might be better to create appropriate masking instructions in
> userspace, in most cases byte addressing is sufficient.
>
> Something like this (warning: untested, misses 'reverse' mapping to
> remove the implicit bitops when listing rules):
>
> http://git.breakpoint.cc/cgit/fw/nftables.git/commit/?h=payload_offset_04&id=76ac27643400111785a8abb21fdd9e4311d9876e
>

I have explained very bad. I'm working in a patch like you but I have 
done a different solution. I have done my solution in the evaluation. I 
have added a bitwise node in the tree when we evaluate the relational if 
we have a EXPR_PAYLOAD node in the left and when the size of this left 
node is not a multiple of BITS_PER_BYTE. And I have used the function 
mpz_prefixmask for doing the masks. The problem come when I have added a 
rule like:

nft add rule ip filter input ip frag-off != 0

The mask that we need to use for take the 13 bits for frag-off is like this:
|00052|N-|00002|	|len |flags| type|
|00008|--|00001|	|len |flags| type|
| 00 00 00 01  |	|      data      |	
|00008|--|00002|	|len |flags| type|
| 00 00 00 01  |	|      data      |	
|00008|--|00003|	|len |flags| type|
| 00 00 00 02  |	|      data      |	
|00012|N-|00004|	|len |flags| type|
|00006|--|00001|	|len |flags| type|
| 1f ff 00 00  |	|      data      |	

The problem is when I have seen the mask of the bitwise in the kernel, I 
have seen that the mask is 0xff1f. I'm working for trying to fix that. I 
have thought that maybe was a problem that I have tried this rule 
without my patch and we have the same problem:

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-06-04 22:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-27 10:00 [nftables PATCH 2/2] src: Add DSCP support in nftables Alvaro Neira Ayuso
2014-05-27 14:18 ` [nftables PATCH v2] src: Replace TOS support for using DSCP support Alvaro Neira Ayuso
2014-06-01 20:27   ` Patrick McHardy
2014-06-02  8:06     ` Álvaro Neira Ayuso
2014-06-02  8:58       ` Florian Westphal
2014-06-02 18:57         ` Álvaro Neira Ayuso [this message]
2014-06-03  5:26         ` Maciej Żenczykowski

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=538CC904.3080705@gmail.com \
    --to=alvaroneay@gmail.com \
    --cc=fw@strlen.de \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@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.