Skip to contentSkip to conversation

DHCPD and Bluetooth

Bluez-users Rob Taft 5 participants 9 messages May 12, 2004 – May 13, 2004 Bluetooth drivers

lore
Share & tools
lore

Rob Taft

author
#0 lore raw

I currently have a setup where I have a Bluetooth adapter on a Linux box, and one on Windows. Everything is configured properly. I connect from the Windows Bluetooth adapter to the Linux one via "Local Area Connection 2" in XP over TCP/IP. I manually type "ifconfig bnep0 192.168.3.1" to assign the adapter an IP, then I have to restart DHCPD to acquire an IP address over Bluetooth. This all works great.

My first question is: Is there a way to recognize when a connection is made, so I can create a script or some code to automatically set bnep0 to 192.168.3.1 and restart the dhcp server?

I only have 2 Bluetooth adapters. What if I used a 3rd from windows to connect to Linux at the same time another one is connected. Will it allow multiple connections? Will it show up as bnep1 or still use bnep0?

Rob Taft, Software Engineer
Perigee, A Division of Sensis Corporation
[email protected]
315-453-7842, Ext. 25

#1 lore raw

I know Slackware has hotplug scripts. You might want to look there.

Myke

Quoted 12 lines · Rob Taft

I currently have a setup where I have a Bluetooth adapter on a Linux box, and one on Windows. Everything is configured properly. I connect from the Windows Bluetooth adapter to the Linux one via "Local Area Connection 2" in XP over TCP/IP. I manually type "ifconfig bnep0 192.168.3.1" to assign the adapter an IP, then I have to restart DHCPD to acquire an IP address over Bluetooth. This all works great.

My first question is: Is there a way to recognize when a connection is made, so I can create a script or some code to automatically set bnep0 to 192.168.3.1 and restart the dhcp server?

I only have 2 Bluetooth adapters. What if I used a 3rd from windows to connect to Linux at the same time another one is connected. Will it allow multiple connections? Will it show up as bnep1 or still use bnep0?

Rob Taft, Software Engineer
Perigee, A Division of Sensis Corporation
[email protected] <mailto:[email protected]>
315-453-7842, Ext. 25

author
#2 lore raw

Changing my OS isn't exactly an option at this point.
----- Original Message -----
From: Mykel
To: Rob Taft
Cc: [email protected]
Sent: Wednesday, May 12, 2004 12:44 PM
Subject: Re: [Bluez-users] DHCPD and Bluetooth

I know Slackware has hotplug scripts. You might want to look there.

Myke

Rob Taft wrote:
I currently have a setup where I have a Bluetooth adapter on a Linux box, and one on Windows. Everything is configured properly. I connect from the Windows Bluetooth adapter to the Linux one via "Local Area Connection 2" in XP over TCP/IP. I manually type "ifconfig bnep0 192.168.3.1" to assign the adapter an IP, then I have to restart DHCPD to acquire an IP address over Bluetooth. This all works great.

My first question is: Is there a way to recognize when a connection is made, so I can create a script or some code to automatically set bnep0 to 192.168.3.1 and restart the dhcp server?

I only have 2 Bluetooth adapters. What if I used a 3rd from windows to connect to Linux at the same time another one is connected. Will it allow multiple connections? Will it show up as bnep1 or still use bnep0?

Rob Taft, Software Engineer
Perigee, A Division of Sensis Corporation
[email protected]
315-453-7842, Ext. 25

#3 lore raw
Quoted 1 line · Rob Taft

Changing my OS isn't exactly an option at this point.

All distributions have hotplug scripts inside. Just use you package system and install it

Michal

Quoted 31 lines

----- Original Message -----
From: Mykel
To: Rob Taft
Cc: [email protected]
Sent: Wednesday, May 12, 2004 12:44 PM
Subject: Re: [Bluez-users] DHCPD and Bluetooth

I know Slackware has hotplug scripts. You might want to look there.

Myke

