-/* Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks
+/* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/* Get VLAN tag. */
s.vlan = -1;
- if (cfg->tag) {
- if (list_is_short(&port->ifaces)) {
- if (*cfg->tag >= 0 && *cfg->tag <= 4095) {
- s.vlan = *cfg->tag;
- }
- } else {
- /* It's possible that bonded, VLAN-tagged ports make sense. Maybe
- * they even work as-is. But they have not been tested. */
- VLOG_WARN("port %s: VLAN tags not supported on bonded ports",
- port->name);
- }
+ if (cfg->tag && *cfg->tag >= 0 && *cfg->tag <= 4095) {
+ s.vlan = *cfg->tag;
}
/* Get VLAN trunks. */
memcpy(s->id, port->bridge->ea, ETH_ADDR_LEN);
}
+ if (eth_addr_is_zero(s->id)) {
+ VLOG_WARN("port %s: Invalid zero LACP system ID.", port->name);
+ return NULL;
+ }
+
/* Prefer bondable links if unspecified. */
priority = atoi(get_port_other_config(port->cfg, "lacp-system-priority",
"0"));
s->name = port->name;
s->balance = BM_SLB;
- if (port->cfg->bond_mode
- && !bond_mode_from_string(&s->balance, port->cfg->bond_mode)) {
- VLOG_WARN("port %s: unknown bond_mode %s, defaulting to %s",
- port->name, port->cfg->bond_mode,
- bond_mode_to_string(s->balance));
+ if (port->cfg->bond_mode) {
+ if (!bond_mode_from_string(&s->balance, port->cfg->bond_mode)) {
+ VLOG_WARN("port %s: unknown bond_mode %s, defaulting to %s",
+ port->name, port->cfg->bond_mode,
+ bond_mode_to_string(s->balance));
+ }
+ } else {
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
+
+ /* XXX: Post version 1.4.*, change the default bond_mode to
+ * active-backup. Until then, warn that the change is imminent. */
+ VLOG_WARN_RL(&rl, "port %s: Using the default bond_mode %s. Note that"
+ " in future versions, the default bond_mode is expected"
+ " to change to active-backup", port->name,
+ bond_mode_to_string(s->balance));
}
if (s->balance == BM_SLB && port->bridge->cfg->n_flood_vlans) {
VLOG_WARN("port %s: SLB bonds are incompatible with flood_vlans, "
struct bridge *br;
size_t i;
- splinter_vlans = NULL;
+ /* Free space allocated for synthesized ports and interfaces, since we're
+ * in the process of reconstructing all of them. */
+ free_registered_blocks();
+
+ splinter_vlans = bitmap_allocate(4096);
sset_init(&splinter_ifaces);
+ vlan_splinters_enabled_anywhere = false;
for (i = 0; i < ovs_cfg->n_bridges; i++) {
struct ovsrec_bridge *br_cfg = ovs_cfg->bridges[i];
size_t j;
struct ovsrec_interface *iface_cfg = port_cfg->interfaces[k];
if (vlan_splinters_is_enabled(iface_cfg)) {
+ vlan_splinters_enabled_anywhere = true;
sset_add(&splinter_ifaces, iface_cfg->name);
-
- if (!splinter_vlans) {
- splinter_vlans = bitmap_allocate(4096);
- }
vlan_bitmap_from_array__(port_cfg->trunks,
port_cfg->n_trunks,
splinter_vlans);
}
}
+
+ if (port_cfg->tag && *port_cfg->tag > 0 && *port_cfg->tag < 4095) {
+ bitmap_set1(splinter_vlans, *port_cfg->tag);
+ }
}
}
- vlan_splinters_enabled_anywhere = splinter_vlans != NULL;
- if (!splinter_vlans) {
+ if (!vlan_splinters_enabled_anywhere) {
+ free(splinter_vlans);
sset_destroy(&splinter_ifaces);
return NULL;
}
{
size_t i;
- free_registered_blocks();
-
/* We iterate through 'br->cfg->ports' instead of 'ports' here because
* we're modifying 'ports'. */
for (i = 0; i < br->cfg->n_ports; i++) {