linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bluez-users] killing a persisted pand session
@ 2004-03-06 23:58 wim delvaux
  2004-03-07  1:17 ` Marcel Holtmann
  0 siblings, 1 reply; 13+ messages in thread
From: wim delvaux @ 2004-03-06 23:58 UTC (permalink / raw)
  To: bluez-users

Hi all,

If i run

pand --persist --connect XXXX

this means that pand will try to reestablish the connection to XXX whenever it 
needs to.

Now I want to terminate that application.

Should I run 

pand -k XXX ?

or

pand -K ?

or

kill `pidof pand` ( or a bit more complicated)

I have tried

pand -k

which seems the most logical but this only closes the connection which then 
gets reestablished after the interval timeout (5 secs).  I would expect a -k 
to really 'kill' the connection and terminate the corresponding pand

W



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bluez-users] killing a persisted pand session
  2004-03-06 23:58 [Bluez-users] killing a persisted pand session wim delvaux
@ 2004-03-07  1:17 ` Marcel Holtmann
  2004-03-07  1:21   ` wim delvaux
  0 siblings, 1 reply; 13+ messages in thread
From: Marcel Holtmann @ 2004-03-07  1:17 UTC (permalink / raw)
  To: wim delvaux; +Cc: BlueZ Mailing List

Hi Wim,

> If i run
> 
> pand --persist --connect XXXX
> 
> this means that pand will try to reestablish the connection to XXX whenever it 
> needs to.
> 
> Now I want to terminate that application.
> 
> Should I run 
> 
> pand -k XXX ?
> 
> or
> 
> pand -K ?
> 
> or
> 
> kill `pidof pand` ( or a bit more complicated)
> 
> I have tried
> 
> pand -k
> 
> which seems the most logical but this only closes the connection which then 
> gets reestablished after the interval timeout (5 secs).  I would expect a -k 
> to really 'kill' the connection and terminate the corresponding pand

you have to kill the pand process first and then run 'pand -k' to kill
the active connections.

Or you extend pand that it will kill the current connection by itself if
it receives SIG_TERM. Patches are welcome ;)

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bluez-users] killing a persisted pand session
  2004-03-07  1:17 ` Marcel Holtmann
@ 2004-03-07  1:21   ` wim delvaux
  2004-03-07  1:33     ` Marcel Holtmann
  0 siblings, 1 reply; 13+ messages in thread
From: wim delvaux @ 2004-03-07  1:21 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: BlueZ Mailing List


> you have to kill the pand process first and then run 'pand -k' to kill
> the active connections.
>
> Or you extend pand that it will kill the current connection by itself if
> it receives SIG_TERM. Patches are welcome ;)

	Ah so it means that pand -k does not send anything to the pand that is 
running .  pand --connect just does something to create the connection.

	If that is the case why doesn't pand without --persist return after the
	connection was established ?

	W

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bluez-users] killing a persisted pand session
  2004-03-07  1:21   ` wim delvaux
@ 2004-03-07  1:33     ` Marcel Holtmann
  2004-03-07  1:42       ` wim delvaux
                         ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Marcel Holtmann @ 2004-03-07  1:33 UTC (permalink / raw)
  To: wim delvaux; +Cc: BlueZ Mailing List

Hi Wim,

> 	Ah so it means that pand -k does not send anything to the pand that is 
> running .  pand --connect just does something to create the connection.
> 
> 	If that is the case why doesn't pand without --persist return after the
> 	connection was established ?

what are you talking about? After pand has established the connection it
hands it over to the kernel BNEP module and exit.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bluez-users] killing a persisted pand session
  2004-03-07  1:33     ` Marcel Holtmann
@ 2004-03-07  1:42       ` wim delvaux
  2004-03-07  1:50         ` Marcel Holtmann
  2004-03-07  1:44       ` wim delvaux
  2004-03-07  1:45       ` wim delvaux
  2 siblings, 1 reply; 13+ messages in thread
From: wim delvaux @ 2004-03-07  1:42 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: BlueZ Mailing List

On Sunday 07 March 2004 02:33, Marcel Holtmann wrote:
> Hi Wim,
>
> > 	Ah so it means that pand -k does not send anything to the pand that is
> > running .  pand --connect just does something to create the connection.
> >
> > 	If that is the case why doesn't pand without --persist return after the
> > 	connection was established ?
>
> what are you talking about? After pand has established the connection it
> hands it over to the kernel BNEP module and exit.

	I was wondering WHY pand is kept running after the BNEP is set up.
	For the persist option I can understand since i presume pand monitors the
	connection it had to establish and if it 'downs' it restarts it.  However if
	this feature is NOT requested (i.e. no --presist is given), then WHY is pand 
still alive after the setup of the connection.

	The reason for this question is that I was trying to determine a fail safe
	integration into hotplug/interfaces.  Seems that if you pand -k the bnep
	module is deactivated and ifdown does no longer work properly (and hence
	the dhcp server is not stopped properly and does not RELEASE its lease)

	I have noticed something else here.  I am testing BT between my Ipaq and
	a usb BT dongle.  When I suspend my Ipaq the pand on my desktop (the one that
	is listening) blocks on an ioctl after it receives the connection request. (I 
checked with strace on that listening pand)

	The iotcl that blocks is the one in bnep_connadd.  Because of this blocking 
(for I do not know what reason) the connection is not established (no IP is 
set up)

static int bnep_connadd(int sk, uint16_t role, char *dev)
{
        struct bnep_connadd_req req;

        strcpy(req.device, dev);
        req.sock = sk;
        req.role = role;
        /* THIS IS THE ONE THAT BLOCKS */
        if (ioctl(ctl, bnepconnadd, &req))
                return -1;
        strcpy(dev, req.device);
        return 0;
}
	Do you know what that ioctl is supposed to do and why it blocks on something

>
> Regards
>
> Marcel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bluez-users] killing a persisted pand session
  2004-03-07  1:33     ` Marcel Holtmann
  2004-03-07  1:42       ` wim delvaux
@ 2004-03-07  1:44       ` wim delvaux
  2004-03-07  1:55         ` Marcel Holtmann
  2004-03-07  1:45       ` wim delvaux
  2 siblings, 1 reply; 13+ messages in thread
From: wim delvaux @ 2004-03-07  1:44 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: BlueZ Mailing List

When the ioctl locks I get the following dmesg 

unregister_netdevice: waiting for bnep0 to become free. Usage count = 2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bluez-users] killing a persisted pand session
  2004-03-07  1:33     ` Marcel Holtmann
  2004-03-07  1:42       ` wim delvaux
  2004-03-07  1:44       ` wim delvaux
@ 2004-03-07  1:45       ` wim delvaux
  2004-03-07  1:57         ` Marcel Holtmann
  2 siblings, 1 reply; 13+ messages in thread
From: wim delvaux @ 2004-03-07  1:45 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: BlueZ Mailing List

I also have a lot of 'dead' pand --listens haning around in the process table 
(perhaps a pointer error caused the module to become dangling ???)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bluez-users] killing a persisted pand session
  2004-03-07  1:42       ` wim delvaux
@ 2004-03-07  1:50         ` Marcel Holtmann
  0 siblings, 0 replies; 13+ messages in thread
From: Marcel Holtmann @ 2004-03-07  1:50 UTC (permalink / raw)
  To: wim delvaux; +Cc: BlueZ Mailing List

Hi Wim,

> 	I was wondering WHY pand is kept running after the BNEP is set up.
> 	For the persist option I can understand since i presume pand monitors the
> 	connection it had to establish and if it 'downs' it restarts it.  However if
> 	this feature is NOT requested (i.e. no --presist is given), then WHY is pand 
> still alive after the setup of the connection.

if you don't use --presist the "pand --connect" process exit after the
full BNEP connection is established. Try "--nodetach" to see it.

> 	The reason for this question is that I was trying to determine a fail safe
> 	integration into hotplug/interfaces.  Seems that if you pand -k the bnep
> 	module is deactivated and ifdown does no longer work properly (and hence
> 	the dhcp server is not stopped properly and does not RELEASE its lease)

If the BNEP connection is deleted you get a remove event from net.agent
hotplug script. If you have problems with DHCP put a bridge interface
above your bnep0 interface.

> 	I have noticed something else here.  I am testing BT between my Ipaq and
> 	a usb BT dongle.  When I suspend my Ipaq the pand on my desktop (the one that
> 	is listening) blocks on an ioctl after it receives the connection request. (I 
> checked with strace on that listening pand)
> 
> 	The iotcl that blocks is the one in bnep_connadd.  Because of this blocking 
> (for I do not know what reason) the connection is not established (no IP is 
> set up)
> 
> static int bnep_connadd(int sk, uint16_t role, char *dev)
> {
>         struct bnep_connadd_req req;
> 
>         strcpy(req.device, dev);
>         req.sock = sk;
>         req.role = role;
>         /* THIS IS THE ONE THAT BLOCKS */
>         if (ioctl(ctl, bnepconnadd, &req))
>                 return -1;
>         strcpy(dev, req.device);
>         return 0;
> }
> 	Do you know what that ioctl is supposed to do and why it blocks on something

This ioctl gives the control of your incoming connection to the kernel
BNEP module, but I don't know why it can block.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bluez-users] killing a persisted pand session
  2004-03-07  1:44       ` wim delvaux
@ 2004-03-07  1:55         ` Marcel Holtmann
  2004-03-07  2:07           ` wim delvaux
  0 siblings, 1 reply; 13+ messages in thread
From: Marcel Holtmann @ 2004-03-07  1:55 UTC (permalink / raw)
  To: wim delvaux; +Cc: BlueZ Mailing List

Hi Wim,

> When the ioctl locks I get the following dmesg 
> 
> unregister_netdevice: waiting for bnep0 to become free. Usage count = 2

then your suspend don't clean up everything. What kernel are you using?
Maybe it is impossible to do a suspend while you have a BNEP connection
opened.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bluez-users] killing a persisted pand session
  2004-03-07  1:45       ` wim delvaux
@ 2004-03-07  1:57         ` Marcel Holtmann
  2004-03-07  2:10           ` wim delvaux
  0 siblings, 1 reply; 13+ messages in thread
From: Marcel Holtmann @ 2004-03-07  1:57 UTC (permalink / raw)
  To: wim delvaux; +Cc: BlueZ Mailing List

Hi Wim,

> I also have a lot of 'dead' pand --listens haning around in the process table 
> (perhaps a pointer error caused the module to become dangling ???)

when do you start your "pand --listen"? Don't start it from
bluetooth.agent script.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bluez-users] killing a persisted pand session
  2004-03-07  1:55         ` Marcel Holtmann
@ 2004-03-07  2:07           ` wim delvaux
  0 siblings, 0 replies; 13+ messages in thread
From: wim delvaux @ 2004-03-07  2:07 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: BlueZ Mailing List

On Sunday 07 March 2004 02:55, Marcel Holtmann wrote:
> Hi Wim,
>
> > When the ioctl locks I get the following dmesg
> >
> > unregister_netdevice: waiting for bnep0 to become free. Usage count = 2
>
> then your suspend don't clean up everything. What kernel are you using?
> Maybe it is impossible to do a suspend while you have a BNEP connection
> opened.


	it is the Ipaq that suspends and the desktop that hangs !
	Ipaq  2.4.19 Desktop 2.6.4.rc2 (bleeding edge !)
	
	I do not do a real suspend.  I bring the network down using a
	script in the suspend_scripts dir and bring it back up in the resume
	
	W

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bluez-users] killing a persisted pand session
  2004-03-07  1:57         ` Marcel Holtmann
@ 2004-03-07  2:10           ` wim delvaux
  2004-03-07  2:37             ` Marcel Holtmann
  0 siblings, 1 reply; 13+ messages in thread
From: wim delvaux @ 2004-03-07  2:10 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: BlueZ Mailing List

On Sunday 07 March 2004 02:57, Marcel Holtmann wrote:
> Hi Wim,
>
> > I also have a lot of 'dead' pand --listens haning around in the process
> > table (perhaps a pointer error caused the module to become dangling ???)
>
> when do you start your "pand --listen"? Don't start it from
> bluetooth.agent script.

	Ah that might be the problem. Indeed it is started from there.

	Why ? As said I have a dongle that gets inserted and removed frequently.
	Therefore I wanted the hcid/sdpd/pand thing to start when the dongle
	is inserted. so I added the start / stop of these apps to the bluetooth.agent	
	script.  


case $ACTION in
    add|register)
        # start bluetooth daemons
        sh -x /etc/init.d/bluez-utils start
        sleep 1
        sh -x /etc/init.d/bluez-sdp start
        sleep 1
        sh -x /etc/init.d/bluez-pan start

        # install remover
        #echo "set -x" > $REMOVER
        #echo 'exec 2> /tmp/HCI_REMOVE' >> $REMOVER
        #echo "/etc/init.d/bluez-pan stop" >> $REMOVER
        #echo "/etc/init.d/bluez-sdp stop" >> $REMOVER
        #echo "/etc/init.d/bluez-utils stop" >> $REMOVER
        #chmod 700 $REMOVER
     ;;
     unregister)
        /etc/init.d/bluez-pan stop
        /etc/init.d/bluez-sdp stop
        /etc/init.d/bluez-utils stop
     ;;
esac

>
> Regards
>
> Marcel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bluez-users] killing a persisted pand session
  2004-03-07  2:10           ` wim delvaux
@ 2004-03-07  2:37             ` Marcel Holtmann
  0 siblings, 0 replies; 13+ messages in thread
From: Marcel Holtmann @ 2004-03-07  2:37 UTC (permalink / raw)
  To: wim delvaux; +Cc: BlueZ Mailing List

Hi Wim,

> > when do you start your "pand --listen"? Don't start it from
> > bluetooth.agent script.
> 
> 	Ah that might be the problem. Indeed it is started from there.
> 
> 	Why ? As said I have a dongle that gets inserted and removed frequently.
> 	Therefore I wanted the hcid/sdpd/pand thing to start when the dongle
> 	is inserted. so I added the start / stop of these apps to the bluetooth.agent	
> 	script.  

all these daemons can run all the time, even when no dongle is inserted.
Start them from /etc/init.d/... and not from bluetooth.agent, because
the hotplug stuff is not for starting daemons. It is for device
configuration.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2004-03-07  2:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-06 23:58 [Bluez-users] killing a persisted pand session wim delvaux
2004-03-07  1:17 ` Marcel Holtmann
2004-03-07  1:21   ` wim delvaux
2004-03-07  1:33     ` Marcel Holtmann
2004-03-07  1:42       ` wim delvaux
2004-03-07  1:50         ` Marcel Holtmann
2004-03-07  1:44       ` wim delvaux
2004-03-07  1:55         ` Marcel Holtmann
2004-03-07  2:07           ` wim delvaux
2004-03-07  1:45       ` wim delvaux
2004-03-07  1:57         ` Marcel Holtmann
2004-03-07  2:10           ` wim delvaux
2004-03-07  2:37             ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).