Repository navigation
omamobile-shell 0.2.143 and omamobile-device-husky 0.1.22: a shared hotspot on ap0 for #539's Hotspot page, used by the Pixel 8 Pro - #1001
Conversation
The Hotspot tile only switched the hotspot on and off; its long-press opened the Wi-Fi picker, which says nothing about the hotspot itself. The tile now has a chevron, like Wi-Fi and Bluetooth, and behind it a page (HotspotPanel.qml): the switch with the number of connected devices, the network name and the password (hidden, an eye shows it), a QR code that joins another phone (the usual WIFI: string, drawn with qrencode, now a dependency), and a pencil that makes name and password editable; a running hotspot restarts with the new values. Data and actions go through hotspot-panel.sh next to the page, as the tiles' tile-state.sh and tile-action.sh. It reads NetworkManager's "Hotspot" connection (the one tile-action.sh makes) and changes it with `nmcli connection modify`. Two more boxes, "Share VPN" (devices on the hotspot reach what the phone's VPN reaches) and "Route all traffic through the VPN", are drawn only when the backend reports them: NetworkManager's shared mode has no such switch, so they stay hidden there. A device that brings its own hotspot (hostapd, its own firewall) can answer the page's verbs from an executable at /etc/omamobile/hotspot-backend (or ~/.config/omamobile/hotspot-backend) and gets the boxes; the script still adds the QR code for it. This is what the Pixel 9a runs today (its hotspot is hostapd on ap0, derekross#523), so the whole page, boxes included, was used there; the NetworkManager path is covered by the test. The page is a layer-shell window of its own, like the Wi-Fi picker, with the same back glyph, and `omarchy-shell shell summon omamobile.quicksettings '{"page":"hotspot"}'` opens it. Tests: test/hotspot-panel.sh (the NetworkManager state line, the QR code drawn once and dropped after a change, name and password checks, a change on a running and on a stopped hotspot, the VPN boxes refused there, no qrencode, a device's own backend), and test/all checks that the tile's chevron opens the page, that the page runs the script next to it and that the password field is masked. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01176vSgL9PRmxFqbaB3D9vk
- shareAvailable starts false and only a backend's share_available: true shows the VPN boxes, so they no longer flash on open or stay when the state line can't be parsed. - "Shares mobile data only." is no longer shown for every backend: a backend that knows says where its devices' traffic goes in a new optional uplink_note; NetworkManager's gives none (its devices follow the phone's default route, a full-tunnel VPN included), and the stopped hotspot reads "Shares the phone's internet connection over Wi-Fi." - qrencode gets the WIFI: string on stdin, keeping the password out of /proc/*/cmdline; the unused qr_escape() is gone. - README: a Hotspot page section on hotspot-panel.sh and where a device's hotspot-backend comes from. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The owner asked that the full-screen pages behind quick settings' tiles close the same way. The Wi-Fi and Bluetooth pages get a swipe-up strip at their bottom edge in derekross#553; the Hotspot page now has the same one: max(28, Style.space(36)) high, a swipe up past 24 px closes it, and the page's body ends above the strip, so nothing on the page lies under it. test/all on a PC: 304 ok. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…de fake tells arguments from stdin Review of derekross#539. tests/grep-q-pipes (derekross#587) refuses a pipe into grep -q in a script that sets pipefail: grep -q exits at the first match, the writer can get SIGPIPE, and pipefail then fails the pipeline at random. test/hotspot-panel.sh had eleven; they now use grep -c ... >/dev/null, which reads all its input. The fake qrencode logged its arguments and its stdin on one line, so the check that the WIFI: string goes to qrencode on stdin passed either way. It now writes "qrencode args:" and "qrencode stdin:" lines, and the test checks that the string arrives on stdin, that the arguments are only the options, and that the string is never an argument (it would show in /proc/*/cmdline). With the script changed to pass the string as an argument, the old test still passed and the new one fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main is at omamobile-shell 0.2.115; this branch takes 0.2.116 so the version file no longer conflicts and CI runs again. The final number is set at merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…spot-page-wt # Conflicts: # packages/omamobile-shell/version
- Escape on the Hotspot page ends the name and password edit, else goes back to quick settings (`root.backRequested()`), as the Wi-Fi, Bluetooth and Record pages do. The scrim tap and the swipe strip still close. - `test/all` checks it with the Wi-Fi and Bluetooth pages, and `plugins/README.md` names the Hotspot page among the ones that go back. - Opening the quick settings sheet closes the Hotspot page too, so pulling the sheet down over an open one leaves nothing behind it. - `OMAMOBILE_HOTSPOT_SYSTEM_BACKEND` names the system backend's path (default /etc/omamobile/hotspot-backend); the test points it into its scratch directory, so it no longer depends on the machine it runs on, and checks the owner's backend goes before the system one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
896a1f1 to
2b3869c
Compare
|
@Somnius, thanks for building this on #539, and for taking the system-path variable along. My push for #539 (Escape goes back to quick settings, the page closes when the sheet opens, and the variable, with the same line as yours) is ready; once it is up you can drop your copy when you rebase. The 9a needs exactly this: the same Three things from the 9a run that touch this PR:
Measured on my phone with Claude. |
2b3869c to
7dee3ab
Compare
…he tile through a device's backend brcmfmac on the Pixel 8 Pro and the 9a refuses AP mode on wlp1s0 (-52). On a second interface ap0 an access point works, and clients join once the profile has pmf 3: the AP's RSN IE from the firmware offers PSK-SHA256 only, while NetworkManager with pmf 1 or 2 gives wpa_supplicant PSK and PSK-SHA256 (derekross#523). So the shell carries one hotspot for such phones: hotspot/hotspot-ap (as root, omamobile-hotspot.service) adds ap0 beside the client Wi-Fi, binds the Hotspot profile to it with pmf 3 on 2.4 GHz, opens DHCP, DNS and forwarding on ap0 in UFW, turns IPv4 forwarding on per link for ap0 and the uplinks that had it off (NetworkManager doesn't for an uplink it doesn't manage, such as the 9a's rmnet0) and sets it back after, keeps a client list, and removes ap0 on stop. hotspot/hotspot-backend answers device package ships /usr/share/omamobile/hotspot.conf, and the device package links /etc/omamobile/hotspot-backend; polkit lets the active local user start and stop that one unit. No VPN sharing or client isolation yet. The heat stop is off by default (stop_temp_mc=). The page handed state, set, share and alltraffic to a device backend, but on and off still went through the tile to nmcli device wifi hotspot. Now tile-action.sh goes through hotspot-panel.sh for those too, which uses the backend when there is one and NetworkManager otherwise, and tile-state.sh reads the tile's state from the backend's "active". Signed-off-by: Lef <me@lefteros.com>
The 8 Pro can't start an access point on wlp1s0 (derekross#523), so it opts in to omamobile-shell's shared hotspot: /usr/share/omamobile/hotspot.conf with interface=ap0, and the /etc/omamobile/hotspot-backend link the Hotspot tile and page look for. Depends on omamobile-shell 0.2.143 and the tools the helper runs (iw, iproute2, NetworkManager, dnsmasq, polkit). Signed-off-by: Lef <me@lefteros.com>
7dee3ab to
badef05
Compare
|
@den-kloot thanks, and great to see it work on the 9a with an iPhone. One place for both phones: done. On your 1 (mobile data): I added it before your check. While the hotspot runs, the helper turns IPv4 forwarding on per link for On your 2 (which networks the clients reach): I'd keep that for a follow-up, with VPN sharing on top as you suggest. I don't want to grow this one more before it has run on a phone. For now the PR and the husky README say a hotspot client can reach the home LAN. Your note in #523 about re-activation dropping the table's routes and On your 3: fixed. The shared header now says the client Wi-Fi can drop for a few seconds and move to the hotspot's channel depending on the phone, and the 8 Pro specifics are in its README. I rebased on your #539 push (38c6c86) and dropped my copy of the system-path variable, so the branch now uses yours, and your two tests for it replace mine. The shell is 0.2.143 here (#539 and #977 both use 0.2.142), Derek sets the real numbers at merge anyway. Not tested yet: this branch installed on any phone. |
|
@Somnius, the 9a run I promised, on your head Setup. Pixel 9a, 1. The start fails with the profile and NetworkManager gives up 25 s later ("Hotspot network creation took too long, failing activation"). The profile has the same code started the access point in 7.2 s, and in 6.6 s on a restart. So 2. With that, a client gets out through mobile data. The iPhone joined by itself 15 s after the start, was authorized, got 10.42.0.176 from NetworkManager's dnsmasq and sent 52 DNS packets to the phone. Forwarded: 487 packets 3. The verbs. As the session user, no prompt from polkit for start or stop.
4. Smaller things.
Not covered: the phone's own Wi-Fi connected beside I can send the tegu side (the Measured on my phone with Claude. |
…FW rules left alone, no forwarding on linkdown links From den-kloot's run on the Pixel 9a (derekross#1001): - A profile the backend makes had key-mgmt wpa-psk and pmf 3 but no proto, pairwise or group, and wpa_supplicant failed with "Could not generate WPA IE": NetworkManager passes PSK-SHA256 only with pmf 3, and without proto rsn it also builds a WPA v1 element. The backend now makes the profile with proto rsn, pairwise ccmp and group ccmp, and hotspot-ap sets the same when it binds a profile to ap0. - ufw_del deleted the hotspot's rules by spec, which also takes an owner's own equal rule. It now only deletes rules tagged omamobile-hotspot, by number. And ufw_add doesn't add a rule the owner already has untagged on the interface, since ufw would put our comment on theirs and the stop would then delete it. - uplinks took every link with a default route, including one marked linkdown (usb0 with no cable). Those are skipped now. Signed-off-by: Lef <me@lefteros.com>
|
@den-kloot thanks a lot for this run, it's exactly what I couldn't do here: mobile data, a clean firewall and an iPhone. Good to see the per-link forwarding is what carries the replies on the 9a.
The new checks for 1, 3 and the owner-rule skip fail with the old code swapped back in, and so does the no-delete-by-spec check. And yes please to the tegu side on top, and the routing table and VPN sharing after that. |
derekross
left a comment
There was a problem hiding this comment.
Thank you, Lef, and thank you @den-kloot for the 9a run with an iPhone over mobile data, which answered the questions I would have asked about forwarding. The shape is right: one helper for both phones, opted into by a file only the device package ships, a polkit rule for one unit and two verbs, cleanup in ExecStopPost, and forwarding turned on per link and put back. I checked that on a phone with no backend the tile now runs the same nmcli commands as before, so the other phones should see no difference; I'll confirm that on my 7 Pro.
Before this leaves draft:
- It goes in after #539. Once #539 is squashed, this branch needs
git rebase --onto origin/main 38c6c86ae925, so only your three commits are left. - Your 8 Pro run from the built packages, through the unit and the page with a client, with a
tools/phone-smokereport and screenshots, as you said. - Two things that are mine to decide, and I'll answer here: whether the root helper and the polkit rule live in omamobile-shell or in a small package of their own (thank you for offering to split it), and whether a hotspot that lets its clients reach the home network can ship before den-kloot's routing-table follow-up. I lean towards a separate package, and I'll confirm.
Small: omamobile-device-husky 0.1.22 is also taken by #997, and the husky package's omamobile-shell>=0.2.143 names a number another open PR claims; I'll set both numbers at merge and keep the dependency equal to the shell this PR lands with.
|
Decisions: (1) the root networking helper and its polkit rule go in a small opt-in package of their own, not omamobile-shell, so the root surface is only on phones that ask for it. Thank you for offering the split. (2) A hotspot whose clients can reach the owner's home network doesn't ship. It waits for den-kloot's routing follow-up that isolates the clients. |
… an opt-in package of their own The helper, its backend, omamobile-hotspot.service, the polkit rule and their tests move out of omamobile-shell into packages/omamobile-hotspot (installed under /usr/lib/omamobile-hotspot/), so omamobile-shell ships no root helper and only phones whose device package asks for it get that surface. The tools the helper runs (iw, iproute2, networkmanager, dnsmasq, polkit, ufw optional) move from omamobile-device-husky to it; husky depends on omamobile-hotspot and its link points at the new path. The README says plainly that clients can reach the networks the phone is on until client isolation lands. Signed-off-by: Lef <me@lefteros.com>
The package would be built and pulled in by husky once merged, so the gate for client isolation is the pull request itself, not publishing. Signed-off-by: Lef <me@lefteros.com>
|
Thanks @derekross. (1) is done in 2d0ff66 and fc00643: One question: the hotspot rule is still the YES rule for start/stop of this one unit. After your #1009 (#1009) decision, should it ask for the PIN too ( On (2): understood, it doesn't ship while clients can reach the home network. I'll leave this as a draft until the isolation is in. @den-kloot, how do you want to go about the routing follow-up? I have a VPN sharing branch here that touches the same place, so I'd rather we agree who does what before either of us writes more. Tested in the Arch CI container as uid 1000: |
derekross
left a comment
There was a problem hiding this comment.
Thank you, Lef. The split is what I asked for, and I checked it file by file: the helper and the backend moved into omamobile-hotspot unchanged, the unit and the polkit rule with them, the shell no longer ships any of it, and the Pixel 8 Pro's package now brings it in by depending on it. Both packages' tests pass here on this head. Keeping it a draft until the clients are isolated is right, and thank you for saying so in the README as well.
On your question about the PIN: by the same reasoning as #1009, starting the hotspot opens DHCP, DNS and forwarding through the firewall on a new interface, and today any process in the session can do that without asking. I lean towards auth_admin_keep for start (stop can stay as it is, since it only closes things), and I'll confirm here before you change it.
Otherwise the list from last time stands: the isolation follow-up (I'll leave the who-does-what to you and @den-kloot), #539 first and then git rebase --onto origin/main 38c6c86ae925, and your 8 Pro run from built packages with a client. Small things: the new pkgdesc says "Omarchy Mobile" (the project is Omamobile now) and the url= still has the old repository name. I'll set the version numbers at merge; the shell's 0.2.143 is already taken on main.
|
Decision: starting the hotspot asks for the PIN ( |
Starting the hotspot opens DHCP, DNS and forwarding on ap0, so the polkit rule now returns auth_admin_keep for start, as the firewall switch does. Stop stays YES since it only closes things. pkgdesc says Omamobile and url= uses the new repo name. Signed-off-by: Lef <me@lefteros.com>
|
Done in e57f38f, following your decision: starting the hotspot now asks for the PIN ( Not run on the phone yet. In the run (from the built packages, with a client connected) I'll check that the shell's PIN pad comes up from the hotspot toggle, and what a cancelled PIN does when you rename the hotspot while it's on (stop goes through, start needs the PIN, so a cancel should leave it off and the page should say so). The #539 rebase and the isolation follow-up are still open, I'll sort out the who-does-what with @den-kloot. |
|
@den-kloot thanks a lot for offering to do the routing follow-up. If you're ok with it, we'll write it: I already have a VPN sharing branch that changes the same part of The plan is one PR on top of this one:
The VPN part exists as two local commits on this PR's older head, from before the I'll open it once this one is in. |
derekross
left a comment
There was a problem hiding this comment.
Thank you, Lef, the rule is exactly the decision: start asks for the PIN, stop stays quiet, and your test fails if either changes. The pkgdesc and url are right now too.
On the follow-up plan: the hotspot can't go in while its clients can reach the home network, so the isolation has to come first or together, not after. Could you put the client isolation into this PR, or open it as its own PR that we merge with this one? And please keep VPN sharing with the kill switch as a separate PR after both: it's new routing and firewall code that runs as root, and it deserves its own review and a run with a real tunnel.
When you do the phone run, a cancelled PIN currently reads as "the hotspot did not start"; a message that says the PIN wasn't entered, as the firewall page does, would help. I'll set the versions at merge.
|
Decision on the order: client isolation has to land in this PR, or in one merged together with it. The rule from before stands: no hotspot ships while its clients can reach the owner's home network, even for one release. VPN sharing and its kill switch are welcome as their own PR afterwards. |
This builds on @den-kloot's #539 (the Hotspot page and its backend hook), so it should go in after it. The branch is #539's head (which has main merged in), plus two commits of mine on top, one for omamobile-shell and one for omamobile-device-husky. Only those two are new here. I'm opening it as a draft because the package itself hasn't run on the phone yet (more on that below).
On the 8 Pro the NetworkManager hotspot can't work as it is.
wlp1s0refuses AP mode (-52, same as the 9a). On a second interfaceap0the AP beacons, but with the profile's pmf 1 my phone never even got to auth. With a patched driver onwlp1s0clients got further and then left the 4-way handshake with reason 17: the AP's RSN IE (from a desktop scan, probe response) only offers PSK-SHA256, while NetworkManager with pmf 1 or 2 gives wpa_supplicant PSK and PSK-SHA256. Withpmf 3it passes PSK-SHA256 only, and then my phone joined onap0. Details in #523: #523 (comment)So instead of a second Hotspot UI, this adds one shared hotspot for #539's page, which phones like this opt in to (den-kloot asked for one place for the 8 Pro and the 9a):
hotspot/hotspot-apruns as root underomamobile-hotspot.service. It addsap0beside the client Wi-Fi and binds theHotspotprofile to it with pmf 3, 2.4 GHz and shared mode. It opens DHCP, DNS and forwarding onap0in UFW, and turns IPv4 forwarding on per link forap0and the uplinks that had it off, then sets it back after. That's in case an uplink NetworkManager doesn't manage, like the 9a'srmnet0, has it off; not confirmed on the 9a yet. It keeps a client list and removes all of it again on stop, soap0only exists while the hotspot is on.hotspot/hotspot-backendanswers the page and the tile (state,active,set,on,off). The unit hasConditionPathExists=/usr/share/omamobile/hotspot.conf, so it does nothing on phones that didn't opt in. polkit lets the active local user start and stop that one unit, nothing else. This adds a root helper for networking and a second polkit rule to omamobile-shell; if that should be its own package, I'll split it. No VPN sharing yet, so the boxes stay hidden.nmcli device wifi hotspot. Nowtile-action.shgoes throughhotspot-panel.shfor on/off too, which uses the backend when there is one and NetworkManager's hotspot otherwise, so other phones behave as before. For the tile's state there's a cheapactiveverb (on or off, no secrets, no QR). A backend without it should still work: the script falls back to its state line (tested with a stub).onwaits until the unit is up, so a start that fails shows as off again (other tile taps wait behind it meanwhile)./usr/share/omamobile/hotspot.conf(interface=ap0), the/etc/omamobile/hotspot-backendlink, a test, and the tools the helper runs as dependencies. The 9a can do the same.OMAMOBILE_HOTSPOT_SYSTEM_BACKENDvariable is his; my copy is gone.The root helper used to stop the hotspot at 60 C on the die in my local builds. After your review of #946 that's off by default now;
stop_temp_mc=in/etc/omamobile/hotspot.confturns it on.Tested on my desktop in the CI container as uid 1000:
tools/pr-check,tests/all, andtest/allfor omamobile-device-husky and omamobile-shell. New in the shell:test/hotspot-ap.sh(including forwarding set and restored per link, with an uplink appearing mid-run) andtest/hotspot-backend.sh, plus cases intest/hotspot-panel.sh, and intest/tile-scripts.shthat run the tile scripts against a stub backend. Everything uses stub nmcli, iw, ufw and systemctl, so nothing on the machine is touched.What has run on the phone, but not as this package: my OnePlus 13 joined an AP on
ap0with pmf 3 twice, once on the stock brcmfmac. It got a lease and had internet; I checked the internet part on the OnePlus, it isn't in a log. Those runs brought the profile up from a test script, not from this service. Separately, an earlier version ofhotspot-ap(from my local omamobile-settings builds, before pmf 3 and the other changes here) started and stopped from my session through polkit, andap0and the UFW rules came and went cleanly. No client was joined in those service runs.Known limit: a hotspot client can also reach the phone's home LAN (forwarding isn't limited to one uplink). Limiting that, with a routing table of its own, goes in a follow-up together with VPN sharing.
Not tested yet: this branch installed on a phone, so a client joining through the service, the backend script, and the tile and page going through it. den-kloot offered a run on the 9a with a client and mobile data; I'll do the 8 Pro one with phone-smoke and screenshots before this leaves draft. Also not tested: scanning while
ap0is up (den-kloot's point 4 on #523), devices without 802.11w (pmf required locks them out), a 5 GHz-only home network. With my home network on 2.4 GHz the client Wi-Fi moved to the hotspot's channel, with a short drop when it started; on 5 GHz (dual-band) it stayed put. Also the NetworkManager path on another phone after the tile change, which only has the stubbed tests. Like #539's NetworkManager path, the password goes tonmclias an argument when it's set.