/*
- * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <assert.h>
#include <inttypes.h>
#include <stdlib.h>
#include "byte-order.h"
{
for (; port < &stp->ports[ARRAY_SIZE(stp->ports)]; port++) {
if (port->state != STP_DISABLED) {
- return (struct stp_port *) port;
+ return CONST_CAST(struct stp_port *, port);
}
}
return NULL;
struct stp_port *
stp_get_port(struct stp *stp, int port_no)
{
- assert(port_no >= 0 && port_no < ARRAY_SIZE(stp->ports));
+ ovs_assert(port_no >= 0 && port_no < ARRAY_SIZE(stp->ports));
return &stp->ports[port_no];
}
stp_port_no(const struct stp_port *p)
{
struct stp *stp = p->stp;
- assert(p >= stp->ports && p < &stp->ports[ARRAY_SIZE(stp->ports)]);
+ ovs_assert(p >= stp->ports && p < &stp->ports[ARRAY_SIZE(stp->ports)]);
return p - stp->ports;
}
static void
stp_topology_change_detection(struct stp *stp)
{
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
+
if (stp_is_root_bridge(stp)) {
stp->topology_change = true;
stp_start_timer(&stp->topology_change_timer, 0);
}
stp->fdb_needs_flush = true;
stp->topology_change_detected = true;
+ VLOG_INFO_RL(&rl, "%s: detected topology change.", stp->name);
}
static void
static void
stp_initialize_port(struct stp_port *p, enum stp_state state)
{
- assert(state & (STP_DISABLED | STP_BLOCKING));
+ ovs_assert(state & (STP_DISABLED | STP_BLOCKING));
stp_become_designated_port(p);
stp_set_port_state(p, state);
p->topology_change_ack = false;
struct stp *stp = stp_find(argv[1]);
if (!stp) {
- unixctl_command_reply(conn, 501, "no such stp object");
+ unixctl_command_reply_error(conn, "no such stp object");
return;
}
stp_topology_change_detection(stp);
}
}
- unixctl_command_reply(conn, 200, "OK");
+ unixctl_command_reply(conn, "OK");
}