linma / rpms / iproute

Forked from rpms/iproute 4 years ago
Clone

Blame SOURCES/0220-ip-check-for-missing-dev-arg-when-doing-VF-rate.patch

049c96
From e9c1b5f32fd39ee8a29035fd49e4aea8daa59cf3 Mon Sep 17 00:00:00 2001
049c96
From: Jakub Sitnicki <jkbs@redhat.com>
049c96
Date: Wed, 27 Jul 2016 15:56:15 +0200
049c96
Subject: [PATCH] ip: check for missing dev arg when doing VF rate
049c96
049c96
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1340914
049c96
Upstream Status: iproute2.git commit 9a02651
049c96
Conflicts:
049c96
* context in iplink_parse() because we already have
049c96
  ccdcbf35f120 ("iplink: add support of IFLA_LINK_NETNSID attribute")
049c96
049c96
commit 9a02651a87d0fd56e2e7eedd63921a050a42b3ec
049c96
Author: Stephen Hemminger <stephen@networkplumber.org>
049c96
Date:   Mon Jul 14 12:08:05 2014 -0700
049c96
049c96
    ip: check for missing dev arg when doing VF rate
049c96
049c96
    New VF rate code was not handling case where device not specified.
049c96
    Caught by GCC warning about uninitialized variable.
049c96
---
049c96
 ip/iplink.c | 8 +++++++-
049c96
 1 file changed, 7 insertions(+), 1 deletion(-)
049c96
049c96
diff --git a/ip/iplink.c b/ip/iplink.c
049c96
index bce5ba0..7ee015c 100644
049c96
--- a/ip/iplink.c
049c96
+++ b/ip/iplink.c
049c96
@@ -381,6 +381,7 @@ static int iplink_parse_vf(int vf, int *argcp, char ***argvp,
049c96
 
049c96
 	if (new_rate_api) {
049c96
 		int tmin, tmax;
049c96
+
049c96
 		if (tivt.min_tx_rate == -1 || tivt.max_tx_rate == -1) {
049c96
 			ipaddr_get_vf_rate(tivt.vf, &tmin, &tmax, dev_index);
049c96
 			if (tivt.min_tx_rate == -1)
049c96
@@ -413,7 +414,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
049c96
 	int vf = -1;
049c96
 	int numtxqueues = -1;
049c96
 	int numrxqueues = -1;
049c96
-	int dev_index;
049c96
+	int dev_index = 0;
049c96
 	int link_netnsid = -1;
049c96
 
049c96
 	*group = -1;
049c96
@@ -524,6 +525,9 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
049c96
 			}
049c96
 			vflist = addattr_nest(&req->n, sizeof(*req),
049c96
 					      IFLA_VFINFO_LIST);
049c96
+			if (dev_index == 0)
049c96
+				missarg("dev");
049c96
+
049c96
 			len = iplink_parse_vf(vf, &argc, &argv, req, dev_index);
049c96
 			if (len < 0)
049c96
 				return -1;
049c96
@@ -627,6 +631,8 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
049c96
 				duparg2("dev", *argv);
049c96
 			*dev = *argv;
049c96
 			dev_index = ll_name_to_index(*dev);
049c96
+			if (dev_index == 0)
049c96
+				invarg("Unknown device", *argv);
049c96
 		}
049c96
 		argc--; argv++;
049c96
 	}
049c96
-- 
049c96
1.8.3.1
049c96