Make internal function is_standard_table_id() public and move it to
ovs-router.h to be used by the next patches in the series.

Since it will be used in both ovs-router.c and route-table.c, and taking
into consideration that route-table.c already includes ovs-router.h, it
makes sense to move the declaration into ovs-router.h.

Signed-off-by: Dima Chumak <dchu...@nvidia.com>
---
 lib/ovs-router.h  | 13 +++++++++++++
 lib/route-table.c | 11 +----------
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/lib/ovs-router.h b/lib/ovs-router.h
index b61712707b1e..c2a92324b6da 100644
--- a/lib/ovs-router.h
+++ b/lib/ovs-router.h
@@ -19,6 +19,9 @@
 
 #include <sys/types.h>
 #include <netinet/in.h>
+#ifdef HAVE_NETLINK
+#include <linux/rtnetlink.h>
+#endif
 
 #include "util.h"
 
@@ -26,6 +29,16 @@
 extern "C" {
 #endif
 
+#ifdef HAVE_NETLINK
+static inline bool ovs_router_is_standard_table_id(uint32_t table_id)
+{
+    return !table_id
+           || table_id == RT_TABLE_DEFAULT
+           || table_id == RT_TABLE_MAIN
+           || table_id == RT_TABLE_LOCAL;
+}
+#endif
+
 bool ovs_router_lookup(uint32_t mark, const struct in6_addr *ip_dst,
                        char output_netdev[],
                        struct in6_addr *src, struct in6_addr *gw);
diff --git a/lib/route-table.c b/lib/route-table.c
index 2bbb51c08f7e..23e43bd02541 100644
--- a/lib/route-table.c
+++ b/lib/route-table.c
@@ -519,21 +519,12 @@ route_table_parse(struct ofpbuf *buf, void *change)
                                nlmsg, rtm, NULL, change);
 }
 
-static bool
-is_standard_table_id(uint32_t table_id)
-{
-    return !table_id
-           || table_id == RT_TABLE_DEFAULT
-           || table_id == RT_TABLE_MAIN
-           || table_id == RT_TABLE_LOCAL;
-}
-
 static void
 route_table_change(struct route_table_msg *change, void *aux OVS_UNUSED)
 {
     if (!change
         || (change->relevant
-            && is_standard_table_id(change->rd.rta_table_id))) {
+            && ovs_router_is_standard_table_id(change->rd.rta_table_id))) {
         route_table_valid = false;
     }
     if (change) {
-- 
2.49.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to