OTBR Snap setup divergence - canonical/openthread-border-router-snap GitHub Wiki
This page documents the differences between the setup of OpenThread Border Router using the snap from the upstream code. It is written with respect to thread-reference-20230119.
The setup is driven by the scripts/setup script, which sources several other scripts from the parent directory. The setup involves un-installation (i.e. cleanup of what is pre-installed) and installation (i.e. build and staging logic).
In summary, the following upstream actions are the major cause for differences:
- Mixed build and staging code. The snap has independent build and runtime logic.
- Dynamic systemd service creation and management. The services are part of the snapcraft definition.
- Direct firewall in-memory system file manipulations. The snap uses iproute2 CLI and firewall-control snap interface.
The following table explains the differences, in the same order appearing in the setup script.
- Y: yes
- N: no
- P: partial
Uninstallation
This involves cleaning up what has been done in previous installations. The operations are performed before the installation to have a clean environment. There is no dedicated script that only performs the uninstallation.
Script | Function | Description | Snapped |
---|---|---|---|
_initrc | before hook | Steps to prepare the environment, incl. loading platform defaults from examples/platforms | Y for buildN for staging: the snap assumes Ubuntu defaults and performs the relevant setup |
_initrc | die, have, have_or_die, with, without | Util functions used in other scripts | Y |
_sudo_extend | extend_sudo_timeout | Extend sudo timeout to 2 hours | N: sudo not used in the snap |
_swapfile | setup_swapfile | Create swap files to allow build on platforms with limited RAM | N: the snap build does not manipulate the host OS |
_disable_services | disable_services | Disable various external services | N: the snap does not manipulate external services |
_otbr | otbr_uninstall | Stop, kill, disable systemd services.Remove files listed in install_manifests.txtReload systemd daemon to apply changes. | N: snap services are managed together with the snap's lifecycle |
_border_routing | border_routing_uninstall | Remove accept_ra file Re-enable DHCPCD IPv6 | N: config not persisted across reboots. Disconfigure logic not implemented in remove hook.N: DHCPCD not disabled by snap; see limitations |
_network_manager | network_manager_uninstall | Several configurations and service manipulations. | N: see limitations |
_dhcpv6_pd | dhcpv6_pd_uninstall | Manipulate DHCPv6-PD configuration | N: see limitations |
_nat64 | nat64_uninstall | Remove the nat44 service. Disconfigure Tayga. | N: snap services are managed with the snap lifecycle.N: Tayga not needed by default. |
_dns64 | dns64_uninstall | Manipulate DNS64 config | N: see limitations |
_rt_tables | rt_tables_uninstall | Remove IP Route Table mapping | N: see #14 |
_ip_forward | ipforward_uninstall | Remove IP forwarding conf file | N: config not persisted across reboots. Disconfigure logic not implemented in remove hook. |
_firewall | firewall_uninstall | Disable and remove service | N: snap services are managed with the snap lifecycle. |
Installation
Script | Function | Description | Snapped |
---|---|---|---|
_firewall | firewall_install | Enable ip6table_filter kernel module.Create, enable, start custom firewall service. | P: Only starting the service, which performs one-shot firewall configurations |
_ip_forward | ipforward_install | Configure IP forwarding, enabling it right away | N: Use sysctl and enable on every start. This method is done without manipulating external system files. |
_rt_tables | rt_tables_install | Add IP Route Table mapping.Add sysctl config to file. | N: see #14N: Use sysctl to add the configuration on startup without manipulating external system files. |
_nat64 | nat64_install | Install Tagya and configure firewall for nat44 forwarding | P: Only configure firewall for nat44 |
_dns64 | dns64_install | Manipulate DNS64 config | N: see limitations |
_network_manager | network_manager_install | Several configurations and service manipulations. | N: see limitations |
_dhcpv6_pd | dhcpv6_pd_install | Manipulate DHCPv6-PD configuration | N: see limitations |
_border_routing | border_routing_install | Disable DHCPCD IPv6.Add accept_ra file.Enable accept_ra right away. | N: use sysctl to add the configuration on startup without manipulating external system files. |
_otbr | otbr_install | Build OTBR, reload systemd daemon, enable services | Y |
_initrc | after hook | Prepare the enviornment post setup | N: see limitations |