2006-01-09 16:41:45

by Kosta Welke

[permalink] [raw]
Subject: [Bluez-devel] pan link quality

Hi all!

I am currently playing around in setting up IP ad-hoc networks using
bluez. olsr-over-bluetooth works, and `pand -Q` is a nice thing :)

The bad stuff is that inquiry & connecting can take some time, but its
hard to really do something against that. (I have a few hacks in mind,
but they wont scale)

What would be really nice is some link quality metric. On my mobile
device `hcitool lq` always returns 255 (Even if the link goes bad and
the other side sees it). But I have one metric in mind: the interface
gets destroyed if a certain number of packets are not acknowledged by
the receiver. Is there some way (other than writing a script that
listens to hcidump) to measure this? `ifconfig bnep0` shows errors:0
and dropped:0 until it is detroyed. I am not a kernel hacker, i looked
around a bit in the bluez module, the library and pand, but couldnt
really find anything...

Do you have any hints? Is there any "unacknoledged packets" metric
accessible from userland? Where is the code that destroys the bnep
interface after x packets?

Thanks in advance,

Kosta

PS: Are you interesed in a "zeroconf ip" patch for pand?


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel


2006-01-20 01:43:50

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] patch: custom devup script

Hi Kosta,

> > I like the idea. However I prefer to remove any default devup script at
> > all and only call it when specified on the command line. Can you provide
> > me with a patch for that?
>
> Sure :)

your patch never applied to the latest CVS and so I had to fix up
everything by hand. Next time make sure the patch is against the CVS and
not some old version you use.

The stuff is now in and you might wanna test it.

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-01-19 01:55:52

by Kosta Welke

[permalink] [raw]
Subject: Re: [Bluez-devel] patch: custom devup script

On Thu, 19 Jan 2006 01:51:28 +0100, Marcel Holtmann <[email protected]>
wrote:

> I like the idea. However I prefer to remove any default devup script at
> all and only call it when specified on the command line. Can you provide
> me with a patch for that?

Sure :)

> And this must be ...zu: and not ...z:u

Yes, you are right. Funny thing is, if you omit the final : it will work
with --devup but not with -u

--- ../../bluez-utils-2.24-original/pand/pand.h 2005-10-29
23:04:28.000000000 +0000
+++ pand.h 2006-01-19 01:58:30.000000000 +0000
@@ -22,10 +22,6 @@
*
*/

-/* PAN scripts & commands */
-#define PAND_CONFIG_DIR "/etc/bluetooth/pan"
-#define PAND_DEVUP_CMD "dev-up"
-
/* BNEP functions */
int bnep_init(void);
int bnep_cleanup(void);
--- ../../bluez-utils-2.24-original/pand/main.c 2005-10-29
23:04:28.000000000 +0000
+++ main.c 2006-01-19 02:51:29.000000000 +0000
@@ -61,6 +61,7 @@
static int master;
static int cleanup;
static int search_duration = 10;
+static char* devup_path = 0;

static struct {
int valid;
@@ -87,13 +88,13 @@

static void run_devup(char *dev, char *dst, int sk, int nsk)
{
- char *argv[4], prog[40];
+ char *argv[4];
struct sigaction sa;

- sprintf(prog, "%s/%s", PAND_CONFIG_DIR, PAND_DEVUP_CMD);
-
- if (access(prog, R_OK | X_OK))
+ if (devup_path && access(devup_path, R_OK | X_OK)) {
+ syslog(LOG_ERR, "could not rx open %s", devup_path);
return;
+ }

if (fork())
return;
@@ -103,17 +104,20 @@

if (nsk >= 0)
close(nsk);
-
+
+ if (!devup_path)
+ exit(0);
+
memset(&sa, 0, sizeof(sa));
sa.sa_handler = SIG_DFL;
sigaction(SIGCHLD, &sa, NULL);
sigaction(SIGPIPE, &sa, NULL);

- argv[0] = prog;
+ argv[0] = devup_path;
argv[1] = dev;
argv[2] = dst;
argv[3] = NULL;
- execv(prog, argv);
+ execv(devup_path, argv);
exit(1);
}

@@ -478,8 +482,6 @@
fclose(f);
return 0;
}
-
-

