@@ -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);
@@ -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) {
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 <dchumak@nvidia.com> --- lib/ovs-router.h | 13 +++++++++++++ lib/route-table.c | 11 +---------- 2 files changed, 14 insertions(+), 10 deletions(-)