[ovs-dev] [PATCH] ofproto: Ignore generation ID for role change to "equal".

Flavio Leitner fbl at sysclose.org
Wed Jul 29 01:06:04 UTC 2015


On Tue, Jul 28, 2015 at 03:21:49PM -0700, Ben Pfaff wrote:
> The OpenFlow specification says that only role changes to slave or master
> check the generation ID, so this is a bug fix.
> 
> Found by OFTest.

Found in OF1.5 page 45 which says that switch must ignore
generation_id if the role in the REQUEST is ROLE_EQUAL
because generation_id is specifically intended for the
disambiguation of race condition in master/slave transition.

> 
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
>  ofproto/ofproto.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index a724071..e9b1472 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -5315,7 +5315,8 @@ handle_role_request(struct ofconn *ofconn, const struct ofp_header *oh)
>      }
>  
>      if (request.role != OFPCR12_ROLE_NOCHANGE) {
> -        if (request.have_generation_id
> +        if (request.role != OFPCR12_ROLE_EQUAL
> +            && request.have_generation_id

maybe this:
       if (request.role != OFPCR12_ROLE_NOCHANGE
           && request.role != OFPCR12_ROLE_EQUAL) {
           if (request.have_generation_id
              && !ofconn_set_master_election_id(ofconn, request.generation_id)) {


just to have the .role comparison grouped.

I am fine either way.
fbl           

>              && !ofconn_set_master_election_id(ofconn, request.generation_id)) {
>                  return OFPERR_OFPRRFC_STALE;
>          }
> -- 
> 2.1.3
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev




More information about the dev mailing list