lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 21 Jul 2014 16:04:55 +0400
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Antonio Quartulli <antonio@...hcoding.com>, davem@...emloft.net
CC:	netdev@...r.kernel.org, Antonio Quartulli <antonio@...n-mesh.com>,
	Jamal Hadi Salim <jhs@...atatu.com>
Subject: Re: [PATCH] skbedit: allow the user to specify bitmask for mark

Hello.

On 21-07-2014 12:35, Antonio Quartulli wrote:

> From: Antonio Quartulli <antonio@...n-mesh.com>

> The user may want to use only some bits of the skb mark in
> his skbedit rules because the remaining part might be used by
> something else.

> Introduce the "mask" parameter to the skbedit actor in order
> to implement such functionality.

> When the mask is specified, only those bits selected by the
> latter are altered really changed by the actor, while the
> rest is left untouched.

> Cc: Jamal Hadi Salim <jhs@...atatu.com>
> Signed-off-by: Antonio Quartulli <antonio@...n-mesh.com>
[...]

> diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
> index fcfeeaf..5fca32b 100644
> --- a/net/sched/act_skbedit.c
> +++ b/net/sched/act_skbedit.c
> @@ -43,8 +43,12 @@ static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a,
>   	if (d->flags & SKBEDIT_F_QUEUE_MAPPING &&
>   	    skb->dev->real_num_tx_queues > d->queue_mapping)
>   		skb_set_queue_mapping(skb, d->queue_mapping);
> -	if (d->flags & SKBEDIT_F_MARK)
> -		skb->mark = d->mark;
> +	if (d->flags & SKBEDIT_F_MARK) {
> +		/* unset all the bits in the mask */
> +		skb->mark = skb->mark & ~d->mask;

    Why not 'skb->mark &= ~d->mask;'?

> +		/* assign the mark value for the masked bit only */
> +		skb->mark |= d->mark & d->mask;
> +	}
>
>   	spin_unlock(&d->tcf_lock);
>   	return d->tcf_action;
[...]

WBR, Sergei

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