]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/core/rtnetlink.c
V4L/DVB (8782): v4l2-dev: add video_device_release_empty
[linux-2.6-omap-h63xx.git] / net / core / rtnetlink.c
index a9a77216310e028c2dfe1d125d2706c21c51630d..3630131fa1fa37e3245301e719db583d0d63db59 100644 (file)
@@ -73,7 +73,7 @@ void __rtnl_unlock(void)
 
 void rtnl_unlock(void)
 {
-       mutex_unlock(&rtnl_mutex);
+       /* This fellow will unlock it for us. */
        netdev_run_todo();
 }
 
@@ -586,6 +586,7 @@ static inline size_t if_nlmsg_size(const struct net_device *dev)
 {
        return NLMSG_ALIGN(sizeof(struct ifinfomsg))
               + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */
+              + nla_total_size(IFALIASZ) /* IFLA_IFALIAS */
               + nla_total_size(IFNAMSIZ) /* IFLA_QDISC */
               + nla_total_size(sizeof(struct rtnl_link_ifmap))
               + nla_total_size(sizeof(struct rtnl_link_stats))
@@ -605,8 +606,11 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
                            int type, u32 pid, u32 seq, u32 change,
                            unsigned int flags)
 {
+       struct netdev_queue *txq;
        struct ifinfomsg *ifm;
        struct nlmsghdr *nlh;
+       struct net_device_stats *stats;
+       struct nlattr *attr;
 
        nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags);
        if (nlh == NULL)
@@ -633,8 +637,12 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
        if (dev->master)
                NLA_PUT_U32(skb, IFLA_MASTER, dev->master->ifindex);
 
-       if (dev->qdisc_sleeping)
-               NLA_PUT_STRING(skb, IFLA_QDISC, dev->qdisc_sleeping->ops->id);
+       txq = netdev_get_tx_queue(dev, 0);
+       if (txq->qdisc_sleeping)
+               NLA_PUT_STRING(skb, IFLA_QDISC, txq->qdisc_sleeping->ops->id);
+
+       if (dev->ifalias)
+               NLA_PUT_STRING(skb, IFLA_IFALIAS, dev->ifalias);
 
        if (1) {
                struct rtnl_link_ifmap map = {
@@ -653,19 +661,13 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
                NLA_PUT(skb, IFLA_BROADCAST, dev->addr_len, dev->broadcast);
        }
 
-       if (dev->get_stats) {
-               struct net_device_stats *stats = dev->get_stats(dev);
-               if (stats) {
-                       struct nlattr *attr;
-
-                       attr = nla_reserve(skb, IFLA_STATS,
-                                          sizeof(struct rtnl_link_stats));
-                       if (attr == NULL)
-                               goto nla_put_failure;
+       attr = nla_reserve(skb, IFLA_STATS,
+                       sizeof(struct rtnl_link_stats));
+       if (attr == NULL)
+               goto nla_put_failure;
 
-                       copy_rtnl_link_stats(nla_data(attr), stats);
-               }
-       }
+       stats = dev->get_stats(dev);
+       copy_rtnl_link_stats(nla_data(attr), stats);
 
        if (dev->rtnl_link_ops) {
                if (rtnl_link_fill(skb, dev) < 0)
@@ -715,6 +717,7 @@ const struct nla_policy ifla_policy[IFLA_MAX+1] = {
        [IFLA_LINKMODE]         = { .type = NLA_U8 },
        [IFLA_LINKINFO]         = { .type = NLA_NESTED },
        [IFLA_NET_NS_PID]       = { .type = NLA_U32 },
+       [IFLA_IFALIAS]          = { .type = NLA_STRING, .len = IFALIASZ-1 },
 };
 
 static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
@@ -855,6 +858,14 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
                modified = 1;
        }
 
+       if (tb[IFLA_IFALIAS]) {
+               err = dev_set_alias(dev, nla_data(tb[IFLA_IFALIAS]),
+                                   nla_len(tb[IFLA_IFALIAS]));
+               if (err < 0)
+                       goto errout;
+               modified = 1;
+       }
+
        if (tb[IFLA_BROADCAST]) {
                nla_memcpy(dev->broadcast, tb[IFLA_BROADCAST], dev->addr_len);
                send_addr_notify = 1;