Updated June 2021
- shill.conf.in sets up the shill upstart environment
- shill-pre-start.sh ensures that directories required by shill are set up correctly.
- shill.sh converts environment variables to command line arguments and runs the shill binary.
shill_main.cc
parses command line options and creates and runs a ShillDaemon class instance which wraps a singleton DaemonTask instance.
The DaemonTask class is a singleton owned by the ShillDaemon class singleton.
It creates the following singleton classes (along with a few support/utility classes).
- Manager This is the primary / top-level shill class.
DaemonTask::Start
callsManager::Start
. - RoutingTable class Available globally using RoutingTable::GetInstance(). See also routing.
- NetlinkManager class Available globally using NetlinkManager::GetInstance().
- DHCPProvider class Available globally using DHCPProvider::GetInstance().
The Manager class is the "top-level" singleton class in Shill, created and owned by DaemonTask.
Manager
is associated with the org.chromium.flimflam.Manager DBus API documented in manager-api.txt.Manager
includes a number of global properties, some of which are included in the DBus API, and some of which come from command-line switches.Manager
owns a DeviceInfo singleton which tracks network instances and creates corresponding Device instances.Manager
also owns a ModemInfo singleton for observingModemManager1.Modem
DBus objects.Manager
keeps its own list ofDevice
instances and handles Registration, power management, and enabling/disabling network technologies (e.g. WiFi, Cellular).- The paths of available
Device
objects are available in theManager.Devices
DBus property.
Manager
owns ServiceProvider instances for managing the creation and lifetime of Service instances.Manager
also keeps its own list ofService
instances and handles Registration, power management, and AutoConnect.- The paths of visible
Service
objects are available in theManager.Services
DBus property, sorted by State and priority as described in manager-api.txt. - The paths of all
Service
objects, including saved (favorite) service configurations that are not visible, are available in theManager.ServiceCompleteList
DBus property, sorted as per Services.
Manager
maintains the stack of Profile instances.
The DeviceInfo class is a singleton owned by Manager.
DeviceInfo
listens to network interface and address-configuration events using RTNL.- On startup,
DeviceInfo
requests a dump of existing network interface and address-configuration information in order to be in sync with the current kernel state. - When
DeviceInfo
has enough information about a network interface for a technology backed by a Device, it creates an instance of the proper type. SeeCreateDevice
in device_info.cc.- Some network interfaces are explicitly ignored by shill and managed by
other entities:
TAP
devices and virtual ethernet interfaces are managed by patchpanel, someTUN
devices may be created and managed by third-party VPN clients directly.
- Some network interfaces are explicitly ignored by shill and managed by
other entities:
DeviceInfo
also updates existing Device instances with new information that it receives about the corresponding network interface.DeviceInfo
is used by some VPN drivers for creating the virtual interface (TUN
device,WG
device) used by third party VPN clients.
The Device class is a base::RefCounted
class representing a
network interface.
Device
is associated with the org.chromium.flimflam.Device DBus API documented in device-api.txt.Device
provides basic functionality to configure its interface through/proc/sys/net
parameters, to acquire and use IP configuration parameters, and to drive Service connection state.Device
sets up a Connection and shares it with the associated active Service.Device
is the base class for a hierarchy of subclasses that perform technology-specific behavior:
Device
instances are managed by DeviceInfo.- Exception:
VirtualDevice
instances corresponding to virtual interfaces (for use-cases like VPN, and cellular dongles).
- Exception:
The ProviderInterface class is a common interface for singleton instances owned by Manager.
- Each
ServiceProvider
is responsible for creating Service instances on startup and as required by the associated Device. - A separate
ServiceProvider
singleton exists for each primary Technology: ServiceProvider
instances create newServices
from the persisted state in the Profile and/or properties from the D-Bus interface.- See CellularServiceProvider for CellularService provisioning.
- The
EthernetProvider
by default has a singleEthernetService
, which the firstEthernet
instance will use. AdditionalEthernet
instances will cause theEthernetProvider
to create additionalEthernetService
instances. - For
WiFiProvider
,Services
are also created based on network scans performed bywpa_supplicant
, which leads to the reception of BSSAdded D-Bus signals that triggerWiFiProvider
to create a correspondingWiFiService
.
The Service class is a base::RefCounted
class representing a
network configuration and a connection through an associated
Device.
Service
is associated with the org.chromium.flimflam.Service DBus API documented in service-api.txt.- A network interface on its own does not provide network connectivity, the
interface must be configured and the link layer connection must be
established by the relevant technology specific software (
WPA
forWiFi
interfaces,ModemManager
forCellular
,kernel
forEthernet
). - A
Service
provides configuration properties to the associated Device and helps setup the Connection and drive the connection state machine. Service
is the base class for a hierarchy of subclasses that perform technology-specific behavior:
- A
Service
has an associatedDevice
instance, stored as a type specificRefPtr
in the subclass. Service
lifetime is managed by the associated ServiceProvider singleton.
The Profile class represents a set of persisted data and is
used for both Device
and Service
properties, as well as a handful of global
properties. Shill keeps a Profile
instance for shared/default properties,
and a per-user Profile when a user is logged in.
- Device and Service classes and their subclasses
handle loading from and saving to the underlying storage used by the current
Profile
. - Shill allows for a stack of
Profile
instances. TheProfile
stack is owned by Manager.- On startup, the
Profile
stack contains a singleDefaultProfile
, which provides pre-login (shared) configuration data.- In addition to the regular
Profile
behavior of persistingService
properties, aDefaultProfile
will also persistDevice
properties and a subset ofManager
properties.
- In addition to the regular
- On user login, specifically when Chrome instructs session_manager to
emit the load-shill-profile upstart event, the
shill_login_user
script is run.- This creates a
Profile
for the user and pushes thatProfile
onto theProfile
stack.
- This creates a
- On user logout,
shill_logout_user
removes the user'sProfile
from theProfile
stack. - When a guest user logs in, a
Profile
is created and pushed onto the stack as usual, but the persisted data is deleted on logout.- An
EphemeralProfile
(see below), is not used for guest users. This allows persistence of properties after a shill crash within a guest user session.
- An
- On startup, the
- Every
Service
has exactly oneProfile
associated with it, which is theProfile
most recently pushed onto theProfile
stack. TheProfile
contains persisted data for theService
. - An
EphemeralProfile
is used exclusively forService
instances that are created but that have noProfile
in theProfile
stack, e.g., aWiFiService
that was created from a WiFi scan but that the user has never attempted to configure or connect to.
- A
Service
can be "linked" to a differentProfile
through the use of theService
kProfileProperty D-Bus property, which is howService
instances currently using theEphemeralProfile
can be moved over to aProfile
that allows its configuration parameters to be persisted. - Note Shill's D-Bus clients (aside from Autotest/Tast) do not create
additional
Profiles
, so theProfile
stack in non-test cases contains only theDefaultProfile
and potentially a userProfile
. TheEphemeralProfile
is not part of theProfile
stack.
TODO: Document the IPConfig class and IP configuration.
- The Connection class is owned by the
Device that sets it up and is shared by the active
Service for the
Device
. - Manager uses the
Connection
of the default Service to configure /etc/resolv.conf (DNS). - TODO: Properly document the Connection class.
TODO
TODO
- DBus permissions are configured in org.chromium.flimflam.conf
- Shill implements the following DBus APIs: