Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
Functions
NetworkSetup Namespace Reference

Functions to set up networking for containers. More...

Functions

bool setupBridgeDevice (const std::shared_ptr< DobbyRdkPluginUtils > &utils, const std::shared_ptr< Netfilter > &netfilter, const std::vector< std::string > &extIfaces)
 Called from host namespace.
 
bool createNetns (const std::string &containerId)
 
bool setupVeth (const std::shared_ptr< DobbyRdkPluginUtils > &utils, const std::shared_ptr< Netfilter > &netfilter, const std::shared_ptr< NetworkingHelper > &helper, const std::string &rootfsPath, const std::string &containerId, const NetworkType networkType)
 Called from host namespace.
 
bool removeVethPair (const std::shared_ptr< Netfilter > &netfilter, const std::shared_ptr< NetworkingHelper > &helper, const std::string &vethName, const NetworkType networkType, const std::string &containerId)
 Remove iptables entries for the container's veth and bring the veth pair down.
 
bool removeBridgeDevice (const std::shared_ptr< Netfilter > &netfilter, const std::vector< std::string > &extIfaces)
 Clear out the iptables rules set for the bridge device and brings the interface down.
 
void addResolvMount (const std::shared_ptr< DobbyRdkPluginUtils > &utils, const std::shared_ptr< rt_dobby_schema > &cfg)
 Adds a mount to /etc/resolv.conf.
 
void addNetworkNamespace (const std::shared_ptr< rt_dobby_schema > &cfg)
 Adds the 'network' namespace to the OCI config.
 

Detailed Description

Functions to set up networking for containers.

Function Documentation

◆ addNetworkNamespace()

void NetworkSetup::addNetworkNamespace ( const std::shared_ptr< rt_dobby_schema > &  cfg)

Adds the 'network' namespace to the OCI config.

Parameters
[in]cfgPointer to bundle config struct

◆ addResolvMount()

void NetworkSetup::addResolvMount ( const std::shared_ptr< DobbyRdkPluginUtils > &  utils,
const std::shared_ptr< rt_dobby_schema > &  cfg 
)

Adds a mount to /etc/resolv.conf.

Parameters
[in]utilsInstance of DobbyRdkPluginUtils.
[in]cfgPointer to bundle config struct.

◆ removeBridgeDevice()

bool NetworkSetup::removeBridgeDevice ( const std::shared_ptr< Netfilter > &  netfilter,
const std::vector< std::string > &  extIfaces 
)

Clear out the iptables rules set for the bridge device and brings the interface down.

Parameters
[in]netfilterInstance of Netfilter.
[in]extIfacesExternal interfaces on the device
Returns
true if successful, otherwise false

◆ removeVethPair()

bool NetworkSetup::removeVethPair ( const std::shared_ptr< Netfilter > &  netfilter,
const std::shared_ptr< NetworkingHelper > &  helper,
const std::string &  vethName,
const NetworkType  networkType,
const std::string &  containerId 
)

Remove iptables entries for the container's veth and bring the veth pair down.

Parameters
[in]netfilterInstance of Netfilter.
[in]helperInstance of NetworkingHelper.
[in]vethNameName of the container's veth interface.
[in]networkTypeContainer's network type.
Returns
true if successful, otherwise false

◆ setupBridgeDevice()

bool NetworkSetup::setupBridgeDevice ( const std::shared_ptr< DobbyRdkPluginUtils > &  utils,
const std::shared_ptr< Netfilter > &  netfilter,
const std::vector< std::string > &  extIfaces 
)

Called from host namespace.

This function will create the bridge device and configure it. Only run if the bridge device hasn't already been created by another container starting.

Parameters
[in]utilsInstance of DobbyRdkPluginUtils.
[in]netfilterInstance of Netfilter.
[in]extIfacesExternal interfaces on the device.
Returns
true if successful, otherwise false

◆ setupVeth()

bool NetworkSetup::setupVeth ( const std::shared_ptr< DobbyRdkPluginUtils > &  utils,
const std::shared_ptr< Netfilter > &  netfilter,
const std::shared_ptr< NetworkingHelper > &  helper,
const std::string &  rootfsPath,
const std::string &  containerId,
const NetworkType  networkType 
)

Called from host namespace.

This function does the following:

  • Creates a virtual ethernet interface for the container
  • Sets an ip address for the container
  • Brings up the veth[i] interface
  • Adds required iptables rules
Parameters
[in]utilsInstance of DobbyRdkPluginUtils.
[in]netfilterInstance of Netfilter.
[in]helperInstance of NetworkingHelper.
[in]rootfsPathPath to the rootfs on the host.
[in]containerIdThe id of the container.
[in]networkTypeNetwork type.
Returns
true if successful, otherwise false