naccyde / rpms / iproute

Forked from rpms/iproute 5 months ago
Clone

Blame SOURCES/0057-iplink_bond-fix-parameter-value-matching.patch

049c96
From 16c4a3d6c4892e6b24ccb0f63cec449823b82ef2 Mon Sep 17 00:00:00 2001
049c96
From: Phil Sutter <psutter@redhat.com>
049c96
Date: Tue, 23 Feb 2016 18:26:25 +0100
049c96
Subject: [PATCH] iplink_bond: fix parameter value matching
049c96
MIME-Version: 1.0
049c96
Content-Type: text/plain; charset=UTF-8
049c96
Content-Transfer-Encoding: 8bit
049c96
049c96
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1269528
049c96
Upstream Status: iproute2.git commit f7a45e0955514
049c96
049c96
commit f7a45e09555145378bdcdb5d074472ae716803ca
049c96
Author: Michal Kubeček <mkubecek@suse.cz>
049c96
Date:   Thu Feb 13 17:31:59 2014 +0100
049c96
049c96
    iplink_bond: fix parameter value matching
049c96
049c96
    Lookup function get_index() compares argument with table entries
049c96
    only up to the length of the table entry so that if an entry
049c96
    with lower index is a substring of a later one, earlier entry is
049c96
    used even if the argument is equal to the other. For example,
049c96
049c96
      ip link set bond0 type bond xmit_hash_policy layer2+3
049c96
049c96
    sets xmit_hash_policy to 0 (layer2) as this is found before
049c96
    "layer2+3" can be checked.
049c96
049c96
    Use strcmp() to compare whole strings instead.
049c96
049c96
    v2: look for an exact match only
049c96
049c96
    Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
049c96
---
049c96
 ip/iplink_bond.c | 2 +-
049c96
 1 file changed, 1 insertion(+), 1 deletion(-)
049c96
049c96
diff --git a/ip/iplink_bond.c b/ip/iplink_bond.c
049c96
index f22151e..7a950df 100644
049c96
--- a/ip/iplink_bond.c
049c96
+++ b/ip/iplink_bond.c
049c96
@@ -106,7 +106,7 @@ static int get_index(const char **tbl, char *name)
049c96
 				return i;
049c96
 
049c96
 	for (i = 0; tbl[i]; i++)
049c96
-		if (strncmp(tbl[i], name, strlen(tbl[i])) == 0)
049c96
+		if (strcmp(tbl[i], name) == 0)
049c96
 			return i;
049c96
 
049c96
 	return -1;
049c96
-- 
049c96
1.8.3.1
049c96