linux-wpan / wpan-tools

Userspace tools for Linux IEEE 802.15.4 stack
https://linux-wpan.org/
Other
54 stars 28 forks source link

wpan-ping with hwsim #23

Open Forty-Bot opened 10 months ago

Forty-Bot commented 10 months ago

This is more of a question than an issue, but I didn't get any response on IRC. I'm trying to get wpan-ping to work with hwsim:

$ sudo modprobe mac802154_hwsim
$ sudo iwpan dev wpan0 set pan_id 0xbeef
$ sudo iwpan dev wpan1 set pan_id 0xbeef
$ sudo iwpan dev wpan0 set short_addr 0x1000
$ sudo iwpan dev wpan1 set short_addr 0x1001
$ sudo ip link set wpan0 up
$ sudo ip link set wpan1 up
$ wpan-ping -i wpan1 -da 0x1000 &
Server mode. Waiting for packets...
$ wpan-ping -i wpan0 -a 0x1001
PING 0x1001 (PAN ID 0xbeef) 5 data bytes
Hit 500 ms packet timeout
Hit 500 ms packet timeout
Hit 500 ms packet timeout
Hit 500 ms packet timeout
Hit 500 ms packet timeout
Hit 500 ms packet timeout
^C

I can see packets on both interfaces in wireshark, but I don't see anything on the server. One odd thing I noticed is that wpan-ping always binds to 0x1000, even when I specify using wpan1.

alexaring commented 7 months ago

No idea about wpan-ping, did you tried IPv6 ping with a 6lowpan interface?

I am also not sure how you can specify the address mode short vs extended there :-/

Forty-Bot commented 7 months ago

No idea about wpan-ping, did you tried IPv6 ping with a 6lowpan interface?

Yes, this works fine. Although when running wpan-ping in a namespace I get

socket: Address family not supported by protocol

I don't particularly care about short/extended.

alexaring commented 7 months ago

Sorry, I never looked into af802154, this is a whole mess socket interface in my opinion and should be replaced to a newer one. However people still using it and I have a lot of ideas how to improve it... I am also not sure if this socket interface is even namespace aware.

I am asking regarding short/extended because somehow you need to tell wpan_ping what to use and not interpreting short address parameter as extended or vise versa.