From: Jarod Wilson <jarod@redhat.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Jiri Pirko <jiri@resnulli.us>,
Linux Kernel Network Developers <netdev@vger.kernel.org>,
Andrey Konovalov <andreyknvl@google.com>
Subject: Re: [Patch net 3/3] team: use a larger struct for mac address
Date: Wed, 26 Apr 2017 13:59:00 -0400 [thread overview]
Message-ID: <af281f03-e6a9-7197-c38c-d5f63abc3410@redhat.com> (raw)
In-Reply-To: <CAM_iQpUGSy7My+hLXhsreq-8wPEdAKzNkQRzu-aiP5nkk+wSdw@mail.gmail.com>
On 2017-04-26 1:28 PM, Cong Wang wrote:
> On Wed, Apr 26, 2017 at 9:46 AM, Jarod Wilson <jarod@redhat.com> wrote:
>> On 2017-04-26 12:11 PM, Cong Wang wrote:
>>>
>>> On Wed, Apr 26, 2017 at 8:55 AM, Jarod Wilson <jarod@redhat.com> wrote:
>>>>
>>>>
>>>> We already have struct sockaddr_storage that could be used throughout
>>>> this
>>>> set as well. We just converted a few pieces of the bonding driver over to
>>>> using it for better support of ipoib bonds, via commit
>>>> faeeb317a5615076dff1ff44b51e862e6064dbd0. Might be better to just use
>>>> that
>>>> in both bonding and team, rather than having different per-driver
>>>> structs,
>>>> or Yet Another Address Storage implementation.
>>>
>>>
>>> Technically, struct sockaddr_storage is not enough either, given the
>>> max is MAX_ADDR_LEN. This is why I gave up on sockaddr_storage.
>>
>>
>> Wait, what? Am I missing something? MAX_ADDR_LEN is 32, and sockaddr_storage
>> is a #define for __kernel_sockaddr_storage, which has it's __data member
>> defined as being of size 128 - sizeof(unsigned short).
>
> My bad, I thought it is same with sizeof(in6addr) without looking into it.
> The question is, why do we waste 126 - 32 = 94 bytes on stack to just
> use struct sockaddr_storage?
That's a fair point.
> I totally understand we want a unified struct, but we already redefine
> it in multiple places in tree...
Something unified and centralized with a data storage of MAX_ADDR_LEN
does seem reasonable to get both consistency and minimized waste, and I
could certainly do a follow-up patch for the bonding driver to switch
the bits now using sockaddr_storage over to whatever new struct gets added.
--
Jarod Wilson
jarod@redhat.com
next prev parent reply other threads:[~2017-04-26 17:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-26 5:03 [Patch net 0/3] net: fix a stack out-of-bound access Cong Wang
2017-04-26 5:03 ` [Patch net 1/3] net: check mac address length for dev_set_mac_address() Cong Wang
2017-04-26 5:03 ` [Patch net 2/3] bonding: use a larger struct for mac address Cong Wang
2017-04-26 5:03 ` [Patch net 3/3] team: " Cong Wang
2017-04-26 5:40 ` Jiri Pirko
2017-04-26 15:55 ` Jarod Wilson
2017-04-26 16:11 ` Cong Wang
2017-04-26 16:46 ` Jarod Wilson
2017-04-26 17:28 ` Cong Wang
2017-04-26 17:59 ` Jarod Wilson [this message]
2017-04-26 16:10 ` Cong Wang
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=af281f03-e6a9-7197-c38c-d5f63abc3410@redhat.com \
--to=jarod@redhat.com \
--cc=andreyknvl@google.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.com \
/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).