Skip to content

Commit

Permalink
Merge pull request #129 from polycube-network/pr/iptables_minor_fixes
Browse files Browse the repository at this point in the history
pcn-iptables: minor fixes
  • Loading branch information
frisso committed May 21, 2019
2 parents 8ad1b6c + d7285b1 commit f516714
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/services/pcn-iptables/src/Chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ ChainInsertOutputJsonObject Chain::insert(ChainInsertInputJsonObject input) {
id = input.getId();
}

if (id > rules_.size()) {
throw std::runtime_error("id not allowed");
}

auto newRule = std::make_shared<ChainRule>(*this, conf);

ChainStatsJsonObject confStats;
Expand Down Expand Up @@ -1072,4 +1076,4 @@ void Chain::delRuleList() {
if (parent_.interactive_) {
applyRules();
}
}
}
14 changes: 14 additions & 0 deletions src/services/pcn-iptables/src/ChainRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,20 @@ bool ChainRule::equal(ChainRule &cmp) {
return false;
}

if (inIfaceIsSet != cmp.inIfaceIsSet)
return false;
if (inIfaceIsSet) {
if (inIface != cmp.inIface)
return false;
}

if (outIfaceIsSet != cmp.outIfaceIsSet)
return false;
if (outIfaceIsSet) {
if (outIface != cmp.outIface)
return false;
}

if (actionIsSet != cmp.actionIsSet)
return false;

Expand Down

0 comments on commit f516714

Please sign in to comment.