static struct option main_lopts[] = {
{ "help", 0, 0, 'h' },
@@ -504,10 +506,11 @@
{ "cache", 0, 0, 'C' },
{ "pidfile", 1, 0, 'P' },
{ "autozap", 0, 0, 'z' },
+ { "devup", 1, 0, 'u' },
{ 0, 0, 0, 0 }
};

-static char main_sopts[] = "hsc:k:Kr:d:e:i:lnp::DQ::AESMC::P:z";
+static char main_sopts[] = "hsc:k:Kr:d:e:i:lnp::DQ::AESMC::P:zu:";

static char main_help[] =
"Bluetooth PAN daemon version " VERSION " \n"
@@ -533,7 +536,8 @@
"\t--nodetach -n Do not become a daemon\n"
"\t--persist -p[interval] Persist mode\n"
"\t--cache -C[valid] Cache addresses\n"
- "\t--pidfile -P <pidfile> Create PID file\n";
+ "\t--pidfile -P <pidfile> Create PID file\n"
+ "\t--devup -u <script> run script when the interface comes up\n";

int main(int argc, char **argv)
{
@@ -636,7 +640,9 @@
case 'z':
cleanup = 1;
break;
-
+ case 'u':
+ devup_path = optarg;
+ break;
case 'h':
default:
printf(main_help);


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-01-19 00:51:28

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] patch: custom devup script

Hi Kosta,

> I still need to call a custom devup script, thou (dhcp, this time),
> so I hope this patch doesnt get corrupted this time.

I like the idea. However I prefer to remove any default devup script at
all and only call it when specified on the command line. Can you provide
me with a patch for that?

> -static char main_sopts[] = "hsc:k:Kr:d:e:i:lnp::DQ::AESMC::P:z";
> +static char main_sopts[] = "hsc:k:Kr:d:e:i:lnp::DQ::AESMC::P:z:u";

And this must be ...zu: and not ...z:u

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-01-18 22:18:29

by Kosta Welke

[permalink] [raw]
Subject: Re: [Bluez-devel] patch: custom devup script

On Wed, 18 Jan 2006 18:37:35 +0100, Claudio Takahasi
<[email protected]> wrote:

> If you want add support to a seamless local IP link address assigment
> to pand daemon. IMHO, it's better use a stable daemon like:
> - HOWL (autoipd)
> - UDHCP + zeroconf patch

I tried to do that, but they didn't work out-of-the-box on my
mobile device. Also, due to my network layout, collision detection
would not really have worked, so that I had to code a plugin
for olsr. None of this matters anymore, because network layout
has changed and I can use dhcp. But thanks for the input!

I still need to call a custom devup script, thou (dhcp, this time),
so I hope this patch doesnt get corrupted this time.

--- bluez-utils-2.20-original/pand/pand.h 2005-08-27 13:37:16.000000000
+0000
+++ bluez-utils-2.20/pand/pand.h 2006-01-18 00:46:10.000000000 +0000
@@ -28,8 +28,7 @@
*/

/* PAN scripts & commands */
-#define PAND_CONFIG_DIR "/etc/bluetooth/pan"
-#define PAND_DEVUP_CMD "dev-up"
+#define PAND_DEVUP_CMD "/etc/bluetooth/pan/dev-up"

/* BNEP functions */
int bnep_init(void);
--- bluez-utils-2.20-original/pand/main.c 2005-08-27 13:37:16.000000000
+0000
+++ bluez-utils-2.20/pand/main.c 2006-01-17 19:49:17.000000000 +0000
@@ -67,6 +67,7 @@
static int master;
static int cleanup;
static int search_duration = 10;
+static char* devup_path = 0;

