On Fri, Apr 13, 2018 at 01:45:30PM -0300, Flavio Leitner wrote: > In some cases 10 seconds might be too much time and in > other cases it might be too little. > > The OpenFlow spec mandates that it should wait at least one > second, so enforce that as the minimum acceptable value. > > Signed-off-by: Flavio Leitner <f...@sysclose.org>
Thanks for the patch. I don't think that this will set the idle timeout back to the default if the setting is removed. It's better if there's that behavior. What do you think of this incremental? I have not tested it but it is meant to behave that way. Also it avoids integer overflow. Thanks, Ben. --8<--------------------------cut here-------------------------->8-- diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index 677deef948ea..f78b4c5ff411 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -37,6 +37,7 @@ #include "openvswitch/poll-loop.h" #include "openvswitch/rconn.h" #include "openvswitch/shash.h" +#include "sat-math.h" #include "simap.h" #include "stream.h" #include "timeval.h" @@ -142,7 +143,7 @@ struct ofconn { #define BUNDLE_IDLE_TIMEOUT_DEFAULT 10000 /* Expire idle bundles after * 10 seconds. */ -static int bundle_idle_timeout = BUNDLE_IDLE_TIMEOUT_DEFAULT; +static unsigned int bundle_idle_timeout = BUNDLE_IDLE_TIMEOUT_DEFAULT; static struct ofconn *ofconn_create(struct connmgr *, struct rconn *, enum ofconn_type, bool enable_async_msgs) @@ -471,12 +472,16 @@ ofconn_get_ofproto(const struct ofconn *ofconn) return ofconn->connmgr->ofproto; } +/* Sets the bundle idle timeout to 'timeout' seconds, interpreting 0 as + * requesting the default timeout. + * + * The OpenFlow spec mandates the timeout to be at least one second; . */ void -connmgr_set_bundle_idle_timeout(unsigned timeout) { - /* OpenFlow spec mandates the timeout to be at least one second. */ - if (timeout > 0) { - bundle_idle_timeout = timeout * 1000; - } +connmgr_set_bundle_idle_timeout(unsigned timeout) +{ + bundle_idle_timeout = (timeout + ? sat_mul(timeout, 1000) + : BUNDLE_IDLE_TIMEOUT_DEFAULT); } /* OpenFlow configuration. */ _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev