diff --git a/configure.ac b/configure.ac index 64e0b89..b8006c0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_INIT([libteam], [1.31-wmo2], [jiri@resnulli.us]) +AC_INIT([libteam], [1.31-wmo3], [jiri@resnulli.us]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) diff --git a/teamd/teamd_lw_ttdp.c b/teamd/teamd_lw_ttdp.c index d4d954a..18045c0 100644 --- a/teamd/teamd_lw_ttdp.c +++ b/teamd/teamd_lw_ttdp.c @@ -714,6 +714,11 @@ static int lw_ttdp_load_options(struct teamd_context *ctx, int err; struct ab* ab = ctx->runner_priv; + if (ab == NULL) { + teamd_log_err("Configuration error"); + return 1; + } + if (ab->is_s4r) { if (ctx->runner && ctx->runner->name && (strncmp("ttdp_s4r", ctx->runner->name, 9) != 0)) { teamd_log_err("This linkwatcher requires the \"ttdp_s4r\" runner. Aborting."); @@ -726,11 +731,6 @@ static int lw_ttdp_load_options(struct teamd_context *ctx, } } - if (ab == NULL) { - teamd_log_err("Configuration error"); - return 1; - } - err = teamd_config_int_get(ctx, &tmp, "@.initial_mode", cpcookie); if (err) { teamd_log_warn("Failed to get initial_mode, defaulting to 1 (slow)"); @@ -844,8 +844,8 @@ static int lw_ttdp_load_options(struct teamd_context *ctx, err = teamd_config_int_get(ctx, &tmp, "@.direction", cpcookie); if (err) { struct ab* ab = ctx->runner_priv; - if (ab && (ab->direction == 1 || ab->direction == 2) || - (ab->is_s4r && (ab->direction == 3 || ab->direction == 4))) { + if (ab && ((ab->direction == 1 || ab->direction == 2) || + (ab->is_s4r && (ab->direction == 3 || ab->direction == 4)))) { teamd_ttdp_log_infox(ttdp_ppriv, "Watcher direction not specified - using runner direction %d", ab->direction); ttdp_ppriv->direction = ab->direction; } else { @@ -1679,7 +1679,7 @@ static int lw_ttdp_receive(struct teamd_context *ctx, int events, void *priv) { notify = 1; } - if (ab && ab->is_s4r && ttdp_ppriv->neighbor_primary_state != ttdp_ppriv->prev_neighbor_primary_state) { + if (ab->is_s4r && ttdp_ppriv->neighbor_primary_state != ttdp_ppriv->prev_neighbor_primary_state) { teamd_ttdp_log_infox(ttdp_ppriv, "Neighbor has new primary state! %08X -> %08X", ttdp_ppriv->prev_neighbor_primary_state, ttdp_ppriv->neighbor_primary_state); struct ab *p = (struct ab*)ctx->runner_priv; diff --git a/teamd/teamd_runner_ttdp.c b/teamd/teamd_runner_ttdp.c index 614a68c..2c4ef6b 100644 --- a/teamd/teamd_runner_ttdp.c +++ b/teamd/teamd_runner_ttdp.c @@ -2878,14 +2878,14 @@ static int ab_init(struct teamd_context *ctx, void *priv) { struct ab *ab = priv; ab->is_s4r = false; - _ab_init(ctx, priv); + return _ab_init(ctx, priv); } static int ab_init_s4r(struct teamd_context *ctx, void *priv) { struct ab *ab = priv; ab->is_s4r = true; - _ab_init(ctx, priv); + return _ab_init(ctx, priv); } static void ab_fini(struct teamd_context *ctx, void *priv)