2004-03-06 23:58:50

by wim delvaux

[permalink] [raw]
Subject: [Bluez-users] killing a persisted pand session

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users


2004-03-07 02:37:34

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] killing a persisted pand session

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2004-03-07 02:10:27

by wim delvaux

[permalink] [raw]
Subject: Re: [Bluez-users] killing a persisted pand session

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

2004-03-07 02:07:49

by wim delvaux

[permalink] [raw]
Subject: Re: [Bluez-users] killing a persisted pand session

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

2004-03-07 01:57:13

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] killing a persisted pand session

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2004-03-07 01:55:45

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] killing a persisted pand session

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2004-03-07 01:50:59

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] killing a persisted pand session

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2004-03-07 01:45:59

by wim delvaux

[permalink] [raw]
Subject: Re: [Bluez-users] killing a persisted pand session

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 ???)

2004-03-07 01:44:05

by wim delvaux

[permalink] [raw]
Subject: Re: [Bluez-users] killing a persisted pand session

When the ioctl locks I get the following dmesg

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

2004-03-07 01:42:16

by wim delvaux

[permalink] [raw]
Subject: Re: [Bluez-users] killing a persisted pand session

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

2004-03-07 01:33:55

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] killing a persisted pand session

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2004-03-07 01:17:43

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] killing a persisted pand session

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2004-03-07 01:21:59

by wim delvaux

[permalink] [raw]
Subject: Re: [Bluez-users] killing a persisted pand session


> 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