Skip to content

add support for simulating wifi#8

Open
Quackdoc wants to merge 1 commit into
waydroid:lineage-18.1from
warlice:lineage-18.1
Open

add support for simulating wifi#8
Quackdoc wants to merge 1 commit into
waydroid:lineage-18.1from
warlice:lineage-18.1

Conversation

@Quackdoc

@Quackdoc Quackdoc commented Aug 8, 2024

Copy link
Copy Markdown

@warlice it will need some testing first

@warlice

warlice commented Aug 9, 2024

Copy link
Copy Markdown

I think it's need an auto-adjusting mechanizm like detecting the cfg80211 and virt_wifi ko, if exists, set a property into waydroid_base.prop.

@aleasto

aleasto commented Aug 10, 2024

Copy link
Copy Markdown
Member

This is not working for me:
logcat.txt

$ sudo waydroid shell -- ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: wifi_eth@if29: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:16:3e:f9:d3:03 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet6 fe80::216:3eff:fef9:d303/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0@wifi_eth: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 00:16:3e:f9:d3:03 brd ff:ff:ff:ff:ff:ff

@warlice

warlice commented Aug 12, 2024

Copy link
Copy Markdown

It lack of an automative action of connecting virtwifi.

@aleasto

aleasto commented Aug 12, 2024

Copy link
Copy Markdown
Member

I'm not sure I understand.
What do we need to do? Why is it not in this PR? Is it working for you?

Comment thread init-net.sh
Comment on lines +4 to +9
if [ ! -d /sys/class/net/wlan0 ]; then
/system/bin/ifconfig eth0 down
/system/bin/ip link set eth0 name wifi_eth
/system/bin/ifconfig wifi_eth up
/system/bin/ip link add link wifi_eth name wlan0 type virt_wifi
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs rework.

  1. Do NOT rename eth0 like that, people will not be happy to have their main ethernet connection be renamed like that.
    • Not to mention that systems can have different names instead of eth0.
      Most distros have nowerdays changed to use eno1 as default for example...
  2. Not all systems have their wifi named wlan0.
    It's better to find an automated way of finding what name the wifi card(s) use.
    Maybe something like:
    wificards=( $(iwconfig 2>/dev/null | grep 'IEEE 802.11' | cut -d ' ' -f 1) )
    for wifi in "${wificards[@]}"; do
     ...
    done

Last but not least, i would prefer it much more to use netdev files to setup this virt_wifi link.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides i don't really understand the need for all this renaming of links anyhow 🤷‍♀️

@JamiKettunen JamiKettunen Nov 21, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that part is to be moved to the host couldn't the virtual wlan setup be handled by the already existing https://github.com/waydroid/waydroid/blob/main/data/scripts/waydroid-net.sh? I'd prefer not adding dependencies on random systemd components for core fixes like "apps not detecting any networking" if that can be avoided

@TriMoon TriMoon Nov 21, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree about the place to move that part.
But strongly disagree with the "random systemd components" with same arguments for usage of non-systemd solutions on a systemd based system which most distro's use these days...

  • Pssttt they already make use of systemd stuff, see waydroid-container.service 😉

If they want to be totally politically correct they should implement all this stuff they do now in scripts, inside a compiled C++ binary that directly calls kernel functions...

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The init script is different because that's just the entrypoint and easily replicatable anywhere, if other waydroid parts depend on systemd handling something it'll just be broken elsewhere silently

@supechicken supechicken Jul 14, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TriMoon This eth0 is inside of Waydroid's own network namespace (which is a veth pair connected to the waydroid0 bridge in the host), and it is not related to the host's network devices

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@supechicken do you have this working? Can you help me understand what I'm missing?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@supechicken do you have this working? Can you help me understand what I'm missing?

I haven't started trying this yet 😅 (will leave a comment here when got progress)

@sujoshua

sujoshua commented Jan 6, 2025

Copy link
Copy Markdown

Any progress ?

@echthesia

Copy link
Copy Markdown

@aleasto I'm not sure this approach is even possible without changes to virt_wifi.ko. As best I understand from my attempts to make it work earlier, the wiphy created by the module is always created in the default (host) namespace and doesn't support being moved to the container namespace. Since the wiphy (with VirtWifi SSID, etc.) ends up on the host, at best you achieve nothing for the container and at worst you break the host's Wi-Fi connection.

@supechicken

Copy link
Copy Markdown
Contributor

Hello there, I have got mac80211_hwsim working on my A14 image (with wpa_supplicant built into the image and hostapd running in the host, connected to the existing waydroid0 bridge)
Screenshot From 2026-01-28 18-10-04

@supechicken

Copy link
Copy Markdown
Contributor

Could anyone here help me test waydroid/waydroid#2211? (Procedures are listed in waydroid/waydroid#2211 (comment))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants