Skip to content

Commit

Permalink
Always update statefile for neighbor elected mac when storing winner mac
Browse files Browse the repository at this point in the history
* Always update statefile for neighbor elected mac when storing winner mac

Co-authored-by: Mika Juvonen <[email protected]>
Co-authored-by: Andy Koszela <[email protected]>
  • Loading branch information
3 people authored Mar 18, 2022
1 parent 535faca commit 3eecdf1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 27 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_INIT([libteam], [1.31-wmo3], [[email protected]])
AC_INIT([libteam], [1.31-wmo4], [[email protected]])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
Expand Down
37 changes: 11 additions & 26 deletions teamd/teamd_runner_ttdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,14 @@ static int elect_neighbor(struct teamd_context *ctx, struct ab *ab, uint8_t *nex
/* store winner mac */
memcpy(ab->elected_neighbor.neighbor_mac, ab->neighbors[candidate_suggestion].neighbor_mac,
sizeof(ab->elected_neighbor.neighbor_mac));
/* Update neighbor mac statefile */
/* Notify the rest of the stack that something has changed */
lag_state_write_elected_neighbor_mac(ctx, ab);
if (ab->is_s4r) {
lag_state_write_elected_neighbor_uuid(ctx, ab);
lag_state_write_elected_neighbor_primary_state(ctx, ab);
}
teamd_ttdp_log_infox(ctx->team_devname, "Writing elected neighbor to state file.");
/* store winner uuid */
memcpy(ab->elected_neighbor.neighbor_uuid, ab->neighbors[candidate_suggestion].neighbor_uuid,
sizeof(ab->elected_neighbor.neighbor_uuid));
Expand Down Expand Up @@ -1069,22 +1077,8 @@ static int ab_link_watch_handler_internal(struct teamd_context *ctx, struct ab *
* add links that have come up to the aggregate, but we do elect neighbors. */
if (ab->aggregate_status == TTDP_AGG_STATE_FIXED_END) {
teamd_ttdp_log_infox(ctx->team_devname, "Linkwatch handler update in FIXED END mode...");
/* Neighbor data is automatically set by my ports. Perform election
* and notify tcnd if it's changed. */
if (elect_neighbor(ctx, ab, ab->neighbor_agreement) != 0) {
/* Notify tcnd that something has changed */

//if (ab->silent == TTDP_NOT_SILENT) {
lag_state_write_elected_neighbor_mac(ctx, ab);
if (ab->is_s4r) {
lag_state_write_elected_neighbor_uuid(ctx, ab);
lag_state_write_elected_neighbor_primary_state(ctx, ab);
}
//}
/* FIXME */
teamd_ttdp_log_infox(ctx->team_devname, "Wrote elected neighbor state file.");
}

/* Neighbor data is automatically set by my ports. Perform election. */
elect_neighbor(ctx, ab, ab->neighbor_agreement);
update_aggregate_state(ctx, ab);
return 0;
}
Expand Down Expand Up @@ -1119,19 +1113,10 @@ static int ab_link_watch_handler_internal(struct teamd_context *ctx, struct ab *
}
}

/* Neighbor data is automatically set by my ports. Perform election
* and notify tcnd if it's changed. */
/* Neighbor data is automatically set by my ports. Perform election. */
if (elect_neighbor(ctx, ab, ab->neighbor_agreement) != 0) {
if (allow_update_aggregate_state)
update_aggregate_state(ctx, ab);

/* Notify tcnd that something has changed */
teamd_ttdp_log_infox(ctx->team_devname, "Writing elected neighbor to state file.");
lag_state_write_elected_neighbor_mac(ctx, ab);
if (ab->is_s4r) {
lag_state_write_elected_neighbor_uuid(ctx, ab);
lag_state_write_elected_neighbor_primary_state(ctx, ab);
}
}

teamd_ttdp_log_dbgx(ctx->team_devname, "AGREE mode %d count %d %d", ab->neighbor_agreement_mode,
Expand Down

0 comments on commit 3eecdf1

Please sign in to comment.