tipc: Fix bug in connection setup via native API
authorAllan Stephens <allan.stephens@windriver.com>
Thu, 5 Jun 2008 00:28:21 +0000 (17:28 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Jun 2008 00:28:21 +0000 (17:28 -0700)
This patch fixes a bug that prevented TIPC from receiving a
connection setup request message on a native TIPC port.
The revised connection setup logic ensures that validation
of the source of a connection-based message is skipped if
the port is not yet connected to a peer.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/port.c

index 2c64ad88e3cfcb483f2c752900bad7ea0c2cfe17..0bd3e6192c43f12420d944018d610109bb2659b8 100644 (file)
@@ -842,13 +842,10 @@ static void port_dispatcher_sigh(void *dummy)
 
                                tipc_port_unlock(p_ptr);
                                if (unlikely(!connected)) {
-                                       if (unlikely(published))
+                                       if (tipc_connect2port(dref, &orig))
                                                goto reject;
-                                       tipc_connect2port(dref,&orig);
-                               }
-                               if (unlikely(msg_origport(msg) != peer_port))
-                                       goto reject;
-                               if (unlikely(msg_orignode(msg) != peer_node))
+                               } else if ((msg_origport(msg) != peer_port) ||
+                                          (msg_orignode(msg) != peer_node))
                                        goto reject;
                                if (unlikely(!cb))
                                        goto reject;