Rob Taft wrote:
I currently have a setup where I have a Bluetooth adapter on a Linux
box, and one on Windows. Everything is configured properly. I connect from the Windows Bluetooth adapter to the Linux one via "Local Area Connection 2" in XP over TCP/IP. I manually type "ifconfig bnep0 192.168.3.1" to assign the adapter an IP, then I have to restart DHCPD to acquire an IP address over Bluetooth. This all works great.

My first question is: Is there a way to recognize when a connection is
made, so I can create a script or some code to automatically set bnep0 to 192.168.3.1 and restart the dhcp server?

I only have 2 Bluetooth adapters. What if I used a 3rd from windows to
connect to Linux at the same time another one is connected. Will it allow multiple connections? Will it show up as bnep1 or still use bnep0?

Quoted 4 lines

Rob Taft, Software Engineer
Perigee, A Division of Sensis Corporation
[email protected]
315-453-7842, Ext. 25

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

author
#4 lore raw

hotplug is installed. I added some lines to /etc/hotplug/usb/bluefw to verify that it is getting executed, but it never does. Nor does it get executed when I type "hotplug usb" or "hotplug usb/bluefw"

Secondly, it seems to me that the hotplug scripts supposed to be called when a hardware device is connected. This is not my issue. I am trying to get a Windows (or any OS) Client to connect to a Linux Server via Bluetooth. When there is nothing connected to the server, bnep0 is not listed in ifconfig. Now I've managed to get it to automatically assign an IP to the Server's Bluetooth when a Client connects by creating /etc/sysconfig/network-scripts/ifcfg-bnep0 with the following data:

DEVICE=bnep0
ONBOOT=yes
USERCTL=no
PEERDNS=no
IPADDR=192.168.3.1
NETMASK=255.255.255.0
BROADCAST=192.168.3.255

This solves half my problem..setting the IP of bnep0 when a client connects, since the IP is lost when the client disconnects.

The other half of the problem is the DHCP server. Once the client disconnects from the server, bnep0 drops the IP, and DHCP no longer serves IP's for it. When a new client connects, I need the DHCP server to begin serving bnep0 again. One way to do it is to restart the DHCP server, but if I take that approach, I need to know when the client connets so I can restart it. I don't think hotplug is what I am looking for since it is hardware connection based.

Rob

----- Original Message -----
From: "Michal Semler" <[email protected]>
To: <[email protected]>
Sent: Wednesday, May 12, 2004 3:03 PM
Subject: Re: [Bluez-users] DHCPD and Bluetooth

Quoted 4 lines · Rob Taft
Quoted 1 line

Changing my OS isn't exactly an option at this point.

All distributions have hotplug scripts inside. Just use you package system

and

Quoted 23 lines

install it

Michal

Quoted 19 lines

----- Original Message -----
From: Mykel
To: Rob Taft
Cc: [email protected]
Sent: Wednesday, May 12, 2004 12:44 PM
Subject: Re: [Bluez-users] DHCPD and Bluetooth

I know Slackware has hotplug scripts. You might want to look there.

Myke

Rob Taft wrote:
I currently have a setup where I have a Bluetooth adapter on a Linux
box, and one on Windows. Everything is configured properly. I connect from the Windows Bluetooth adapter to the Linux one via "Local Area Connection 2" in XP over TCP/IP. I manually type "ifconfig bnep0 192.168.3.1" to assign the adapter an IP, then I have to restart DHCPD

to

Quoted 3 lines
Quoted 3 lines

acquire an IP address over Bluetooth. This all works great.

My first question is: Is there a way to recognize when a connection

is

Quoted 1 line
Quoted 1 line

made, so I can create a script or some code to automatically set bnep0

to

Quoted 3 lines
Quoted 3 lines

192.168.3.1 and restart the dhcp server?

I only have 2 Bluetooth adapters. What if I used a 3rd from windows

to

Quoted 1 line
Quoted 1 line

connect to Linux at the same time another one is connected. Will it

allow

Quoted 10 lines
Quoted 8 lines

multiple connections? Will it show up as bnep1 or still use bnep0?

Rob Taft, Software Engineer
Perigee, A Division of Sensis Corporation
[email protected]
315-453-7842, Ext. 25

