Skip to content

Commit

Permalink
ic: minor code improvements
Browse files Browse the repository at this point in the history
1. Remove excess nbrec_logical_router variable.
2. Remove excess call to add_static_to_routes_ad().
3. Remove double nexthop check in ic_route_find().

Acked-by: Numan Siddique <numans@ovn.org>
Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
(cherry picked from commit 5916210)
  • Loading branch information
odivlad authored and dceara committed Dec 16, 2022
1 parent 5cefb15 commit 5b0e813
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions ic/ovn-ic.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,8 +899,7 @@ ic_route_find(struct hmap *routes, const struct in6_addr *prefix,
r->plen == plen &&
ipv6_addr_equals(&r->nexthop, nexthop) &&
!strcmp(r->origin, origin) &&
!strcmp(r->route_table ? r->route_table : "", route_table) &&
ipv6_addr_equals(&r->nexthop, nexthop)) {
!strcmp(r->route_table ? r->route_table : "", route_table)) {
return r;
}
}
Expand Down Expand Up @@ -1135,17 +1134,8 @@ add_static_to_routes_ad(
struct hmap *routes_ad,
const struct nbrec_logical_router_static_route *nb_route,
const struct lport_addresses *nexthop_addresses,
const struct smap *nb_options, const char *route_table)
const struct smap *nb_options)
{
if (strcmp(route_table, nb_route->route_table)) {
if (VLOG_IS_DBG_ENABLED()) {
VLOG_DBG("Skip advertising route %s -> %s as its route table %s !="
" %s of TS port", nb_route->ip_prefix, nb_route->nexthop,
nb_route->route_table, route_table);
}
return;
}

struct in6_addr prefix, nexthop;
unsigned int plen;
if (!parse_route(nb_route->ip_prefix, nb_route->nexthop,
Expand Down Expand Up @@ -1570,10 +1560,10 @@ build_ts_routes_to_adv(struct ic_context *ctx,
nbrec_logical_router_update_static_routes_delvalue(lr,
nb_route);
}
} else {
} else if (!strcmp(ts_route_table, nb_route->route_table)) {
/* It may be a route to be advertised */
add_static_to_routes_ad(routes_ad, nb_route, ts_port_addrs,
&nb_global->options, ts_route_table);
&nb_global->options);
}
}

Expand Down Expand Up @@ -1606,7 +1596,6 @@ advertise_lr_routes(struct ic_context *ctx,
const struct icsbrec_port_binding *isb_pb;
const char *lrp_name, *ts_name, *route_table;
struct lport_addresses ts_port_addrs;
const struct nbrec_logical_router *lr = ic_lr->lr;
const struct icnbrec_transit_switch *key;

struct hmap routes_ad = HMAP_INITIALIZER(&routes_ad);
Expand All @@ -1624,7 +1613,7 @@ advertise_lr_routes(struct ic_context *ctx,
VLOG_INFO_RL(&rl, "Route sync ignores port %s on ts %s for router"
" %s because the addresses are invalid.",
isb_pb->logical_port, isb_pb->transit_switch,
lr->name);
ic_lr->lr->name);
continue;
}
lrp_name = get_lrp_name_by_ts_port_name(ctx, isb_pb->logical_port);
Expand Down

0 comments on commit 5b0e813

Please sign in to comment.