From e9e2856e084383b4f93b371dfba8320b51d4cd03 Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Sun, 6 Dec 2009 21:37:57 -0800 Subject: [PATCH] netflow: Correctly set active timeout value. This fixes a bug originally introduced in commit 763435 "vswitchd: Initial conversion to database-based configuration." The bug reversed a less than operator when setting the active timeout field. Also add a warning if the timeout is set to an invalid value. CC: Glen Gibb --- ofproto/netflow.c | 6 ++---- ofproto/netflow.h | 2 ++ vswitchd/bridge.c | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ofproto/netflow.c b/ofproto/netflow.c index b01666386..34d571f08 100644 --- a/ofproto/netflow.c +++ b/ofproto/netflow.c @@ -37,8 +37,6 @@ #define NETFLOW_V5_VERSION 5 -static const int ACTIVE_TIMEOUT_DEFAULT = 600; - /* Every NetFlow v5 message contains the header that follows. This is * followed by up to thirty records that describe a terminating flow. * We only send a single record per NetFlow message. @@ -210,10 +208,10 @@ netflow_set_options(struct netflow *nf, collectors_create(&nf_options->collectors, 0, &nf->collectors); old_timeout = nf->active_timeout; - if (nf_options->active_timeout > 0) { + if (nf_options->active_timeout >= 0) { nf->active_timeout = nf_options->active_timeout; } else { - nf->active_timeout = ACTIVE_TIMEOUT_DEFAULT; + nf->active_timeout = NF_ACTIVE_TIMEOUT_DEFAULT; } nf->active_timeout *= 1000; if (old_timeout != nf->active_timeout) { diff --git a/ofproto/netflow.h b/ofproto/netflow.h index cc7b96057..7f48ddda9 100644 --- a/ofproto/netflow.h +++ b/ofproto/netflow.h @@ -20,6 +20,8 @@ #include "flow.h" #include "svec.h" +static const int NF_ACTIVE_TIMEOUT_DEFAULT = 600; + struct ofexpired; struct netflow_options { diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 581af96a2..d7f4d3289 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -714,7 +714,10 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg) if (!opts.active_timeout) { opts.active_timeout = -1; } else if (opts.active_timeout < 0) { - opts.active_timeout = 0; + VLOG_WARN("bridge %s: active timeout interval set to negative " + "value, using default instead (%d seconds)", br->name, + NF_ACTIVE_TIMEOUT_DEFAULT); + opts.active_timeout = -1; } opts.add_id_to_iface = nf_cfg->add_id_to_interface; -- 2.45.2