Along with dependent data structures this function is useful for
external programs to make use of functionality provided by the
route-table module.

Signed-off-by: Frode Nordahl <[email protected]>
---
 lib/route-table.c | 35 +----------------------------------
 lib/route-table.h | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 34 deletions(-)

diff --git a/lib/route-table.c b/lib/route-table.c
index cd2f3583f..35b0a2b18 100644
--- a/lib/route-table.c
+++ b/lib/route-table.c
@@ -48,39 +48,6 @@ VLOG_DEFINE_THIS_MODULE(route_table);
 
 COVERAGE_DEFINE(route_table_dump);
 
-struct route_data_nexthop {
-    struct ovs_list nexthop_node;
-
-    sa_family_t family;
-    struct in6_addr addr;
-    char ifname[IFNAMSIZ]; /* Interface name. */
-};
-
-struct route_data {
-    struct ovs_list nexthops;
-
-    /* Copied from struct rtmsg. */
-    unsigned char rtm_dst_len;
-    unsigned char rtm_protocol;
-    bool local;
-
-    /* Extracted from Netlink attributes. */
-    struct in6_addr rta_dst; /* 0 if missing. */
-    struct in6_addr rta_prefsrc; /* 0 if missing. */
-    uint32_t mark;
-    uint32_t rta_table_id; /* 0 if missing. */
-    uint32_t rta_priority; /* 0 if missing. */
-};
-
-
-/* A digested version of a route message sent down by the kernel to indicate
- * that a route has changed. */
-struct route_table_msg {
-    bool relevant;        /* Should this message be processed? */
-    int nlmsg_type;       /* e.g. RTM_NEWROUTE, RTM_DELROUTE. */
-    struct route_data rd; /* Data parsed from this message. */
-};
-
 static struct ovs_mutex route_table_mutex = OVS_MUTEX_INITIALIZER;
 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
 
@@ -189,7 +156,7 @@ route_table_wait(void)
     ovs_mutex_unlock(&route_table_mutex);
 }
 
-static bool
+bool
 route_table_dump_one_table(
     uint32_t id,
     void (*handle_msg)(const struct route_table_msg *, void *),
diff --git a/lib/route-table.h b/lib/route-table.h
index 3a02d737a..592ad5570 100644
--- a/lib/route-table.h
+++ b/lib/route-table.h
@@ -24,8 +24,41 @@
 #include <stdbool.h>
 #include <stdint.h>
 
+#include "openvswitch/list.h"
 #include "openvswitch/types.h"
 
+struct route_data_nexthop {
+    struct ovs_list nexthop_node;
+
+    sa_family_t family;
+    struct in6_addr addr;
+    char ifname[IFNAMSIZ]; /* Interface name. */
+};
+
+struct route_data {
+    struct ovs_list nexthops;
+
+    /* Copied from struct rtmsg. */
+    unsigned char rtm_dst_len;
+    unsigned char rtm_protocol;
+    bool local;
+
+    /* Extracted from Netlink attributes. */
+    struct in6_addr rta_dst; /* 0 if missing. */
+    struct in6_addr rta_prefsrc; /* 0 if missing. */
+    uint32_t mark;
+    uint32_t rta_table_id; /* 0 if missing. */
+    uint32_t rta_priority; /* 0 if missing. */
+};
+
+/* A digested version of a route message sent down by the kernel to indicate
+ * that a route has changed. */
+struct route_table_msg {
+    bool relevant;        /* Should this message be processed? */
+    int nlmsg_type;       /* e.g. RTM_NEWROUTE, RTM_DELROUTE. */
+    struct route_data rd; /* Data parsed from this message. */
+};
+
 uint64_t route_table_get_change_seq(void);
 void route_table_init(void);
 void route_table_run(void);
@@ -33,4 +66,8 @@ void route_table_wait(void);
 bool route_table_fallback_lookup(const struct in6_addr *ip6_dst,
                                  char name[],
                                  struct in6_addr *gw6);
+bool route_table_dump_one_table(
+    uint32_t id,
+    void (*handle_msg)(const struct route_table_msg *, void *),
+    void *data);
 #endif /* route-table.h */
-- 
2.45.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to