This allows external callers to provide their own function for handling route messages processed by the route-table module.
Signed-off-by: Frode Nordahl <[email protected]> Acked-by: Eelco Chaudron <[email protected]> --- lib/route-table.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/route-table.c b/lib/route-table.c index 180da1632..3539ac11f 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -114,7 +114,7 @@ static struct nln_notifier *name_notifier = NULL; static bool route_table_valid = false; static void route_table_reset(void); -static void route_table_handle_msg(const struct route_table_msg *); +static void route_table_handle_msg(const struct route_table_msg *, void *aux); static int route_table_parse(struct ofpbuf *, void *change); static void route_table_change(struct route_table_msg *, void *aux); static void route_map_clear(void); @@ -197,8 +197,13 @@ route_table_wait(void) ovs_mutex_unlock(&route_table_mutex); } +typedef void route_table_handle_msg_callback(const struct route_table_msg *, + void *aux); + static bool -route_table_dump_one_table(uint32_t id) +route_table_dump_one_table(uint32_t id, + route_table_handle_msg_callback *handle_msg_cb, + void *aux) { uint64_t reply_stub[NL_DUMP_BUFSIZE / 8]; struct ofpbuf request, reply, buf; @@ -234,7 +239,7 @@ route_table_dump_one_table(uint32_t id) if (!(nlmsghdr->nlmsg_flags & NLM_F_DUMP_FILTERED)) { filtered = false; } - route_table_handle_msg(&msg); + handle_msg_cb(&msg, aux); route_data_destroy(&msg.rd); } } @@ -261,7 +266,8 @@ route_table_reset(void) COVERAGE_INC(route_table_dump); for (size_t i = 0; i < ARRAY_SIZE(tables); i++) { - if (!route_table_dump_one_table(tables[i])) { + if (!route_table_dump_one_table(tables[i], + route_table_handle_msg, NULL)) { /* Got unfiltered reply, no need to dump further. */ break; } @@ -496,7 +502,8 @@ route_table_change(struct route_table_msg *change, void *aux OVS_UNUSED) } static void -route_table_handle_msg(const struct route_table_msg *change) +route_table_handle_msg(const struct route_table_msg *change, + void *aux OVS_UNUSED) { if (change->relevant && change->nlmsg_type == RTM_NEWROUTE && !ovs_list_is_empty(&change->rd.nexthops)) { -- 2.47.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