Quoted 3 lines

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to

deliver

Quoted 7 lines

higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

#5 lore raw

Hello,

Quoted 2 lines

restart it. I don't think hotplug is what I am looking for since it is hardware connection based.

This is not only hardware connection based. When you try setup network from remote device, that kernel call /sbin/hotplug with NET action. You can edit script "/etc/hotplug.d/default/default.hotplug" or other in your distribution and uncomment line "DEBUG=yes export DEBUG".
Later you can look in to log file for interesting messages ;-)
In this case will be probably interesting script /etc/hotplug/net.agent.

Best regards,

Pavel Ruzicka

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

author
#6 lore raw

I think I'm almost there.
I noticed that it is not HW based after I posted. I saw in /var/log/messages a message that occurred ever connection:

May 12 17:01:20 SMED /etc/hotplug/net.agent: invoke ifup bnep0

So I went into the net.agent file and found this line that matched the output:

debug_mesg invoke ifup $INTERFACE

I added more lines to that so now it looks like this:

if [ -x /sbin/ifup ]; then
debug_mesg invoke ifup $INTERFACE debug_mesg LALALALALALALALALALA #ADDED THIS exec /sbin/ifup $INTERFACE
debug_message Attempting to restart dhcpd. #ADDED THIS
exec /etc/init.d/dhcpd restart #ADDED THIS
else
mesg "how do I bring interfaces up on this distro?"
fi

I then restarted my entire system....and the 2nd 2 lines were never reached. I added the LALALA line after and that appears in the logs...so I'm guessing that "exec /sbin/ifup $INTERFACE" is causing the script to exit

----- Original Message -----
From: "Pavel Ruzicka" <[email protected]>
To: <[email protected]>
Cc: "Rob Taft" <[email protected]>
Sent: Wednesday, May 12, 2004 4:57 PM
Subject: Re: [Bluez-users] DHCPD and Bluetooth

Quoted 6 lines

Hello,

Quoted 2 lines

restart it. I don't think hotplug is what I am looking for since it is hardware connection based.

This is not only hardware connection based. When you try setup network

from

Quoted 2 lines

remote device, that kernel call /sbin/hotplug with NET action. You can edit script "/etc/hotplug.d/default/default.hotplug" or other in

your

Quoted 4 lines

distribution and uncomment line "DEBUG=yes export DEBUG". Later you can look in to log file for interesting messages ;-) In this case will be probably interesting script /etc/hotplug/net.agent.

Quoted 8 lines

Best regards,

Pavel Ruzicka

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to

deliver

Quoted 7 lines

higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

#7 lore raw
Quoted 9 lines · Rob Taft

I think I'm almost there.
I noticed that it is not HW based after I posted. I saw in /var/log/messages a message that occurred ever connection:

May 12 17:01:20 SMED /etc/hotplug/net.agent: invoke ifup bnep0

So I went into the net.agent file and found this line that matched the output:

Quoted 8 lines

debug_mesg invoke ifup $INTERFACE

I added more lines to that so now it looks like this:

if [ -x /sbin/ifup ]; then
debug_mesg invoke ifup $INTERFACE
debug_mesg LALALALALALALALALALA #ADDED THIS
exec /sbin/ifup $INTERFACE

^^^^ remove this exec!

Quoted 9 lines

debug_message Attempting to restart dhcpd. #ADDED THIS
exec /etc/init.d/dhcpd restart #ADDED THIS
else
mesg "how do I bring interfaces up on this distro?"
fi

I then restarted my entire system....and the 2nd 2 lines were never reached. I added the LALALA line after and that appears in the logs...so I'm guessing that "exec /sbin/ifup $INTERFACE" is causing the script to exit

see man bash-builtins

Achim

Quoted 58 lines

----- Original Message -----
From: "Pavel Ruzicka" <[email protected]>
To: <[email protected]>
Cc: "Rob Taft" <[email protected]>
Sent: Wednesday, May 12, 2004 4:57 PM
Subject: Re: [Bluez-users] DHCPD and Bluetooth

