26#include <DobbyRdkPluginUtils.h> 
   63    bool ifaceUp(
const std::string& ifaceName);
 
   64    bool ifaceDown(
const std::string& ifaceName);
 
   66    bool ifaceIsUp(
const std::string& ifaceName) 
const;
 
   67    bool ifaceExists(
const std::string& ifaceName) 
const;
 
   70                         const in_addr_t address, 
const in_addr_t netmask);
 
   72                         const struct in6_addr address, 
const int netmask);
 
   76                             const std::string& ifaceName, 
bool enable);
 
   81                          const std::string& ifaceName, 
int value);
 
   84                     const std::array<uint8_t, 6>& address);
 
   85    std::array<uint8_t, 6> 
getIfaceMAC(
const std::string& ifaceName);
 
  101                          const std::string& ifaceName);
 
  103                            const std::string& ifaceName);
 
  106    std::string 
createVeth(
const std::string& peerVethName,
 
  108                           std::vector<std::string> &takenVeths);
 
  109    bool checkVeth(
const std::string& vethName);
 
  112    bool addRoute(
const std::string& iface, 
const in_addr_t destination,
 
  113                  const in_addr_t netmask, 
const in_addr_t gateway);
 
  114    bool addRoute(
const std::string& iface, 
const struct in6_addr destination,
 
  115                  const int netmask, 
const struct in6_addr gateway);
 
  117    bool addArpEntry(
const std::string &iface, in_addr_t address,
 
  118                     const std::array<uint8_t, 6> &mac);
 
  120    bool delArpEntry(
const std::string &iface, in_addr_t address);
 
  123    bool applyChangesToLink(
const std::string& ifaceName,
 
  127                        const in_addr_t address, 
const in_addr_t netmask);
 
  129                        const struct in6_addr address, 
const int netmask);
 
  131    bool setIfaceConfig(
const std::string& ifaceName, 
const unsigned int configId,
 
  132                        const uint32_t value);
 
  138    struct nl_sock* mSocket;
 
  139    int mSysClassNetDirFd;
 
  140    mutable std::mutex mLock;
 
 
Basic wrapper around the libnl netlink library.
Definition Netlink.h:54
 
bool ifaceExists(const std::string &ifaceName) const
Checks if an interface with a given name exists (interface could be either up or down)
Definition Netlink.cpp:1288
 
bool ifaceIsUp(const std::string &ifaceName) const
Queries the interface to determine if it's up or not.
Definition Netlink.cpp:1251
 
bool setIfaceForwarding6(const std::shared_ptr< DobbyRdkPluginUtils > &utils, const std::string &ifaceName, bool enable)
Enables or disables IPv6 forwarding on the given interface.
Definition Netlink.cpp:851
 
bool setLinkAddress(const NlLink &link, const in_addr_t address, const in_addr_t netmask)
Sets the ip address and netmask of an interface (IPv4)
Definition Netlink.cpp:596
 
bool delArpEntry(const std::string &iface, in_addr_t address)
Removes (invalidates) an entry in the ARP table.
Definition Netlink.cpp:2060
 
bool addRoute(const std::string &iface, const in_addr_t destination, const in_addr_t netmask, const in_addr_t gateway)
Adds a new route to the routing table (IPv4)
Definition Netlink.cpp:1740
 
bool ifaceUp(const std::string &ifaceName)
Brings an interface up.
Definition Netlink.cpp:954
 
bool delIfaceFromBridge(const std::string &bridgeName, const std::string &ifaceName)
Removes an interface from a bridge.
Definition Netlink.cpp:1644
 
bool setIfaceRouteLocalNet(const std::string &ifaceName, bool enable)
Sets the route_localnet flag on the interface.
Definition Netlink.cpp:884
 
bool setIfaceAddress(const std::string &ifaceName, const in_addr_t address, const in_addr_t netmask)
Sets the ip address and netmask of an interface (IPv4)
Definition Netlink.cpp:686
 
bool addIfaceToBridge(const std::string &bridgeName, const std::string &ifaceName)
Adds an interface to the bridge device.
Definition Netlink.cpp:1585
 
bool setIfaceConfig(const std::string &ifaceName, const unsigned int configId, const uint32_t value)
Sets the config on a given interface.
Definition Netlink.cpp:769
 
std::string getAvailableVethName(const int startIndex) const
Returns the number of the next free veth device.
Definition Netlink.cpp:1326
 
std::list< BridgePortDetails > getAttachedIfaces(const std::string &bridgeName)
Gets the set of interfaces currently enslaved to a given bridge device.
Definition Netlink.cpp:1150
 
bool addArpEntry(const std::string &iface, in_addr_t address, const std::array< uint8_t, 6 > &mac)
Sets an entry in the ARP table.
Definition Netlink.cpp:1973
 
bool createBridge(const std::string &bridgeName)
Creates a new bridge device.
Definition Netlink.cpp:1495
 
std::string createVeth(const std::string &peerVethName, pid_t peerPid, std::vector< std::string > &takenVeths)
Creates a veth pair for the netns attached to the given pid.
Definition Netlink.cpp:1365
 
bool setIfaceAcceptRa(const std::shared_ptr< DobbyRdkPluginUtils > &utils, const std::string &ifaceName, int value)
Sets the accept_ra flag on the interface.
Definition Netlink.cpp:920
 
bool destroyBridge(const std::string &bridgeName)
Deletes an existing bridge device.
Definition Netlink.cpp:1536
 
bool setIfaceMAC(const std::string &ifaceName, const std::array< uint8_t, 6 > &address)
Sets the MAC address of the given interface.
Definition Netlink.cpp:1033
 
bool ifaceDown(const std::string &ifaceName)
Takes an interface down.
Definition Netlink.cpp:992
 
bool setIfaceForwarding(const std::string &ifaceName, bool enable)
Enables or disables IPv4 forwarding on the given interface.
Definition Netlink.cpp:820
 
std::array< uint8_t, 6 > getIfaceMAC(const std::string &ifaceName)
Gets the MAC address of the given interface.
Definition Netlink.cpp:1095
 
Wrapper around the rtnl_link object.
Definition Netlink.cpp:421