Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix pcn-iptables interface matching issue #252

Merged
merged 1 commit into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/iptables/iptables
Submodule iptables updated 1 files
+4 −4 libiptc/libiptc.c
3 changes: 3 additions & 0 deletions src/polycubed/src/base_cube.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class BaseCube : virtual public BaseCubeIface {
protected:
static const int _POLYCUBE_MAX_BPF_PROGRAMS = 64;
static const int _POLYCUBE_MAX_PORTS = 128;
static_assert(_POLYCUBE_MAX_PORTS <= 0xffff,
"_POLYCUBE_MAX_PORTS shouldn't be great than 0xffff, "
"id 0xffff was used by iptables wild card index");
static std::vector<std::string> cflags;

virtual int load(ebpf::BPF &bpf, ProgramType type) = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/services/pcn-iptables/src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ bool Chain::interfaceFromRulesToMap(
if (interfaces.size() != 0 && dont_care_rules.size() != 0) {
std::vector<uint64_t> bitVector(
FROM_NRULES_TO_NELEMENTS(Iptables::max_rules_));
interfaces.insert(std::pair<uint16_t, std::vector<uint64_t>>(0, bitVector));
interfaces.insert(std::pair<uint16_t, std::vector<uint64_t>>(0xffff, bitVector));
for (auto const &ruleNumber : dont_care_rules) {
for (auto &interface : interfaces) {
SET_BIT((interface.second)[ruleNumber / 63], ruleNumber % 63);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Iptables::InterfaceLookup::InterfaceLookup(
: ProgramType::INGRESS) {
this->type_ = type;

auto it = ports.find(0);
auto it = ports.find(0xffff);
if (it == ports.end()) {
wildcard_rule_ = false;
wildcard_string_ = "";
Expand Down