VLAN discovery would fail if the Ethernet interface was also part of a
bond.  The VLAN discovery code in both fcoemon and fipvlan needed to set
the PACKET_ORIGDEV socket option.  Also, skip over bonding interfaces in
fipvlan so that it doesn't try and run over a bond when using the auto
setting.

Signed-off-by: Chris Leech <[email protected]>
---

 fcoemon.c |    2 ++
 fipvlan.c |   11 ++++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/fcoemon.c b/fcoemon.c
index 8709285..196a4de 100644
--- a/fcoemon.c
+++ b/fcoemon.c
@@ -566,12 +566,14 @@ static void fcm_fip_recv(void *arg)
 static int fcm_vlan_disc_init(void)
 {
        int fd;
+       int origdev = 1;
 
        fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_FIP));
        if (fd < 0) {
                FCM_LOG_ERR(errno, "socket error");
                return fd;
        }
+       setsockopt(fd, SOL_PACKET, PACKET_ORIGDEV, &origdev, sizeof(origdev));
        fcm_fip_socket = fd;
        sa_select_add_fd(fd, fcm_fip_recv, NULL, NULL, NULL);
        return 0;
diff --git a/fipvlan.c b/fipvlan.c
index 1f5556b..66bfacd 100644
--- a/fipvlan.c
+++ b/fipvlan.c
@@ -34,10 +34,10 @@
 #include <net/if.h>
 #include <net/if_arp.h>
 #include <net/ethernet.h>
-#include <netpacket/packet.h>
 #include <arpa/inet.h>
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
+#include <linux/if_packet.h>
 
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -302,6 +302,7 @@ void rtnl_recv_newlink(struct nlmsghdr *nh)
 
        if (ifla[IFLA_LINKINFO]) {
                parse_linkinfo(linkinfo, ifla[IFLA_LINKINFO]);
+               /* Track VLAN devices separately */
                if (linkinfo[IFLA_INFO_KIND] &&
                    !strcmp(RTA_DATA(linkinfo[IFLA_INFO_KIND]), "vlan")) {
                        iff->is_vlan = true;
@@ -315,6 +316,12 @@ void rtnl_recv_newlink(struct nlmsghdr *nh)
                        TAILQ_INSERT_TAIL(&real_dev->vlans, iff, list_node);
                        return;
                }
+               /* ignore bonding interfaces */
+               if (linkinfo[IFLA_INFO_KIND] &&
+                   !strcmp(RTA_DATA(linkinfo[IFLA_INFO_KIND]), "bond")) {
+                       free(iff);
+                       return;
+               }
        }
        TAILQ_INSERT_TAIL(&interfaces, iff, list_node);
 }
@@ -589,6 +596,7 @@ int main(int argc, char **argv)
 {
        int ps, ns;
        int rc = 0;
+       int origdev = 1;
 
        exe = strrchr(argv[0], '/');
        if (exe)
@@ -606,6 +614,7 @@ int main(int argc, char **argv)
                rc = ps;
                goto ps_err;
        }
+       setsockopt(ps, SOL_PACKET, PACKET_ORIGDEV, &origdev, sizeof(origdev));
        ns = rtnl_socket();
        if (ns < 0) {
                rc = ns;

_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to