1 /************************************************************************
2 * RSTP library - Rapid Spanning Tree (802.1t, 802.1w)
3 * Copyright (C) 2001-2003 Optical Access
6 * This file is part of RSTP library.
8 * RSTP library is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by the
10 * Free Software Foundation; version 2.1
12 * RSTP library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
15 * General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with RSTP library; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 **********************************************************************/
23 /* Port Protocol Migration state machine : 17.26 */
31 CHOOSE(SENDING_RSTP), \
36 #define GET_STATE_NAME STP_migrate_get_state_name
39 #define MigrateTime 3 /* 17,16.4 */
42 STP_migrate_enter_state (STATE_MACH_T
* this)
44 register PORT_T
* port
= this->owner
.port
;
46 switch (this->State
) {
53 port
->mdelayWhile
= MigrateTime
;
54 port
->mcheck
= port
->initPm
= False
;
55 port
->sendRSTP
= True
;
58 port
->rcvdRSTP
= port
->rcvdSTP
= False
;
61 port
->mdelayWhile
= MigrateTime
;
62 port
->sendRSTP
= False
;
66 port
->rcvdRSTP
= port
->rcvdSTP
= False
;
72 STP_migrate_check_conditions (STATE_MACH_T
* this)
74 register PORT_T
* port
= this->owner
.port
;
76 if ((!port
->portEnabled
&& !port
->initPm
) || BEGIN
== this->State
)
77 return STP_hop_2_state (this, INIT
);
79 switch (this->State
) {
81 if (port
->portEnabled
) {
82 return STP_hop_2_state (this, (port
->owner
->ForceVersion
>= 2) ?
83 SEND_RSTP
: SEND_STP
);
87 return STP_hop_2_state (this, SENDING_RSTP
);
90 return STP_hop_2_state (this, SEND_RSTP
);
91 if (port
->mdelayWhile
&&
92 (port
->rcvdSTP
|| port
->rcvdRSTP
)) {
93 return STP_hop_2_state (this, SENDING_RSTP
);
96 if (!port
->mdelayWhile
&& port
->rcvdSTP
) {
97 return STP_hop_2_state (this, SEND_STP
);
100 if (port
->owner
->ForceVersion
< 2) {
101 return STP_hop_2_state (this, SEND_STP
);
106 return STP_hop_2_state (this, SENDING_STP
);
109 return STP_hop_2_state (this, SEND_RSTP
);
110 if (port
->mdelayWhile
&&
111 (port
->rcvdSTP
|| port
->rcvdRSTP
))
112 return STP_hop_2_state (this, SENDING_STP
);
113 if (!port
->mdelayWhile
&& port
->rcvdRSTP
)
114 return STP_hop_2_state (this, SEND_RSTP
);