Skip to content

Commit

Permalink
add support for distributed lrp bfd
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian committed Oct 30, 2024
1 parent df87e13 commit 234f3bc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions controller/pinctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -7561,6 +7561,15 @@ bfd_monitor_run(struct ovsdb_idl_txn *ovnsb_idl_txn,
continue;
}

if (smap_get_bool(&pb->external_ids, "distributed-bfd", false)) {
const char *chassis_name = smap_get(&bt->external_ids,
"chassis-name");
if (!chassis_name || strcmp(chassis_name, chassis->name)) {
continue;
}
goto handle_bfd;
}

const char *peer_s = smap_get(&pb->options, "peer");
if (!peer_s) {
continue;
Expand All @@ -7582,6 +7591,7 @@ bfd_monitor_run(struct ovsdb_idl_txn *ovnsb_idl_txn,
continue;
}

handle_bfd:
entry = pinctrl_find_bfd_monitor_entry_by_port(
bt->dst_ip, bt->src_port);
if (!entry) {
Expand Down
14 changes: 14 additions & 0 deletions northd/northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -10098,6 +10098,13 @@ build_bfd_update_sb_conf(const struct nbrec_bfd *nb_bt,
if (min_rx != sb_bt->min_rx) {
sbrec_bfd_set_min_rx(sb_bt, min_rx);
}

struct smap ids = SMAP_INITIALIZER(&ids);
if (nb_bt->external_ids && !smap_is_empty(&nb_bt->external_ids)) {
smap_clone(&ids, &nb_bt->external_ids);
}
sbrec_bfd_set_external_ids(sb_bt, &ids);
smap_destroy(&ids);
}

/* RFC 5881 section 4
Expand Down Expand Up @@ -10178,6 +10185,13 @@ build_bfd_table(struct ovsdb_idl_txn *ovnsb_txn,
int d_mult = nb_bt->n_detect_mult ? nb_bt->detect_mult[0]
: BFD_DEF_DETECT_MULT;
sbrec_bfd_set_detect_mult(sb_bt, d_mult);

struct smap ids = SMAP_INITIALIZER(&ids);
if (nb_bt->external_ids && !smap_is_empty(&nb_bt->external_ids)) {
smap_clone(&ids, &nb_bt->external_ids);
}
sbrec_bfd_set_external_ids(sb_bt, &ids);
smap_destroy(&ids);
} else {
if (strcmp(bfd_e->sb_bt->status, nb_bt->status)) {
if (!strcmp(nb_bt->status, "admin_down") ||
Expand Down

0 comments on commit 234f3bc

Please sign in to comment.