Container
General InformationLinux containers (LXC) can be installed and executed on the router. A container is a virtualisation of an independent system, it "feels" like an independent computer with own
The containers use the Linux kernel and drivers of the firmware. Direct access to hardware is not permitted so that the functionality of the router cannot be compromised. Theoretically, an unlimited number of containers can be stored and started on the router. The number is limited by finite RAM and flash memory (refer to Resources). The content of containers is treated like firmware images. The root file systems of containers is stored in the flash memory and listed in the web interface. Each container requires
Container functionalityEach container can be uploaded to the router via the web interface. If a container that has the same designator as an already existing container is loaded to the router, this will overwrite the old container. If one container shall exist in several instances on the router, for example a second instance of the icom Data Suite, the designator of the first container must be changed before uploading the second container. Each container can be deleted from the router. In this case, all data that has been generated in the container, like log files for example, will also be deleted. The container will be removed from the profile of the router. Each container can be activated or deactivated in the configuration. All active containers will be started up independently during system start. Active containers can be started or stopped using events and actions. Each container can be downloaded from the router again in form of an update packet. Optionally, a container can be blocked for download by deleting the file "/usr/share/downloadable". This allows to realise a simple copy protection. Each container has an own network interface that must be configured via the web interface. It will be connected to one of the IP nets of the router via a bridge. Connections can be treated like an independent device in the network using the netfilter rules. Routes must be created in the container if a communication with machines in other networks is desired. Each container can receive and send messages via MCIP. This generates an interface to the firmware functionality (events and actions). Each container gets a directory ("/data") mounted, in which own data can be stored that outlast an update of the container (configuration, logs). This directory will only be deleted if the whole container is deleted.
Each container has the configuration option to consider the special subdirectory "/data/etc" as configuration for container applications. Then, this configuration will be added to the update packet as an attachment when downloading a profile, so that the router and the settings of the application can be stored together in a container. The designator of the container is also specified in the manifest so that the profile can be assigned again to this container with the upload without being dependent on the internal container name (e.g. container1). The configuration file of the container may have any format, so it can be a database or only a simple ASCII file for example. Each container gets the enabled hardware resources entered as device nodes, irrespective of which services use these device nodes already. Resources are serial interfaces for example. Each container can write its console output in a log. This allows to identify the possible reason for a container that does not start. Each container can optionally be assigned a licence stored on the router that can be used by the application in the container to unlock functionality. Available resources and applicationsThe firmware of the router reserves itself 64 MByte RAM. The remainder will be apportioned equally among the container instances to be started. Half of the CPU computing time is guaranteed to the router firmware. The remaining computing time get the container instances proportionately. However, the computing time shares are only limited if they are actually requested by the individual beneficiaries. If the firmware and all started container instances do not perform any computations, the full computing time is available. Flash memory is not limited. The firmware and all container instances must share the available memory. There is no quota since an apportionment like for the volatile resources RAM or CPU computing time cannot be changed later in case another container will be added. Generated containersContainers that have been generated by the firmware provide a minimum environment that can be used as a starting point for own applications. A user "root” with the password "root" exists in the containers. The password shall be changed immediately upon generating the container due to reasons of security. Any new users and groups can be created. A container created by the firmware contains:
A container contains the following directories and files:
These tools have a help text that is displayed using the parameter "-h". The tools assist for receiving SMS (sms-tool), events at the inputs ("get-input" for level changes and "get-pulses" for pulses at the inputs). "mcip-tool" can be used to send and receive messages via MCIP what allows to exchange messages between processes within one or different containers. "set-output" can be used to switch outputs, if access to the CLI of the router is allowed in the container without authentication. "cli-cmd" can be used to read out and change the configuration of the router. Status information of the router can be queried. "container" can be used to start, stop or restart containers, if access to the CLI of the router is allowed in the container without authentication.
Container storageThe container storage permits to upload files to the router in form of an update packet.
Individual paths of the container storage can then be made available to each container in a configurable path with read or read and write permissions.
The paths in the container must explictly be permitted in non-downloadable containers using the (white-list) file /usr/share/mount_allow explained above.
The two udate packet file types differ in their behaviour for folders that exist in both, the container storage and the update packet.
The folders and their content will be deleted first for "Full Storage".
The content of the folders is merged for "Incremental Storage", existing files that are not in the update packet will remain.
The file authorisations stored in the update packet will be taken over. Exchanging files with a containerIn order to copy files from the container or to the container disregarding container storage, "scp" seems to be appropriate since an SSH server is already installed in generated containers. An SSH client like "openssh" or "putty" is necessary. A possible call is: "scp root@192.168.1.1:/root/readme.txt ./". wget is also installed in the container so that files can be retrieved from web servers into the container. To do this, login to the container via ssh and call wget: "wget http://webserver_domain_or_IP/applikation". If the downloaded file is a binary and is to be executed, the "execute" permission must also be set: "chmod 755 application". The busybox applets are also available in the container:
Creating own containersA container created by the firmware can be used as starting point. After downloading as update packet, this package must be unpacked with "tar -xf <filename"> into a new directory. The manifest and the actual container are now on hand. The container is also a tar archive. In order to be able to unpack and modify a container locally, it is compulsory for the tar archive to
Upon modifying the files, the root file system must be packed as tar archive again (tar cvf ../<filename.tar>). The new MD5 checksum of the new tar archive must be entered into the manifest. If the file name has changed, this must also be adjusted in the manifest. The manifest and the new tar file form in a new, common tar archive the new update packet. |