Fixes for 'make UNATTENDED=yes CC=clang CXX=clang verify'
[vpp.git] / src / vpp-api / vom / route.cpp
index 3b86fb2..247afa0 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "vom/route.hpp"
 #include "vom/route_cmds.hpp"
-#include "vom/singular_db.hpp"
+#include "vom/singular_db_funcs.hpp"
 
 namespace VOM {
 namespace route {
@@ -367,7 +367,7 @@ ip_route::singular() const
 void
 ip_route::dump(std::ostream& os)
 {
-  m_db.dump(os);
+  db_dump(m_db, os);
 }
 
 ip_route::event_handler::event_handler()
@@ -403,7 +403,7 @@ ip_route::event_handler::handle_populate(const client_db::key_t& key)
      * populating the route domain here
      */
     route_domain rd_temp(payload.table_id);
-    std::shared_ptr<route_domain> rd = route_domain::find(rd_temp);
+    std::shared_ptr<route_domain> rd = route_domain::find(payload.table_id);
     if (!rd) {
       OM::commit(key, rd_temp);
     }
@@ -427,8 +427,14 @@ ip_route::event_handler::handle_populate(const client_db::key_t& key)
         boost::asio::ip::address address = from_bytes(0, p.next_hop);
         std::shared_ptr<interface> itf = interface::find(p.sw_if_index);
         if (itf) {
-          path path_v4(address, *itf, p.weight, p.preference);
-          ip_r.add(path_v4);
+          if (p.is_dvr) {
+            path path_v4(*itf, nh_proto_t::IPV4, route::path::flags_t::DVR,
+                         p.weight, p.preference);
+            ip_r.add(path_v4);
+          } else {
+            path path_v4(address, *itf, p.weight, p.preference);
+            ip_r.add(path_v4);
+          }
         } else {
           path path_v4(rd_temp, address, p.weight, p.preference);
           ip_r.add(path_v4);
@@ -450,7 +456,7 @@ ip_route::event_handler::handle_populate(const client_db::key_t& key)
 
     prefix_t pfx(1, payload.address, payload.address_length);
     route_domain rd_temp(payload.table_id);
-    std::shared_ptr<route_domain> rd = route_domain::find(rd_temp);
+    std::shared_ptr<route_domain> rd = route_domain::find(payload.table_id);
     if (!rd) {
       OM::commit(key, rd_temp);
     }
@@ -474,8 +480,14 @@ ip_route::event_handler::handle_populate(const client_db::key_t& key)
         std::shared_ptr<interface> itf = interface::find(p.sw_if_index);
         boost::asio::ip::address address = from_bytes(1, p.next_hop);
         if (itf) {
-          path path_v6(address, *itf, p.weight, p.preference);
-          ip_r.add(path_v6);
+          if (p.is_dvr) {
+            path path_v6(*itf, nh_proto_t::IPV6, route::path::flags_t::DVR,
+                         p.weight, p.preference);
+            ip_r.add(path_v6);
+          } else {
+            path path_v6(address, *itf, p.weight, p.preference);
+            ip_r.add(path_v6);
+          }
         } else {
           path path_v6(rd_temp, address, p.weight, p.preference);
           ip_r.add(path_v6);
@@ -502,7 +514,7 @@ ip_route::event_handler::order() const
 void
 ip_route::event_handler::show(std::ostream& os)
 {
-  m_db.dump(os);
+  db_dump(m_db, os);
 }
 
 std::ostream&