Skip to content

Commit 02508c2

Browse files
authored
Merge pull request #87 from MortenSchou/master
Fix segfault when converting to JSON format
2 parents b4d382a + b7d5a23 commit 02508c2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/aalwines/model/builders/AalWiNesBuilder.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ namespace aalwines {
158158
for (const auto& entry : table.entries()) {
159159
std::stringstream label;
160160
label << entry._top_label;
161-
j[label.str()] = entry._rules;
161+
std::vector<RoutingTable::forward_t> rules; // Filter out non-MPLS rules. ROUTE, RECEIVE and DISCARD types are undocumented legacy stuff...
162+
std::copy_if(entry._rules.begin(), entry._rules.end(), std::back_inserter(rules), [](const RoutingTable::forward_t& rule){ return rule._type == RoutingTable::MPLS; });
163+
j[label.str()] = rules;
162164
}
163165
}
164166

0 commit comments

Comments
 (0)