/* sFlow library callback to allocate memory. */
static void *
-sflow_agent_alloc_cb(void *magic UNUSED, SFLAgent *agent UNUSED, size_t bytes)
+sflow_agent_alloc_cb(void *magic OVS_UNUSED, SFLAgent *agent OVS_UNUSED,
+ size_t bytes)
{
return calloc(1, bytes);
}
/* sFlow library callback to free memory. */
static int
-sflow_agent_free_cb(void *magic UNUSED, SFLAgent *agent UNUSED, void *obj)
+sflow_agent_free_cb(void *magic OVS_UNUSED, SFLAgent *agent OVS_UNUSED,
+ void *obj)
{
free(obj);
return 0;
/* sFlow library callback to report error. */
static void
-sflow_agent_error_cb(void *magic UNUSED, SFLAgent *agent UNUSED, char *msg)
+sflow_agent_error_cb(void *magic OVS_UNUSED, SFLAgent *agent OVS_UNUSED,
+ char *msg)
{
VLOG_WARN("sFlow agent error: %s", msg);
}
/* sFlow library callback to send datagram. */
static void
-sflow_agent_send_packet_cb(void *os_, SFLAgent *agent UNUSED,
- SFLReceiver *receiver UNUSED, u_char *pkt,
+sflow_agent_send_packet_cb(void *os_, SFLAgent *agent OVS_UNUSED,
+ SFLReceiver *receiver OVS_UNUSED, u_char *pkt,
uint32_t pktLen)
{
struct ofproto_sflow *os = os_;
if (agent_device) {
struct netdev *netdev;
- if (!netdev_open(agent_device, NETDEV_ETH_TYPE_NONE, &netdev)) {
+ if (!netdev_open_default(agent_device, &netdev)) {
int error = netdev_get_in4(netdev, &in4, NULL);
netdev_close(netdev);
if (!error) {
ofproto_sflow_del_port(os, odp_port);
/* Open network device. */
- error = netdev_open(netdev_name, NETDEV_ETH_TYPE_NONE, &netdev);
+ error = netdev_open_default(netdev_name, &netdev);
if (error) {
VLOG_WARN_RL(&rl, "failed to open network device \"%s\": %s",
netdev_name, strerror(error));
unsigned int odp_port;
SFLAddress agentIP;
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
if (options_changed
|| collectors_count(os->collectors) < options->targets.n) {
collectors_destroy(os->collectors);
- error = collectors_create(&options->targets,
- SFL_DEFAULT_COLLECTOR_PORT, &os->collectors);
+ collectors_create(&options->targets, SFL_DEFAULT_COLLECTOR_PORT,
+ &os->collectors);
if (os->collectors == NULL) {
VLOG_WARN_RL(&rl, "no collectors could be initialized, "
"sFlow disabled");
/* Get packet payload and extract flow. */
payload.data = (union odp_action *) (actions + n_actions);
payload.size = msg->length - min_size;
- flow_extract(&payload, msg->port, &flow);
+ flow_extract(&payload, 0, msg->port, &flow);
/* Build a flow sample */
memset(&fs, 0, sizeof fs);