Skip to content

Commit b4d4499

Browse files
committed
OFConnectionManager: implement OF 1.4 role status message
The BSN role status message was backported from the standard so the code is basically identical.
1 parent 4f00d7b commit b4d4499

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

modules/OFConnectionManager/module/src/ofconnectionmanager.c

+14-1
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,10 @@ ind_cxn_send_role_status(connection_t *cxn, int reason)
901901
/* Master -> slave is currently the only possible case */
902902
INDIGO_ASSERT(cxn->controller->role == INDIGO_CXN_R_SLAVE);
903903

904+
/* The BSN backport and the standard message use the same reason values */
905+
AIM_ASSERT(reason == OFPCRR_MASTER_REQUEST);
906+
AIM_ASSERT(OFPCRR_MASTER_REQUEST == OFP_BSN_CONTROLLER_ROLE_REASON_MASTER_REQUEST);
907+
904908
if (cxn->status.negotiated_version == OF_VERSION_1_3) {
905909
of_bsn_role_status_t *msg = of_bsn_role_status_new(OF_VERSION_1_3);
906910
if (msg == NULL) {
@@ -910,6 +914,15 @@ ind_cxn_send_role_status(connection_t *cxn, int reason)
910914
of_bsn_role_status_reason_set(msg, reason);
911915
of_bsn_role_status_generation_id_set(msg, ind_cxn_generation_id);
912916
indigo_cxn_send_controller_message(cxn->cxn_id, msg);
917+
} else if (cxn->status.negotiated_version >= OF_VERSION_1_4) {
918+
of_role_status_t *msg = of_role_status_new(cxn->status.negotiated_version);
919+
if (msg == NULL) {
920+
AIM_DIE("Failed to allocate role status message");
921+
}
922+
of_role_status_role_set(msg, OF_CONTROLLER_ROLE_SLAVE);
923+
of_role_status_reason_set(msg, reason);
924+
of_role_status_generation_id_set(msg, ind_cxn_generation_id);
925+
indigo_cxn_send_controller_message(cxn->cxn_id, msg);
913926
}
914927
}
915928

@@ -937,7 +950,7 @@ ind_controller_change_master(indigo_controller_id_t master_id)
937950
ctrl->role = INDIGO_CXN_R_SLAVE;
938951
ind_cxn_send_role_status(
939952
CXN_ID_TO_CONNECTION(ctrl->aux_id_to_cxn_id[0]),
940-
OFP_BSN_CONTROLLER_ROLE_REASON_MASTER_REQUEST);
953+
OFPCRR_MASTER_REQUEST);
941954
}
942955
}
943956
}

0 commit comments

Comments
 (0)