patch-2.4.20 linux-2.4.20/net/irda/ircomm/ircomm_tty_attach.c

Next file: linux-2.4.20/net/irda/ircomm/ircomm_tty_ioctl.c
Previous file: linux-2.4.20/net/irda/ircomm/ircomm_tty.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.19/net/irda/ircomm/ircomm_tty_attach.c linux-2.4.20/net/irda/ircomm/ircomm_tty_attach.c
@@ -47,6 +47,7 @@
 
 static void ircomm_tty_ias_register(struct ircomm_tty_cb *self);
 static void ircomm_tty_discovery_indication(discovery_t *discovery,
+					    DISCOVERY_MODE mode,
 					    void *priv);
 static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, 
 					struct ias_value *value, void *priv);
@@ -305,6 +306,7 @@
  *
  */
 static void ircomm_tty_discovery_indication(discovery_t *discovery,
+					    DISCOVERY_MODE mode,
 					    void *priv)
 {
 	struct ircomm_tty_cb *self;
@@ -312,6 +314,20 @@
 
 	IRDA_DEBUG(2, __FUNCTION__"()\n");
 
+	/* Important note :
+	 * We need to drop all passive discoveries.
+	 * The LSAP management of IrComm is deficient and doesn't deal
+	 * with the case of two instance connecting to each other
+	 * simultaneously (it will deadlock in LMP).
+	 * The proper fix would be to use the same technique as in IrNET,
+	 * to have one server socket and separate instances for the
+	 * connecting/connected socket.
+	 * The workaround is to drop passive discovery, which drastically
+	 * reduce the probability of this happening.
+	 * Jean II */
+	if(mode == DISCOVERY_PASSIVE)
+		return;
+
 	info.daddr = discovery->daddr;
 	info.saddr = discovery->saddr;
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)