Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
MulticastForwarder.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 2020 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#ifndef MULTICASTFORWARDER_H
21#define MULTICASTFORWARDER_H
22
23#include "Netfilter.h"
24#include "rt_dobby_schema.h"
25
26#include <sys/types.h>
27#include <netinet/in.h>
28#include <map>
29#include <list>
30#include <unordered_map>
31#include <mutex>
32#include <string>
33#include <memory>
34#include <vector>
35
36
37// -----------------------------------------------------------------------------
50namespace MulticastForwarder
51{
52bool set(const std::shared_ptr<Netfilter> &netfilter,
53 const rt_defs_plugins_networking_data *pluginData,
54 const std::string &vethName,
55 const std::string &containerId,
56 const std::vector<std::string> &extIfaces);
57
58bool removeRules(const std::shared_ptr<Netfilter> &netfilter,
59 const rt_defs_plugins_networking_data *pluginData,
60 const std::string &vethName,
61 const std::string &containerId,
62 const std::vector<std::string> &extIfaces);
63};
64
65bool checkCompatibility();
66int checkAddressFamily(const std::string &address);
67bool executeCommand(const std::string &command);
68
69bool addSmcrouteRules(const std::vector<std::string> &extIfaces, const std::string &address, const std::string &containerId);
70bool removeSmcrouteRules(const std::string &containerId);
71
72std::string constructPreRoutingIptablesRule(const std::string &containerId,
73 const std::string &address,
74 const in_port_t port,
75 const int addressFamily);
76std::string constructForwardingIptablesRule(const std::string &containerId,
77 const std::string &address,
78 const in_port_t port,
79 const int addressFamily);
80std::string constructEbtablesRule(const std::string &address,
81 const std::string &vethName,
82 const int addressFamily);
83std::string constructSmcrouteRules(const std::string &extIface,
84 const std::string &address);
85
86#endif // MULTICASTFORWARDER_H
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.
Definition DnsmasqSetup.cpp:173
bool removeRules(const std::shared_ptr< Netfilter > &netfilter, const std::shared_ptr< NetworkingHelper > &helper, const std::string &containerId)
Deletes dnsmasq rules for the container.
Definition DnsmasqSetup.cpp:256