add --default-timeout option
diff --git a/src/python/oftest/ofutils.py b/src/python/oftest/ofutils.py
index ce4e6ad..219ce4f 100644
--- a/src/python/oftest/ofutils.py
+++ b/src/python/oftest/ofutils.py
@@ -6,6 +6,8 @@
 import random
 import time
 
+default_timeout = None # set by oft
+
 def gen_xid():
     return random.randrange(1,0xffffffff)
 
@@ -19,7 +21,7 @@
 def timed_wait(cv, fn, timeout=-1):
     if timeout == -1:
         # TODO make this configurable
-        timeout = 2
+        timeout = default_timeout
 
     end_time = time.time() + timeout
     while True:
diff --git a/tests/oft b/tests/oft
index dbc9588..f8c4205 100755
--- a/tests/oft
+++ b/tests/oft
@@ -131,6 +131,7 @@
     sys.path.insert(0, pydir)
 
 import testutils
+import oftest.ofutils
 
 try:
     import scapy.all as scapy
@@ -180,6 +181,7 @@
     "profile"            : None,
     "allow_user"         : False,
     "fail_skipped"       : False,
+    "default_timeout"    : 2,
 }
 
 # Default test priority
@@ -269,6 +271,8 @@
                       help="Proceed even if oftest is not run as root")
     parser.add_option("--fail-skipped", action="store_true",
                       help="Return failure if any test was skipped")
+    parser.add_option("--default-timeout", type="int",
+                      help="Timeout in seconds for most operations")
     # Might need this if other parsers want command line
     # parser.allow_interspersed_args = False
     (options, args) = parser.parse_args()
@@ -560,6 +564,8 @@
 else:
     _verb = 2
 
+oftest.ofutils.default_timeout = config["default_timeout"]
+
 if os.getuid() != 0 and not config["allow_user"]:
     print "ERROR: Super-user privileges required. Please re-run with " \
           "sudo or as root."