cozybit / wmediumd

mac80211_hwsim modifications and related stuff
14 stars 11 forks source link

Wmediumd does not work #5

Open nachtmaar opened 8 years ago

nachtmaar commented 8 years ago

Wmedium does not work for me.

Steps to reproduce:

In different terminals:

I hope you can help me.

I use the vanilla ubuntu2 3.16.0-73-generic kernel. Also tested with Ubuntu 16.04 LTS kernel (4.x)

#
# wmediumd sample config file
#

ifaces :
{
  count = 2;
  ids = [ "42:00:00:00:00:00", "42:00:00:00:01:00" ];
};

#
# probability matrices are defined in a rowcentric way
# probability matrices are ordered from slower to fastest, check wmediumd documentation for more info
#

prob :
{
  rates = 12;
  matrix_list = (
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ] );
};

./wmediumd -c cfg-examples/allloses_2.cfg:

Input configuration file: cfg-examples/allloses_2.cfg
#_if = 2
A[0]:42:00:00:00:00:00
A[1]:42:00:00:00:01:00
[ -1.000000][  1.000000]
[  1.000000][ -1.000000]
Matrix rate = 0
[ -1.000000][  1.000000]
[  1.000000][ -1.000000]
Matrix rate = 1
[ -1.000000][  1.000000]
[  1.000000][ -1.000000]
Matrix rate = 2
[ -1.000000][  1.000000]
[  1.000000][ -1.000000]
Matrix rate = 3
[ -1.000000][  1.000000]
[  1.000000][ -1.000000]
Matrix rate = 4
[ -1.000000][  1.000000]
[  1.000000][ -1.000000]
Matrix rate = 5
[ -1.000000][  1.000000]
[  1.000000][ -1.000000]
Matrix rate = 6
[ -1.000000][  1.000000]
[  1.000000][ -1.000000]
Matrix rate = 7
[ -1.000000][  1.000000]
[  1.000000][ -1.000000]
Matrix rate = 8
[ -1.000000][  1.000000]
[  1.000000][ -1.000000]
Matrix rate = 9
[ -1.000000][  1.000000]
[  1.000000][ -1.000000]
Matrix rate = 10
[ -1.000000][  1.000000]
[  1.000000][ -1.000000]
Matrix rate = 11
REGISTER SENT!
bcopeland commented 8 years ago

It's not clear what your server and client are, but in any case, you should know that there is a newer version of wmediumd here: https://github.com/bcopeland/wmediumd that might be worth a try.

nachtmaar commented 8 years ago

Its the raw socket appliaction.

Thanks, I will give it a try :)

bcopeland commented 8 years ago

Right, I forgot that was a thing :) I removed that application from my fork, but there are some examples in the tests/ directory in my version that might help you get started with normal wireless utilities.

nachtmaar commented 8 years ago

I followed your "example session".

The join commands failed for me:

sudo iw dev wlan1 mesh join meshabc

I get the performance measurements with iperf done, but your fork also does not apply link loss with the appended config.

Any ideas?

bcopeland commented 8 years ago

I think you forgot to attach the config?

For the mesh parts, you will need to have mesh support compiled into your kernel -- I'm guessing that is the problem. You can use an AP and STA or two IBSS stations though.

nachtmaar commented 8 years ago

Here is the config file:

#
# wmediumd sample config file
#

ifaces :
{
  count = 2;
  ids = [ "42:00:00:00:00:00", "42:00:00:00:01:00" ];
};

#
# probability matrices are defined in a rowcentric way
# probability matrices are ordered from slower to fastest, check wmediumd documentation for more info
#

prob :
{
  rates = 12;
  matrix_list = (
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ],
        [ -1.0, 1.0, 1.0, -1.0 ] );
};

Hope you can help me.

bcopeland commented 8 years ago

Ah, OK, I see. In my fork I have removed the explicit probability matrix and instead set the per-rate probabilities based on a single signal level value.

By default, if unspecified, the "link" between two stations has a signal level of 30 dB and therefore no loss.

You can specify the signal level on a (symmetric) link as in the example below, which has 4 nodes. The first and last node have no connectivity (signal = 0) while the link between the first and second node has a 10 dB level (some loss), and so on.

