4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai/************************************************************************
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * RSTP library - Rapid Spanning Tree (802.1t, 802.1w)
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * Copyright (C) 2001-2003 Optical Access
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * Author: Alex Rozin
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * This file is part of RSTP library.
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * RSTP library is free software; you can redistribute it and/or modify it
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * under the terms of the GNU Lesser General Public License as published by the
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * Free Software Foundation; version 2.1
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * RSTP library is distributed in the hope that it will be useful, but
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * WITHOUT ANY WARRANTY; without even the implied warranty of
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * General Public License for more details.
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * You should have received a copy of the GNU Lesser General Public License
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * along with RSTP library; see the file COPYING. If not, write to the Free
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * 02111-1307, USA.
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai **********************************************************************/
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai/* Topolgy Change state machine : 17.25 */
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai#include "stp_to.h" /* for STP_OUT_flush_lt */
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai#define GET_STATE_NAME STP_topoch_get_state_name
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * In many kinds of hardware the function
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * STP_OUT_flush_lt is a) is very hard and b) cannot
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * delete learning emtries per port. The alternate
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * method may be used: we don't care operEdge flag here,
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * but clean learning table once for TopologyChange
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * for all ports, except the received port. I am ready to discuss :(
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * See below word STRONGLY_SPEC_802_1W
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavaiflush (STATE_MACH_T *this, char* reason) /* 17.19.9 */
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai "flush", port->port_name, port->owner->name,
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai LT_FLASH_ONLY_THE_PORT == type ? "this port" : "other ports",
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai bret = STP_OUT_flush_lt (port->port_index, port->owner->vlan_id,
4eaa471005973e11a6110b69fe990530b3b95a38Rishi SrivatsavaisetTcPropBridge (STATE_MACH_T* this, char* reason) /* 17.19.14 */
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai for (tmp = port->owner->ports; tmp; tmp = tmp->next) {
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai "clearFDB", port->port_name, port->owner->name,
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai STP_OUT_flush_lt (port->port_index, port->owner->vlan_id,
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavaistatic unsigned int
4eaa471005973e11a6110b69fe990530b3b95a38Rishi SrivatsavainewTcWhile (STATE_MACH_T* this) /* 17.19.7 */
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai if (port->sendRSTP && port->operPointToPointMac) {
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai return 2 * port->owner->rootTimes.HelloTime;
4eaa471005973e11a6110b69fe990530b3b95a38Rishi SrivatsavaiSTP_topoch_enter_state (STATE_MACH_T* this)
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai port->rcvdTcAck = port->tc = port->tcProp = False;
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai stp_trace("DETECTED: tcWhile=%d on port %s",
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai stp_trace("PROPAGATING: tcWhile=%d on port %s",
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai stp_trace("ACKNOWLEDGED: tcWhile=%d on port %s",
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai stp_trace("NOTIFIED_TCN: tcWhile=%d on port %s",
4eaa471005973e11a6110b69fe990530b3b95a38Rishi SrivatsavaiSTP_topoch_check_conditions (STATE_MACH_T* this)
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai if (port->role == RootPort || port->role == DesignatedPort)
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai if (port->rcvdTc || port->rcvdTcn || port->rcvdTcAck ||
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai if (port->role != RootPort && (port->role != DesignatedPort))
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai return STP_hop_2_state (this, NOTIFIED_TCN);
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai return STP_hop_2_state (this, NOTIFIED_TC);
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai return STP_hop_2_state (this, PROPAGATING);
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai return STP_hop_2_state (this, ACKNOWLEDGED);