Skip to content

Commit

Permalink
Merge pull request #422 from bisdn/jogo_fix_frr_workaround
Browse files Browse the repository at this point in the history
fix duplicate route check for FRR
  • Loading branch information
rubensfig authored Nov 17, 2023
2 parents 6f780e6 + 1672f13 commit 4fa44ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/netlink/nl_l3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,7 @@ int nl_l3::add_l3_unicast_route(rtnl_route *r, bool update_route) {
rtnl_route_get_protocol(r) != RTPROT_KERNEL) {
nl_route_query rq;

auto route = rq.query_route(rtnl_route_get_dst(r));
auto route = rq.query_route(rtnl_route_get_dst(r), RTM_F_FIB_MATCH);

if (route) {
bool duplicate = false;
Expand Down Expand Up @@ -1933,7 +1933,7 @@ int nl_l3::del_l3_unicast_route(rtnl_route *r, bool keep_route) {
rtnl_route_get_protocol(r) != RTPROT_KERNEL) {
nl_route_query rq;

auto route = rq.query_route(rtnl_route_get_dst(r));
auto route = rq.query_route(rtnl_route_get_dst(r), RTM_F_FIB_MATCH);

if (route) {
bool duplicate = false;
Expand Down
3 changes: 2 additions & 1 deletion src/netlink/nl_route_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ class nl_route_query final {
/**
* return object has to be freed using nl_object_put
*/
struct rtnl_route *query_route(struct nl_addr *dst) {
struct rtnl_route *query_route(struct nl_addr *dst, uint32_t flags = 0) {
int err = 1;
struct nl_msg *m;
struct rtmsg rmsg;
memset(&rmsg, 0, sizeof(rmsg));
rmsg.rtm_family = nl_addr_get_family(dst);
rmsg.rtm_dst_len = nl_addr_get_prefixlen(dst);
rmsg.rtm_flags = flags;

struct nl_object *route = nullptr;
nl_socket_modify_cb(sock, NL_CB_VALID, NL_CB_CUSTOM, cb, &route);
Expand Down

0 comments on commit 4fa44ec

Please sign in to comment.