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: <87ioljv3st.fsf@x220.int.ebiederm.org>
Date:	Sat, 23 Aug 2014 06:33:22 -0500
From:	ebiederm@...ssion.com (Eric W. Biederman)
To:	Jiri Pirko <jiri@...nulli.us>
Cc:	Florian Fainelli <f.fainelli@...il.com>,
	netdev <netdev@...r.kernel.org>,
	David Miller <davem@...emloft.net>,
	Neil Horman <nhorman@...driver.com>,
	Andy Gospodarek <andy@...yhouse.net>, tgraf <tgraf@...g.ch>,
	dborkman <dborkman@...hat.com>, ogerlitz <ogerlitz@...lanox.com>,
	jesse <jesse@...ira.com>, pshelar <pshelar@...ira.com>,
	azhou <azhou@...ira.com>, Ben Hutchings <ben@...adent.org.uk>,
	Stephen Hemminger <stephen@...workplumber.org>,
	Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
	vyasevic <vyasevic@...hat.com>,
	Cong Wang <xiyou.wangcong@...il.com>,
	John Fastabend <john.r.fastabend@...el.com>,
	Eric Dumazet <edumazet@...gle.com>,
	Jamal Hadi Salim <jhs@...atatu.com>,
	Scott Feldman <sfeldma@...ulusnetworks.com>,
	Roopa Prabhu <roopa@...ulusnetworks.com>,
	John Linville <linville@...driver.com>,
	dev <dev@...nvswitch.org>,
	"jasowang\@redhat.com" <jasowang@...hat.com>,
	Nicolas Dichtel <nicolas.dichtel@...nd.com>,
	Sergey Ryazanov <ryazanov.s.a@...il.com>,
	Lennert Buytenhek <buytenh@...tstofly.org>,
	Aviad Raveh <aviadr@...lanox.com>,
	Felix Fietkau <nbd@...nwrt.org>,
	Alexei Starovoitov <alexei.starovoitov@...il.com>,
	Neil Jerram <Neil.Jerram@...aswitch.com>, ronye@...lanox.com
Subject: Re: [patch net-next RFC 07/12] dsa: implement ndo_swdev_get_id

Jiri Pirko <jiri@...nulli.us> writes:

> Thu, Aug 21, 2014 at 06:56:13PM CEST, f.fainelli@...il.com wrote:
>>2014-08-21 9:19 GMT-07:00 Jiri Pirko <jiri@...nulli.us>:
>>> Signed-off-by: Jiri Pirko <jiri@...nulli.us>
>>> ---
>>>  net/dsa/Kconfig |  2 +-
>>>  net/dsa/slave.c | 16 ++++++++++++++++
>>>  2 files changed, 17 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
>>> index f5eede1..66c445a 100644
>>> --- a/net/dsa/Kconfig
>>> +++ b/net/dsa/Kconfig
>>> @@ -1,6 +1,6 @@
>>>  config HAVE_NET_DSA
>>>         def_bool y
>>> -       depends on NETDEVICES && !S390
>>> +       depends on NETDEVICES && NET_SWITCHDEV && !S390
>>>
>>>  # Drivers must select NET_DSA and the appropriate tagging format
>>>
>>> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
>>> index 45a1e34..e069ba3 100644
>>> --- a/net/dsa/slave.c
>>> +++ b/net/dsa/slave.c
>>> @@ -171,6 +171,19 @@ static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
>>>         return -EOPNOTSUPP;
>>>  }
>>>
>>> +static int dsa_slave_swdev_get_id(struct net_device *dev,
>>> +                                 struct netdev_phys_item_id *psid)
>>> +{
>>> +       struct dsa_slave_priv *p = netdev_priv(dev);
>>> +       struct dsa_switch *ds = p->parent;
>>> +       u64 tmp = (u64) ds;
>>> +
>>> +       /* TODO: add more sophisticated id generation */
>>> +       memcpy(&psid->id, &tmp, sizeof(tmp));
>>> +       psid->id_len = sizeof(tmp);
>>
>>There is already an unique id generated, which is the index in the
>>switch tree, and which is stored in struct dsa_switch, so this could
>>probably be simplified to:
>>
>>psid->id = ds->index
>
> That index is 0..n if I understand that correctly. That is not enough.
> The point is to have unique id for every chip in the system. If we would
> have 0,1,2... the collision is very likely.

I am just kibitzing but ethernet switches capable of speaking stp
require a mac address per port.  So if you want a unique id I would
pick one of your mac addresses, which should be uniuqe.

I can understand low end devices where sophisticated things will never
happen fudging on the mac address requirements but by the time you care
I expect you have a mac address.

Eric
--
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