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]
Message-ID: <CANn89i+ZnnJrLeSXadgDxWWT6q1Y+gPVoK8EJ417AzNfFKLQ+A@mail.gmail.com>
Date:   Wed, 31 Aug 2016 11:39:43 -0700
From:   Eric Dumazet <edumazet@...gle.com>
To:     Hadar Hen Zion <hadarh@...lanox.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        netdev <netdev@...r.kernel.org>, Jiri Pirko <jiri@...lanox.com>,
        Jiri Benc <jbenc@...hat.com>,
        Jamal Hadi Salim <jhs@...atatu.com>,
        Shmulik Ladkani <shmulik.ladkani@...il.com>,
        Tom Herbert <tom@...bertland.com>,
        Cong Wang <xiyou.wangcong@...il.com>,
        Or Gerlitz <ogerlitz@...lanox.com>,
        Amir Vadai <amirva@...lanox.com>, Amir Vadai <amir@...ai.me>
Subject: Re: [PATCH net-next V4 4/4] net/sched: Introduce act_tunnel_key

On Wed, Aug 31, 2016 at 5:46 AM, Hadar Hen Zion <hadarh@...lanox.com> wrote:
>
> From: Amir Vadai <amir@...ai.me>
>
> This action could be used before redirecting packets to a shared tunnel
> device, or when redirecting packets arriving from a such a device.
>
>
> +
> +struct tcf_tunnel_key_params {
> +       struct rcu_head         rcu;
> +       int                     tcft_action;

Also add " int action;"

(see why later)

> +       struct metadata_dst     *tcft_enc_metadata;
> +};
> +



> +
> +static int tunnel_key_act(struct sk_buff *skb, const struct tc_action *a,
> +                         struct tcf_result *res)
> +{
> +       struct tcf_tunnel_key *t = to_tunnel_key(a);
> +       struct tcf_tunnel_key_params *params;
> +       int action;
> +
> +       rcu_read_lock();
> +
> +       params = rcu_dereference(t->params);
> +
> +       tcf_lastuse_update(&t->tcf_tm);
> +       bstats_cpu_update(this_cpu_ptr(t->common.cpu_bstats), skb);
> +       action = t->tcf_action;

Ideally, you should read param->action instead of t->tcf_action to be
completely clean.

> +
> +       switch (params->tcft_action) {
> +       case TCA_TUNNEL_KEY_ACT_RELEASE:
> +               skb_dst_drop(skb);
> +               break;
> +       case TCA_TUNNEL_KEY_ACT_SET:
> +               skb_dst_drop(skb);
> +               skb_dst_set(skb, dst_clone(&params->tcft_enc_metadata->dst));
> +               break;
> +       default:
> +               WARN_ONCE(1, "Bad tunnel_key action.\n");
> +               break;
> +       }
> +
> +       rcu_read_unlock();
> +
> +       return action;
> +}
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