I desperately want my sailfishOS phone to act as access point from specifically connecting to an existing wifi connection, and then using that connection to be the basis of creating your own wifi access point, colloquial known as “wifi repeating”.
in my investigation, i was able to make some progress on this front.
firstly, i want to address the sentiment that what i am trying to do is not possible, and that i’m wasting my time. this is bluntly false. virtually android smartphone released in the last 14 years supports this functionality (natively supported by the wifi driver).
moving on, i need to address the role of wpa_supplicant in sailfishos startup proccess.
if you are to run the command:
ps aux | grep "wpa_supp"
we see that it is this process is created at startup:
2671 root /usr/sbin/wpa_supplicant -u -c /etc/wpa_supplicant/wpa_supplicant.conf -O/var/run/wpa_supplicant -u -P /var/run/wpa_supplicant.pid
from what i gather, this is responsible for enabling “bgscan”, a process necessary for the wifi device to perform wifi scanning capabilities for the device wlan0
.
i had success killing the currently running wpa_supplicant command, and starting 2 new wpa_supplicant commands with different command line arguments. I was able to create a new wifi device called “wlan1” that has the ssid “test_ap”, and the second command restores the original functionality bgscan process needed for wlan0 to connect to wifi.
#create wlan1
/usr/sbin/wpa_supplicant -B -c /tmp/wpa_supplicant_ap.conf -O /var/run/wpa_supplicant -i wlan1
#bring up adapter scanning mechansim on interval bgscan=“simple:30:-45:300” (default)
/usr/sbin/wpa_supplicant -B -u -c /etc/wpa_supplicant/wpa_supplicant.conf -O/var/run/wpa_supplicant -u -P /var/run/wpa_supplicant.pid -i wlan0
in this state, my sailfishos device has created access point, while simultaneously be connected to the internet. In the attached picture, i see on my android 13 device, the “test_ap” access point however if fails to connect to because it fails to obtain an ip address. On my sailfishos device, i am connected to my router’s ssid “4050” and web browsing works as normal.
These are my 2 educated guesses, i am speculating on the further work needed in order for devices to be able to successfully connect to the access point sailfishos is making.
-
there needs to be some mechanism or command line connman arguments needed for wlan1 to provide a ip address to a connecting wifi device (dhcp). chatgpt also mentioned that potentially a python script can be used instead for this purpose, but i am unsure of this process.
-
there needs to be defined network routing between wlan0 and wlan1.
output of terminal:
wlan0 Link encap:Ethernet HWaddr 3C:01:EF:F1:D9:88
inet addr:192.168.1.14 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::3e01:efff:fef1:d988/64 Scope:Link
inet6 addr: 240e:3bb:2e77:fb00:3e01:efff:fef1:d988/64 Scope:Global
UP BROADCAST RUNNING MULTICAST DYNAMIC MTU:1500 Metric:1
RX packets:66 errors:0 dropped:0 overruns:0 frame:0
TX packets:87 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3000
RX bytes:8722 (8.5 KiB) TX bytes:7556 (7.3 KiB)
wlan1 Link encap:Ethernet HWaddr 3E:01:EF:78:D9:88
inet addr:192.168.27.1 Bcast:192.168.27.255 Mask:255.255.255.0
inet6 addr: fe80::3c01:efff:fe78:d988/64 Scope:Link
UP BROADCAST RUNNING MULTICAST DYNAMIC MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:3 overruns:0 carrier:0
collisions:0 txqueuelen:3000
RX bytes:0 (0.0 b) TX bytes:460 (460.0 b)
[root@Xperia10III defaultuser]# ping -I wlan1 192.168.1.14
PING 192.168.1.14 (192.168.1.14): 56 data bytes
^C
— 192.168.1.14 ping statistics —
3 packets transmitted, 0 packets received, 100% packet loss
[root@Xperia10III defaultuser]#
i need help creating routes between wlan1 and wlan0.
i have made a bash script (insert below) that replicates all the commands needed in order to get where i am at. Also i want to say that rebooting your device will revert all changes as nothing in my script is permanent.
#script start
rm -f /tmp/wpa_supplicant_ap.conf #ensure file does not exist
echo ‘ctrl_interface=/var/run/wpa_supplicant’ > /tmp/wpa_supplicant_ap.conf
echo ‘ctrl_interface_group=0’ >> /tmp/wpa_supplicant_ap.conf
echo ‘update_config=1’ >> /tmp/wpa_supplicant_ap.conf
echo ‘’ >> /tmp/wpa_supplicant_ap.conf
echo ‘network={’ >> /tmp/wpa_supplicant_ap.conf
echo ’ mode=2’ >> /tmp/wpa_supplicant_ap.conf
echo ’ ssid=“test_ap”’ >> /tmp/wpa_supplicant_ap.conf
echo ’ frequency=2412’ >> /tmp/wpa_supplicant_ap.conf
echo ’ key_mgmt=WPA-PSK’ >> /tmp/wpa_supplicant_ap.conf
echo ’ psk=“12345678”’ >> /tmp/wpa_supplicant_ap.conf
echo ‘}’ >> /tmp/wpa_supplicant_ap.conf
#showcase instance of wpa_supplicant is running
ps aux | grep “wpa_supp”
#kill the instance of wpa_supplicant
pkill wpa_supplicant
iw dev wlan0 interface add wlan1 type __ap addr 12:34:56:78:ab:ce
ifconfig wlan1 192.168.27.1 up #attempting to give it networking
#create wlan1
/usr/sbin/wpa_supplicant -B -c /tmp/wpa_supplicant_ap.conf -O /var/run/wpa_supplicant -i wlan1
#bring up adapter scanning mechansim on interval bgscan=“simple:30:-45:300” (default)
/usr/sbin/wpa_supplicant -B -u -c /etc/wpa_supplicant/wpa_supplicant.conf -O/var/run/wpa_supplicant -u -P /var/run/wpa_supplicant.pid -i wlan0
#toggle wifi on and off (necessary)
dbus-send --system --print-reply --dest=net.connman /net/connman/technology/wifi net.connman.Technology.SetProperty string:“Powered” variant:boolean:false
dbus-send --system --print-reply --dest=net.connman /net/connman/technology/wifi net.connman.Technology.SetProperty string:“Powered” variant:boolean:true
echo “now we see test_ap is online”
#script end
any help and investigation into this matter would be greatly appreciated!