[ovs-dev] [PATCH 14/14] ofproto: Add support for master/slave controller coordination.

Justin Pettit jpettit at nicira.com
Tue Apr 20 07:51:48 UTC 2010


On Apr 8, 2010, at 5:07 PM, Ben Pfaff wrote:

> @@ -54,6 +59,34 @@ struct nicira_header {
> };
> OFP_ASSERT(sizeof(struct nicira_header) == 16);
> 
> +/* Configures the "role" of the sending controller:
> + *
> + *    - Other (NX_ROLE_OTHER), the default role if a controller has not
> + *      configured one for itself, allows the controller access to all OpenFlow
> + *      features.
> + *
> + *    - Master (NX_ROLE_MASTER) is equivalent to Other, except that there may
> + *      be at most one Master controller at a time: when a controller
> + *      configures itself as Master, any existing Master is demoted to the
> + *      Slave role.

On my first read through this, it wasn't really clear to me the difference between "Master" and "Other".  By reading through the source, I now know that "Master" and "Slave" are essentially a pairing.  And "Other" is completely outside of their interactions.  I think it might be good to be a little more explicit.

> + *
> + *    - Slave (NX_ROLE_SLAVE) allows the controller read-only access to
> + *      OpenFlow features.  In particular attempts to modify the flow table
> + *      will be rejected with an OFPBRC_EPERM error.
> + *
> + *      Slave controllers also do not receive asynchronous messages
> + *      (OFPT_PACKET_IN, OFPT_FLOW_REMOVED, OFPT_PORT_STATUS).
> + */


> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index 00ebfe2..8de3183 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> 
> @@ -2050,7 +2056,7 @@ handle_set_config(struct ofproto *p, struct ofconn *ofconn,
>     }
>     flags = ntohs(osc->flags);
> 
> -    if (ofconn->type == OFCONN_CONTROLLER) {
> +    if (ofconn->type == OFCONN_CONTROLLER && ofconn->role != NX_ROLE_SLAVE) {

Is there a reason you didn't call reject_slave_controller() to generate an EPERM in this case?

Thanks for generating the set!

--Justin






More information about the dev mailing list