From: Thomas Graf <tgraf@suug.ch>
To: Mike Rapoport <mike.rapoport@ravellosystems.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next v3 2/2] vxlan: allow specifying multiple default destinations
Date: Thu, 30 May 2013 12:09:48 +0100 [thread overview]
Message-ID: <20130530110948.GA10532@casper.infradead.org> (raw)
In-Reply-To: <1369821617-29098-3-git-send-email-mike.rapoport@ravellosystems.com>
Looks much better, thanks for taking the feedback. Some additional
feedback inlined:
On 05/29/13 at 01:00pm, Mike Rapoport wrote:
> +static int vxlan_remote_add(struct vxlan_dev *vxlan, struct nlattr *attr)
> +{
> + struct nlattr *i;
> + __be32 ip = htonl(INADDR_NONE);
> + __be16 port;
> + u32 ifindex, vni;
> + int rem, err = 0;
> +
> + port = vxlan->dst_port;
> + vni = vxlan->default_dst.remote_vni;
> + ifindex = vxlan->default_dst.remote_ifindex;
> +
> + nla_for_each_nested(i, attr, rem) {
> + switch (nla_type(i)) {
> + case IFLA_VXLAN_REMOTE_ADDR:
> + ip = nla_get_be32(i);
> + break;
> + case IFLA_VXLAN_REMOTE_PORT:
> + port = nla_get_be16(i);
> + break;
> + case IFLA_VXLAN_REMOTE_VNI:
> + vni = nla_get_u32(i);
> + break;
> + case IFLA_VXLAN_REMOTE_IFINDEX:
> + ifindex = nla_get_u32(i);
> + break;
> + default:
> + err = -EINVAL;
> + break;
> + };
> +
> + if (err)
> + return err;
> + }
The above construct is not forward compatible. If we want to add
more attributes in the future any older kernel will break with
EINVAL. We typically support partial requests in older kernels.
> @@ -1380,6 +1478,13 @@ static void vxlan_setup(struct net_device *dev)
> INIT_HLIST_HEAD(&vxlan->fdb_head[h]);
> }
>
> +static const struct nla_policy vxlan_remotes_policy[IFLA_VXLAN_REMOTE_MAX + 1] = {
> + [IFLA_VXLAN_REMOTE_ADDR] = { .len = FIELD_SIZEOF(struct iphdr, daddr) },
I would just make this a u32 for now.
> @@ -1512,6 +1646,46 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port)
> return vs;
> }
>
> +static int vxlan_remotes_update(struct vxlan_dev *vxlan, struct nlattr *attr)
> +{
> + struct nlattr *i;
> + int rem, err = 0;
> +
> + nla_for_each_nested(i, attr, rem) {
> + switch (nla_type(i)) {
> + case IFLA_VXLAN_REMOTE_NEW:
> + err = vxlan_remote_add(vxlan, i);
> + break;
> + case IFLA_VXLAN_REMOTE_DEL:
> + err = vxlan_remote_delete(vxlan, i);
> + break;
> + default:
> + err = -EINVAL;
> + break;
I would return EOPNOTSUPP here
> +static int vxlan_fill_remotes_info(struct sk_buff *skb,
> + const struct vxlan_dev *vxlan)
> +{
> + struct vxlan_rdst *rdst;
> + struct nlattr *nest, *rdst_nest;
> + __be32 ip;
> + int i;
> +
> + if (vxlan->remote_cnt) {
> + nest = nla_nest_start(skb, IFLA_VXLAN_REMOTES);
> + if (nest == NULL)
> + goto nla_put_failure;
> +
> + for (rdst = vxlan->default_dst.remote_next, i = 0; rdst;
> + rdst = rdst->remote_next, i++) {
> + ip = rdst->remote_ip;
> +
> + rdst_nest = nla_nest_start(skb, i);
Attribute type '0' is reserved, please don't use it. Start with '1'.
> +enum {
> + IFLA_VXLAN_REMOTE_NEW,
> + IFLA_VXLAN_REMOTE_DEL,
> +};
Same here, attribute type '0' is reserved.
next prev parent reply other threads:[~2013-05-30 11:09 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-29 10:00 [PATCH net-next v3 0/2] vxlan: allow specifying multiple default destinations Mike Rapoport
2013-05-29 10:00 ` [PATCH net-next v3 1/2] vxlan: introduce vxlan_rdst_append Mike Rapoport
2013-05-29 22:56 ` Stephen Hemminger
2013-05-30 8:42 ` Mike Rapoport
2013-05-29 10:00 ` [PATCH net-next v3 2/2] vxlan: allow specifying multiple default destinations Mike Rapoport
2013-05-30 11:09 ` Thomas Graf [this message]
2013-05-30 11:16 ` Mike Rapoport
2013-05-30 11:37 ` Thomas Graf
2013-05-31 16:17 ` Stephen Hemminger
2013-06-02 10:29 ` Mike Rapoport
2013-06-03 15:57 ` Stephen Hemminger
2013-06-03 19:47 ` Mike Rapoport
2013-06-03 18:26 ` [RFC] vxlan: convert remote list to list_rcu Stephen Hemminger
2013-06-03 20:18 ` David Stevens
2013-06-03 20:45 ` Stephen Hemminger
2013-06-03 21:46 ` David Stevens
2013-06-04 9:18 ` Mike Rapoport
2013-06-04 12:48 ` David Stevens
2013-06-04 17:20 ` Mike Rapoport
2013-06-04 19:02 ` David Stevens
2013-06-05 12:53 ` Mike Rapoport
2013-06-04 9:10 ` Mike Rapoport
2013-06-04 16:00 ` Stephen Hemminger
2013-06-04 16:29 ` David Stevens
2013-06-04 17:22 ` Mike Rapoport
2013-05-29 10:00 ` [PATCH iproute2] vxlan: allow specifying multiple default destinations Mike Rapoport
2013-05-29 10:13 ` Cong Wang
2013-05-29 10:52 ` Mike Rapoport
2013-05-29 22:56 ` Stephen Hemminger
2013-05-30 8:42 ` Mike Rapoport
2013-05-30 11:44 ` Thomas Graf
2013-05-30 12:46 ` Mike Rapoport
2013-05-30 15:57 ` Thomas Graf
2013-06-02 7:09 ` Mike Rapoport
2013-06-05 4:30 ` Stephen Hemminger
2013-06-05 12:58 ` Mike Rapoport
2013-05-30 17:07 ` Stephen Hemminger
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=20130530110948.GA10532@casper.infradead.org \
--to=tgraf@suug.ch \
--cc=mike.rapoport@ravellosystems.com \
--cc=netdev@vger.kernel.org \
/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).