Beispiel #1
0
/* The Port Information State Machine : 17.21 */

#define STATES { \
  CHOOSE(DISABLED), \
  CHOOSE(ENABLED),  \
  CHOOSE(AGED),     \
  CHOOSE(UPDATE),   \
  CHOOSE(CURRENT),  \
  CHOOSE(RECEIVE),  \
  CHOOSE(SUPERIOR), \
  CHOOSE(REPEAT),   \
  CHOOSE(AGREEMENT)    \
}

#define GET_STATE_NAME STP_info_get_state_name
#include "choose.h"

#if 0 /* for debug */
void
_stp_dump (char* title, unsigned char* buff, int len)
{
  register int iii;

  stp_trace ("\n%s:", title);
  for (iii = 0; iii < len; iii++) {
    if (! (iii % 24)) stp_trace ("\n%6d:", iii);
    if (! (iii % 8)) stp_trace (" ");
    stp_trace ("%02lx", (unsigned long) buff[iii]);
  }
  stp_trace ("\n");
}
Beispiel #2
0
int STP_IN_stpm_create(int vlan_id, char *name, BITMAP_T *port_bmp)
{
	register STPM_T *this;
	int err_code;
	UID_STP_CFG_T init_cfg;

	stp_trace ("STP_IN_stpm_create(%s)", name);

	init_cfg.field_mask = BR_CFG_ALL;
	STP_OUT_get_init_stpm_cfg (vlan_id, &init_cfg);
	init_cfg.field_mask = 0;

	RSTP_CRITICAL_PATH_START;
	this = stp_in_stpm_create (vlan_id, name, port_bmp, &err_code);
	if (this) {
		this->BridgeIdentifier.prio = init_cfg.bridge_priority;
		this->BridgeTimes.MaxAge = init_cfg.max_age;
		this->BridgeTimes.HelloTime = init_cfg.hello_time;
		this->BridgeTimes.ForwardDelay = init_cfg.forward_delay;
		this->ForceVersion
		                = (PROTOCOL_VERSION_T) init_cfg.force_version;
		if (this->ForceVersion >= 2) {
			this->rstpVersion = True;
			this->stpVersion = False;
		} else {
			this->rstpVersion = False;
			this->stpVersion = True;
		}
	}
#ifdef ORIG
#else
	if (this->admin_state != STP_ENABLED)
		err_code = STP_stpm_enable(this, STP_ENABLED);
#endif

	RSTP_CRITICAL_PATH_END;
	return err_code;
}
Beispiel #3
0
int stp_param_set_stpm_disable()
{
	int ret = 0;

	if(True == g_flag) {
		if(0 == (ret = stp_in_global_disable())) {
			g_flag = False;
			g_stp_state = STP_DISABLED;

			/*for next enable*/
			ret = stp_mgmt_stpm_create_cist();
			if (STP_OK != ret) {
			 stp_trace("FATAL: can't enable:%s\n",
			             stp_in_get_error_explanation (ret));
			  return (-1);
			}
		}
	}
	else
		return STP_NOT_ENABLED;

	return ret;
}