Quoted 6 lines

Hello,

Quoted 2 lines

restart it. I don't think hotplug is what I am looking for since it is hardware connection based.

This is not only hardware connection based. When you try setup network

from

Quoted 2 lines

remote device, that kernel call /sbin/hotplug with NET action. You can edit script "/etc/hotplug.d/default/default.hotplug" or other in

your

Quoted 4 lines

distribution and uncomment line "DEBUG=yes export DEBUG". Later you can look in to log file for interesting messages ;-) In this case will be probably interesting script /etc/hotplug/net.agent.

Quoted 8 lines

Best regards,

Pavel Ruzicka

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to

deliver

Quoted 7 lines

higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

Signature · 15 lines
  To me vi is Zen.  To use vi is to practice zen. Every command is
  a koan. Profound to the user, unintelligible to the uninitiated.
  You discover truth everytime you use it.
                                      -- [email protected]


-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users
author
#8 lore raw

TY, up and running!

----- Original Message -----
From: "Achim Bohnet" <[email protected]>
To: <[email protected]>
Sent: Wednesday, May 12, 2004 5:47 PM
Subject: Re: [Bluez-users] DHCPD and Bluetooth

Quoted 12 lines · Rob Taft
Quoted 11 lines

I think I'm almost there.
I noticed that it is not HW based after I posted. I saw in /var/log/messages a message that occurred ever connection:

May 12 17:01:20 SMED /etc/hotplug/net.agent: invoke ifup bnep0

So I went into the net.agent file and found this line that matched the output:

debug_mesg invoke ifup $INTERFACE

Quoted 15 lines
Quoted 6 lines

I added more lines to that so now it looks like this:

if [ -x /sbin/ifup ]; then
debug_mesg invoke ifup $INTERFACE
debug_mesg LALALALALALALALALALA #ADDED THIS
exec /sbin/ifup $INTERFACE

^^^^ remove this exec!

Quoted 7 lines

debug_message Attempting to restart dhcpd. #ADDED THIS
exec /etc/init.d/dhcpd restart #ADDED THIS
else
mesg "how do I bring interfaces up on this distro?"
fi

I then restarted my entire system....and the 2nd 2 lines were never

reached.

Quoted 1 line
Quoted 1 line

I added the LALALA line after and that appears in the logs...so I'm

guessing

Quoted 21 lines
Quoted 1 line

that "exec /sbin/ifup $INTERFACE" is causing the script to exit

see man bash-builtins

Achim

Quoted 16 lines

----- Original Message -----
From: "Pavel Ruzicka" <[email protected]>
To: <[email protected]>
Cc: "Rob Taft" <[email protected]>
Sent: Wednesday, May 12, 2004 4:57 PM
Subject: Re: [Bluez-users] DHCPD and Bluetooth

Quoted 3 lines

Hello,

Quoted 1 line

restart it. I don't think hotplug is what I am looking for since it

is

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

hardware connection based.

This is not only hardware connection based. When you try setup network

from

Quoted 2 lines

remote device, that kernel call /sbin/hotplug with NET action. You can edit script "/etc/hotplug.d/default/default.hotplug" or other

in

Quoted 4 lines
Quoted 4 lines

your

Quoted 3 lines

distribution and uncomment line "DEBUG=yes export DEBUG". Later you can look in to log file for interesting messages ;-) In this case will be probably interesting script

/etc/hotplug/net.agent.

Quoted 20 lines
Quoted 20 lines
Quoted 9 lines

Best regards,

Pavel Ruzicka

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to

deliver

Quoted 7 lines

higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

Quoted 3 lines
Quoted 3 lines

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to

deliver

Quoted 20 lines
Quoted 9 lines

higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

Signature · 9 lines
  To me vi is Zen.  To use vi is to practice zen. Every command is
  a koan. Profound to the user, unintelligible to the uninitiated.
  You discover truth everytime you use it.
                                      -- [email protected]


-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to

deliver

Quoted 7 lines

higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
Bluez-users mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users