OpenTollGate / TollGateNostrToolKit

5 stars 1 forks source link

Automatically start/stop WiFi #26

Closed chGoodchild closed 1 month ago

chGoodchild commented 1 month ago

TODO: Random IP address...

chGoodchild commented 1 month ago

TODO: Random IP address...

Created a separate issue for this: https://github.com/OpenTollGate/TollGateNostrToolKit/issues/27

chGoodchild commented 1 month ago

TODO:

chGoodchild commented 1 month ago

6ef91a73e51525965604dc4999cba54d2a049112

Only the DHCP lease fix needs to be simplified now...

chGoodchild commented 1 month ago

Turns out that DHCP wasn't fixed in 6ef91a73e51525965604dc4999cba54d2a049112 either..

chGoodchild commented 1 month ago

Need to check 28156e074b2a2f498c3b1cffafb434b04a461080 again..

chGoodchild commented 1 month ago

Need to check 28156e0 again..

28156e074b2a2f498c3b1cffafb434b04a461080 works...

chGoodchild commented 1 month ago

Latest hotspot manager: 2c4af36f2b0b2ea3fe977f7044e85ea06e9ae1e5

chGoodchild commented 1 month ago

DHCP works in commit 28156e074b2a2f498c3b1cffafb434b04a461080 , which is almost the same as commit 12c30aef294964ab6a6b8e3a52473f50967602b7 , but it doesn't work in 12c30aef294964ab6a6b8e3a52473f50967602b7...

Will reset everything to 28156e074b2a2f498c3b1cffafb434b04a461080 and work forwards... Latest hotspot manager: 2c4af36f2b0b2ea3fe977f7044e85ea06e9ae1e5 Latest first-boot-script, dhcp-lease-fix and setup_vpn: 12c30aef294964ab6a6b8e3a52473f50967602b7

chGoodchild commented 1 month ago

Wow! 2ac6028708df070b1280d947b9b6add42fa16c6c doesn't work even though 28156e074b2a2f498c3b1cffafb434b04a461080 does. The only difference is that dhcp_lease_fix.sh is on the filesystem, but it isn't being used...

chGoodchild commented 1 month ago

According to diff there are differences between dcdc8096cf9c2d901de58c0e6c1702f7c6326ec9 and 28156e074b2a2f498c3b1cffafb434b04a461080 , but dcdc8096cf9c2d901de58c0e6c1702f7c6326ec9 doesn't give me a DHCP lease on first boot and 28156e074b2a2f498c3b1cffafb434b04a461080 does.

Will build dcdc8096cf9c2d901de58c0e6c1702f7c6326ec9 from scratch to see what happens...

chGoodchild commented 1 month ago

Built dcdc8096cf9c2d901de58c0e6c1702f7c6326ec9 from scratch and it still doesn't get a DHCP lease on firstboot.

$ git log
commit dcdc8096cf9c2d901de58c0e6c1702f7c6326ec9 (HEAD -> 22-manage-wifi, origin/22-manage-wifi)
$ git diff 28156e074b2a2f498c3b1cffafb434b04a461080

No diff to 28156e074b2a2f498c3b1cffafb434b04a461080 !

chGoodchild commented 1 month ago

It seems to depend on the order in which commits are built and whether they are built from scratch or not. I compiled 28156e074b2a2f498c3b1cffafb434b04a461080 after compiling dcdc8096cf9c2d901de58c0e6c1702f7c6326ec9 from scratch and 28156e074b2a2f498c3b1cffafb434b04a461080 no longer gives me a DHCP lease. However, earlier it did give me a DHCP lease every time I reverted to that commit and I compiled it (not from scratch though).

I will compile 28156e074b2a2f498c3b1cffafb434b04a461080 from scratch now to verify that I don't get a DHCP lease in this commit and that it must have worked by coincidence due to something that was still left in the openwrt build directory from earlier commits (before 28156e074b2a2f498c3b1cffafb434b04a461080).

I'm re-flashing with sysupgrade -n by the way...

chGoodchild commented 1 month ago

It seems to depend on the order in which commits are built and whether they are built from scratch or not. I compiled 28156e0 after compiling dcdc809 from scratch and 28156e0 no longer gives me a DHCP lease. However, earlier it did give me a DHCP lease every time I reverted to that commit and I compiled it (not from scratch though).

I will compile 28156e0 from scratch now to verify that I don't get a DHCP lease in this commit and that it must have worked by coincidence due to something that was still left in the openwrt build directory from earlier commits (before 28156e0).

I'm re-flashing with sysupgrade -n by the way...

Confirmed, 28156e074b2a2f498c3b1cffafb434b04a461080 doesn't give me a DHCP lease after compiling from scratch...

chGoodchild commented 1 month ago

Double check before merge.

Test results for 904a0019b5a6227871fa3f64a076f8a372a39134 :

Network restart issues:

oot@OpenWrt:~#         check_network() {
>             ping -c 1 8.8.8.8 >/dev/null 2>&1
>         }
root@OpenWrt:~# check_network
root@OpenWrt:~# check_network | echo

root@OpenWrt:~#             ping -c 1 8.8.8.8 >/dev/null 2>&1
root@OpenWrt:~#             ping -c 1 8.8.8.8 >/dev/null
root@OpenWrt:~#             ping -c 1 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=114 time=143.336 ms

--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 143.336/143.336/143.336 ms
chGoodchild commented 1 month ago

Postponing "use npub instead of MAC address if the npub is available" to a later feature, because this branch needs to be closed at some point and I don't want to test everything again from scratch..