]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/net/vxlan.c
vxlan: call peernet2id() in fdb notification
[mirror_ubuntu-artful-kernel.git] / drivers / net / vxlan.c
index c0dda6fc09217bb31ab2f750e5d4d51abd6411cf..9735059dee9941526e7cb0b92986eee5db1af1b7 100644 (file)
@@ -27,7 +27,6 @@
 #include <net/net_namespace.h>
 #include <net/netns/generic.h>
 #include <net/vxlan.h>
-#include <net/protocol.h>
 
 #if IS_ENABLED(CONFIG_IPV6)
 #include <net/ip6_tunnel.h>
@@ -288,7 +287,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
 
        if (!net_eq(dev_net(vxlan->dev), vxlan->net) &&
            nla_put_s32(skb, NDA_LINK_NETNSID,
-                       peernet2id_alloc(dev_net(vxlan->dev), vxlan->net)))
+                       peernet2id(dev_net(vxlan->dev), vxlan->net)))
                goto nla_put_failure;
 
        if (send_eth && nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->eth_addr))
@@ -861,20 +860,20 @@ out:
 /* Dump forwarding table */
 static int vxlan_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
                          struct net_device *dev,
-                         struct net_device *filter_dev, int idx)
+                         struct net_device *filter_dev, int *idx)
 {
        struct vxlan_dev *vxlan = netdev_priv(dev);
        unsigned int h;
+       int err = 0;
 
        for (h = 0; h < FDB_HASH_SIZE; ++h) {
                struct vxlan_fdb *f;
-               int err;
 
                hlist_for_each_entry_rcu(f, &vxlan->fdb_head[h], hlist) {
                        struct vxlan_rdst *rd;
 
                        list_for_each_entry_rcu(rd, &f->remotes, list) {
-                               if (idx < cb->args[0])
+                               if (*idx < cb->args[2])
                                        goto skip;
 
                                err = vxlan_fdb_info(skb, vxlan, f,
@@ -882,17 +881,15 @@ static int vxlan_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
                                                     cb->nlh->nlmsg_seq,
                                                     RTM_NEWNEIGH,
                                                     NLM_F_MULTI, rd);
-                               if (err < 0) {
-                                       cb->args[1] = err;
+                               if (err < 0)
                                        goto out;
-                               }
 skip:
-                               ++idx;
+                               *idx += 1;
                        }
                }
        }
 out:
-       return idx;
+       return err;
 }
 
 /* Watch incoming packets to learn mapping between Ethernet address