#include <assert.h>
#include <errno.h>
#include <arpa/inet.h>
+#include <ctype.h>
#include <inttypes.h>
#include <net/if.h>
#include <openflow/openflow.h>
void
bridge_reconfigure(void)
{
- struct svec old_br, new_br;
+ struct svec old_br, new_br, raw_new_br;
struct bridge *br, *next;
size_t i, j;
- /* Collect old and new bridges. */
+ /* Collect old bridges. */
svec_init(&old_br);
- svec_init(&new_br);
LIST_FOR_EACH (br, struct bridge, node, &all_bridges) {
svec_add(&old_br, br->name);
}
- cfg_get_subsections(&new_br, "bridge");
+
+ /* Collect new bridges. */
+ svec_init(&raw_new_br);
+ cfg_get_subsections(&raw_new_br, "bridge");
+ svec_init(&new_br);
+ for (i = 0; i < raw_new_br.n; i++) {
+ const char *name = raw_new_br.names[i];
+ if ((!strncmp(name, "dp", 2) && isdigit(name[2])) ||
+ (!strncmp(name, "nl:", 3) && isdigit(name[3]))) {
+ VLOG_ERR("%s is not a valid bridge name (bridges may not be "
+ "named \"dp\" or \"nl:\" followed by a digit)", name);
+ } else {
+ svec_add(&new_br, name);
+ }
+ }
+ svec_destroy(&raw_new_br);
/* Get rid of deleted bridges and add new bridges. */
svec_sort(&old_br);
.SS "Bridge Configuration"
A bridge (switch) with a given \fIname\fR is configured by specifying
the names of its network devices as values for key
-\fBbridge.\fIname\fB.port\fR.
+\fBbridge.\fIname\fB.port\fR. (The specified \fIname\fR may not begin
+with \fBdp\fR or \fBnl:\fR followed by a digit.)
.PP
A bridge with a given \fIname\fR always has an associated network
device with the same \fIname\fR. This network device may be included