[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF1J0HM2vuGfVg-p8pARzOR1bz+X6bs_yMHXPBM45k4Ty9OcUA@mail.gmail.com>
Date: Mon, 24 Jun 2013 09:58:42 +0300
From: Mike Rapoport <mike.rapoport@...ellosystems.com>
To: Cong Wang <xiyou.wangcong@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next v4 2/2] vxlan: allow specifying multiple default destinations
On Mon, Jun 24, 2013 at 9:48 AM, Cong Wang <xiyou.wangcong@...il.com> wrote:
> On Sun, 23 Jun 2013 at 16:22 GMT, Mike Rapoport <mike.rapoport@...ellosystems.com> wrote:
>> static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[])
>> {
>> + int err;
>> +
>> if (tb[IFLA_ADDRESS]) {
>> if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN) {
>> pr_debug("invalid link address (not ethernet)\n");
>> @@ -1460,6 +1599,10 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[])
>> }
>> }
>>
>> + err = vxlan_validate_remotes(data[IFLA_VXLAN_REMOTES]);
>> + if (err)
>> + return err;
>> +
>> return 0;
>> }
>
>
> Seems you can simply return vxlan_validate_remotes(...); here.
Yes, but I believe it's better looking this way.
>> +static int vxlan_fill_remotes_info(struct sk_buff *skb,
>> + const struct vxlan_dev *vxlan)
>> +{
>> + struct vxlan_rdst *rd;
>> + struct nlattr *nest, *rdst_nest;
>> + __be32 ip;
>> + int i = 1;
>> +
>> + if (!vxlan->remotes_cnt)
>> + return 0;
>> +
>> + nest = nla_nest_start(skb, IFLA_VXLAN_REMOTES);
>> + if (nest == NULL)
>> + goto nla_put_failure;
>> +
>> + list_for_each_entry_rcu(rd, &vxlan->remotes, list) {
>
>
> Need RCU read lock here?
Why? The remotes list can be modified only via netlink with rtnl_lock held...
>
>> + ip = rd->remote_ip;
>> +
>> + if (ip == vxlan->default_dst.remote_ip)
>> + continue;
>> +
>> + rdst_nest = nla_nest_start(skb, i);
>> + if (rdst_nest == NULL)
>> + goto nla_put_failure;
>> +
>> + if (nla_put_be32(skb, IFLA_VXLAN_REMOTE_ADDR, ip))
>> + goto nla_put_failure;
>> +
>> + nla_nest_end(skb, rdst_nest);
>> + i++;
>> + }
>> +
>> + nla_nest_end(skb, nest);
>> +
>> + return 0;
>> +
>> +nla_put_failure:
>> + return -EMSGSIZE;
>> +}
>> +
>
>
> Thanks!
>
> --
> 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
--
Sincerely yours,
Mike.
--
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