If it weren't for cgorac, who probably just registered to the forum and was, like me in need of a bluez related help, I wouldn't manage it at all. Frankly I've just given up when suddenly... But let me give it to you as it should be given - in order.
I made a fresh install, so this should be easy to follow.
1. to make bluetooth services start on boot, you'll need to make /etc/rc.d/rc.bluetooth executable
chmod u+x /etc/rc.d/rc.bluetooth
2. set your default key (1234 or whatever you like)
echo -n "1234" >/etc/bluetooth/passkeys/default
3. change your /etc/dbus-1/system.d/bluetooth.conf to allow passkey agent access to dbus (add the red marked line)
<!-- This configuration file specifies the required security policies
for Bluetooth core daemon to work. -->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
<!-- ../system.conf have denied everything, so we just punch some holes -->
4. reboot now to make sure the dbus configuration change is loaded
5. After reboot the bluetooth services should be running. To pair your device (desktop, laptop, phone...) provoke the bonding by initiating an obex connection form the computer to the device
5.1 First find out the MAC of the device
you should obtain an address of the device
5.2 start the obex connection
obexftp -b <insert address of the device here> -l
you will be prompted to insert a passkey on you device, insert the one you've set in step 2.
5.3 You should be all good now! Your device is paired.
If you'd like to setup your computer as a NAP, read on.
Some time ago, BlueZ switched from dedicated daemons (like pand) to plugins (like network.so). The only problems are that they either don't work, or I just couldn't find a way how to make them work and even worse, they tend to make the old "legacy" deamons unusable by blocking a socket they use. So how can you solve this? Read on!
6. There are 2 ways to disable the "new" service plugins, like network.so. First is to recompile - this is a nice way, on the other hand, you might break something and lose some functionality by not specifing correct configure parameters or omitting some. Do that if you know exactly what you are doing. I on the other hand have already broken so many BlueZ installations that I don't dare anymore. I'll go the nasty way
6.1 switch to plugins directory
and you'll see them there. Your arch enemy is network.so and network.la. Rename them. hcid will be very sad that he can't find them and load them and will probably rant about that, but that is his problem, not mine. And you will be able to use the good old pand daemon again.
7. make a "devup" executable file, this will bring your bnep0 interface up assign an IP to it and allow packet forwarding. You can create it wherever you like, just make it owned and executable by root and don't forget to use the whole path to it in step 8 below.
my devup looks like this. Seen it on a gentoo page and works flawlessly for me. This requires some basic knowledge of networking. If you undrestand the code below, you should be able to change it to your liking
echo 1 > /proc/sys/net/ipv4/ip_forward
ifconfig bnep0 192.168.0.2 up
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
iptables -A FORWARD -i bnep0 -o eth0 -j ACCEPT
iptables -A FORWARD -o bnep0 -i eth0 -j ACCEPT
make it executable
chmod u+x /etc/bluetooth/pan/devup
8. enable pand in /etc/rc.d/rc.bluetooth.conf and set the command options. You'll find it just at the bottom of the config file. Mine look like this
# The PAN daemon is used to setup a Bluetooth network.
PAND_OPTIONS="--listen --role NAP --devup /etc/bluetooth/pan/devup --persist"
9. restart bluetooth services
10. You are done! Next time your device connects, a bnep0 interface with an assigned IP becomes available on your computer and will be able to forward packets to and from your device. Just make sure you configure your PANu side (another computer or phone) to have an IP from the same subnet as bnep0 and the same DNS server as yours in /etc/resolv.conf.
Last but not least I'd like to thank everyone who made this possible, it's too many of you, most of you are already forgotten names from various forums I've read in the past 2 weeks. If you see something you feel was your idea and would like some credit for it, let me know. Or just feel happy you've helped. I am not taking credit for any of this, I am just glad I got it working. I hope it will help others, too