netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: roopa <roopa@cumulusnetworks.com>
To: Scott Feldman <sfeldma@gmail.com>
Cc: Netdev <netdev@vger.kernel.org>,
	shemminger@vyatta.com,
	"vyasevic@redhat.com" <vyasevic@redhat.com>,
	Wilson Kok <wkok@cumulusnetworks.com>
Subject: Re: [PATCH 1/6] bridge: add support to parse multiple vlan info attributes in IFLA_AF_SPEC
Date: Mon, 29 Dec 2014 14:10:31 -0800	[thread overview]
Message-ID: <54A1D157.1000002@cumulusnetworks.com> (raw)
In-Reply-To: <CAE4R7bAyWy83S-K_XtiRNJO2rZXtVpijPxqj_oq_sZqPKW-h-Q@mail.gmail.com>

On 12/29/14, 1:40 PM, Scott Feldman wrote:
> On Mon, Dec 29, 2014 at 1:05 PM,  <roopa@cumulusnetworks.com> wrote:
>> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>>
>> This patch changes bridge IFLA_AF_SPEC netlink attribute parser to
>> look for more than one IFLA_BRIDGE_VLAN_INFO attribute. This allows
>> userspace to pack more than one vlan in the setlink msg.
>>
>> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
>> ---
>>   net/bridge/br_netlink.c |   18 +++++++++---------
>>   1 file changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
>> index 9f5eb55..75971b1 100644
>> --- a/net/bridge/br_netlink.c
>> +++ b/net/bridge/br_netlink.c
>> @@ -230,18 +230,18 @@ static int br_afspec(struct net_bridge *br,
>>                       struct nlattr *af_spec,
>>                       int cmd)
>>   {
>> -       struct nlattr *tb[IFLA_BRIDGE_MAX+1];
>> +       struct bridge_vlan_info *vinfo;
>>          int err = 0;
>> +       struct nlattr *attr;
>> +       int err = 0;
>> +       int rem;
>> +       u16 vid;
>>
>> -       err = nla_parse_nested(tb, IFLA_BRIDGE_MAX, af_spec, ifla_br_policy);
> Removing this call orphans ifla_br_policy...should ifla_br_policy be removed?

good question. Its a good place to see the type. In-fact userspace 
programs also copy the same policy to parse netlink attributes. hmmm..
I would like to keep it if it does not throw a warning.
>
>> -       if (err)
>> -               return err;
>> -
>> -       if (tb[IFLA_BRIDGE_VLAN_INFO]) {
>> -               struct bridge_vlan_info *vinfo;
>> -
>> -               vinfo = nla_data(tb[IFLA_BRIDGE_VLAN_INFO]);
>> +       nla_for_each_nested(attr, af_spec, rem) {
>> +               if (nla_type(attr) != IFLA_BRIDGE_VLAN_INFO)
>> +                       continue;
> Need to validate size of attr is sizeof(struct bridge_vlan_info).

ack, will fix.
>
>> +               vinfo = nla_data(attr);
>>                  if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK)
>>                          return -EINVAL;
>>
>> --
>> 1.7.10.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-12-29 22:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-29 21:05 [PATCH 1/6] bridge: add support to parse multiple vlan info attributes in IFLA_AF_SPEC roopa
2014-12-29 21:40 ` Scott Feldman
2014-12-29 22:10   ` roopa [this message]
2014-12-29 23:47     ` Scott Feldman
2014-12-30  0:07       ` Scott Feldman
2014-12-30  0:26         ` Scott Feldman
2014-12-30  5:25           ` roopa
2014-12-30  5:31             ` Scott Feldman
2014-12-30  6:01               ` roopa

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=54A1D157.1000002@cumulusnetworks.com \
    --to=roopa@cumulusnetworks.com \
    --cc=netdev@vger.kernel.org \
    --cc=sfeldma@gmail.com \
    --cc=shemminger@vyatta.com \
    --cc=vyasevic@redhat.com \
    --cc=wkok@cumulusnetworks.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).