From: Ben Pfaff Date: Mon, 11 Jan 2010 19:08:29 +0000 (-0800) Subject: sflow: Fix ifDirection setting if duplex unknown. X-Git-Tag: v0.99.1~1^2~9 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=b6dab095874bef8c59e9c1304cfc49f55a8259fb;p=sliver-openvswitch.git sflow: Fix ifDirection setting if duplex unknown. Reported by Justin Pettit. --- diff --git a/ofproto/ofproto-sflow.c b/ofproto/ofproto-sflow.c index 7fa2e1b94..45c6c08ad 100644 --- a/ofproto/ofproto-sflow.c +++ b/ofproto/ofproto-sflow.c @@ -148,12 +148,14 @@ sflow_agent_get_counters(void *os_, SFLPoller *poller, 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;