counters->ifIndex = SFL_DS_INDEX(poller->dsi);
counters->ifType = 6;
if (!netdev_get_features(osp->netdev, ¤t, NULL, NULL, NULL)) {
+ /* The values of ifDirection come from MAU MIB (RFC 2668): 0 = unknown,
+ 1 = full-duplex, 2 = half-duplex, 3 = in, 4=out */
counters->ifSpeed = netdev_features_to_bps(current);
counters->ifDirection = (netdev_features_is_full_duplex(current)
? 1 : 2);
} else {
counters->ifSpeed = 100000000;
- counters->ifDirection = 1;
+ counters->ifDirection = 0;
}
if (!netdev_get_flags(osp->netdev, &flags) && flags & NETDEV_UP) {
bool carrier;
time_t now;
int error;
+ if (!options->targets.n || !options->sampling_rate) {
+ /* No point in doing any work if there are no targets or nothing to
+ * sample. */
+ ofproto_sflow_clear(os);
+ return;
+ }
+
options_changed = (!os->options
|| !ofproto_sflow_options_equal(options, os->options));
error = collectors_create(&options->targets,
SFL_DEFAULT_COLLECTOR_PORT, &os->collectors);
if (os->collectors == NULL) {
- VLOG_WARN_RL(&rl, "no configured collectors, sFlow disabled");
+ VLOG_WARN_RL(&rl, "no collectors could be initialized, "
+ "sFlow disabled");
ofproto_sflow_clear(os);
return;
}
sflow_agent_send_packet_cb);
receiver = sfl_agent_addReceiver(os->sflow_agent);
- sfl_receiver_set_sFlowRcvrOwner(receiver, "OpenVSwitch sFlow");
+ sfl_receiver_set_sFlowRcvrOwner(receiver, "Open vSwitch sFlow");
sfl_receiver_set_sFlowRcvrTimeout(receiver, 0xffffffff);
- /* Add a single sampler to represent the whole switch (special <ifIndex>:0
+ /* Add a single sampler to represent the datapath (special <ifIndex>:0
* datasource). The alternative is to model a physical switch more closely
* and instantiate a separate sampler object for each interface, but then
* unicasts would have to be offered to two samplers, and
break;
}
}
+
+ /* Set output port, as defined by http://www.sflow.org/sflow_version_5.txt
+ (search for "Input/output port information"). */
if (!n_outputs) {
/* This value indicates that the packet was dropped for an unknown
* reason. */