static struct {
int valid;
@@ -93,10 +94,13 @@

static void run_devup(char *dev, char *dst, int sk, int nsk)
{
- char *argv[4], prog[40];
+ char *argv[4], *prog;
struct sigaction sa;

- sprintf(prog, "%s/%s", PAND_CONFIG_DIR, PAND_DEVUP_CMD);
+ if (devup_path)
+ prog = devup_path;
+ else
+ prog = PAND_DEVUP_CMD;

if (access(prog, R_OK | X_OK))
return;
@@ -510,10 +514,11 @@
{ "cache", 0, 0, 'C' },
{ "pidfile", 1, 0, 'P' },
{ "autozap", 0, 0, 'z' },
+ { "devup", 1, 0, 'u' },
{ 0, 0, 0, 0 }
};

-static char main_sopts[] = "hsc:k:Kr:d:e:i:lnp::DQ::AESMC::P:z";
+static char main_sopts[] = "hsc:k:Kr:d:e:i:lnp::DQ::AESMC::P:z:u";

static char main_help[] =
"Bluetooth PAN daemon version " VERSION " \n"
@@ -539,7 +544,8 @@
"\t--nodetach -n Do not become a daemon\n"
"\t--persist -p[interval] Persist mode\n"
"\t--cache -C[valid] Cache addresses\n"
- "\t--pidfile -P <pidfile> Create PID file\n";
+ "\t--pidfile -P <pidfile> Create PID file\n"
+ "\t--devup <script> run script instead of usual dev-up\n";

int main(int argc, char **argv)
{
@@ -642,7 +648,9 @@
case 'z':
cleanup = 1;
break;
-
+ case 'u':
+ devup_path = optarg;
+ break;
case 'h':
default:
printf(main_help);


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-01-18 17:37:35

by Claudio Takahasi

[permalink] [raw]
Subject: Re: [Bluez-devel] patch: custom devup script

Hi guys,

Some comments about zeroconf. I didn't read you whole discussion,
sorry I am writing someting irrelevant.

If you want add support to a seamless local IP link address assigment
to pand daemon. IMHO, it's better use a stable daemon like:
- HOWL (autoipd)
- UDHCP + zeroconf patch

I did some test with udhcp integrated to pand, it is working fine. I
preffer UDHCP approach because it assign a local link address, but if
a DHCP is available the IP local link address(zeroconf) will be
overwritten and address conflict is supported.

Regards,
Claudio.

On 1/18/06, Marcel Holtmann <[email protected]> wrote:
> Hi Kosta,
>
> > As my zeroconf implementation is incomplete (only generates an IP
> > address, but does not check for conflicts), I instead added an option t=
o
> > run a custom devup script instead of /etc/bluetooth/pan/dev-up.
> >
> > Why? Because the mobile phone running embedded linux has a read-only
> > /etc. This way, I can move my devup-script anywhere I want, without
> > needing to recompile if its location changes.
>
> your email client eats all the whitespaces and tabs. Please resend it
> and attach it this time or use another (working) email client.
>
> Regards
>
> Marcel
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi=
les
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D103432&bid=3D230486&dat=
=3D121642
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>


--
---------------------------------------------------------
Claudio Takahasi
Instituto Nokia de Tecnologia - INdT


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-01-18 13:20:15

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] patch: custom devup script

Hi Kosta,

> As my zeroconf implementation is incomplete (only generates an IP
> address, but does not check for conflicts), I instead added an option to
> run a custom devup script instead of /etc/bluetooth/pan/dev-up.
>
> Why? Because the mobile phone running embedded linux has a read-only
> /etc. This way, I can move my devup-script anywhere I want, without
> needing to recompile if its location changes.

your email client eats all the whitespaces and tabs. Please resend it
and attach it this time or use another (working) email client.

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-01-18 00:58:22

by Kosta Welke

[permalink] [raw]
Subject: [Bluez-devel] patch: custom devup script

I changed the subject from "pan link quality" because it didnt really
apply anymore.

Marcel Holtmann wrote:

>> PS: Are you interesed in a "zeroconf ip" patch for pand?
> Go ahead and post the patch to the mailing list. We will review it.

As my zeroconf implementation is incomplete (only generates an IP
address, but does not check for conflicts), I instead added an option to
run a custom devup script instead of /etc/bluetooth/pan/dev-up.

Why? Because the mobile phone running embedded linux has a read-only
/etc. This way, I can move my devup-script anywhere I want, without
needing to recompile if its location changes.

(In the unlikely case that anyone is interested in my zeroconf,
here's the uri: http://lastpageofthe.net/zeroconf.test.c )

Here's the unified diff:
--- ../bluez-utils-2.24-original/pand/pand.h2005-10-29
23:04:28.000000000 +0000
+++ pand/pand.h2006-01-18 00:49:23.000000000 +0000
@@ -23,8 +23,7 @@
*/

/* PAN scripts & commands */
-#define PAND_CONFIG_DIR "/etc/bluetooth/pan"
-#define PAND_DEVUP_CMD "dev-up"
+#define PAND_DEVUP_CMD "/etc/bluetooth/pan/dev-up"

/* BNEP functions */
int bnep_init(void);
--- ../bluez-utils-2.20-original/pand/main.c2005-08-27
13:37:16.000000000 +0000
+++ pand/main.c2006-01-17 19:49:17.000000000 +0000
@@ -67,6 +67,7 @@
static int master;
static int cleanup;
static int search_duration = 10;
+static char* devup_path = 0;

static struct {
int valid;
@@ -93,10 +94,13 @@

static void run_devup(char *dev, char *dst, int sk, int nsk)
{
-char *argv[4], prog[40];
+char *argv[4], *prog;
struct sigaction sa;

-sprintf(prog, "%s/%s", PAND_CONFIG_DIR, PAND_DEVUP_CMD);
+if (devup_path)
+prog = devup_path;
+else
+prog = PAND_DEVUP_CMD;

if (access(prog, R_OK | X_OK))
return;
@@ -510,10 +514,11 @@
{ "cache", 0, 0, 'C' },
{ "pidfile", 1, 0, 'P' },
{ "autozap", 0, 0, 'z' },
+{ "devup", 1, 0, 'u' },
{ 0, 0, 0, 0 }
};

-static char main_sopts[] = "hsc:k:Kr:d:e:i:lnp::DQ::AESMC::P:z";
+static char main_sopts[] = "hsc:k:Kr:d:e:i:lnp::DQ::AESMC::P:z:u";

static char main_help[] =
"Bluetooth PAN daemon version " VERSION " \n"
@@ -539,7 +544,8 @@
"\t--nodetach -n Do not become a daemon\n"
"\t--persist -p[interval] Persist mode\n"
"\t--cache -C[valid] Cache addresses\n"
-"\t--pidfile -P <pidfile> Create PID file\n";
+"\t--pidfile -P <pidfile> Create PID file\n"
+"\t--devup <script> run script instead of usual dev-up\n";

int main(int argc, char **argv)
{
@@ -642,7 +648,9 @@
case 'z':
cleanup = 1;
break;
-
+case 'u':
+devup_path = optarg;
+break;
case 'h':
default:
printf(main_help);


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-01-10 16:07:36

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] pan link quality

Hi Kosta,

> I am currently playing around in setting up IP ad-hoc networks using
> bluez. olsr-over-bluetooth works, and `pand -Q` is a nice thing :)
>
> The bad stuff is that inquiry & connecting can take some time, but its
> hard to really do something against that. (I have a few hacks in mind,
> but they wont scale)
>
> What would be really nice is some link quality metric. On my mobile
> device `hcitool lq` always returns 255 (Even if the link goes bad and
> the other side sees it). But I have one metric in mind: the interface
> gets destroyed if a certain number of packets are not acknowledged by
> the receiver. Is there some way (other than writing a script that
> listens to hcidump) to measure this? `ifconfig bnep0` shows errors:0
> and dropped:0 until it is detroyed. I am not a kernel hacker, i looked
> around a bit in the bluez module, the library and pand, but couldnt
> really find anything...
>
> Do you have any hints? Is there any "unacknoledged packets" metric
> accessible from userland? Where is the code that destroys the bnep
> interface after x packets?

the link quality is vendor specific and we really only know how CSR
implemented it. The RSSI might be another indicator, but I assume some
chip manufacturers did a bad implementation. What chips are you using?

> PS: Are you interesed in a "zeroconf ip" patch for pand?

Go ahead and post the patch to the mailing list. We will review it.

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel