Blob Blame History Raw
From 885787d1eed7e0245afcd7ac39f9484202edb23c Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Thu, 22 Jan 2015 12:51:21 +0800
Subject: [PATCH V2 1/2] fipvlan: allow fcf lookup without MAC

This fixes a segfault where there's a lookup_fcf call with mac hard set to NULL

The MACs not really needed, as fipvlan doesn't use the FCF information at all -
it just picks a VLAN and then FCF selection happens from the kernel FIP code
once activated.
---
 fipvlan.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fipvlan.c b/fipvlan.c
index cc71412..211da53 100644
--- a/fipvlan.c
+++ b/fipvlan.c
@@ -168,9 +168,10 @@ static struct fcf *lookup_fcf(struct fcf_list_head *head, int ifindex,
 	struct fcf *fcf;
 
 	TAILQ_FOREACH(fcf, head, list_node)
-		if ((ifindex == fcf->ifindex) && (vlan == fcf->vlan) &&
-		    (memcmp(mac, fcf->mac_addr, ETHER_ADDR_LEN) == 0))
-			return fcf;
+		if ((ifindex == fcf->ifindex) && (vlan == fcf->vlan)) {
+			if ((!mac) || (memcmp(mac, fcf->mac_addr, ETHER_ADDR_LEN) == 0))
+				return fcf;
+		}
 	return NULL;
 }
 
-- 
2.1.0