]> git.hungrycats.org Git - linux/commitdiff
[NET]: Allow get/set of dev->weight via netlink.
authorEric Lemoine <eric.lemoine@gmail.com>
Thu, 2 Sep 2004 06:13:01 +0000 (23:13 -0700)
committerDavid S. Miller <davem@nuts.davemloft.net>
Thu, 2 Sep 2004 06:13:01 +0000 (23:13 -0700)
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/rtnetlink.h
net/core/rtnetlink.c

index f92c35c07faca0e8a067ee1172aed17e7ece6840..388b3d3feb43f7df6e0b946be971aece139d922a 100644 (file)
@@ -565,6 +565,8 @@ enum
 #define IFLA_TXQLEN IFLA_TXQLEN
        IFLA_MAP,
 #define IFLA_MAP IFLA_MAP
+       IFLA_WEIGHT,
+#define IFLA_WEIGHT IFLA_WEIGHT
        __IFLA_MAX
 };
 
index 4b50fabc39c579381e0e99f64aad4c107d41c9c7..24c9551c45b578c21d32479bb7c6fe569dd27128 100644 (file)
@@ -176,6 +176,11 @@ static int rtnetlink_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
                RTA_PUT(skb, IFLA_TXQLEN, sizeof(txqlen), &txqlen);
        }
 
+       if (1) {
+               u32 weight = dev->weight;
+               RTA_PUT(skb, IFLA_WEIGHT, sizeof(weight), &weight);
+       }
+
        if (1) {
                struct ifmap map = {
                        .mem_start   = dev->mem_start,
@@ -333,6 +338,13 @@ static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
                dev->tx_queue_len = *((u32 *) RTA_DATA(ida[IFLA_TXQLEN - 1]));
        }
 
+       if (ida[IFLA_WEIGHT - 1]) {
+               if (ida[IFLA_WEIGHT - 1]->rta_len != RTA_LENGTH(sizeof(u32)))
+                       goto out;
+
+               dev->weight = *((u32 *) RTA_DATA(ida[IFLA_WEIGHT - 1]));
+       }
+
        err = 0;
 
 out: