[ovs-dev] [PATCH 04/17] rstp-state-machines: Fix compare_rstp_priority_vector().

Jarno Rajahalme jrajahalme at nicira.com
Thu Nov 13 23:21:58 UTC 2014


On Nov 6, 2014, at 7:31 AM, Daniele Venturino <daniele.venturino at m3s.it> wrote:

>        The bridge_port_id is never conveyed in Configuration Messages, but is
>        used as a tie-breaker within a Bridge. This patch extends the
>        comparison to this fifth field in a rstp_priority_vector.

The commit message in the email should not have the indentation. I have removed the indentation in my working copy, so:

Acked-by: Jarno Rajahalme <jrajahalme at nicira.com>

> 
> Signed-off-by: Daniele Venturino <daniele.venturino at m3s.it>
> ---
> lib/rstp-state-machines.c | 18 ++++++++++++++----
> 1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/rstp-state-machines.c b/lib/rstp-state-machines.c
> index ade2d61..1912d7e 100644
> --- a/lib/rstp-state-machines.c
> +++ b/lib/rstp-state-machines.c
> @@ -1978,12 +1978,14 @@ static enum vector_comparison
> compare_rstp_priority_vectors(const struct rstp_priority_vector *v1,
>                              const struct rstp_priority_vector *v2)
> {
> -    VLOG_DBG("v1: "RSTP_ID_FMT", %u, "RSTP_ID_FMT", %d",
> +    VLOG_DBG("v1: "RSTP_ID_FMT", %u, "RSTP_ID_FMT", %d, %d",
>              RSTP_ID_ARGS(v1->root_bridge_id), v1->root_path_cost,
> -             RSTP_ID_ARGS(v1->designated_bridge_id), v1->designated_port_id);
> -    VLOG_DBG("v2: "RSTP_ID_FMT", %u, "RSTP_ID_FMT", %d",
> +             RSTP_ID_ARGS(v1->designated_bridge_id), v1->designated_port_id,
> +             v1->bridge_port_id);
> +    VLOG_DBG("v2: "RSTP_ID_FMT", %u, "RSTP_ID_FMT", %d, %d",
>              RSTP_ID_ARGS(v2->root_bridge_id), v2->root_path_cost,
> -             RSTP_ID_ARGS(v2->designated_bridge_id), v2->designated_port_id);
> +             RSTP_ID_ARGS(v2->designated_bridge_id), v2->designated_port_id,
> +             v2->bridge_port_id);
> 
>     /* [17.6]
>      * This message priority vector is superior to the port priority vector and
> @@ -2018,6 +2020,14 @@ compare_rstp_priority_vectors(const struct rstp_priority_vector *v1,
>             && v1->root_path_cost == v2->root_path_cost
>             && v1->designated_bridge_id == v2->designated_bridge_id
>             && v1->designated_port_id == v2->designated_port_id) {
> +            if (v1->bridge_port_id < v2->bridge_port_id) {
> +                VLOG_DBG("superior");
> +                return SUPERIOR;
> +            }
> +            else if (v1->bridge_port_id > v2->bridge_port_id) {
> +                VLOG_DBG("inferior");
> +                return INFERIOR;
> +            }
>             VLOG_DBG("superior_same");
>             return SAME;
>         }
> -- 
> 1.8.1.2
> 




More information about the dev mailing list