On Thu, Dec 21, 2000 at 05:14:25PM -0500, Andrew Sutton wrote:
> Jean Tourrilhes wrote:
> > 
> > Andrew Sutton wrote :
> > > i'm having some problems with the irda stuff, primarily with irttp and
> > > the irsock interface (or so it seems), and some other odd issues
> > > besides.
> > 
> >         This doesn't look healthy at all. Your server is ar LSAP 0,
> > which is the LSAP reserved for the IAS server. No wonder your IAS
> > queries fail.
> >         Now, the big question is why the IrDA stack allow this to
> > happen. It look like the IrDA stack was not initialised properly,
> > which goes back to "see the list of common problems".
> > 
> 
> i went ahead and installed kernel 2.4.0-test12 and the irdautils-9.13,
> rebuilt everythings (all the irda stuff) as a module and started over.
> just to start with a (hopefully) clean slate. however, i'm still seeing
> the problem with getting a 0 LSAP. at least with my previous program.
[...]
> this doesn't really make any sense... i can't imagine how the scope of a
> variable would affect how a socket is bound. oh... and there's nothing
> in the log files about any kind of errors, the stack is successfully
> attached, ias entries added, ias queries succeed, etc, etc.

        Doh ! I'm stupid. You just forgot to do before the bind :
-------------------------
  self.sir_lsap_sel = LSAP_ANY;
-------------------------
        Or else you are totally screwing up your call to bind.

        Dag, could you check the attached fix and include it in the
stack sometimes ? That will prevent this kind of bug and display a
more obvious error message...

        Regards,

        Jean
diff -u -p linux/net/irda/irttp.d1.c linux/net/irda/irttp.c
--- linux/net/irda/irttp.d1.c   Thu Dec 21 21:54:33 2000
+++ linux/net/irda/irttp.c      Thu Dec 21 21:59:23 2000
@@ -139,6 +139,15 @@ struct tsap_cb *irttp_open_tsap(__u8 sts
        ASSERT(irttp != NULL, return NULL;);
        ASSERT(irttp->magic == TTP_MAGIC, return NULL;);
 
+       /* The IrLMP spec (IrLMP 1.1 p10) says that we have the right to
+        * use only 0x01-0x6F. Of course, we can use LSAP_ANY as well.
+        * JeanII */
+       if((stsap_sel != LSAP_ANY) &&
+          ((stsap_sel < 0x01) || (stsap_sel >= 0x70))) {
+               IRDA_DEBUG(0, __FUNCTION__ "(), invalid tsap!\n");
+               return NULL;
+       }
+
        self = kmalloc(sizeof(struct tsap_cb), GFP_ATOMIC);
        if (self == NULL) {
                IRDA_DEBUG(0, __FUNCTION__ "(), unable to kmalloc!\n");

Reply via email to