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

Sets up iptables routing to allow apps within a network namespace to talk to the dnsmasq server running outside the container. More...

Functions

bool set (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)
 Add iptables rules and create the /etc/resolv.conf file.
 
bool removeRules (const std::shared_ptr< Netfilter > &netfilter, const std::shared_ptr< NetworkingHelper > &helper, const std::string &containerId)
 Deletes dnsmasq rules for the container.
 

Detailed Description

Sets up iptables routing to allow apps within a network namespace to talk to the dnsmasq server running outside the container.

This works by routing traffic sent to the dobby bridge on port 53 to the localhost interface outside the container.

Function Documentation

◆ removeRules()

bool DnsmasqSetup::removeRules ( const std::shared_ptr< Netfilter > &  netfilter,
const std::shared_ptr< NetworkingHelper > &  helper,
const std::string &  containerId 
)

Deletes dnsmasq rules for the container.

Run in postHalt hook.

Parameters
[in]netfilterInstance of Netfilter class
[in]helperInstance of NetworkingHelper.
[in]containerIdContainer identifier
Returns
true if successful, otherwise false

◆ set()

bool DnsmasqSetup::set ( 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 
)

Add iptables rules and create the /etc/resolv.conf file.

Run in createRuntime hook.

Create a new /etc/resolv.conf file specifying the name server as our bridge interface. Add a PREROUTING rule to the iptable NAT table, which will redirect the traffic to localhost outside the container for port 53 only.

Parameters
[in]utilsInstance of DobbyRdkPluginUtils class
[in]netfilterInstance of Netfilter class
[in]helperInstance of NetworkingHelper.
[in]rootfsPathPath to container rootfs on the host
[in]containerIdContainer identifier
[in]networkTypeNetwork type
Returns
true if successful, otherwise false