-
Notifications
You must be signed in to change notification settings - Fork 28
Description
A controller in role slave is not allowed to perform actions that changes the state of the switch.
Version 1.3.1, ch 6.3.4 page 30 it says about controllers with role=slave
"The controller is denied the ability to execute controller-to-switch commands that modify the state of the switch, OFPT_PACKET_OUT, OFPT_FLOW_MOD, OFPT_GROUP_MOD, OFPT_PORT_MOD and OFPT_TABLE_MOD. If the controller sends one of those commands, the switch must reply with an OFPT_ERROR message with a type field of OFPET_BAD_REQUEST, a code field of OFPBRC_IS_SLAVE. Other controller-to-switch messages, such as OFPT_MULTIPART_REQUEST and OFPT_ROLE_REQUEST, should be processed normally."
This is not completely correct. The multipart subcommand table_features can be used to modify the switch. So it is necessary to add something like
handle_message(#ofp_message{
version = Version, type = multipart_request,
body = #ofp_table_features_request{ body = Body }} = Message,
#state{role = slave} = State) when Body /= [] ->
%% Don't allow slave controllers to modify things.
Error = create_error(Version, bad_request, is_slave),
IsSlaveError = Message#ofp_message{body = Error},
do_send(IsSlaveError, State);
to ofp_client. But this is not possible since ofp_client is version agnostic, so the #ofp_table_features record is not available.