Raizo62 / vwifi

Simulator of WiFi (802.11) interfaces to communicate between several Virtual Machines
GNU Lesser General Public License v3.0
57 stars 8 forks source link

OpenWRT X86_64 porting #2

Closed nickbash11 closed 3 years ago

nickbash11 commented 3 years ago

I get an unsolvable situation during attempt to compile vwifi on OpenWRT SDK. So yes, I've create a Makefile, and you can see it in my git repository But it has missing libraries, which do not present in openwrt packages:

Package vwifi is missing dependencies for the following libraries: libc.so.6 libm.so.6 libpthread.so.0

vwifi.log But those are presented in SDK directory openwrt-sdk-19.07.4-x86-64_gcc-7.5.0_musl.Linux-x86_64/staging_dir/host/lib/

Could you help me to solve this issue?

Raizo62 commented 3 years ago

Hi

I works on a branch to compile vwifi on OpenWRT. It works. I will push the branch (as soon as possible).

For libnl, i have cross compiled the files of Debian. I will put the method on the wiki. Or have you a better idea ?

nickbash11 commented 3 years ago

No, I have no idea, I've just tried to run it with static method by copying files to OpenWRT virtual machine, but it persistently does not find the libstdc++.so.6 :( https://paste.ubuntu.com/p/hVN4jqW9jH/

nickbash11 commented 3 years ago

Ok, it worked when I put all missing libraries to the dir with strange path "/###" , if it matters.

Screenshot_2020-09-15_17-33-09

I will be waiting for your branch! Thanks in advance!

Raizo62 commented 3 years ago

vwifi-server is useless on OpenWRT. You must run vwifi-guest

Raizo62 commented 3 years ago

the branch "openwrt" is push

nickbash11 commented 3 years ago

vwifi-server is useless on OpenWRT. You must run vwifi-guest

Why? I am going to connect two-more OpenWRT nodes in virtualbox, do I have to start vwifi-server on the host system anyway?

Raizo62 commented 3 years ago

You are right. You can start vwifi-server on OpenWRT, but you can also start it on other Linux. But you must start vwifi-guest on OpenWRT.

nickbash11 commented 3 years ago

It is really weird, I had to add a directory with strange name "###" and put all links to libs, otherwise it does not find anything. Something wrong with toolchain maybe...

nickbash11 commented 3 years ago

You are right. You can start vwifi-server on OpenWRT, but you can also start it on other Linux. But you must start vwifi-guest on OpenWRT.

Ok, I start vwifi-server on one node, and start vwifi-guest on the other node? The last one will be connect to vwifi-server (via IP I think), am I right?

Raizo62 commented 3 years ago

