bridge: fdb dumping takes a filter device
[deliverable/linux.git] / net / core / rtnetlink.c
index 1063996f8317fb95fea964e095ae2e372ceb74be..90a906e7ac264caadc5cd67d67d36746d7808099 100644 (file)
@@ -299,7 +299,12 @@ int __rtnl_link_register(struct rtnl_link_ops *ops)
        if (rtnl_link_ops_get(ops->kind))
                return -EEXIST;
 
-       if (!ops->dellink)
+       /* The check for setup is here because if ops
+        * does not have that filled up, it is not possible
+        * to use the ops for creating device. So do not
+        * fill up dellink as well. That disables rtnl_dellink.
+        */
+       if (ops->setup && !ops->dellink)
                ops->dellink = unregister_netdevice_queue;
 
        list_add_tail(&ops->list, &link_ops);
@@ -1777,7 +1782,7 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh)
                return -ENODEV;
 
        ops = dev->rtnl_link_ops;
-       if (!ops)
+       if (!ops || !ops->dellink)
                return -EOPNOTSUPP;
 
        ops->dellink(dev, &list_kill);
@@ -2038,6 +2043,9 @@ replay:
                        return -EOPNOTSUPP;
                }
 
+               if (!ops->setup)
+                       return -EOPNOTSUPP;
+
                if (!ifname[0])
                        snprintf(ifname, IFNAMSIZ, "%s%%d", ops->kind);
 
@@ -2509,6 +2517,7 @@ skip:
 int ndo_dflt_fdb_dump(struct sk_buff *skb,
                      struct netlink_callback *cb,
                      struct net_device *dev,
+                     struct net_device *filter_dev,
                      int idx)
 {
        int err;
@@ -2539,13 +2548,15 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
                        br_dev = netdev_master_upper_dev_get(dev);
                        ops = br_dev->netdev_ops;
                        if (ops->ndo_fdb_dump)
-                               idx = ops->ndo_fdb_dump(skb, cb, dev, idx);
+                               idx = ops->ndo_fdb_dump(skb, cb, dev, NULL,
+                                                       idx);
                }
 
                if (dev->netdev_ops->ndo_fdb_dump)
-                       idx = dev->netdev_ops->ndo_fdb_dump(skb, cb, dev, idx);
+                       idx = dev->netdev_ops->ndo_fdb_dump(skb, cb, dev, NULL,
+                                                           idx);
                else
-                       idx = ndo_dflt_fdb_dump(skb, cb, dev, idx);
+                       idx = ndo_dflt_fdb_dump(skb, cb, dev, NULL, idx);
        }
        rcu_read_unlock();
 
This page took 0.026585 seconds and 5 git commands to generate.