ifaces :
{
    ids = [
        "02:00:00:00:00:00",
        "02:00:00:00:01:00",
        "02:00:00:00:02:00",
        "02:00:00:00:03:00"
    ];
    links = (
        (0, 1, 10),
        (0, 2, 20),
        (0, 3, 0),
        (1, 2, 30),
        (1, 3, 10),
        (2, 3, 20)
    );
};
nachtmaar commented 8 years ago

Still no luck.

I used this modified config for 2 radios:

ifaces :
{
    ids = [
        "42:00:00:00:00:00",
        "42:00:00:00:01:00"
    ];
    links = (
        (0, 1, 0)
    );
};
sudo ./wmediumd/wmediumd -c loss_copeland.cfg
Input configuration file: loss_copeland.cfg
#_if = 2
Added station 0: 42:00:00:00:00:00
Added station 1: 42:00:00:00:01:00
REGISTER SENT!

The ipferf runs show still 100 Mbits/sec.

I also tried a IBSS setup, same problem.

bcopeland commented 8 years ago

If you do TCP iperf without bandwidth limiting, what kind of numbers do you get? Sounds like register failed somehow and you are using mac80211_hwsim's internal forwarding.

nachtmaar commented 8 years ago
Server listening on UDP port 5001
Binding to local address 10.10.10.2
Receiving 1470 byte datagrams
UDP buffer size:  208 KByte (default)
------------------------------------------------------------
[  3] local 10.10.10.2 port 5001 connected with 10.10.10.2 port 57775
[ ID] Interval       Transfer     Bandwidth        Jitter   Lost/Total Datagrams
[  3]  0.0-10.0 sec   120 MBytes   100 Mbits/sec   0.012 ms    0/85351 (0%)
[  3] 10.0-20.0 sec   120 MBytes   100 Mbits/sec   0.012 ms    0/85445 (0%)
bcopeland commented 8 years ago

I mean iperf without -u on server, and without -u and -b 100M on the client. Anyway, I'm pretty sure that's what's happening. Does 'dmesg' show any errors?

nachtmaar commented 8 years ago

The dmesg output:

[ 5551.527477] ieee80211 phy0: mac80211_hwsim_configure_filter
[ 5657.591051] mac80211_hwsim: wmediumd released netlink socket, switching to perfect channel medium
[ 5658.332397] mac80211_hwsim: received a REGISTER, switching to wmediumd mode with pid -1241509246

Iperf unlimited has a bandwith of ~ 20.9 Gbits/sec

bcopeland commented 8 years ago

Are you sure the two devices are in separate network namespaces? That seems high even if using mac80211's in-kernel forwarding. You should only see one of the devices from 'iw' in each namespace.

nachtmaar commented 8 years ago

At least, I set them with the sudo iw phy phy1 set netns $pid command. How can I check that with the iw command?

Is the config working for you?

bcopeland commented 8 years ago

Note that "$pid" needs to be the actual pid of the bash process in the new network namespace. When you run iw dev with no arguments in the outer namespace, you should only see one of the devices; in the inner namespace (other window) you will see the other device.

An alternative is to try running cd tests; ./n-linear-mesh.sh which, provided you have tmux available, will do all the steps for you.

nachtmaar commented 8 years ago

OK. You are right, no device was in a different namespace.

I have the namespace working now and get these messages from wmediumd (current setup is IBSS mode):

[11593.028917] Station 42:00:00:00:00:00 BK 0 BE 0 VI 0 VO 0
[11593.028917] Station 42:00:00:00:01:00 BK 0 BE 0 VI 0 VO 1
cloned msg dest 42:00:00:00:00:00 (radio: 42:00:00:00:00:00) len 73
...

But iperf is not working anymore, because it has no route:

connect failed: No route to host

Moreover, the script is not working for me:

sudo ./n-linear-mesh.sh
./n-linear-mesh.sh: line 11: func: No such file or directory
duplicate session: wmediumd
./n-linear-mesh.sh: line 39: addr2phy: command not found
ls: cannot access '/sys/class/ieee80211//device/net': No such file or directory
Waiting for netns 0 -- /tmp/netns.pid.0
Waiting for  to move to netns...
Waiting for  to move to netns...
bcopeland commented 8 years ago

Oops. Yes, indeed, func is missing from repo. Will add.

Regarding lack of route, you'll need to both have delivery working (so signal > 0) and IPs assigned to both nodes so that ARP can determine the network addresses of each end.

bcopeland commented 8 years ago

Done, please repull.