No. vwifi-server is like a hub/switch. vwifi-guest must be started on each OpenWRT. The 2 vwifi-guest must connect to vwifi-server via IP (I don't know how to start VHost on OpenWRT)

Raizo62 commented 3 years ago

The wiki to compile vwifi on OpenWRT : https://github.com/Raizo62/vwifi/wiki/Install-on-OpenWRT It's not over yet, but it can help you

nickbash11 commented 3 years ago

No. vwifi-server is like a hub/switch. vwifi-guest must be started on each OpenWRT. The 2 vwifi-guest must connect to vwifi-server via IP (I don't know how to start VHost on OpenWRT)

I understood from this point.

nickbash11 commented 3 years ago

Screenshot_2020-09-15_21-19-28 oops! :(

Raizo62 commented 3 years ago

You have use the wiki to build vwifi-guest ?

nickbash11 commented 3 years ago

You have use the wiki to build vwifi-guest ?

Wow, Sorry, I did not get it right away. I will try it for tomorrow

nickbash11 commented 3 years ago

What do I need to do after libnl built? vwifi did not compile on OpenWRT because include files (netlink) does not exist.

nickbash11 commented 3 years ago

Ok, it was very struggled... After this point https://github.com/Raizo62/vwifi/wiki/Install-on-OpenWRT#compilation-of-libnl-for-openwrt you have to copy includes and libraries to OpenWRT /usr/lib and then create libpthread.a

libnl-3.a
libnl-3.la
libnl-cli-3.a
libnl-cli-3.la
libnl-genl-3.a
libnl-genl-3.la
libnl-idiag-3.a
libnl-idiag-3.la
libnl-nf-3.a
libnl-nf-3.la
libnl-route-3.a
libnl-route-3.la
libnl-xfrm-3.a
libnl-xfrm-3.la

after that I could only execute make and it has assembled

Screenshot_2020-09-16_12-29-56

nickbash11 commented 3 years ago

Now I am going to do some tests and then the question how to create a package ipk through SDK will still remain for me, though I can make it as a static precompiled binaries...

nickbash11 commented 3 years ago

Something wrong, I connected 3 machines, two are debian and one is openwrt (virtualbox)

$ ./vwifi-ctrl show
PacketLoss : Disable
Host : Connected
----------------
[15114](10,10,10)
[108736](10,10,10)
[113600](10,10,10)

Two of them are in 802.11s (mesh point) mode, and one is the monitor. And packets do not travel between them :( What can I do?

nickbash11 commented 3 years ago

Furthermore, if I connect two OpenWRT virtualbox then I get errors: Screenshot_2020-09-16_16-43-08

Raizo62 commented 3 years ago

I have see strange behavior in OpenWRT, that, now, i can't explain. In my tests, OpenWRT was the AP and a Debian was a client. Often, OpenWRT deleted a wlan interface as soon as i configured it. I haved not this case if OpenWRT was the client and the Debian the AP. After this success, I was able to configure OpenWRT as an AP. Perhaps OpenWRT must be reboot after the install of kmod-mac80211-hwsim

nickbash11 commented 3 years ago

I would be happy if it worked at least on debian. Try to test again with a fresh brain, might be I did something wrong

nickbash11 commented 3 years ago

I confirm, it works between two debian nodes! I use 802.11s (MESH) protocol, nodes see each other and can ping. But OpenWRT connects shortly and even displays in station dump table, but every time it reconnects with an error message:

Error - recieved no frame data in message

Raizo62 commented 3 years ago

I have updated the wiki.

Have you tested to use the Debian as AP and OpenWRT as Client. When it works, you transform OpenWRT like AP ?

I have success to use OpenWRT as AP with WPA2/WPAEntreprise

nickbash11 commented 3 years ago

I have updated the wiki.

I did

Have you tested to use the Debian as AP and OpenWRT as Client. When it works, you transform OpenWRT like AP ?

I have setup an AP on OpenWRT:

root@OpenWrt:~# iw dev
phy#1
    Interface wlan1
        ifindex 5
        wdev 0x100000001
        addr 02:00:00:00:01:00
        type managed
        txpower 0.00 dBm
phy#0
    Interface wlan0
        ifindex 8
        wdev 0x2
        addr 00:00:00:ff:ff:ff
        ssid OpenWrt
        type AP
        channel 6 (2437 MHz), width: 20 MHz (no HT), center1: 2437 MHz
        txpower 20.00 dBm

and connected it to the vwifi-server, it's ok when the "radio broadcast" keeps silence, but when I do something like "iwlist wlan0 scan" on the other side, (e.g. generate any packets) OpenWRT begins to reconnect with Error - recieved no frame data in message

nickbash11 commented 3 years ago

I even can see it through airodump-ng wlan0

Screenshot_2020-09-17_20-45-31

Raizo62 commented 3 years ago

Where is your vwifi-server ? The TCP communications between the vwifi-guest and vwifi-server are stables ?

nickbash11 commented 3 years ago

Where is your vwifi-server ?

There is where the virtualbox machine

The TCP communications between the vwifi-guest and vwifi-server are stables ?

Certainly, I was connected to it via ssh at that moment.

Debian works fine with the same configuration.

nickbash11 commented 3 years ago

Could I give you the Virtualbox image with openwrt? You would see how it is

Raizo62 commented 3 years ago

Yes, you can.

nickbash11 commented 3 years ago

https://www.filedropper.com/openwrt-19 It is the first file hosting which I found in google.

There are two network cards attached as bridges in that machine (for eth0 and eth1 accordingly).

Raizo62 commented 3 years ago

Sorry :

nickbash11 commented 3 years ago

what is the password of root ?

root password is "password" :) I usually use it through virtualbox screen, there you can change the password.

when i go on http://192.168.1.1 , i have the web explorer of files and not the web interface

Hmm, I do not use web interface as a rule, just do not know it works or not.

nickbash11 commented 3 years ago

You'll find all need files in /root directory

Raizo62 commented 3 years ago

Sorry, i don't know how to configure Wifi on OpenWRT without web interface, then I can't test.

The mine is OpenWrt 19.07.3, r11063-85e04e9f46. Yours is 19.07.4. I don't know if you changed anything on your version of OpenWRT ; or perhaps they have modify something, But files are missing for the web page

nickbash11 commented 3 years ago

Sorry, i don't know how to configure Wifi on OpenWRT without web interface, then I can't test.

There is already configured as open with name Openwrt

The mine is OpenWrt 19.07.3, r11063-85e04e9f46. Yours is 19.07.4.

Ok, I'll try exact 19.07.03 r11063-85e04e9f46 and then write about results.

nickbash11 commented 3 years ago

This time I was strictly followed the rules from wiki (with version), and got the same behavior when I did scanning from the other machine. This machine has web interface and root password is password , all files are in the root directory as well.

http://www.filedropper.com/openwrt-19073

nickbash11 commented 3 years ago

Screenshot_2020-09-19_17-51-55

Raizo62 commented 3 years ago

I have tested your VM. OpenWRT was the Open AP and a Debian was the Client. The Debian got his IP by DHCP.

Where is your vwifi-server ?

(With my test, the Debian and the vwifi-server use the beta branch. But, I guess it doesn't change anything)

nickbash11 commented 3 years ago

Hmmm, I've tried vwifi server on two different PCs, one is my laptop and the other is PC with Kali linux, there are where virtual machines running.

So, tomorrow I will try to run vwifi-server on virtualbox with debian. By the way, what debian version do you use?

Raizo62 commented 3 years ago

Kali Linux is like Debian. VWifi works on it.

With my test, OpenWRT and Debian were VM, and vwifi-server was on the hypervisor (Debian Buster)

Raizo62 commented 3 years ago

Are you sure that your IP network of Wifi is not in conflict with the IP network of vwifi programs ?

Raizo62 commented 3 years ago

For vwifi programs on Debian like, you should perhaps use the beta branch

nickbash11 commented 3 years ago

For vwifi programs on Debian like, you should perhaps use the beta branch

Yes, I did it and it works properly

Raizo62 commented 3 years ago

For vwifi programs on Debian like, you should perhaps use the beta branch

Yes, I did it and it works properly

With OpenWRT ? or only between Debian like ?

nickbash11 commented 3 years ago

With OpenWRT ? or only between Debian like ?

I've tested ping with OpenWRT as two mesh nodes (IEEE802.11s), and OpenWRT as an AP with debian as a client. Both case show me that icmp packets more than 830 and 854 bytes (mesh and AP) do not pass through virtual wifi connection.

Screenshot_2020-09-20_14-21-23

One of the host starts to reconnect every time when the packet does not fit in

You can try it with command: ping -s 1000 ap_openwrt_host

I have not tried it between two debian-like OS so do not know

Raizo62 commented 3 years ago

I have not tested but, in src/types.h , try to change "typedef unsigned short TMinimalSize;" in "typedef unsigned int TMinimalSize;"

nickbash11 commented 3 years ago

It does not help. Perhaps it is the matter for the other issue. Was it tested ever?

Raizo62 commented 3 years ago

You can try it with command: ping -s 1000 ap_openwrt_host

I can reproduce the deconnection. I will see what i can do.

Raizo62 commented 3 years ago

To test :