netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jamal <hadi@cyberus.ca>
To: Anton 'EvilMan' Danilov <littlesmilingcloud@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2] pedit action: add mask for changing bits.
Date: Mon, 27 Feb 2012 08:58:55 -0500	[thread overview]
Message-ID: <1330351135.2384.1039.camel@mojatatu> (raw)
In-Reply-To: <CAEzD07+0EA12igqAcwbM8VGKLR9Hp0GjJ7t_Jve=JXOrEKvu9w@mail.gmail.com>

Hi Anton,

On Sat, 2012-02-25 at 22:01 +0400, Anton 'EvilMan' Danilov wrote:
> This patch adds the ability to set the mask for changing bits. The
> mask parameter is optional.
> 
> Example of usage:
> #rewrite vlan id. cos field in 802.1q header is unchanged.
> ip link add link eth0 name eth0.99 type vlan id 99 reorder_hdr off
> egress-qos-map 0:7
> tc qdisc add dev eth0 root handle 1: prio bands 8
> tc filter add dev eth0 parent 1: protocol all pref 1 u32
> tc filter add dev eth0 parent 1: protocol all pref 1 handle ::1 u32 \
>    match u16 0x8100 0xffff at -6 \
>    match u16 0x0063 0x0fff at -4 \
>    classid 1:5 \
>    action pedit munge offset -4 u16 set 0x000d 0x0fff

Looks like a reasonable feature to have - but it has to continue working
as before for things that dont need the mask.

> 
> diff --git a/tc/m_pedit.c b/tc/m_pedit.c
> index 7499846..f081eff 100644
> --- a/tc/m_pedit.c
> +++ b/tc/m_pedit.c

> 
> 	tkey->val = htonl(tkey->val & retain);
> -	tkey->mask = htonl(tkey->mask | ~retain);
> +	tkey->mask = htonl(~tkey->mask | ~retain);

A change like the above worries me that this may work for your use case
but will break other things that used to work. I'd like to run some
tests but dont have the cycles for the next few days. Alternatively, I
could explain some tests to you and you could validate and fix whatever
breaks.
Let me know what is best for you.

cheers,
jamal

  reply	other threads:[~2012-02-27 13:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-25 18:01 [PATCH iproute2] pedit action: add mask for changing bits Anton 'EvilMan' Danilov
2012-02-27 13:58 ` jamal [this message]
2012-02-27 14:15   ` Anton 'EvilMan' Danilov
2012-02-28 13:05     ` Jamal Hadi Salim
2012-02-29 13:12       ` Anton 'EvilMan' Danilov
2012-02-29 14:01         ` jamal
2012-04-25 20:15           ` Stephen Hemminger
2012-04-26 10:21             ` Jamal Hadi Salim

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=1330351135.2384.1039.camel@mojatatu \
    --to=hadi@cyberus.ca \
    --cc=jhs@mojatatu.com \
    --cc=littlesmilingcloud@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).