size_t n_vlans;
int *vlans;
size_t i;
+ bool mirror_all_ports;
/* Get output port. */
out_port_name = cfg_get_key(0, "mirror.%s.%s.output.port",
m->out_port = out_port;
m->out_vlan = out_vlan;
+ /* If no selection criteria have been given, mirror for all ports. */
+ mirror_all_ports = (!m->src_ports.n) && (!m->dst_ports.n) && (!m->n_vlans);
+
/* Update ports. */
mirror_bit = MIRROR_MASK_C(1) << m->idx;
for (i = 0; i < m->bridge->n_ports; i++) {
struct port *port = m->bridge->ports[i];
- if (svec_contains(&m->src_ports, port->name)
+ if (mirror_all_ports
+ || svec_contains(&m->src_ports, port->name)
|| (m->n_vlans
&& (!port->vlan
? port_trunks_any_mirrored_vlan(m, port)
port->src_mirrors &= ~mirror_bit;
}
- if (svec_contains(&m->dst_ports, port->name)) {
+ if (mirror_all_ports || svec_contains(&m->dst_ports, port->name)) {
port->dst_mirrors |= mirror_bit;
} else {
port->dst_mirrors &= ~mirror_bit;