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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 21 Jul 2016 09:50:00 -0700
From:	Cong Wang <xiyou.wangcong@...il.com>
To:	Jamal Hadi Salim <jhs@...atatu.com>
Cc:	Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: [Patch net-next 1/2] net_sched: move tc_action into tcf_common

On Thu, Jul 21, 2016 at 12:38 AM, Jamal Hadi Salim <jhs@...atatu.com> wrote:
> It is an involved change (and i was fond of the container_of()
> trickery;)).
>
> Looking at this patch I cant grok some parts - maybe i need to apply it
> when i am not in a hurry to see clearly.
> Mostly this around things like:
> ---
> const struct tc_action *a
> struct tcf_mirred *m = to_mirred(a)
> ---
>
> Essentially this reduces to
> struct tcf_mirred *m = (struct tcf_mirred *)a
>
> How would that work?

This works because we always put struct tc_action
as the first member of each specific action, e.g. tcf_mirred,

struct tcf_mirred {
        struct tc_action        common;
        int                     tcfm_eaction;
        int                     tcfm_ifindex;
        int                     tcfm_ok_push;
        struct net_device __rcu *tcfm_dev;
        struct list_head        tcfm_list;
};

We can put a container_of() if you want to relax this rule,
but we already use the same trick in many other places
in networking subsystem. ;)

> Do we still need the void *priv

No, I already removed it in this patch.

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