diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 7d24648ff1..234b7e9147 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -520,7 +520,9 @@ update_sequence_numbers(int64_t loop_start_time, chassis_priv->name); } - if (chassis_priv->nb_cfg < hv_cfg) { + /* Detect if overflows happened within the cfg update. */ + int64_t delta = chassis_priv->nb_cfg - hv_cfg; + if (chassis_priv->nb_cfg < hv_cfg || delta > INT32_MAX) { hv_cfg = chassis_priv->nb_cfg; hv_cfg_ts = chassis_priv->nb_cfg_timestamp; } else if (chassis_priv->nb_cfg == hv_cfg && diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c index 9399f9462b..03b18595dc 100644 --- a/utilities/ovn-nbctl.c +++ b/utilities/ovn-nbctl.c @@ -122,7 +122,9 @@ nbctl_post_execute(struct ovsdb_idl *idl, struct ovsdb_idl_txn *txn, int64_t cur_cfg = (wait_type == NBCTL_WAIT_SB ? nb->sb_cfg : MIN(nb->sb_cfg, nb->hv_cfg)); - if (cur_cfg >= next_cfg) { + /* Detect if overflows happened within the cfg update. */ + int64_t delta = cur_cfg - next_cfg; + if (cur_cfg >= next_cfg && delta < INT32_MAX) { if (print_wait_time) { printf("Time spent on processing nb_cfg %"PRId64":\n", next_cfg);