-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manage router card modes using systemd targets #101
Comments
Switching with conman presents an issue because there is no way to tell Connman which connection file to load and no way to tell connmanctl to disable IPv4/6 after it has begun (the command suggested in the documentaiton fails as not implemented). For now I think the best way to handle this is to have two different wifi connection files that get symbolically linked into /var/lib/connman at initialization. To do this I would create two services, connman-secure.service and connman-pass.service which link the file and cause the regular connman initialization process to begin. In the future we will not want users to have to maintain two separate files for the same wifi connections so it will either have to be managed or the passthrough mode gets those lines appended at runtime. |
The approach makes sense to me. I suggest defining just one templated systemd service to do the linking, perhaps called So It can list The data directory would have multiple files:
The unit file would look something like:
I'm not sure how |
Fixed by #103 |
The router card will operate in one of three modes: passthrough, secure host, or secure lan mode (the latter is not yet supported).
Currently, the modes are managed as different systemd services: xbridge (passthrough) and xbridges (secure host). Each service expresses its dependencies as
Requires/After
parameters in its unit file. This scatters the dependencies through a chain of service files. It's hard to reason about and maintain.Instead, we can treat each mode as a different systemd target (or runlevel, in sysv parlance). Then the service dependencies of each target can be expressed in one easy spot, as symlinks in the
<target-name>.target.wants
directory.The target that systemd boots to is specified by the
/etc/systemd/systemd/default.target
symlink. So changing the mode is as simple as changing the symlink and rebooting.Directory and File Structure
I envision the following directory structure
/etc/systemd/system/default.target
is a symlink to/data/systemd/active-mode.target
/data/systemd/mode.target
is a symlink to the active target/usr/lib/systemd/system/<mode>.target
/usr/lib/systemd/system/passthrough.target
is a target unit file/usr/lib/systemd/system/secure-host.target
is a target unit file/usr/lib/systemd/system/secure-lan.target
is a target unit file (in the future, when lan mode is addedpassthrough.target
looks something like:And
secure-host.target
looks something like:/etc/systemd/system/multi-user.target.wants
contains symlinks to services required by all modes/etc/systemd/system/passthrough.target.wants
contains symlinks to services just required by passthrough/etc/systemd/system/secure-host.target.wants
contains symlinks to services just required by secure host modeWhen
secure-lan
mode is added, we might add a/etc/systemd/system/secure.target.wants
target to specify services required by bothsecure-host
andsecure-lan
modes. For now though, justsecure-host.target.wants
is sufficient.Services and Dependencies
multi-user.target.wants
[email protected]
gether.service
passthrough.target.wants
connman
(with IPv4=off and IPv6=off)[email protected]
secure-host.target.wants
connman
(with default IPv4 and IPv6 settings that run DHCP)[email protected]
[email protected]
Reworking the
xbridge/xbridges
servicesTODO. @drbild finish this section
The text was updated successfully, but these errors were encountered: