Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
BridgeInterface.h
1/*
2* If not stated otherwise in this file or this component's LICENSE file the
3* following copyright and licenses apply:
4*
5* Copyright 2016 Sky UK
6*
7* Licensed under the Apache License, Version 2.0 (the "License");
8* you may not use this file except in compliance with the License.
9* You may obtain a copy of the License at
10*
11* http://www.apache.org/licenses/LICENSE-2.0
12*
13* Unless required by applicable law or agreed to in writing, software
14* distributed under the License is distributed on an "AS IS" BASIS,
15* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16* See the License for the specific language governing permissions and
17* limitations under the License.
18*/
19/*
20 * File: BridgeInterface.h
21 *
22 */
23#ifndef BRIDGEINTERFACE_H
24#define BRIDGEINTERFACE_H
25
26#include <DobbyRdkPluginUtils.h>
27#include "NetworkingHelper.h"
28#include "Netlink.h"
29
30#include <string>
31#include <memory>
32
33#include <arpa/inet.h>
34
35// -----------------------------------------------------------------------------
46namespace BridgeInterface
47{
48 bool createBridge(const std::shared_ptr<Netlink> &netlink);
49 bool destroyBridge(const std::shared_ptr<Netlink> &netlink);
50 bool up(const std::shared_ptr<Netlink> &netlink);
51 bool down(const std::shared_ptr<Netlink> &netlink);
52 bool setAddresses(const std::shared_ptr<Netlink> &netlink);
53 bool setIfaceForwarding(const std::shared_ptr<DobbyRdkPluginUtils> &utils,
54 const std::shared_ptr<Netlink> &netlink,
55 bool enable);
56 bool setIfaceRouteLocalNet(const std::shared_ptr<DobbyRdkPluginUtils> &utils,
57 const std::shared_ptr<Netlink> &netlink,
58 bool enable);
59 bool setIfaceAcceptRa(const std::shared_ptr<DobbyRdkPluginUtils> &utils,
60 const std::shared_ptr<Netlink> &netlink,
61 int value);
62
63 bool disableStp(const std::shared_ptr<DobbyRdkPluginUtils> &utils);
64
65 bool attachLink(const std::shared_ptr<Netlink> &netlink,
66 const std::string &name);
67 std::array<uint8_t, 6> macAddress(const std::shared_ptr<Netlink> &netlink);
68 bool setMACAddress(const std::shared_ptr<Netlink> &netlink,
69 const std::array<uint8_t, 6>& address);
70};
71
72bool netlinkFlagsWorkaround(short int mask, short int flags);
73bool netlinkForwardingWorkaround(const std::shared_ptr<DobbyRdkPluginUtils> &utils,
74 bool enable);
75bool netlinkRouteLocalNetWorkaround(const std::shared_ptr<DobbyRdkPluginUtils> &utils,
76 bool enable);
77
78#endif // !defined(BRIDGEINTERFACE_H)
A set of functions to setup and bring down a bridge device. The main reason to use these functions se...
bool setMACAddress(const std::shared_ptr< Netlink > &netlink, const std::array< uint8_t, 6 > &address)
Sets the MAC address of the interface.
Definition BridgeInterface.cpp:251
bool setIfaceRouteLocalNet(const std::shared_ptr< DobbyRdkPluginUtils > &utils, const std::shared_ptr< Netlink > &netlink, bool enable)
Sets the route_localnet on the Dobby bridge device.
Definition BridgeInterface.cpp:158
bool down(const std::shared_ptr< Netlink > &netlink)
Brings the Dobby bridge device down.
Definition BridgeInterface.cpp:101
bool setAddresses(const std::shared_ptr< Netlink > &netlink)
Sets the ip addresses for the bridge device.
Definition BridgeInterface.cpp:201
bool disableStp(const std::shared_ptr< DobbyRdkPluginUtils > &utils)
Disables Spanning Tree Protocol in sysfs file.
Definition BridgeInterface.cpp:222
bool destroyBridge(const std::shared_ptr< Netlink > &netlink)
Destroys the Dobby bridge device.
Definition BridgeInterface.cpp:63
std::array< uint8_t, 6 > macAddress(const std::shared_ptr< Netlink > &netlink)
Gets the MAC address of the interface.
Definition BridgeInterface.cpp:237
bool createBridge(const std::shared_ptr< Netlink > &netlink)
Creates the Dobby bridge device.
Definition BridgeInterface.cpp:48
bool up(const std::shared_ptr< Netlink > &netlink)
Brings the Dobby bridge device up.
Definition BridgeInterface.cpp:80
bool setIfaceAcceptRa(const std::shared_ptr< DobbyRdkPluginUtils > &utils, const std::shared_ptr< Netlink > &netlink, int value)
Sets the accept_ra on the Dobby bridge device.
Definition BridgeInterface.cpp:181
bool setIfaceForwarding(const std::shared_ptr< DobbyRdkPluginUtils > &utils, const std::shared_ptr< Netlink > &netlink, bool enable)
Sets forwarding on the Dobby bridge device.
Definition BridgeInterface.cpp:124
bool attachLink(const std::shared_ptr< Netlink > &netlink, const std::string &name)
Attaches an interface to the bridge.
Definition BridgeInterface.cpp:267