Preferred Network Interface(PNI) is a feature introduced in RDK to avoid the confusion related to network connectivity and switch seamlessly between different interfaces. Currently it is meant for wifi and ethernet interfaces.
Background
For RDK client profiles, the network connectivity options are usually two, ethernet and WiFi.Ethernet is by default is the preferred interface, but the option to choose interface is exposed to user. PNI logic is encoded in /lib/rdk/pni_controller.sh
By default if ethernet interface is active and connected, WiFi interface will be disabled. This behaviour can be altered using
Features
Ability to switch between interface seamlessly
Ability to verify the connectivity options
systemd services involved
pni_settings_loader.service
This service is managed by systemd.This is mostly used to load the persisted data from previous runs.
pni_controller.service
This services is controlled by netsrvmgr service. This is invoked every time a network interface status is changed. Possible scernarios include, but not limited to
Ethernet connect/disconnect
invoking setInterfaceEnabled API
Wifi endpoint connect/disconnect.
Environment Settings
Three variables are defined for PNI. These variables are defined in pni_controller.service
CONFIG_DISABLE_PNI - determines whether PNI is enabled in the device.
CONFIG_DISABLE_CONNECTIVITY_TEST - determines whether a connectivity test needs to be done after network is established
CONFIG_ALLOW_PNI_TO_DISABLE_WIFI - determines whether PNI can disable wifi interface altogether or remove route and ip address information alone.
- Use this to disable interface irrespective of whether the interface is the active interface or not. If this RFC is not enabled, you can only disable passive interfaces.
Connectivity test options
After establishing network connectivity , PNI can verify the connectivity status of the network. It does by reaching out to endpoints specified in /opt/persistent/connectivity_test_endpoints if available, otherwise defaulting to "google.comespn.comspeedtest.net"