Skip to content

Commit f516714

Browse files
authored
Merge pull request #129 from polycube-network/pr/iptables_minor_fixes
pcn-iptables: minor fixes
2 parents 8ad1b6c + d7285b1 commit f516714

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/services/pcn-iptables/src/Chain.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ ChainInsertOutputJsonObject Chain::insert(ChainInsertInputJsonObject input) {
232232
id = input.getId();
233233
}
234234

235+
if (id > rules_.size()) {
236+
throw std::runtime_error("id not allowed");
237+
}
238+
235239
auto newRule = std::make_shared<ChainRule>(*this, conf);
236240

237241
ChainStatsJsonObject confStats;
@@ -1072,4 +1076,4 @@ void Chain::delRuleList() {
10721076
if (parent_.interactive_) {
10731077
applyRules();
10741078
}
1075-
}
1079+
}

src/services/pcn-iptables/src/ChainRule.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,20 @@ bool ChainRule::equal(ChainRule &cmp) {
176176
return false;
177177
}
178178

179+
if (inIfaceIsSet != cmp.inIfaceIsSet)
180+
return false;
181+
if (inIfaceIsSet) {
182+
if (inIface != cmp.inIface)
183+
return false;
184+
}
185+
186+
if (outIfaceIsSet != cmp.outIfaceIsSet)
187+
return false;
188+
if (outIfaceIsSet) {
189+
if (outIface != cmp.outIface)
190+
return false;
191+
}
192+
179193
if (actionIsSet != cmp.actionIsSet)
180194
return false;
181195

0 commit comments

Comments
 (0)