fcoemon tries to figure out sanmac, of an interface, before trying to start
VLAN discovery. This is done using a rtnl socket (with nl_groups set to
RTNLGRP_LINK) and RTM_GETDCB query to the kernel. Since nl_group is set to
RTNLGRP_LINK the receive handler also receives RTN_NEW_LINK multicast
notifcations and RTN_NEW_LINK notifications are wrongly considered as valid
repose to query. Since no valid sanmac is discovered, fcoemon fails to start
VLAN discovery on this interface.

This is evident when running fcoemon on XenServer, as the interfaces resets
when they are added to the bridge.

Ideally sanmac discovery doesn't require rtnl socket to be opened with
RTNLGRP_LINK and this would avoid receiving multicast notifications.

Signed-off-by: Anoob Soman <[email protected]>
---
 fipvlan.c           | 2 +-
 include/rtnetlink.h | 2 +-
 lib/rtnetlink.c     | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fipvlan.c b/fipvlan.c
index 288b011..2059276 100644
--- a/fipvlan.c
+++ b/fipvlan.c
@@ -979,7 +979,7 @@ int main(int argc, char **argv)
                exit(1);
        }
 
-       ns = rtnl_socket();
+       ns = rtnl_socket(RTMGRP_LINK);
        if (ns < 0) {
                rc = ns;
                goto ns_err;
diff --git a/include/rtnetlink.h b/include/rtnetlink.h
index b4fd1c8..dfe781e 100644
--- a/include/rtnetlink.h
+++ b/include/rtnetlink.h
@@ -20,7 +20,7 @@
 #ifndef _RTNETLINK_
 #define _RTNETLINK_
 
-int rtnl_socket(void);
+int rtnl_socket(unsigned int group);
 typedef int rtnl_handler(struct nlmsghdr *nh, void *arg);
 int rtnl_recv(int s, rtnl_handler *fn, void *arg);
 ssize_t send_getlink_dump(int s);
diff --git a/lib/rtnetlink.c b/lib/rtnetlink.c
index 08552bf..3b84137 100644
--- a/lib/rtnetlink.c
+++ b/lib/rtnetlink.c
@@ -52,11 +52,11 @@
 /**
  * rtnl_socket - create and bind a routing netlink socket
  */
-int rtnl_socket(void)
+int rtnl_socket(unsigned int groups)
 {
        struct sockaddr_nl sa = {
                .nl_family = AF_NETLINK,
-               .nl_groups = RTMGRP_LINK,
+               .nl_groups = groups,
        };
        int s;
        int rc;
@@ -507,7 +507,7 @@ int rtnl_get_sanmac(const char *ifname, unsigned char *addr)
        add_rtattr(nh, DCB_ATTR_IFNAME, (void *)ifname, strlen(ifname) + 1);
        add_rtattr(nh, DCB_ATTR_PERM_HWADDR, NULL, 0);
 
-       s = rtnl_socket();
+       s = rtnl_socket(0);
        if (s < 0) {
                RTNL_LOG_ERRNO("failed to create the socket");
                return s;
-- 
1.9.1

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

Reply via email to