If the link state is changing while fipvlan is running, it could result in a
packet socket being added to the poll list more than once.  When that happened,
recvmsg would be called multiple times for a single FIP response.

Previously this caused a hang, which the change to MSG_DONTWAIT worked around,
but an error message is still printed every time the condition occurs.  This
change fixes the poll list managment to correctly avoid the error.

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

 fipvlan.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/fipvlan.c b/fipvlan.c
index eddffbb..b400427 100644
--- a/fipvlan.c
+++ b/fipvlan.c
@@ -80,6 +80,11 @@ static int pfd_len = 0;
 void pfd_add(int fd)
 {
        struct pollfd *npfd;
+       int i;
+
+       for (i = 0; i < pfd_len; i++)
+               if (pfd[i].fd == fd)
+                       return;
 
        npfd = realloc(pfd, (pfd_len + 1) * sizeof(struct pollfd));
        if (!npfd) {
@@ -319,6 +324,8 @@ void rtnl_recv_newlink(struct nlmsghdr *nh)
                iff->running = (ifm->ifi_flags & IFF_RUNNING) == IFF_RUNNING;
                if (iff->running)
                        pfd_add(iff->ps);
+               else
+                       pfd_remove(iff->ps);
                return;
        }
 

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

Reply via email to