107 lines
3.3 KiB
Diff
107 lines
3.3 KiB
Diff
|
From f36193036751f88c6208e7f0feda36116978a1af Mon Sep 17 00:00:00 2001
|
||
|
From: Hannes Reinecke <hare@suse.de>
|
||
|
Date: Thu, 30 Jun 2016 07:48:38 +0200
|
||
|
Subject: Fallback to default MAC address for FIP
|
||
|
|
||
|
FIP is a normal ethernet protocol, and doesn't rely on DCB to
|
||
|
be active or supported. So we should default to the NIC MAC
|
||
|
if no SAN MAC is present.
|
||
|
|
||
|
Signed-off-by: Hannes Reinecke <hare@suse.com>
|
||
|
---
|
||
|
fcoemon.c | 4 ++--
|
||
|
fipvlan.c | 2 +-
|
||
|
include/fip.h | 2 +-
|
||
|
lib/fip.c | 8 ++++----
|
||
|
4 files changed, 8 insertions(+), 8 deletions(-)
|
||
|
|
||
|
diff --git a/fcoemon.c b/fcoemon.c
|
||
|
index 32ba30c..1df3d82 100644
|
||
|
--- a/fcoemon.c
|
||
|
+++ b/fcoemon.c
|
||
|
@@ -1057,7 +1057,7 @@ static int fcm_vlan_disc_socket(struct fcoe_port *p)
|
||
|
int fd;
|
||
|
int origdev = 1;
|
||
|
|
||
|
- fd = fip_socket(p->ifindex, FIP_NONE);
|
||
|
+ fd = fip_socket(p->ifindex, p->mac, FIP_NONE);
|
||
|
if (fd < 0) {
|
||
|
FCM_LOG_ERR(errno, "socket error");
|
||
|
return fd;
|
||
|
@@ -1496,7 +1496,7 @@ static void init_fip_vn2vn_responder(struct fcoe_port *p)
|
||
|
if (p->fip_responder_socket >= 0)
|
||
|
return;
|
||
|
|
||
|
- s = fip_socket(p->ifindex, FIP_ALL_VN2VN);
|
||
|
+ s = fip_socket(p->ifindex, p->mac, FIP_ALL_VN2VN);
|
||
|
if (s < 0) {
|
||
|
FCM_LOG_ERR(errno, "%s: Failed to get fip socket\n", p->ifname);
|
||
|
return;
|
||
|
diff --git a/fipvlan.c b/fipvlan.c
|
||
|
index 4acf3d1..3662885 100644
|
||
|
--- a/fipvlan.c
|
||
|
+++ b/fipvlan.c
|
||
|
@@ -824,7 +824,7 @@ static int probe_fip_interface(struct iff *iff)
|
||
|
|
||
|
if (iff->ps < 0) {
|
||
|
iff->fip_ready = false;
|
||
|
- iff->ps = fip_socket(iff->ifindex, FIP_NONE);
|
||
|
+ iff->ps = fip_socket(iff->ifindex, iff->mac_addr, FIP_NONE);
|
||
|
if (iff->ps < 0) {
|
||
|
FIP_LOG_DBG("if %d not ready\n", iff->ifindex);
|
||
|
return 0;
|
||
|
diff --git a/include/fip.h b/include/fip.h
|
||
|
index 443d3c4..0b6385c 100644
|
||
|
--- a/include/fip.h
|
||
|
+++ b/include/fip.h
|
||
|
@@ -144,7 +144,7 @@ struct fip_tlv_vlan {
|
||
|
|
||
|
/* libutil / fip.c functionality */
|
||
|
|
||
|
-int fip_socket(int ifindex, enum fip_multi multi);
|
||
|
+int fip_socket(int ifindex, unsigned char *mac, enum fip_multi multi);
|
||
|
|
||
|
/* FIP message handler, passed into fip_recv */
|
||
|
typedef int fip_handler(struct fiphdr *fh, struct sockaddr_ll *sa, void *arg);
|
||
|
diff --git a/lib/fip.c b/lib/fip.c
|
||
|
index 6657b61..b7f687b 100644
|
||
|
--- a/lib/fip.c
|
||
|
+++ b/lib/fip.c
|
||
|
@@ -122,13 +122,13 @@ fip_socket_add_addr(int s, int ifindex, bool add, const __u8 *mac, bool multi)
|
||
|
* @ifindex: network interface index to send on
|
||
|
* @add: 1 to add 0 to del
|
||
|
*/
|
||
|
-static int fip_socket_sanmac(int s, int ifindex, int add)
|
||
|
+static int fip_socket_sanmac(int s, int ifindex, unsigned char *mac, int add)
|
||
|
{
|
||
|
unsigned char smac[ETHER_ADDR_LEN];
|
||
|
|
||
|
if (fip_get_sanmac(ifindex, smac)) {
|
||
|
FIP_LOG_DBG("%s: no sanmac, ifindex %d\n", __func__, ifindex);
|
||
|
- return -ENXIO;
|
||
|
+ memcpy(smac, mac, ETHER_ADDR_LEN);
|
||
|
}
|
||
|
|
||
|
return fip_socket_add_addr(s, ifindex, add, smac, false);
|
||
|
@@ -200,7 +200,7 @@ static void drain_socket(int s)
|
||
|
* @ifindex: ifindex of netdevice to bind to
|
||
|
* @multi: Indication of any multicast address to bind to
|
||
|
*/
|
||
|
-int fip_socket(int ifindex, enum fip_multi multi)
|
||
|
+int fip_socket(int ifindex, unsigned char *mac, enum fip_multi multi)
|
||
|
{
|
||
|
struct sockaddr_ll sa = {
|
||
|
.sll_family = AF_PACKET,
|
||
|
@@ -214,7 +214,7 @@ int fip_socket(int ifindex, enum fip_multi multi)
|
||
|
if (s < 0)
|
||
|
return s;
|
||
|
|
||
|
- rc = fip_socket_sanmac(s, ifindex, 1);
|
||
|
+ rc = fip_socket_sanmac(s, ifindex, mac, 1);
|
||
|
if (rc < 0) {
|
||
|
close(s);
|
||
|
return rc;
|
||
|
--
|
||
|
2.6.6
|
||
|
|