/* Get rid of deleted bridges and add new bridges. */
svec_sort(&old_br);
svec_sort(&new_br);
+ assert(svec_is_unique(&old_br));
+ assert(svec_is_unique(&new_br));
LIST_FOR_EACH_SAFE (br, next, struct bridge, node, &all_bridges) {
if (!svec_contains(&new_br, br->name)) {
bridge_destroy(br);
bridge_fetch_dp_ifaces(br, &cur_ifaces);
bridge_get_all_ifaces(br, &want_ifaces);
- svec_sort(&want_ifaces);
- svec_sort(&cur_ifaces);
svec_diff(&want_ifaces, &cur_ifaces, NULL, NULL, &del_ifaces);
for (i = 0; i < del_ifaces.n; i++) {
const char *if_name = del_ifaces.names[i];
bridge_fetch_dp_ifaces(br, &cur_ifaces);
bridge_get_all_ifaces(br, &want_ifaces);
- svec_sort(&want_ifaces);
- svec_sort(&cur_ifaces);
svec_diff(&want_ifaces, &cur_ifaces, &add_ifaces, NULL, NULL);
for (i = 0; i < add_ifaces.n; i++) {
const char *if_name = add_ifaces.names[i];
/* Get rid of deleted ports and add new ports. */
svec_sort(&old_ports);
+ assert(svec_is_unique(&old_ports));
svec_sort(&new_ports);
+ if (!svec_is_unique(&new_ports)) {
+ VLOG_WARN("bridge %s: %s specified twice as bridge port",
+ br->name, svec_get_duplicate(&new_ports));
+ svec_unique(&new_ports);
+ }
for (i = 0; i < br->n_ports; ) {
struct port *port = br->ports[i];
if (!svec_contains(&new_ports, port->name)) {
svec_add(ifaces, iface->name);
}
}
+ svec_sort(ifaces);
+ assert(svec_is_unique(ifaces));
}
static bool
}
retval = 0;
+ if (iface_names) {
+ svec_sort(iface_names);
+ if (!svec_is_unique(iface_names)) {
+ VLOG_WARN("datapath nl:%d reported interface named %s twice",
+ br->dp_idx, svec_get_duplicate(iface_names));
+ svec_unique(iface_names);
+ }
+ }
+
done:
vconn_close(vconn);
ofpbuf_delete(reply);
/* Get rid of deleted mirrors and add new mirrors. */
svec_sort(&old_mirrors);
+ assert(svec_is_unique(&old_mirrors));
svec_sort(&new_mirrors);
+ assert(svec_is_unique(&new_mirrors));
for (i = 0; i < MAX_MIRRORS; i++) {
struct mirror *m = br->mirrors[i];
if (m && !svec_contains(&new_mirrors, m->name)) {
struct svec tmp;
size_t i;
- svec_sort(ports);
- svec_unique(ports);
+ svec_sort_unique(ports);
svec_init(&tmp);
for (i = 0; i < ports->n; i++) {
/* This isn't perfect: it won't combine "0" and "00", and the textual sort
* order won't give us numeric sort order. But that's good enough for what
* we need right now. */
- svec_sort(vlan_strings);
- svec_unique(vlan_strings);
+ svec_sort_unique(vlan_strings);
*vlans = xmalloc(sizeof *vlans * vlan_strings->n);
n_vlans = 0;