[ovs-dev] The beautiful work in crisis!

2016-06-26 Thread dev
Hello!

We are looking for employees working remotely.

My name is Lola, am the personnel manager of a large International company.
Most of the work you can do from home, that is, at a distance.

Salary is $2500-$5000.

If you are interested in this offer, please visit 
Our Site

Best regards!___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] Processed: openvswitch: FTBFS with openssl 1.1.0

2016-06-26 Thread Debian Bug Tracking System
Processing control commands:

> block 827061 by -1
Bug #827061 [release.debian.org] transition: openssl
827061 was blocked by: 828328 828242 828315 828431 828357 828355 828243 828451 
828450 828423 828292 828338 828310 828404 828448 828319 828429 828392 828336 
828304 828251 828274 828331 828447 828271 828229 828459 828327 828305 828320 
828462 828282 828368 828231 828301 828395 828460 828461 828082 828418 828313 
828440 828442 828473 828228 828285 828446 828476 828433 828255 828291 828364 
828334 828437 828245 828340 828405 828273 828346 828350 814600 828373 828236 
828376 828241 828234 828277 828439 828237 828386 828402 828417 828316 828358 
828286 828337 828265 828254 828298 828247 828422 828249 828354 828261 828262 
828403 828470 828396 828232 828349 828424 828416 828345 828326 828420 828361 
828374 828307 828299 828233 828468 828250 828244 828295 827068 828409 828362 
828445 828381 828363 828369 828260 828434 828351 828425 828317 828389 828323 
828284 828314 828398 828246 828347 828342 828463 828388 828391 828294 828471 
828283 828366 828235 828333 828303 828359 828372 828385 828419 828289 828467 
828267 828083 828371 828302 828353 828443 828335 828413 828348 828279 828379 
828269 828449 828466 828387 828139 808669 828426 828329 828230 828410 828308 
828378 828280 828375 828318 828287 828356 828270 828263 828281 828240 828472 
828457 828415 822380 828436 828238 828306 828296 828325 828275 828253 828397 
828268 828383 828438 828407 828427 828309 828256 828464 809271 828465 828258 
828370 828339 828394 828400 828290 828455 828293 828477 828264 828367 828266 
828322 828311 828390 828252 828384 828343 828321 828352 828421 828411 828142 
828435 828127 828360 828408 828469 828259 828257 828414 828453 828432 828406 
828248 828456 828382 828341 828399 828276 828297 828452 828332 828377 828380 
828365 828278 828300 828458 828330 828401 828412 828474 828475 828430 828272 
828454 828393 828239 828324 828288 828312 828428 828444 828441 828344
827061 was not blocking any bugs.
Added blocking bug(s) of 827061: 828478

-- 
827061: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=827061
828478: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=828478
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 00/20] Fix and enable Python tests on Windows

2016-06-26 Thread Paul Boca
This series of patches ports the python damons to Windows and
fixes the tests to work on Windows.
There are still some python tests that fail on Windows, from which
some are failing on Linux too.
The patches in this series are dependent and are related to
python tests on Windows.

V2: Fixes more porting issues for Windows
V3: Fixes all python tests
This series was extended from 16 to 21 patches in order to solve
all python related tests in one series.
To run the tests on windows 'pypiwin32' is required to be
installed for both Python2 and Python3 (pip install pypiwin32).
V4: Rebased the entire series, if didn't apply anymore.
Fixed delete of PID file on exit of python daemon, this leaded to
removal of patch "python tests: Don't check if the PID file
gets deleted".

Paul-Daniel Boca (20):
  tests: Fixed PMD tests on Windows
  windows: Added lockf function and lock PID file
  python tests: Implemented signal.alarm for Windows
  python tests: Register signal handlers only on supported types on
Windows
  python tests: Fixed ctl file name for Windows
  python tests: Fixed unixctl python tests for Windows
  python tests: Added fcntl module for Windows
  python tests: Skip IPsec test on Windows
  python tests: Skip TCP6 idl tests on Windows
  python tests: Skip python tests on Windows where POSIX pid is used
  python tests: Fixed OSError not iterable on Windows
  python tests: Fixed abs_file_name function for Windows
  python tests: Ported UNIX sockets to Windows
  python tests: Ported Python daemon to Windows
  at tests: Allow Python tests to be run on Windows
  python tests: Ignore stderr output
  ovs-ofctl.at: Prevent msys from getting confused with ipv6 address.
  python tests: Skip ovn-controller-vtep tests on Windows
  tests: Skip vlog tests that try to move opened file
  vlog test: Disable default syslog logger

 lib/daemon-windows.c   |  44 +
 python/automake.mk |   1 +
 python/ovs/daemon.py   | 218 +
 python/ovs/fatal_signal.py |  28 +-
 python/ovs/fcntl_win.py|  36 +++
 python/ovs/jsonrpc.py  |   3 +
 python/ovs/poller.py   |   5 +
 python/ovs/socket_util.py  |  53 --
 python/ovs/stream.py   |   6 +-
 python/ovs/unixctl/__init__.py |  10 +-
 python/ovs/unixctl/server.py   |  15 ++-
 python/ovs/util.py |   2 +-
 python/ovs/vlog.py |   1 +
 tests/appctl.py|  27 -
 tests/atlocal.in   |   7 --
 tests/daemon-py.at |   7 ++
 tests/jsonrpc-py.at|   3 +
 tests/ovn-controller-vtep.at   |   1 +
 tests/ovn-nbctl.at |   4 +-
 tests/ovs-monitor-ipsec.at |   1 +
 tests/ovsdb-idl.at |   1 +
 tests/pmd.at   |   4 +-
 tests/test-daemon.py   |   4 +-
 tests/test-ovsdb.py|  26 -
 tests/test-unix-socket.py  |  26 -
 tests/unixctl-py.at|  14 ++-
 tests/vlog.at  |  14 ++-
 27 files changed, 473 insertions(+), 88 deletions(-)
 create mode 100644 python/ovs/fcntl_win.py

-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 03/20] python tests: Implemented signal.alarm for Windows

2016-06-26 Thread Paul Boca
signal.alarm is not available in Windows and would trigger an exception
when called. Implemented this to mentain compatibility between
Windows and Linux for python tests.

Signed-off-by: Paul-Daniel Boca 
---
V2: No changes
V3: Code styling changes
V4: No changes
---
 tests/appctl.py   | 27 ++-
 tests/test-ovsdb.py   | 26 +-
 tests/test-unix-socket.py | 26 +-
 3 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/tests/appctl.py b/tests/appctl.py
index e5bcf2c..a465544 100644
--- a/tests/appctl.py
+++ b/tests/appctl.py
@@ -22,6 +22,28 @@ import ovs.unixctl.client
 import ovs.util
 import ovs.vlog
 
+if sys.platform == 'win32':
+import os
+import time
+import threading
+
+def _win_signal_alarm(timeout):
+
+class Alarm (threading.Thread):
+def __init__ (self, timeout):
+super(Alarm, self).__init__ ()
+self.timeout = timeout
+self.setDaemon (True)
+
+def run (self):
+time.sleep (self.timeout)
+os._exit (1)
+
+def win_signal(timeout):
+alarm = Alarm (timeout)
+alarm.start ()
+
+win_signal(timeout)
 
 def connect_to_target(target):
 error, str_result = ovs.unixctl.socket_name_from_target(target)
@@ -52,7 +74,10 @@ def main():
 args = parser.parse_args()
 
 if args.timeout:
-signal.alarm(int(args.timeout))
+if sys.platform == "win32":
+_win_signal_alarm(int(args.timeout))
+else:
+signal.alarm(int(args.timeout))
 
 ovs.vlog.Vlog.init()
 target = args.target
diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py
index 42d36d4..4bbdadd 100644
--- a/tests/test-ovsdb.py
+++ b/tests/test-ovsdb.py
@@ -31,6 +31,27 @@ import ovs.poller
 import ovs.util
 import six
 
+def _win_signal_alarm(timeout):
+import signal
+import os
+import time
+import threading
+
+class Alarm (threading.Thread):
+def __init__ (self, timeout):
+threading.Thread.__init__ (self)
+self.timeout = timeout
+self.setDaemon (True)
+
+def run (self):
+time.sleep (self.timeout)
+os._exit (1)
+
+def win_signal(timeout):
+alarm = Alarm (timeout)
+alarm.start ()
+
+win_signal(timeout)
 
 def unbox_json(json):
 if type(json) == list and len(json) == 1:
@@ -612,7 +633,10 @@ def main(argv):
 except TypeError:
 raise error.Error("value %s on -t or --timeout is not at "
   "least 1" % value)
-signal.alarm(timeout)
+if sys.platform == "win32":
+_win_signal_alarm(timeout)
+else:
+signal.alarm(timeout)
 else:
 sys.exit(0)
 
diff --git a/tests/test-unix-socket.py b/tests/test-unix-socket.py
index ebfa054..b666872 100644
--- a/tests/test-unix-socket.py
+++ b/tests/test-unix-socket.py
@@ -20,6 +20,27 @@ import sys
 
 import ovs.socket_util
 
+def _win_signal_alarm(timeout):
+import signal
+import os
+import time
+import threading
+
+class Alarm (threading.Thread):
+def __init__ (self, timeout):
+threading.Thread.__init__ (self)
+self.timeout = timeout
+self.setDaemon (True)
+
+def run (self):
+time.sleep (self.timeout)
+os._exit (1)
+
+def win_signal(timeout):
+alarm = Alarm (timeout)
+alarm.start ()
+
+win_signal(timeout)
 
 def main(argv):
 if len(argv) not in (2, 3):
@@ -33,7 +54,10 @@ def main(argv):
 sockname2 = sockname1
 
 signal.signal(signal.SIGALRM, signal.SIG_DFL)
-signal.alarm(5)
+if sys.platform == "win32":
+_win_signal_alarm(5)
+else:
+signal.alarm(5)
 
 # Create a listening socket under name 'sockname1'.
 error, sock1 = ovs.socket_util.make_unix_socket(socket.SOCK_STREAM, False,
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 01/20] tests: Fixed PMD tests on Windows

2016-06-26 Thread Paul Boca
CHECK_CPU_DISCOVERED check the log file now, not the stderr.
On Windows the ovs-vswitchd output is logged only in log file, not to stderr.
Tested both on Windows and Linux

Signed-off-by: Paul-Daniel Boca 
---
V2: No changes
V3: No changes
V4: No changes
---
 tests/pmd.at | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/pmd.at b/tests/pmd.at
index ce22583..3216762 100644
--- a/tests/pmd.at
+++ b/tests/pmd.at
@@ -25,8 +25,8 @@ dnl is greater or equal to 'n_cpu'. Without parameters checks 
that at
 dnl least one CPU discovered.
 m4_define([CHECK_CPU_DISCOVERED], [
 PATTERN="Discovered [[0-9]]* NUMA nodes and [[0-9]]* CPU cores"
-OVS_WAIT_UNTIL([grep "$PATTERN" stderr])
-N_CPU=$(grep "$PATTERN" stderr | sed -e 's/.* \([[0-9]]*\) CPU cores/\1/')
+OVS_WAIT_UNTIL([grep "$PATTERN" ovs-vswitchd.log])
+N_CPU=$(grep "$PATTERN" ovs-vswitchd.log | sed -e 's/.* \([[0-9]]*\) CPU 
cores/\1/')
 if [[ -z "$1" ]]
 then AT_CHECK([test "$N_CPU" -gt "0"])
 else AT_SKIP_IF([test "$N_CPU" -lt "$1"])
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 04/20] python tests: Register signal handlers only on supported types on Windows

2016-06-26 Thread Paul Boca
SIGHUP and SIGALRM are not available on Windows.

Signed-off-by: Paul-Daniel Boca 
---
V2: Fixed Python function inet_open_active, treat WSAEWOULDBLOCK error as
EINPROGRESS on Windows
V3: No changes
V4: No changes
---
 python/ovs/fatal_signal.py | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/python/ovs/fatal_signal.py b/python/ovs/fatal_signal.py
index 7308039..5b90559 100644
--- a/python/ovs/fatal_signal.py
+++ b/python/ovs/fatal_signal.py
@@ -15,6 +15,7 @@
 import atexit
 import os
 import signal
+import sys
 
 import ovs.vlog
 
@@ -128,9 +129,13 @@ def _init():
 global _inited
 if not _inited:
 _inited = True
-
-for signr in (signal.SIGTERM, signal.SIGINT,
-  signal.SIGHUP, signal.SIGALRM):
-if signal.getsignal(signr) == signal.SIG_DFL:
-signal.signal(signr, _signal_handler)
+if sys.platform == "win32":
+for signr in (signal.SIGTERM, signal.SIGINT):
+if signal.getsignal(signr) == signal.SIG_DFL:
+signal.signal(signr, _signal_handler)
+else:
+for signr in (signal.SIGTERM, signal.SIGINT,
+  signal.SIGHUP, signal.SIGALRM):
+if signal.getsignal(signr) == signal.SIG_DFL:
+signal.signal(signr, _signal_handler)
 atexit.register(_atexit_handler)
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 02/20] windows: Added lockf function and lock PID file

2016-06-26 Thread Paul Boca
If the PID file isn't locked then appctl.py detects it as stale and
bails out without doing anything.
Because of this lots of Python tests fail.

Signed-off-by: Paul-Daniel Boca 
---
V2: No changes
V3: No changes
V4: No changes
---
 lib/daemon-windows.c | 44 
 1 file changed, 44 insertions(+)

diff --git a/lib/daemon-windows.c b/lib/daemon-windows.c
index 8cf0fea..161e754 100644
--- a/lib/daemon-windows.c
+++ b/lib/daemon-windows.c
@@ -18,6 +18,7 @@
 #include "daemon.h"
 #include "daemon-private.h"
 #include 
+#include 
 #include 
 #include "dirs.h"
 #include "ovs-thread.h"
@@ -26,6 +27,12 @@
 
 VLOG_DEFINE_THIS_MODULE(daemon_windows);
 
+/* Constants for flock function */
+#defineLOCK_SH 0x0 /* Shared lock. */
+#defineLOCK_EX LOCKFILE_EXCLUSIVE_LOCK /* Exclusive lock. */
+#defineLOCK_NB LOCKFILE_FAIL_IMMEDIATELY   /* Don't block when 
locking. */
+#defineLOCK_UN 0x8000  /* Unlock. */
+
 static bool service_create;  /* Was --service specified? */
 static bool service_started; /* Have we dispatched service to start? */
 
@@ -414,6 +421,33 @@ unlink_pidfile(void)
 }
 }
 
+static int
+flock(FILE* fd, int operation)
+{
+NTSTATUS status;
+HANDLE hFile;
+OVERLAPPED ov = {0};
+
+hFile = (HANDLE)_get_osfhandle(fileno(filep_pidfile));
+if (hFile == INVALID_HANDLE_VALUE) {
+VLOG_FATAL("Invalid handle value");
+return -1;
+}
+
+if (operation & LOCK_UN) {
+if (UnlockFileEx(hFile, 0, 0, 0x, &ov) == FALSE) {
+return -1;
+}
+} else {
+if (LockFileEx(hFile, operation, 0, 0, 0x, &ov) == FALSE) {
+VLOG_FATAL("LockFileEx failed, status = 0x%08x\n", status);
+return -1;
+}
+}
+
+return 0;
+}
+
 /* If a pidfile has been configured, creates it and stores the running
  * process's pid in it.  Ensures that the pidfile will be deleted when the
  * process exits. */
@@ -444,6 +478,16 @@ make_pidfile(void)
 VLOG_FATAL("Failed to write into the pidfile %s", pidfile);
 }
 
+fflush(filep_pidfile);
+error = flock(filep_pidfile, LOCK_SH);
+if (error) {
+/* Looks like we failed to acquire the lock.  Note that, if we failed
+ * for some other reason (and '!overwrite_pidfile'), we will have
+ * left 'tmpfile' as garbage in the file system. */
+VLOG_FATAL("%s: fcntl(F_SETLK) failed (%s)", pidfile,
+   ovs_strerror(error));
+}
+
 /* Don't close the pidfile till the process exits. */
 }
 
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 06/20] python tests: Fixed unixctl python tests for Windows

2016-06-26 Thread Paul Boca
For bogus pid file path, use a windows-like file path.

Signed-off-by: Paul-Daniel Boca 
---
V2: No changes
V3: No changes
V4: No changes
---
 tests/unixctl-py.at | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tests/unixctl-py.at b/tests/unixctl-py.at
index cbcd802..2031897 100644
--- a/tests/unixctl-py.at
+++ b/tests/unixctl-py.at
@@ -92,11 +92,17 @@ m4_define([UNIXCTL_BAD_TARGET_PYN],
AT_CHECK_UNQUOTED([tail -1 stderr], [0], [dnl
 appctl.py: cannot read pidfile "`pwd`/bogus.pid" (No such file or directory)
 ])
-
-   AT_CHECK([PYAPPCTL_PYN([$3]) -t /bogus/path.pid doit], [1], [], [stderr])
-   AT_CHECK([tail -1 stderr], [0], [dnl
+   if test "$IS_WIN32" = "no"; then
+ AT_CHECK([PYAPPCTL_PYN([$3]) -t /bogus/path.pid doit], [1], [], [stderr])
+ AT_CHECK([tail -1 stderr], [0], [dnl
 appctl.py: cannot connect to "/bogus/path.pid" (No such file or directory)
 ])
+   else
+ AT_CHECK([PYAPPCTL_PYN([$3]) -t c:/bogus/path.pid doit], [1], [], 
[stderr])
+ AT_CHECK([tail -1 stderr], [0], [dnl
+appctl.py: cannot connect to "c:/bogus/path.pid" (No such file or directory)
+])
+   fi
 
AT_CLEANUP])
 
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 08/20] python tests: Skip IPsec test on Windows

2016-06-26 Thread Paul Boca
IPsec is not used on Windows yet, and the services used by this test
are non-existent on Windows.

Signed-off-by: Paul-Daniel Boca 
---
V2: No changes
V3: No changes
V4: No changes
---
 tests/ovs-monitor-ipsec.at | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/ovs-monitor-ipsec.at b/tests/ovs-monitor-ipsec.at
index 7f13444..89eab71 100644
--- a/tests/ovs-monitor-ipsec.at
+++ b/tests/ovs-monitor-ipsec.at
@@ -2,6 +2,7 @@ AT_BANNER([ovs-monitor-ipsec])
 
 AT_SETUP([ovs-monitor-ipsec])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
+AT_SKIP_IF([test "$IS_WIN32" = "yes"])
 AT_SKIP_IF([$non_ascii_cwd])
 
 cp "$top_srcdir/vswitchd/vswitch.ovsschema" .
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 07/20] python tests: Added fcntl module for Windows

2016-06-26 Thread Paul Boca
This is needed for lockf function used to lock the PID file on Windows.
ioctl and fcntl functions are not implemented at this time because they are
not used by any script.

Signed-off-by: Paul-Daniel Boca 
---
V2: No changes
V3: No changes
V4: No changes
---
 python/automake.mk  |  1 +
 python/ovs/fcntl_win.py | 36 
 2 files changed, 37 insertions(+)
 create mode 100644 python/ovs/fcntl_win.py

diff --git a/python/automake.mk b/python/automake.mk
index ecad39d..1c8fa38 100644
--- a/python/automake.mk
+++ b/python/automake.mk
@@ -11,6 +11,7 @@ ovstest_pyfiles = \
 ovs_pyfiles = \
python/ovs/__init__.py \
python/ovs/daemon.py \
+   python/ovs/fcntl_win.py \
python/ovs/db/__init__.py \
python/ovs/db/data.py \
python/ovs/db/error.py \
diff --git a/python/ovs/fcntl_win.py b/python/ovs/fcntl_win.py
new file mode 100644
index 000..cf48aaa
--- /dev/null
+++ b/python/ovs/fcntl_win.py
@@ -0,0 +1,36 @@
+import errno
+import win32con
+import win32file
+import pywintypes
+import msvcrt
+
+LOCK_EX = win32con.LOCKFILE_EXCLUSIVE_LOCK
+LOCK_SH = 0 # the default
+LOCK_NB = win32con.LOCKFILE_FAIL_IMMEDIATELY
+LOCK_UN = 0x8000  # unlock - non-standard
+
+def fcntl(fd, op, arg=0):
+# not implemented yet on Windows
+return 0
+
+def ioctl(fd, op, arg=0, mutable_flag=True):
+# not implemented yet on Windows
+if mutable_flag:
+return 0
+else:
+return ""
+
+def lockf(fd, flags, length=0x, start=0, whence=0):
+file_name = fd.name
+overlapped = pywintypes.OVERLAPPED()
+hfile = msvcrt.get_osfhandle(fd.fileno())
+if LOCK_UN & flags:
+ret = win32file.UnlockFileEx(hfile, 0, start, length, overlapped)
+else:
+try:
+ret = win32file.LockFileEx(hfile, flags, start, length, overlapped)
+except:
+raise IOError(errno.EAGAIN, "", "")
+
+def flock(fd, flags):
+lockf(fd, flags, 0x, 0, 0)
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 05/20] python tests: Fixed ctl file name for Windows

2016-06-26 Thread Paul Boca
On Windows the CTL file doesn't contain the pid of the process.

Signed-off-by: Paul-Daniel Boca 
---
V2: No changes
V3: No changes
V4: No changes
---
 python/ovs/unixctl/__init__.py | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/python/ovs/unixctl/__init__.py b/python/ovs/unixctl/__init__.py
index d3d3556..6bbcbaa 100644
--- a/python/ovs/unixctl/__init__.py
+++ b/python/ovs/unixctl/__init__.py
@@ -13,6 +13,7 @@
 # limitations under the License.
 
 import six
+import sys
 
 import ovs.util
 
@@ -71,14 +72,19 @@ def command_register(name, usage, min_args, max_args, 
callback, aux):
 def socket_name_from_target(target):
 assert isinstance(target, strtypes)
 
-if target.startswith("/"):
+if target.startswith('/') or target.find(':') > -1:
 return 0, target
 
+""" Leave it to read the pid file on Windows also, the tests expect this
+error in case of failure. """
 pidfile_name = "%s/%s.pid" % (ovs.dirs.RUNDIR, target)
 pid = ovs.daemon.read_pidfile(pidfile_name)
 if pid < 0:
 return -pid, "cannot read pidfile \"%s\"" % pidfile_name
 
-return 0, "%s/%s.%d.ctl" % (ovs.dirs.RUNDIR, target, pid)
+if sys.platform == "win32":
+return 0, "%s/%s.ctl" % (ovs.dirs.RUNDIR, target)
+else:
+return 0, "%s/%s.%d.ctl" % (ovs.dirs.RUNDIR, target, pid)
 
 command_register("help", "", 0, 0, _unixctl_help, None)
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 09/20] python tests: Skip TCP6 idl tests on Windows

2016-06-26 Thread Paul Boca
TCP6 sockets are not supported in python on Windows.

Signed-off-by: Paul-Daniel Boca 
---
V2: No changes
V3: No changes
V4: No changes
---
 tests/ovsdb-idl.at | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at
index cda0f79..4d16230 100644
--- a/tests/ovsdb-idl.at
+++ b/tests/ovsdb-idl.at
@@ -109,6 +109,7 @@ m4_define([OVSDB_CHECK_IDL_TCP_PY],
 m4_define([OVSDB_CHECK_IDL_TCP6_PYN],
   [AT_SETUP([$1 - tcp6])
AT_SKIP_IF([test $7 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_SKIP_IF([test $HAVE_IPV6 = no])
AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5])
AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema],
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 10/20] python tests: Skip python tests on Windows where POSIX pid is used

2016-06-26 Thread Paul Boca
There is a difference between POSIX pid and Windows pid, not all the time are 
equal.
On Windows when a python script is started, a sh command is triggered as the 
parent
for script. So when we try to get the daemon pid with 'echo $!', this will get 
the pid of sh
not of python.exe as expected.
Also the 'kill' command expects a POSIX pid, not the Windows pid written by the 
python
daemons in pid file.

Signed-off-by: Paul-Daniel Boca 
---
V2: No changes
V3: No changes
V4: No changes
---
 tests/daemon-py.at  | 7 +++
 tests/jsonrpc-py.at | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/tests/daemon-py.at b/tests/daemon-py.at
index e59c11d..d952126 100644
--- a/tests/daemon-py.at
+++ b/tests/daemon-py.at
@@ -3,6 +3,7 @@ AT_BANNER([daemon unit tests - Python])
 m4_define([DAEMON_PYN],
   [AT_SETUP([daemon - $1])
AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_KEYWORDS([python daemon])
AT_CAPTURE_FILE([pid])
AT_CAPTURE_FILE([expected])
@@ -26,6 +27,7 @@ DAEMON_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
 m4_define([DAEMON_MONITOR_PYN],
   [AT_SETUP([daemon --monitor - $1])
AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_CAPTURE_FILE([pid])
AT_CAPTURE_FILE([parent])
AT_CAPTURE_FILE([parentpid])
@@ -73,6 +75,7 @@ DAEMON_MONITOR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
 m4_define([DAEMON_MONITOR_RESTART_PYN],
   [AT_SETUP([daemon --monitor restart exit code - $1])
AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_CAPTURE_FILE([pid])
AT_CAPTURE_FILE([parent])
AT_CAPTURE_FILE([parentpid])
@@ -120,6 +123,7 @@ DAEMON_MONITOR_RESTART_PYN([Python3], [$HAVE_PYTHON3], 
[$PYTHON3])
 m4_define([DAEMON_DETACH_PYN],
   [AT_SETUP([daemon --detach - $1])
AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_CAPTURE_FILE([pid])
# Start the daemon and make sure that the pidfile exists immediately.
# We don't wait for the pidfile to get created because the daemon is
@@ -142,6 +146,7 @@ m4_define([CHECK],
 m4_define([DAEMON_DETACH_MONITOR_PYN],
   [AT_SETUP([daemon --detach --monitor - $1])
AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_CAPTURE_FILE([daemon])
AT_CAPTURE_FILE([olddaemon])
AT_CAPTURE_FILE([newdaemon])
@@ -219,6 +224,7 @@ DAEMON_DETACH_MONITOR_ERRORS_PYN([Python3], 
[$HAVE_PYTHON3], [$PYTHON3])
 m4_define([DAEMON_DETACH_CLOSES_FDS_PYN],
   [AT_SETUP([daemon --detach closes standard fds - $1])
AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_CAPTURE_FILE([pid])
AT_CAPTURE_FILE([status])
AT_CAPTURE_FILE([stderr])
@@ -243,6 +249,7 @@ DAEMON_DETACH_CLOSES_FDS_PYN([Python3], [$HAVE_PYTHON3], 
[$PYTHON3])
 m4_define([DAEMON_DETACH_MONITOR_CLOSES_FDS_PYN],
   [AT_SETUP([daemon --detach --monitor closes standard fds - $1])
AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_CAPTURE_FILE([pid])
AT_CAPTURE_FILE([status])
AT_CAPTURE_FILE([stderr])
diff --git a/tests/jsonrpc-py.at b/tests/jsonrpc-py.at
index 966741d..5440b7d 100644
--- a/tests/jsonrpc-py.at
+++ b/tests/jsonrpc-py.at
@@ -3,6 +3,7 @@ AT_BANNER([JSON-RPC - Python])
 m4_define([JSONRPC_REQ_REPLY_SUCCESS_PYN],
   [AT_SETUP([JSON-RPC request and successful reply - $1])
AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_KEYWORDS([python jsonrpc])
AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --detach --pidfile=`pwd`/pid 
listen punix:socket])
AT_CHECK([test -s pid])
@@ -20,6 +21,7 @@ JSONRPC_REQ_REPLY_SUCCESS_PYN([Python3], [$HAVE_PYTHON3], 
[$PYTHON3])
 m4_define([JSONRPC_REQ_REPLY_ERROR_PYN],
   [AT_SETUP([JSON-RPC request and error reply - $1])
AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_KEYWORDS([python jsonrpc])
AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --detach --pidfile=`pwd`/pid 
listen punix:socket])
AT_CHECK([test -s pid])
@@ -37,6 +39,7 @@ JSONRPC_REQ_REPLY_ERROR_PYN([Python3], [$HAVE_PYTHON3], 
[$PYTHON3])
 m4_define([JSONRPC_NOTIFICATION_PYN],
   [AT_SETUP([JSON-RPC notification - $1])
AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_KEYWORDS([python jsonrpc])
AT_CHECK([$3 $srcdir/test-jsonrpc.py --detach --pidfile=`pwd`/pid listen 
punix:socket])
AT_CHECK([test -s pid])
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 12/20] python tests: Fixed abs_file_name function for Windows

2016-06-26 Thread Paul Boca
On windows a path containint ':' is considered an absolute path.

Signed-off-by: Paul-Daniel Boca 
---
V2: No changes
V3: No changes
V4: No changes
---
 python/ovs/util.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/ovs/util.py b/python/ovs/util.py
index cb0574b..edcfe81 100644
--- a/python/ovs/util.py
+++ b/python/ovs/util.py
@@ -30,7 +30,7 @@ def abs_file_name(dir_, file_name):
 
 This differs from os.path.abspath() in that it will never change the
 meaning of a file name."""
-if file_name.startswith('/'):
+if file_name.startswith('/') or file_name.find(':') > -1:
 return file_name
 else:
 if dir_ is None or dir_ == "":
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 11/20] python tests: Fixed OSError not iterable on Windows

2016-06-26 Thread Paul Boca
On Windows if this exception is triggered then it will raise an exception while 
in the
exception handler.

Signed-off-by: Paul-Daniel Boca 
---
V2: No changes
V3: No changes
V4: No changes
---
 python/ovs/poller.py | 5 +
 1 file changed, 5 insertions(+)

diff --git a/python/ovs/poller.py b/python/ovs/poller.py
index 20be801..a0fb2a7 100644
--- a/python/ovs/poller.py
+++ b/python/ovs/poller.py
@@ -17,6 +17,7 @@ import ovs.timeval
 import ovs.vlog
 import select
 import socket
+import os
 
 try:
 import eventlet.patcher
@@ -168,6 +169,10 @@ class Poller(object):
 try:
 events = self.poll.poll(self.timeout)
 self.__log_wakeup(events)
+except OSError as e:
+error = e.errno
+if error != errno.EINTR:
+vlog.err("poll: %s" % os.strerror(e.errno))
 except select.error as e:
 # XXX rate-limit
 error, msg = e
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 13/20] python tests: Ported UNIX sockets to Windows

2016-06-26 Thread Paul Boca
AF_UNIX sockets are not supported on Windows.
Instead of an AF_UNIX socket use localhost tcp connections to communicate
between components. This makes the python sockets compatible with
the ones used in Windows applications.

In case the socket returns WSAEWOULDBLOCK, it is replaced by EAGAIN error
in order to be compatible with Windows.

Signed-off-by: Paul-Daniel Boca 
---
V2: Fixed Python function inet_open_active, treat WSAEWOULDBLOCK error as
EINPROGRESS on Windows
V3: Use context managers for file handle leaks
V4: No changes
---
 python/ovs/jsonrpc.py|  3 +++
 python/ovs/socket_util.py| 53 
 python/ovs/stream.py |  6 +++--
 python/ovs/unixctl/server.py | 15 +
 4 files changed, 62 insertions(+), 15 deletions(-)

diff --git a/python/ovs/jsonrpc.py b/python/ovs/jsonrpc.py
index 6300c67..74438c9 100644
--- a/python/ovs/jsonrpc.py
+++ b/python/ovs/jsonrpc.py
@@ -14,6 +14,7 @@
 
 import errno
 import os
+import sys
 
 import six
 
@@ -274,6 +275,8 @@ class Connection(object):
 except UnicodeError:
 error = errno.EILSEQ
 if error:
+if sys.platform == "win32" and error == 
errno.WSAEWOULDBLOCK:
+error = errno.EAGAIN
 if error == errno.EAGAIN:
 return error, None
 else:
diff --git a/python/ovs/socket_util.py b/python/ovs/socket_util.py
index b358b05..81120a8 100644
--- a/python/ovs/socket_util.py
+++ b/python/ovs/socket_util.py
@@ -17,6 +17,7 @@ import os
 import os.path
 import random
 import socket
+import sys
 
 import six
 from six.moves import range
@@ -53,6 +54,23 @@ def free_short_name(short_name):
 link_name = os.path.dirname(short_name)
 ovs.fatal_signal.unlink_file_now(link_name)
 
+def compat_read_unix_socket(path):
+try:
+with open(path, "r+") as file_handle:
+ret = int(file_handle.readline())
+except IOError as e:
+vlog.warn("%s: open: %s" % (path, e.strerror))
+raise socket.error(errno.ENOENT)
+
+return ret
+
+def compat_write_unix_socket(path, port):
+try:
+with open(path, "w") as file_handle:
+file_handle.write(str(port))
+except IOError as e:
+vlog.warn("%s: open: %s" % (path, e.strerror))
+raise socket.error(errno.ENOENT)
 
 def make_unix_socket(style, nonblock, bind_path, connect_path, short=False):
 """Creates a Unix domain socket in the given 'style' (either
@@ -65,7 +83,10 @@ def make_unix_socket(style, nonblock, bind_path, 
connect_path, short=False):
 None."""
 
 try:
-sock = socket.socket(socket.AF_UNIX, style)
+if sys.platform == "win32":
+sock = socket.socket(socket.AF_INET, style)
+else:
+sock = socket.socket(socket.AF_UNIX, style)
 except socket.error as e:
 return get_exception_errno(e), None
 
@@ -81,17 +102,28 @@ def make_unix_socket(style, nonblock, bind_path, 
connect_path, short=False):
 return e.errno, None
 
 ovs.fatal_signal.add_file_to_unlink(bind_path)
-sock.bind(bind_path)
+if sys.platform == "win32":
+sock.bind(("127.0.0.1", 0))
+compat_write_unix_socket(bind_path, sock.getsockname()[1])
+else:
+sock.bind(bind_path)
 
-try:
-os.fchmod(sock.fileno(), 0o700)
-except OSError as e:
-pass
+try:
+os.fchmod(sock.fileno(), 0o700)
+except OSError as e:
+pass
 if connect_path is not None:
 try:
-sock.connect(connect_path)
+if sys.platform == "win32":
+port = compat_read_unix_socket(connect_path)
+sock.connect(("127.0.0.1", port))
+else:
+sock.connect(connect_path)
 except socket.error as e:
-if get_exception_errno(e) != errno.EINPROGRESS:
+error = get_exception_errno(e)
+if sys.platform == "win32" and error == errno.WSAEWOULDBLOCK:
+error = errno.EINPROGRESS
+if error != errno.EINPROGRESS:
 raise
 return 0, sock
 except socket.error as e:
@@ -228,7 +260,10 @@ def inet_open_active(style, target, default_port, dscp):
 try:
 sock.connect(address)
 except socket.error as e:
-if get_exception_errno(e) != errno.EINPROGRESS:
+error = get_exception_errno(e)
+if sys.platform == "win32" and error == errno.WSAEWOULDBLOCK:
+error = errno.EINPROGRESS
+if error != errno.EINPROGRESS:
 raise
 return 0, sock
 except socket.error as e:
diff --git a/python/ovs/stream.py b/pyth

[ovs-dev] [PATCH V4 14/20] python tests: Ported Python daemon to Windows

2016-06-26 Thread Paul Boca
Used subprocess.Popen instead os.fork (not implemented on windows)
and repaced of os.pipe with Windows pipes.

To be able to identify the child process I added an extra parameter
to daemon process '--pipe-handle', this parameter also contains
the parent Windows pipe handle, used by the child to signal the start.

The PID file is created directly on Windows, without using a temporary file
because the symbolic link doesn't inheriths the file lock set on temporary file.

Signed-off-by: Paul-Daniel Boca 
---
V2: Fix lockf on Linux, small error on os.link and missing pipe_handle 
parameter.
V3: Import modules at the start of the code
V4: Close file before trying to delete it in signal hooks.
On Windows the PID file cannot be deleted while it's handle
is opened for write.
---
 python/ovs/daemon.py   | 218 -
 python/ovs/fatal_signal.py |  13 +++
 tests/test-daemon.py   |   4 +-
 3 files changed, 192 insertions(+), 43 deletions(-)

diff --git a/python/ovs/daemon.py b/python/ovs/daemon.py
index bd06195..d327629 100644
--- a/python/ovs/daemon.py
+++ b/python/ovs/daemon.py
@@ -13,12 +13,11 @@
 # limitations under the License.
 
 import errno
-import fcntl
 import os
-import resource
 import signal
 import sys
 import time
+import threading
 
 import ovs.dirs
 import ovs.fatal_signal
@@ -28,6 +27,15 @@ import ovs.timeval
 import ovs.util
 import ovs.vlog
 
+if sys.platform == "win32":
+import ovs.fcntl_win as fcntl
+import win32file, win32pipe, win32api, win32security, win32con, pywintypes
+import msvcrt
+import subprocess
+else:
+import fcntl
+import resource
+
 vlog = ovs.vlog.Vlog("daemon")
 
 # --detach: Should we run in the background?
@@ -53,6 +61,9 @@ _monitor = False
 # File descriptor used by daemonize_start() and daemonize_complete().
 _daemonize_fd = None
 
+# Running as the child process - Windows only.
+_detached = False
+
 RESTART_EXIT_CODE = 5
 
 
@@ -109,13 +120,20 @@ def set_monitor():
 global _monitor
 _monitor = True
 
+def set_detached(wp):
+"""Sets up a following call to daemonize() to fork a supervisory process to
+monitor the daemon and restart it if it dies due to an error signal."""
+global _detached
+global _daemonize_fd
+_detached = True
+_daemonize_fd = int(wp)
+
 
 def _fatal(msg):
 vlog.err(msg)
 sys.stderr.write("%s\n" % msg)
 sys.exit(1)
 
-
 def _make_pidfile():
 """If a pidfile has been configured, creates it and stores the running
 process's pid in it.  Ensures that the pidfile will be deleted when the
@@ -123,8 +141,12 @@ def _make_pidfile():
 pid = os.getpid()
 
 # Create a temporary pidfile.
-tmpfile = "%s.tmp%d" % (_pidfile, pid)
-ovs.fatal_signal.add_file_to_unlink(tmpfile)
+if sys.platform == "win32":
+tmpfile = _pidfile
+else:
+tmpfile = "%s.tmp%d" % (_pidfile, pid)
+ovs.fatal_signal.add_file_to_unlink(tmpfile)
+
 try:
 # This is global to keep Python from garbage-collecting and
 # therefore closing our file after this function exits.  That would
@@ -147,40 +169,47 @@ def _make_pidfile():
 _fatal("%s: write failed: %s" % (tmpfile, e.strerror))
 
 try:
-fcntl.lockf(file_handle, fcntl.LOCK_EX | fcntl.LOCK_NB)
+if sys.platform != "win32":
+fcntl.lockf(file_handle, fcntl.LOCK_EX | fcntl.LOCK_NB)
+else:
+fcntl.lockf(file_handle, fcntl.LOCK_SH | fcntl.LOCK_NB)
 except IOError as e:
 _fatal("%s: fcntl failed: %s" % (tmpfile, e.strerror))
 
-# Rename or link it to the correct name.
-if _overwrite_pidfile:
-try:
-os.rename(tmpfile, _pidfile)
-except OSError as e:
-_fatal("failed to rename \"%s\" to \"%s\" (%s)"
-   % (tmpfile, _pidfile, e.strerror))
-else:
-while True:
+if sys.platform != "win32":
+# Rename or link it to the correct name.
+if _overwrite_pidfile:
 try:
-os.link(tmpfile, _pidfile)
-error = 0
+os.rename(tmpfile, _pidfile)
 except OSError as e:
-error = e.errno
-if error == errno.EEXIST:
-_check_already_running()
-elif error != errno.EINTR:
-break
-if error:
-_fatal("failed to link \"%s\" as \"%s\" (%s)"
-   % (tmpfile, _pidfile, os.strerror(error)))
-
-# Ensure that the pidfile will get deleted on exit.
-ovs.fatal_signal.add_file_to_unlink(_pidfile)
-
-# Delete the temporary pidfile if it still exists.
-if not _overwrite_pidfile:
-error = ovs.fatal_signal.unlink_file_now(tmpfile)
-if error:
-_fatal("%s: unlink failed (%s)" % (tmpfile, os.strerror(error)))
+_fatal("failed to rename \"%s\" to \"%s\" (%s)"
+   % (tmpfile, _pidfile, e.strerror))
+e

[ovs-dev] [PATCH V4 15/20] at tests: Allow Python tests to be run on Windows

2016-06-26 Thread Paul Boca
This patch removes the code which disables Python tests to be run on
Windows.

Signed-off-by: Alin Gabriel Serdean 
Signed-off-by: Paul-Daniel Boca 
---
V2: No changes
V3: No changes
V4: No changes
---
 tests/atlocal.in | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/tests/atlocal.in b/tests/atlocal.in
index f174061..410199f 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -109,13 +109,6 @@ else
 HAVE_IPV6=no
 fi
 
-# XXX: Disable Python related tests on Windows because Open vSwitch code
-# written in Python has not been ported to the Windows platform. We will
-# need to remove the next block after porting is complete.
-if test "$IS_WIN32" = "yes"; then
-HAVE_PYTHON="no"
-fi
-
 if test "$HAVE_PYTHON" = "yes" \
&& test "x`$PYTHON $abs_top_srcdir/tests/test-l7.py --help | grep 'ftp'`" 
!= x; then
 HAVE_PYFTPDLIB="yes"
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 16/20] python tests: Ignore stderr output

2016-06-26 Thread Paul Boca
test-unixctl.py and test-vlog.py outputs on stderr and on Windows
stderr is not overriden by every AT_CHECK call, the logs are only
apended to the file and subsequent AT_CHECKs get errors from previous
call.

Signed-off-by: Paul-Daniel Boca 
---
V3: Initial commit
V4: No changes
---
 tests/unixctl-py.at | 2 +-
 tests/vlog.at   | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/unixctl-py.at b/tests/unixctl-py.at
index 2031897..fd40e3d 100644
--- a/tests/unixctl-py.at
+++ b/tests/unixctl-py.at
@@ -114,7 +114,7 @@ m4_define([UNIXCTL_SERVER_PYN],
AT_SKIP_IF([test $2 = no])
on_exit 'kill `cat test-unixctl.py.pid`'
AT_CAPTURE_FILE([`pwd`/test-unixctl.py.log])
-   AT_CHECK([$3 $srcdir/test-unixctl.py --log-file --pidfile --detach])
+   AT_CHECK([$3 $srcdir/test-unixctl.py --log-file --pidfile --detach  
2>`pwd`/unixctl.stderr])
 
AT_CHECK([APPCTL -t test-unixctl.py help], [0], [stdout])
AT_CHECK([cat stdout], [0], [dnl
diff --git a/tests/vlog.at b/tests/vlog.at
index b96f394..bf14290 100644
--- a/tests/vlog.at
+++ b/tests/vlog.at
@@ -5,7 +5,7 @@ m4_define([VLOG_PYN],
AT_SKIP_IF([test $2 = no])
AT_CAPTURE_FILE([log_file])
AT_CAPTURE_FILE([stderr_log])
-   AT_CHECK([$3 $srcdir/test-vlog.py --log-file log_file \
+   AT_CHECK([$3 $srcdir/test-vlog.py --log-file=log_file \
 -v dbg module_1:info module_2:warn syslog:off 2>stderr_log])
 
AT_CHECK([sed -e 's/.*-.*-.*T..:..:..Z |//' \
@@ -192,7 +192,7 @@ m4_define([VLOG_REOPEN_WITHOUT_FILE_PYN],
AT_SKIP_IF([test $2 = no])
on_exit 'kill `cat test-unixctl.py.pid`'
 
-   AT_CHECK([$3 $srcdir/test-unixctl.py --pidfile --detach])
+   AT_CHECK([$3 $srcdir/test-unixctl.py --pidfile --detach 
2>`pwd`/unixctl.stderr])
 
AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen], [0],
  [Logging to file not configured
@@ -403,7 +403,7 @@ m4_define([VLOG_SET_AND_LIST_PYN],
on_exit 'kill `cat test-unixctl.py.pid`'
 
AT_CAPTURE_FILE([log])
-   AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile 
--detach])
+   AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile 
--detach] 2>`pwd`/unixctl.stderr)
 
AT_CHECK([APPCTL -t test-unixctl.py vlog/list], [0], [dnl
  consolesyslogfile
@@ -499,7 +499,7 @@ m4_define([VLOG_RFC5424_PYN],
 ])
 
AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile \
--vFACILITY:daemon --detach])
+-vFACILITY:daemon --detach 2>`pwd`/unixctl.stderr])
 
AT_CHECK([ovs-appctl -t test-unixctl.py vlog/set FACILITY:invalid], [0],
 [Facility invalid is invalid
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 20/20] vlog test: Disable default syslog logger

2016-06-26 Thread Paul Boca
Disable the syslog logger in case on Windows, '/dev/log' doesn't exist.
Seems like on Python34 a default handler is added to the logger and it prints
even if no handler is set by us.

Signed-off-by: Paul-Daniel Boca 
---
V3: Initial commit
V4: No changes
---
 python/ovs/vlog.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/python/ovs/vlog.py b/python/ovs/vlog.py
index 4996387..49210b8 100644
--- a/python/ovs/vlog.py
+++ b/python/ovs/vlog.py
@@ -301,6 +301,7 @@ class Vlog(object):
 # If there is no infrastructure to support python syslog, increase
 # the logging severity level to avoid repeated errors.
 if not os.path.exists("/dev/log"):
+logger.disabled = True
 logger.setLevel(logging.CRITICAL)
 return
 
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 17/20] ovs-ofctl.at: Prevent msys from getting confused with ipv6 address.

2016-06-26 Thread Paul Boca
msys converts ::0/0 into ;c:\MinGW\msys\1.0\1.

To prevent this, use fullform ipv6 address of the form 0:0:0:0:0:0:0:1 instead.

Signed-off-by: Paul-Daniel Boca 
---
V3: Initial commit
V4: No changes
---
 tests/ovn-nbctl.at | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at
index 91d482b..fd67c6d 100644
--- a/tests/ovn-nbctl.at
+++ b/tests/ovn-nbctl.at
@@ -407,7 +407,7 @@ AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl
 ])
 
 dnl Check IPv6 routes
-AT_CHECK([ovn-nbctl lr-route-add lr0 ::/0 2001:0db8:0:f101::1])
+AT_CHECK([ovn-nbctl lr-route-add lr0 0:0:0:0:0:0:0:1/0 2001:0db8:0:f101::1])
 AT_CHECK([ovn-nbctl lr-route-add lr0 2001:0db8:0::/64 2001:0db8:0:f102::1 lp0])
 AT_CHECK([ovn-nbctl lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1])
 
@@ -434,7 +434,7 @@ dnl Check IPv4 and IPv6 routes
 AT_CHECK([ovn-nbctl lr-route-add lr0 0.0.0.0/0 192.168.0.1])
 AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.1.1/24 11.0.1.1 lp0])
 AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.0.1/24 11.0.0.1])
-AT_CHECK([ovn-nbctl lr-route-add lr0 ::/0 2001:0db8:0:f101::1])
+AT_CHECK([ovn-nbctl lr-route-add lr0 0:0:0:0:0:0:0:1/0 2001:0db8:0:f101::1])
 AT_CHECK([ovn-nbctl lr-route-add lr0 2001:0db8:0::/64 2001:0db8:0:f102::1 lp0])
 AT_CHECK([ovn-nbctl lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1])
 
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 18/20] python tests: Skip ovn-controller-vtep tests on Windows

2016-06-26 Thread Paul Boca
The tests are not intended to run on Windows.
Until now they were skipped based on $HAVE_PYTHON only.

Signed-off-by: Paul-Daniel Boca 
---
V3: Initial commit
V4: No changes
---
 tests/ovn-controller-vtep.at | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/ovn-controller-vtep.at b/tests/ovn-controller-vtep.at
index 4bbda73..bc56e66 100644
--- a/tests/ovn-controller-vtep.at
+++ b/tests/ovn-controller-vtep.at
@@ -16,6 +16,7 @@ m4_define([OVN_CONTROLLER_VTEP_START],
AT_KEYWORDS([ovn])
# this will cause skip when 'make check' using Windows setup.
AT_SKIP_IF([test $HAVE_PYTHON = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
 
dnl Create databases (ovn-nb, ovn-sb, vtep).
AT_CHECK([ovsdb-tool create vswitchd.db 
$abs_top_srcdir/vswitchd/vswitch.ovsschema])
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V4 19/20] tests: Skip vlog tests that try to move opened file

2016-06-26 Thread Paul Boca
On Windows if a file is opened by an application for writing, we cannot move
it until all handles to that file are closed.

Signed-off-by: Paul-Daniel Boca 
---
V3: Initial commit
V4: No changes
---
 tests/vlog.at | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/tests/vlog.at b/tests/vlog.at
index bf14290..78f10df 100644
--- a/tests/vlog.at
+++ b/tests/vlog.at
@@ -148,6 +148,9 @@ AT_CLEANUP
 
 m4_define([VLOG_REOPEN_PYN],
   [AT_SETUP([vlog - vlog/reopen - $1])
+   # This test won't work as-is on Windows because Windows doesn't allow
+   # files that are open to be renamed.
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_SKIP_IF([test $2 = no])
on_exit 'kill `cat test-unixctl.py.pid`'
 
@@ -314,6 +317,9 @@ AT_CLEANUP
 
 m4_define([VLOG_CLOSE_PYN],
   [AT_SETUP([vlog - vlog/close - $1])
+   # This test won't work as-is on Windows because Windows doesn't allow
+   # files that are open to be renamed.
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_SKIP_IF([test $2 = no])
on_exit 'kill `cat test-unixctl.py.pid`'
 
-- 
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] Returned mail: see transcript for details

2016-06-26 Thread Mail Delivery Subsystem
The original message was received at Sun, 26 Jun 2016 21:49:30 +0800
from openvswitch.org [65.229.241.244]

- The following addresses had permanent fatal errors -


- Transcript of session follows -
  while talking to openvswitch.org.:
>>> MAIL From:"Mail Delivery Subsystem" 
<<< 501 "Mail Delivery Subsystem" ... Refused



___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] We offer new vacancy

2016-06-26 Thread dev
Hello!

We are looking for employees working remotely.

My name is Wade, am the personnel manager of a large International company.
Most of the work you can do from home, that is, at a distance.

Salary is $2500-$5000.

If you are interested in this offer, please visit 
Our Site

Best regards!___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] ovs-pki: Use SHA-512 message digest when available.

2016-06-26 Thread Ben Pfaff
The upcoming OpenSSL 1.1.0 release disables use of SHA-1, which breaks the
OVS unit tests, which use SHA-1.  We last tried to switch to SHA-512 in
2014 with commit 9ff33ca75e9fcc ("ovs-pki: Use SHA-512 instead of MD5 as
message digest."), but we had to downgrade to SHA-1 in commit 4a1f9610682d
("ovs-pki: Use SHA-1 instead of SHA-512 as message digest.") because
XenServer did not support SHA-512.

This commit detects support for SHA-512 and uses it if available, so it
should avoid the problem encountered previously.

CC: 828...@bugs.debian.org
Reported-at: https://bugs.debian.org/828478
Reported-by: Kurt Roeckx 
Signed-off-by: Ben Pfaff 
---
 AUTHORS  |  1 +
 utilities/ovs-pki.in | 15 +--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 704ba40..a893330 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -367,6 +367,7 @@ Konstantin Khorenko khore...@openvz.org
 Kris zhang  zhang.k...@gmail.com
 Krishna Miriyalakris...@nicira.com
 Krishna Mohan Elluruelluru.kri.mo...@hpe.com
+Kurt Roeckx k...@roeckx.be
 Len Gao l...@vmware.com
 Logan Rosen logatron...@gmail.com
 Luca Falavigna  dktrkr...@debian.org
diff --git a/utilities/ovs-pki.in b/utilities/ovs-pki.in
index 9b2b5aa..17497a8 100755
--- a/utilities/ovs-pki.in
+++ b/utilities/ovs-pki.in
@@ -248,7 +248,18 @@ if test "$command" = "init"; then
 
 # Write CA configuration file.
 if test ! -e ca.cnf; then
-sed "s/@ca@/$ca/g;s/@curr_date@/$curr_date/g" > ca.cnf <<'EOF'
+   if echo | openssl dgst -sha512 >/dev/null 2>&1; then
+   md=sha512
+   elif echo | openssl dgst -sha1 >/dev/null 2>&1; then
+   md=sha1
+   else
+   echo "$0: openssl does not support sha512 or sha1" >&2
+   exit 1
+   fi
+sed "s/@ca@/$ca/g
+s/@curr_date@/$curr_date/g
+s/@md@/$md/g
+" > ca.cnf <<'EOF'
 [ req ]
 prompt = no
 distinguished_name = req_distinguished_name
@@ -274,7 +285,7 @@ private_key= $dir/private/cakey.pem# CA private key
 RANDFILE   = $dir/private/.rand# random number file
 default_days   = 3650  # how long to certify for
 default_crl_days= 30   # how long before next CRL
-default_md = sha1  # message digest to use
+default_md = @md@  # message digest to use
 policy = policy# default policy
 email_in_dn= no# Don't add the email into cert DN
 name_opt   = ca_default# Subject name display option
-- 
2.1.3

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] Valgrind errors on Bridge IPFIX statistics check

2016-06-26 Thread William Tu
Hi,

Valgrind reports the error below on
# make check-valgrind TESTSUITEFLAGS='1055'
Testcase 1055: ofproto-dpif - Bridge IPFIX statistics check

I'm not sure if it's a false positive or not, it looks like the memory
is allocated by bridge level IPFIX test but error is triggerred from
flow stat request (handle_ipfix_flow_stats_request)
valgrind --version
valgrind-3.11.0

==56149== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
==56149==at 0x571102F: send (in /usr/lib64/libpthread-2.22.so)
==56149==by 0x52DAE3: fd_send (stream-fd.c:128)
==56149==by 0x4E5526: stream_send (stream.c:372)
==56149==by 0x52E63B: vconn_stream_send (vconn-stream.c:202)
==56149==by 0x4EFE9F: do_send (vconn.c:685)
==56149==by 0x4D5EC0: try_send (rconn.c:1130)
==56149==by 0x4D5FD8: rconn_send__ (rconn.c:765)
==56149==by 0x4D6004: rconn_send (rconn.c:794)
==56149==by 0x444655: ofconn_send (connmgr.c:1550)
==56149==by 0x444655: ofconn_send_reply (connmgr.c:1072)
==56149==by 0x444655: ofconn_send_replies (connmgr.c:1083)
==56149==by 0x4200F5: handle_ipfix_flow_stats_request (ofproto.c:916)
==56149==by 0x4200F5: handle_openflow__ (ofproto.c:7425)
==56149==by 0x4200F5: handle_openflow (ofproto.c:7475)
==56149==by 0x445BA2: ofconn_run (connmgr.c:1376)
==56149==by 0x445BA2: connmgr_run (connmgr.c:320)
==56149==by 0x41A4A5: ofproto_run (ofproto.c:1820)
==56149==by 0x409FD3: bridge_run__ (bridge.c:2893)
==56149==by 0x40F168: bridge_run (bridge.c:2950)
==56149==by 0x4062C4: main (ovs-vswitchd.c:112)
==56149==  Address 0x9c8bf5c is 108 bytes inside a block of size 1,112 alloc'd
==56149==at 0x4C28C50: malloc (vg_replace_malloc.c:298)
==56149==by 0x4C2AC1C: realloc (vg_replace_malloc.c:785)
==56149==by 0x4ED314: xrealloc (util.c:123)
==56149==by 0x4BF6B7: ofpbuf_resize__ (ofpbuf.c:244)
==56149==by 0x4A249F: ofpraw_put__ (ofp-msgs.c:726)
==56149==by 0x4A2992: ofpraw_alloc_xid (ofp-msgs.c:594)
==56149==by 0x4A2992: ofpraw_alloc_reply (ofp-msgs.c:608)
==56149==by 0x4A2B54: ofpraw_alloc_stats_reply (ofp-msgs.c:644)
==56149==by 0x4A2E07: ofpmp_init (ofp-msgs.c:930)
==56149==by 0x42011A: handle_ipfix_bridge_stats_request (ofproto.c:892)
==56149==by 0x42011A: handle_openflow__ (ofproto.c:7422)
==56149==by 0x42011A: handle_openflow (ofproto.c:7475)
==56149==by 0x445BA2: ofconn_run (connmgr.c:1376)
==56149==by 0x445BA2: connmgr_run (connmgr.c:320)
==56149==by 0x41A4A5: ofproto_run (ofproto.c:1820)
==56149==by 0x409FD3: bridge_run__ (bridge.c:2893)
==56149==by 0x40F168: bridge_run (bridge.c:2950)
==56149==by 0x4062C4: main (ovs-vswitchd.c:112)
==56149==  Uninitialised value was created by a heap allocation
==56149==at 0x4C28C50: malloc (vg_replace_malloc.c:298)
==56149==by 0x4C2AC1C: realloc (vg_replace_malloc.c:785)
==56149==by 0x4ED314: xrealloc (util.c:123)
==56149==by 0x4BF6B7: ofpbuf_resize__ (ofpbuf.c:244)
==56149==by 0x4A249F: ofpraw_put__ (ofp-msgs.c:726)
==56149==by 0x4A2992: ofpraw_alloc_xid (ofp-msgs.c:594)
==56149==by 0x4A2992: ofpraw_alloc_reply (ofp-msgs.c:608)
==56149==by 0x4A2B54: ofpraw_alloc_stats_reply (ofp-msgs.c:644)
==56149==by 0x4A2E07: ofpmp_init (ofp-msgs.c:930)
==56149==by 0x42011A: handle_ipfix_bridge_stats_request (ofproto.c:892)
==56149==by 0x42011A: handle_openflow__ (ofproto.c:7422)
==56149==by 0x42011A: handle_openflow (ofproto.c:7475)
==56149==by 0x445BA2: ofconn_run (connmgr.c:1376)
==56149==by 0x445BA2: connmgr_run (connmgr.c:320)
==56149==by 0x41A4A5: ofproto_run (ofproto.c:1820)
==56149==by 0x409FD3: bridge_run__ (bridge.c:2893)
==56149==by 0x40F168: bridge_run (bridge.c:2950)
==56149==by 0x4062C4: main (ovs-vswitchd.c:112)

Regards,
William
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] open vacancy

2016-06-26 Thread dev
Hello!

We are looking for employees working remotely.

My name is Valeria, am the personnel manager of a large International company.
Most of the work you can do from home, that is, at a distance.

Salary is $2500-$5000.

If you are interested in this offer, please visit 
Our Site

Best regards!___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] ovs-pki: Use SHA-512 message digest when available.

2016-06-26 Thread Kurt Roeckx
On Sun, Jun 26, 2016 at 11:05:35AM -0700, Ben Pfaff wrote:
> The upcoming OpenSSL 1.1.0 release disables use of SHA-1, which breaks the
> OVS unit tests, which use SHA-1.  We last tried to switch to SHA-512 in
> 2014 with commit 9ff33ca75e9fcc ("ovs-pki: Use SHA-512 instead of MD5 as
> message digest."), but we had to downgrade to SHA-1 in commit 4a1f9610682d
> ("ovs-pki: Use SHA-1 instead of SHA-512 as message digest.") because
> XenServer did not support SHA-512.
> 
> This commit detects support for SHA-512 and uses it if available, so it
> should avoid the problem encountered previously.

Note that openssl has supported SHA-512 for a while.  It's been
supported since 0.9.8 which was released in 2005.  So that support
detection doesn't look like a good idea.

You indicated that XenServer didn't support it.  Did that change?

From what I understand of the log it's that the certificate still
using a weak digest.  I guess we started to rejected SHA-1 by
default now, which is actually a good thing.  The browsers should
stop supporting it soon too.

I suggest you just switch to SHA-256 or SHA-512 by default.

> diff --git a/AUTHORS b/AUTHORS
> index 704ba40..a893330 100644
> --- a/AUTHORS
> +++ b/AUTHORS
> @@ -367,6 +367,7 @@ Konstantin Khorenko khore...@openvz.org
>  Kris zhang  zhang.k...@gmail.com
>  Krishna Miriyalakris...@nicira.com
>  Krishna Mohan Elluruelluru.kri.mo...@hpe.com
> +Kurt Roeckx k...@roeckx.be

There really is no reason to add me, it's not like I contributed
anything, someone else tried to build it and I just filed bugs
based on that.


Kurt

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] Valgrind errors on Bridge IPFIX statistics check

2016-06-26 Thread Ben Pfaff
On Sun, Jun 26, 2016 at 11:28:44AM -0700, William Tu wrote:
> Hi,
> 
> Valgrind reports the error below on
> # make check-valgrind TESTSUITEFLAGS='1055'
> Testcase 1055: ofproto-dpif - Bridge IPFIX statistics check
> 
> I'm not sure if it's a false positive or not, it looks like the memory
> is allocated by bridge level IPFIX test but error is triggerred from
> flow stat request (handle_ipfix_flow_stats_request)

Thanks for the report.

I posted a likely fix, but I did not test it with valgrind:
http://openvswitch.org/pipermail/dev/2016-June/073773.html
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] ofp-util: Zero out padding bytes in ofputil_ipfix_stats_to_reply().

2016-06-26 Thread Ben Pfaff
Otherwise IPFIX statistics leak memory from ovs-vswitchd.

Reported-by: William Tu 
Reported-at: http://openvswitch.org/pipermail/dev/2016-June/073769.html
Signed-off-by: Ben Pfaff 
---
 lib/ofp-util.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 6519e62..cc9f5e0 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -7982,6 +7982,7 @@ ofputil_ipfix_stats_to_reply(const struct 
ofputil_ipfix_stats *ois,
 reply->ipv6_error_pkts = htonll(ois->ipv6_error_pkts);
 reply->tx_pkts = htonll(ois->tx_pkts);
 reply->tx_errors = htonll(ois->tx_errors);
+memset(reply->pad, 0, sizeof reply->pad);
 }
 
 /* Encode a ipfix stat for 'ois' and append it to 'replies'. */
-- 
2.1.3

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] Processing of openvswitch_2.5.1~pre+git20160626-1_i386.changes

2016-06-26 Thread Debian FTP Masters
openvswitch_2.5.1~pre+git20160626-1_i386.changes uploaded successfully to 
localhost
along with the files:
  openvswitch_2.5.1~pre+git20160626-1.dsc
  openvswitch_2.5.1~pre+git20160626.orig.tar.xz
  openvswitch_2.5.1~pre+git20160626-1.debian.tar.xz
  openvswitch-common_2.5.1~pre+git20160626-1_i386.deb
  openvswitch-dbg_2.5.1~pre+git20160626-1_i386.deb
  openvswitch-ipsec_2.5.1~pre+git20160626-1_i386.deb
  openvswitch-pki_2.5.1~pre+git20160626-1_all.deb
  openvswitch-switch_2.5.1~pre+git20160626-1_i386.deb
  openvswitch-test_2.5.1~pre+git20160626-1_all.deb
  openvswitch-testcontroller_2.5.1~pre+git20160626-1_i386.deb
  openvswitch-vtep_2.5.1~pre+git20160626-1_i386.deb
  python-openvswitch_2.5.1~pre+git20160626-1_all.deb

Greetings,

Your Debian queue daemon (running on host franck.debian.org)
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] openvswitch_2.5.1~pre+git20160626-1_i386.changes is NEW

2016-06-26 Thread Debian FTP Masters
binary:openvswitch-testcontroller is NEW.

Your package has been put into the NEW queue, which requires manual action
from the ftpteam to process. The upload was otherwise valid (it had a good
OpenPGP signature and file hashes are valid), so please be patient.

Packages are routinely processed through to the archive, and do feel
free to browse the NEW queue[1].

If there is an issue with the upload, you will receive an email from a
member of the ftpteam.

If you have any questions, you may reply to this email.

[1]: https://ftp-master.debian.org/new.html
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] Valgrind errors on Bridge IPFIX statistics check

2016-06-26 Thread Daniel Ye
HI William and Ben,

Thanks for catching and fixing this problem. I applied the patch and tested. The
problem is gone. Thanks.

Bests,
Daniel
> On Jun 27, 2016, at 5:54 AM, Ben Pfaff  wrote:
> 
> On Sun, Jun 26, 2016 at 11:28:44AM -0700, William Tu wrote:
>> Hi,
>> 
>> Valgrind reports the error below on
>> # make check-valgrind TESTSUITEFLAGS='1055'
>> Testcase 1055: ofproto-dpif - Bridge IPFIX statistics check
>> 
>> I'm not sure if it's a false positive or not, it looks like the memory
>> is allocated by bridge level IPFIX test but error is triggerred from
>> flow stat request (handle_ipfix_flow_stats_request)
> 
> Thanks for the report.
> 
> I posted a likely fix, but I did not test it with valgrind:
>
> https://urldefense.proofpoint.com/v2/url?u=http-3A__openvswitch.org_pipermail_dev_2016-2DJune_073773.html&d=CwIBAg&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=AMeQBzObb3Yn4XemNxgato0M1gEhd6eNH0myARLK2io&m=A4t0EDwz4HnsJKlvdy10_25K1b86MdlhO2kUmP2GPSk&s=w43xuG0M3jrdKVjl_NCG0hbYZlfDqwgPs0jnyjYBxeI&e=
>  

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [OVN] Potential scalability bug in ovn-northd on creating and binding large number of lports

2016-06-26 Thread Hui Kang


Ryan Moats/Omaha/IBM wrote on 06/25/2016 09:07:39 PM:

> From: Ryan Moats/Omaha/IBM
> To: Hui Kang/Watson/IBM@IBMUS
> Cc: Ben Pfaff , dev@openvswitch.org
> Date: 06/25/2016 09:07 PM
> Subject: Re: [ovs-dev] [OVN] Potential scalability bug in ovn-northd
> on creating and binding large number of lports
>
> Hui Kang/Watson/IBM wrote on 06/25/2016 07:53:36 PM:
>
> > From: Hui Kang/Watson/IBM
> > To: Ryan Moats/Omaha/IBM@IBMUS
> > Cc: Ben Pfaff , dev@openvswitch.org
> > Date: 06/25/2016 07:53 PM
> > Subject: Re: [ovs-dev] [OVN] Potential scalability bug in ovn-northd
> > on creating and binding large number of lports
> >
> > > >
> > > > Actually, I take that back.  The cycles/port for all the cases
above
> > > > demonstrate only slightly nonlinear scaling: 200/25 is 8
Mcycles/port,
> > > > 1200/125 is 9.6 Mcycles/port.
> > > >
> > > > So the issue is not that it does not scale.  The issue is that it
is
> > > > slow.
> > >
> > > Er? When I do the ratios, I come up with 125 Kcycles/port at 200
> ports going
> > > down to slightly more than 104 Kcycles/port at 1200 ports, which
> is slightly
> > > sub-linear (and I do think that's a good thing).
> > >
> > > However, I'm left wondering if it would be possible to make things
even
> > > better through judicial use of persistence and incremental
processing.
> > >
> > > Right now the ports logic looks to me like:
> > > - Build a list of all ports known via port bindings in the sb db.
> > > - For each port known via the nb db:
> > >   - Look for the port in the sb list.
> > >   - If found, move the port from the sb list to the both list
> > >   - If not found, create a new entry in the nb_only list.
> > > (After the above finishes, we have three lists: sb_only,
> nb_only, and both)
> > > - For each entry in the both list, do modifications to align the port
> > >   binding with nb information.
> > > - For each entry in the nb_only list, create port_binding information
in
> > >   the sb db.
> > >   [If I were updating the port lists, I'd move the port from the
nb_only
> > >   list to both list]
> > > - For each entry in the sb_only list, remove from the port_binding
table.
> > >   [If I were updating the sb_only list, I'd remove it from the
sb_only
> > >   list]
> >
> > Hi, Ryan
> > Thanks for drafting the pseudo-code.
> > Please allow me to add number bullets in your original version to
> accommodate
> > further discussions.
>
> That's fine, I updated from sb list to sb_only to be more clear as well
>
> >
> > 1. Build a list of all ports known via port bindings in the sb_only db.
> > 2. For each port known via the nb db:
> >2.1 Look for the port in the sb_only list.
> >2.2 If found, move the port from the sb_only list to the both list
> >2.3 If not found, create a new entry in the nb_only list.
> > (After the above finishes, we have three lists: sb_only, nb_only, and
both)
> > 3. For each entry in the both list, do modifications to align the port
> >binding with nb information.
> > 4. For each entry in the nb_only list, create port_binding information
in
> >the sb db.
> >[If I were updating the port lists, I'd move the port from the
nb_only
> >list to both list]
> > 5. For each entry in the sb_only list, remove from the port_binding
table.
> >[If I were updating the sb_only list, I'd remove it from the sb_only
> >list]
> >
> > In square bracket of step 4., do you mean "If I were updating the
> nb_lists in
> > step 2.3.,  ..."?
>
> No, that is part of the "if I were going to persist all the port lists,
> what would I need to do"
>
> > Similarly, in step 5, do you mean "If I were updating the sb_only list
in
> > step 2.2,..."?
>
> Ditto the above explanation.
>
> > In my opinion, step 4 and step 5 could be avoided with your logic in
square
> > bracket. Is my understanding correct?
>
> No, as those both still need to be performed whether I persist the port
lists
> in ovn-northd or not.
>
> > >
> > > I *think* if I were to consider persisting the sb_only, nb_only, and
both
> > > lists and follow the extra logic I've added in square brackets above,
I'd
> > > only have entries in the both list at the end of the calculationset,
so I
> > > should only need to persist the both table.
> >
> > What do you mean by "persisting"? A global linked list to store the
elements
> > of struct ovn_ports?
>
> That's exactly what I mean. I'm looking at trading memory for execution
time.
>
> > > Further, I *think* if I were to then apply change tracking to the
first
> > > part of the process above, the logic changes to:
> >
> > Which step of the above pseudo-code should the following code be
> > embedded into ?
>
> The following replaces the entire list above. The good thing about
writing
> this down is that I can come back to it later and realize where I goofed
-
> see below.
>
> > >
> > > - For each tracked entry in the port bindings table

Is this really a For loop? Since northd is monitoring the chassis column of
southbound database, I think the above Fo

Re: [ovs-dev] [PATCH] ofp-util: Zero out padding bytes in ofputil_ipfix_stats_to_reply().

2016-06-26 Thread William Tu
Thanks, the patch solves the valgrind error.

Acked-by: William Tu 

On Sun, Jun 26, 2016 at 2:54 PM, Ben Pfaff  wrote:
> Otherwise IPFIX statistics leak memory from ovs-vswitchd.
>
> Reported-by: William Tu 
> Reported-at: http://openvswitch.org/pipermail/dev/2016-June/073769.html
> Signed-off-by: Ben Pfaff 
> ---
>  lib/ofp-util.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> index 6519e62..cc9f5e0 100644
> --- a/lib/ofp-util.c
> +++ b/lib/ofp-util.c
> @@ -7982,6 +7982,7 @@ ofputil_ipfix_stats_to_reply(const struct 
> ofputil_ipfix_stats *ois,
>  reply->ipv6_error_pkts = htonll(ois->ipv6_error_pkts);
>  reply->tx_pkts = htonll(ois->tx_pkts);
>  reply->tx_errors = htonll(ois->tx_errors);
> +memset(reply->pad, 0, sizeof reply->pad);
>  }
>
>  /* Encode a ipfix stat for 'ois' and append it to 'replies'. */
> --
> 2.1.3
>
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [OVN] Potential scalability bug in ovn-northd on creating and binding large number of lports

2016-06-26 Thread Ryan Moats
Hui Kang/Watson/IBM wrote on 06/26/2016 07:11:27 PM:

> From: Hui Kang/Watson/IBM
> To: Ryan Moats/Omaha/IBM@IBMUS
> Cc: Ben Pfaff , dev@openvswitch.org
> Date: 06/26/2016 07:11 PM
> Subject: Re: [ovs-dev] [OVN] Potential scalability bug in ovn-northd
> on creating and binding large number of lports
>
> Ryan Moats/Omaha/IBM wrote on 06/25/2016 09:07:39 PM:
>
> > From: Ryan Moats/Omaha/IBM
> > To: Hui Kang/Watson/IBM@IBMUS
> > Cc: Ben Pfaff , dev@openvswitch.org
> > Date: 06/25/2016 09:07 PM
> > Subject: Re: [ovs-dev] [OVN] Potential scalability bug in ovn-northd
> > on creating and binding large number of lports
> >
> > Hui Kang/Watson/IBM wrote on 06/25/2016 07:53:36 PM:
> >
> > > From: Hui Kang/Watson/IBM
> > > To: Ryan Moats/Omaha/IBM@IBMUS
> > > Cc: Ben Pfaff , dev@openvswitch.org
> > > Date: 06/25/2016 07:53 PM
> > > Subject: Re: [ovs-dev] [OVN] Potential scalability bug in ovn-northd
> > > on creating and binding large number of lports
> > >
> > > > >
> > > > > Actually, I take that back.  The cycles/port for all the cases
above
> > > > > demonstrate only slightly nonlinear scaling: 200/25 is 8
Mcycles/port,
> > > > > 1200/125 is 9.6 Mcycles/port.
> > > > >
> > > > > So the issue is not that it does not scale.  The issue is that it
is
> > > > > slow.
> > > >
> > > > Er? When I do the ratios, I come up with 125 Kcycles/port at 200
> > ports going
> > > > down to slightly more than 104 Kcycles/port at 1200 ports, which
> > is slightly
> > > > sub-linear (and I do think that's a good thing).
> > > >
> > > > However, I'm left wondering if it would be possible to make things
even
> > > > better through judicial use of persistence and incremental
processing.
> > > >
> > > > Right now the ports logic looks to me like:
> > > > - Build a list of all ports known via port bindings in the sb db.
> > > > - For each port known via the nb db:
> > > >   - Look for the port in the sb list.
> > > >   - If found, move the port from the sb list to the both list
> > > >   - If not found, create a new entry in the nb_only list.
> > > > (After the above finishes, we have three lists: sb_only,
> > nb_only, and both)
> > > > - For each entry in the both list, do modifications to align the
port
> > > >   binding with nb information.
> > > > - For each entry in the nb_only list, create port_binding
> information in
> > > >   the sb db.
> > > >   [If I were updating the port lists, I'd move the port from the
nb_only
> > > >   list to both list]
> > > > - For each entry in the sb_only list, remove from the
> port_binding table.
> > > >   [If I were updating the sb_only list, I'd remove it from the
sb_only
> > > >   list]
> > >
> > > Hi, Ryan
> > > Thanks for drafting the pseudo-code.
> > > Please allow me to add number bullets in your original version to
> > accommodate
> > > further discussions.
> >
> > That's fine, I updated from sb list to sb_only to be more clear as well
> >
> > >
> > > 1. Build a list of all ports known via port bindings in the sb_only
db.
> > > 2. For each port known via the nb db:
> > >2.1 Look for the port in the sb_only list.
> > >2.2 If found, move the port from the sb_only list to the both list
> > >2.3 If not found, create a new entry in the nb_only list.
> > > (After the above finishes, we have three lists: sb_only,
> nb_only, and both)
> > > 3. For each entry in the both list, do modifications to align the
port
> > >binding with nb information.
> > > 4. For each entry in the nb_only list, create port_binding
information in
> > >the sb db.
> > >[If I were updating the port lists, I'd move the port from the
nb_only
> > >list to both list]
> > > 5. For each entry in the sb_only list, remove from the port_binding
table.
> > >[If I were updating the sb_only list, I'd remove it from the
sb_only
> > >list]
> > >
> > > In square bracket of step 4., do you mean "If I were updating the
> > nb_lists in
> > > step 2.3.,  ..."?
> >
> > No, that is part of the "if I were going to persist all the port lists,
> > what would I need to do"
> >
> > > Similarly, in step 5, do you mean "If I were updating the sb_only
list in
> > > step 2.2,..."?
> >
> > Ditto the above explanation.
> >
> > > In my opinion, step 4 and step 5 could be avoided with your
> logic in square
> > > bracket. Is my understanding correct?
> >
> > No, as those both still need to be performed whether I persist theport
lists
> > in ovn-northd or not.
> >
> > > >
> > > > I *think* if I were to consider persisting the sb_only,
> nb_only, and both
> > > > lists and follow the extra logic I've added in square
bracketsabove, I'd
> > > > only have entries in the both list at the end of the
> calculationset, so I
> > > > should only need to persist the both table.
> > >
> > > What do you mean by "persisting"? A global linked list to store
> the elements
> > > of struct ovn_ports?
> >
> > That's exactly what I mean. I'm looking at trading memory for
> execution time.
> >
> > > > Further, I *think* if I were to then apply 

[ovs-dev] RETURNED MAIL: SEE TRANSCRIPT FOR DETAILS

2016-06-26 Thread MAILER-DAEMON
The message could not be delivered

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [OVN] Potential scalability bug in ovn-northd on creating and binding large number of lports

2016-06-26 Thread Hui Kang


Ryan Moats/Omaha/IBM wrote on 06/26/2016 08:53:19 PM:

> From: Ryan Moats/Omaha/IBM
> To: Hui Kang/Watson/IBM@IBMUS
> Cc: Ben Pfaff , dev@openvswitch.org
> Date: 06/26/2016 08:53 PM
> Subject: Re: [ovs-dev] [OVN] Potential scalability bug in ovn-northd
> on creating and binding large number of lports
>
> Hui Kang/Watson/IBM wrote on 06/26/2016 07:11:27 PM:
>
> > From: Hui Kang/Watson/IBM
> > To: Ryan Moats/Omaha/IBM@IBMUS
> > Cc: Ben Pfaff , dev@openvswitch.org
> > Date: 06/26/2016 07:11 PM
> > Subject: Re: [ovs-dev] [OVN] Potential scalability bug in ovn-northd
> > on creating and binding large number of lports
> >
> > Ryan Moats/Omaha/IBM wrote on 06/25/2016 09:07:39 PM:
> >
> > > From: Ryan Moats/Omaha/IBM
> > > To: Hui Kang/Watson/IBM@IBMUS
> > > Cc: Ben Pfaff , dev@openvswitch.org
> > > Date: 06/25/2016 09:07 PM
> > > Subject: Re: [ovs-dev] [OVN] Potential scalability bug in ovn-northd
> > > on creating and binding large number of lports
> > >
> > > Hui Kang/Watson/IBM wrote on 06/25/2016 07:53:36 PM:
> > >
> > > > From: Hui Kang/Watson/IBM
> > > > To: Ryan Moats/Omaha/IBM@IBMUS
> > > > Cc: Ben Pfaff , dev@openvswitch.org
> > > > Date: 06/25/2016 07:53 PM
> > > > Subject: Re: [ovs-dev] [OVN] Potential scalability bug in
ovn-northd
> > > > on creating and binding large number of lports
> > > >
> > > > > >
> > > > > > Actually, I take that back.  The cycles/port for all the cases
above
> > > > > > demonstrate only slightly nonlinear scaling: 200/25 is 8
> Mcycles/port,
> > > > > > 1200/125 is 9.6 Mcycles/port.
> > > > > >
> > > > > > So the issue is not that it does not scale.  The issue is that
it is
> > > > > > slow.
> > > > >
> > > > > Er? When I do the ratios, I come up with 125 Kcycles/port at 200
> > > ports going
> > > > > down to slightly more than 104 Kcycles/port at 1200 ports, which
> > > is slightly
> > > > > sub-linear (and I do think that's a good thing).
> > > > >
> > > > > However, I'm left wondering if it would be possible to make
> things even
> > > > > better through judicial use of persistence and incremental
processing.
> > > > >
> > > > > Right now the ports logic looks to me like:
> > > > > - Build a list of all ports known via port bindings in the sb db.
> > > > > - For each port known via the nb db:
> > > > >   - Look for the port in the sb list.
> > > > >   - If found, move the port from the sb list to the both list
> > > > >   - If not found, create a new entry in the nb_only list.
> > > > > (After the above finishes, we have three lists: sb_only,
> > > nb_only, and both)
> > > > > - For each entry in the both list, do modifications to align the
port
> > > > >   binding with nb information.
> > > > > - For each entry in the nb_only list, create port_binding
> > information in
> > > > >   the sb db.
> > > > >   [If I were updating the port lists, I'd move the port from
> the nb_only
> > > > >   list to both list]
> > > > > - For each entry in the sb_only list, remove from the
> > port_binding table.
> > > > >   [If I were updating the sb_only list, I'd remove it from the
sb_only
> > > > >   list]
> > > >
> > > > Hi, Ryan
> > > > Thanks for drafting the pseudo-code.
> > > > Please allow me to add number bullets in your original version to
> > > accommodate
> > > > further discussions.
> > >
> > > That's fine, I updated from sb list to sb_only to be more clear as
well
> > >
> > > >
> > > > 1. Build a list of all ports known via port bindings in the sb_only
db.
> > > > 2. For each port known via the nb db:
> > > >2.1 Look for the port in the sb_only list.
> > > >2.2 If found, move the port from the sb_only list to the both
list
> > > >2.3 If not found, create a new entry in the nb_only list.
> > > > (After the above finishes, we have three lists: sb_only,
> > nb_only, and both)
> > > > 3. For each entry in the both list, do modifications to align the
port
> > > >binding with nb information.
> > > > 4. For each entry in the nb_only list, create port_binding
> information in
> > > >the sb db.
> > > >[If I were updating the port lists, I'd move the port from
> the nb_only
> > > >list to both list]
> > > > 5. For each entry in the sb_only list, remove from the
> port_binding table.
> > > >[If I were updating the sb_only list, I'd remove it from the
sb_only
> > > >list]
> > > >
> > > > In square bracket of step 4., do you mean "If I were updating the
> > > nb_lists in
> > > > step 2.3.,  ..."?
> > >
> > > No, that is part of the "if I were going to persist all the port
lists,
> > > what would I need to do"
> > >
> > > > Similarly, in step 5, do you mean "If I were updating the
> sb_only list in
> > > > step 2.2,..."?
> > >
> > > Ditto the above explanation.
> > >
> > > > In my opinion, step 4 and step 5 could be avoided with your
> > logic in square
> > > > bracket. Is my understanding correct?
> > >
> > > No, as those both still need to be performed whether I persist
> theport lists
> > > in ovn-northd or not.
> > >
> > > > >
> > > > > I *think* i

[ovs-dev] [patch_v3 1/2] ovn: Fix receive from vxlan in ovn-controller.

2016-06-26 Thread Darrell Ball
OVN only supports source_node replication and previously vtep interaction,
which used service node replication by default for
multicast/broadcast/unknown unicast traffic worked by happenstance.
Because of limited vxlan encapsulation metadata, received packets were
resubmitted to find the egress port(s). This is not correct for multicast,
broadcast and unknown unicast traffic as traffic will get resent on the tunnel
mesh. ovn-controller is changed not to send traffic received from vxlan
tunnels out the tunnel mesh again.  Traffic received from vxlan tunnels is
now only sent locally as intended.

To support keeping state for receipt from a vxlan tunnel a MFF logical
register is allocated for general scratchpad purposes and one bit is used for
receipt from vxlan context.

As part of this change ovn-controller-vtep is hard-coded to set the replication
mode of each logical switch to source node as OVN will only support source
node replication.

Signed-off-by: Darrell Ball 
---
 ovn/controller-vtep/vtep.c |  4 
 ovn/controller/physical.c  | 25 -
 ovn/lib/logical-fields.h   | 13 +++--
 tests/ovn.at   |  3 +++
 4 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/ovn/controller-vtep/vtep.c b/ovn/controller-vtep/vtep.c
index e412b6b..f9151c2 100644
--- a/ovn/controller-vtep/vtep.c
+++ b/ovn/controller-vtep/vtep.c
@@ -233,6 +233,10 @@ vtep_lswitch_run(struct shash *vtep_pbs, struct sset 
*vtep_pswitches,
  vtep_ls->tunnel_key[0], tnl_key);
 }
 vteprec_logical_switch_set_tunnel_key(vtep_ls, &tnl_key, 1);
+/* OVN is expected to always use source node replication mode,
+ * hence the replication mode is hard-coded for each logical
+ * switch in the context of ovn-controller-vtep. */
+vteprec_logical_switch_set_replication_mode(vtep_ls, 
"source_node");
 sset_add(&used_ls, lswitch_name);
 }
 }
diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c
index 85528e0..0dbdd21 100644
--- a/ovn/controller/physical.c
+++ b/ovn/controller/physical.c
@@ -524,6 +524,21 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id 
mff_ovn_geneve,
 ofpact_put_OUTPUT(&ofpacts)->port = ofport;
 ofctrl_add_flow(flow_table, OFTABLE_REMOTE_OUTPUT, 100,
 &match, &ofpacts);
+
+/* For packets received from a Vxlan tunnel which get
+ * resubmitted to OFTABLE_LOG_INGRESS_PIPELINE due to lack of
+ * needed metadata in Vxlan, explicitly skip sending back out
+ * any tunnels and resubmit to table 33 for local delivery. */
+match_init_catchall(&match);
+ofpbuf_clear(&ofpacts);
+
+match_set_reg(&match, MFF_LOG_FLAGS - MFF_REG0,
+  MFF_LOG_FLAGS_RCV_FROM_VXLAN);
+/* Resubmit to table 33. */
+put_resubmit(OFTABLE_LOCAL_OUTPUT, &ofpacts);
+ofctrl_add_flow(flow_table, OFTABLE_REMOTE_OUTPUT, 101, &match,
+&ofpacts);
+
 }
 }
 
@@ -687,11 +702,7 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id 
mff_ovn_geneve,
  * metadata, we only support VXLAN for connections to gateways.  The
  * VNI is used to populate MFF_LOG_DATAPATH.  The gateway's logical
  * port is set to MFF_LOG_INPORT.  Then the packet is resubmitted to
- * table 16 to determine the logical egress port.
- *
- * xxx Due to resubmitting to table 16, broadcasts will be re-sent to
- * xxx all logical ports, including non-local ones which could cause
- * xxx duplicate packets to be received by multiply-connected gateways. */
+ * table 16 to determine the logical egress port. */
 HMAP_FOR_EACH (tun, hmap_node, &tunnels) {
 if (tun->type != VXLAN) {
 continue;
@@ -711,6 +722,10 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id 
mff_ovn_geneve,
 ofpbuf_clear(&ofpacts);
 put_move(MFF_TUN_ID, 0,  MFF_LOG_DATAPATH, 0, 24, &ofpacts);
 put_load(binding->tunnel_key, MFF_LOG_INPORT, 0, 15, &ofpacts);
+/* For packets received from a vxlan tunnel, set a flag to that
+ * effect. */
+put_load(MFF_LOG_FLAGS_RCV_FROM_VXLAN, MFF_LOG_FLAGS,
+ 0, 32, &ofpacts);
 put_resubmit(OFTABLE_LOG_INGRESS_PIPELINE, &ofpacts);
 
 ofctrl_add_flow(flow_table, OFTABLE_PHY_TO_LOG, 100, &match,
diff --git a/ovn/lib/logical-fields.h b/ovn/lib/logical-fields.h
index f0f97a9..b340653 100644
--- a/ovn/lib/logical-fields.h
+++ b/ovn/lib/logical-fields.h
@@ -23,6 +23,7 @@
  * These values are documented in ovn-architecture(7), please update the
  * documentation if you change any of them. */
 #define MFF_LOG_DATAPATH MFF_METADATA /* Logical datapath (64 bits). */
+#define MFF_LOG_FLAGS  MFF_REG2   /* Logical flags (32 bits

[ovs-dev] [patch_v3 2/2] ovn: Reformat some ovn design documentation

2016-06-26 Thread Darrell Ball
Some design micro-details (e.g.) register assignments) that may change
over time were moved from the ovn-architecture.7.xml document to the
OVN-DESIGN.md document.  A table is added to summarize and quantify
MFF logical metadata and register usage.  The OVN-DESIGN.md file was
tested using the following markdown parsers:

https://jbt.github.io/markdown-editor/
http://dillinger.io/

The new flags register usage is also documented in the new
OVN-DESIGN.md document.

Signed-off-by: Darrell Ball 
---
 ovn/OVN-DESIGN.md  | 185 
 ovn/automake.mk|   1 +
 ovn/ovn-architecture.7.xml | 188 -
 3 files changed, 186 insertions(+), 188 deletions(-)
 create mode 100644 ovn/OVN-DESIGN.md

diff --git a/ovn/OVN-DESIGN.md b/ovn/OVN-DESIGN.md
new file mode 100644
index 000..ec3f0c4
--- /dev/null
+++ b/ovn/OVN-DESIGN.md
@@ -0,0 +1,185 @@
+OVN register and metadata usage:
+---
+
+logical datapath field:
+
+A field that denotes the logical datapath through which a packet is being
+processed.
+*Keep the following in sync with MFF_LOG_DATAPATH in*
+*ovn/lib/logical-fields.h.*
+OVN uses the field that OpenFlow 1.1+ simply (and confusingly) calls
+'metadata' to store the logical datapath.  (This field is passed across
+tunnels as part of the tunnel key.)
+
+
+logical input port field:
+
+A field that denotes the logical port from which the packet entered the
+logical datapath.
+*Keep the following in sync with MFF_LOG_INPORT in*
+*ovn/lib/logical-fields.h.*
+OVN stores this in Nicira extension register number 6.
+
+Geneve and STT tunnels pass this field as part of the tunnel key.
+Although VXLAN tunnels do not explicitly carry a logical input port,
+OVN only uses VXLAN to communicate with gateways that from OVN's
+perspective consist of only a single logical port, so that OVN can set
+the logical input port field to this one on ingress to the OVN logical
+pipeline.
+
+
+logical output port field:
+
+A field that denotes the logical port from which the packet will leave
+the logical datapath.  This is initialized to 0 at the beginning of the
+logical ingress pipeline.
+*Keep the following in sync with MFF_LOG_OUTPORT in*
+*ovn/lib/logical-fields.h.*
+OVN stores this in Nicira extension register number 7.
+
+Geneve and STT tunnels pass this field as part of the tunnel key.  VXLAN
+tunnels do not transmit the logical output port field.
+
+
+conntrack zone field for logical ports:
+
+A field that denotes the connection tracking zone for logical ports.
+The value only has local significance and is not meaningful between
+chassis.  This is initialized to 0 at the beginning of the logical
+ingress pipeline.  OVN stores this in Nicira extension register number 5.
+
+
+conntrack zone fields for Gateway router:
+
+Fields that denote the connection tracking zones for Gateway routers.
+These values only have local significance (only on chassis that have
+Gateway routers instantiated) and is not meaningful between
+chassis.  OVN stores the zone information for DNATting in Nicira
+extension register number 3 and zone information for SNATing in Nicira
+extension register number 4.
+
+
+flags field:
+
+Scratchpad flags that denote the pipeline state between tables.  The
+values only have local significance and are not meaningful between
+chassis.  This is initialized to 0 at the beginning of the logical
+ingress pipeline. 
+*Keep the following in sync with MFF_LOG_FLAGS in*
+*ovn/lib/logical-fields.h.*
+OVN stores this in Nicira extension register number 2.
+
+
+VLAN ID:
+
+The VLAN ID is used as an interface between OVN and containers nested
+inside a VM (see Life Cycle of a container interface inside a VM, in 
+ovn-architecture.7.xml, for more information).
+
+
+The following table summarizes the register and metadata usage for OVN.
+*Keep the following in sync with MFF_LOG_FLAGS in*
+*ovn/lib/logical-fields.h.*:
+
+```
+
+  Register/Metadata Usage  Bits (Used/Total)
+  ---
+  MFF_METADATA logical datapath  24/64
+  MFF_REG0 generic scratch   32/32
+  MFF_REG1 generic scratch   32/32
+  MFF_REG2 flags  1/32
+  MFF_REG3 conntrack dnat zone gateway   16/32
+  MFF_REG4 conntrack snat zone gateway   16/32
+  MFF_REG5 conntrack zone logical ports  16/32
+  MFF_REG6 logical input port15/32
+  MFF_REG7 logical output port   16/32
+
+```
+
+OVN Tunnel Encapsulations:
+-
+
+tunnel key:
+
+When OVN encapsulates a packet in Geneve or another tunnel, it attaches
+extra data to it to allow the receiving OVN instance to process it
+correctly.  This takes diff

[ovs-dev] [patch_v3 0/2] ovn: Fix receive from vxlan in ovn-controller.

2016-06-26 Thread Darrell Ball
OVN only supports source_node replication and previously vtep interaction,
which used service node replication by default for 
multicast/broadcast/unknown unicast traffic worked by happenstance.
Because of limited vxlan encapsulation metadata, received packets were
resubmitted to find the egress port(s). This is not correct for multicast,
broadcast and unknown unicast traffic as traffic will get resent on the tunnel
mesh. ovn-controller is changed not to send traffic received from vxlan
tunnels out the tunnel mesh again.  Traffic received from vxlan tunnels is
now only sent locally as intended.

To support keeping state for receipt from a vxlan tunnel a MFF logical
register is allocated for general scratchpad purposes and one bit is used for
receipt from vxlan context.  

As part of this change ovn-controller-vtep is hard-coded to set the replication
mode of each logical switch to source node as OVN will only support source
node replication.

Some design micro-details (e.g.) register assignments) that may change
over time were moved from the ovn-architecture.7.xml document to the
OVN-DESIGN.md document.  A table is added to summarize and quantify
MFF logical metadata and register usage.  The OVN-DESIGN.md file was
tested using the following markdown parsers:

https://jbt.github.io/markdown-editor/
http://dillinger.io/

The new flags register usage is also documented in the new
OVN-DESIGN.md document.

v2->v3:
Change reg0 and reg1 usage column comment to "generic scratch".
Split code change for bug fix and documentation update into two patches.

v1->v2:
Rebased after recent conflicting commit.  Converted some xml
comments ported from the ovn-architecture document. Removed redundant
register initialization and unnecessary bit declaration.

Darrell Ball (2):
  ovn: Fix receive from vxlan in ovn-controller.
  ovn: Reformat some ovn design documentation

 ovn/OVN-DESIGN.md  | 185 
 ovn/automake.mk|   1 +
 ovn/controller-vtep/vtep.c |   4 +
 ovn/controller/physical.c  |  25 --
 ovn/lib/logical-fields.h   |  13 +++-
 ovn/ovn-architecture.7.xml | 188 -
 tests/ovn.at   |   3 +
 7 files changed, 224 insertions(+), 195 deletions(-)
 create mode 100644 ovn/OVN-DESIGN.md

-- 
1.9.1

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] Delivery reports about your e-mail

2016-06-26 Thread Mail Delivery Subsystem
The original message was received at Mon, 27 Jun 2016 09:04:06 +0700 from 
openvswitch.org [85.9.20.1]

- The following addresses had permanent fatal errors -




___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] The crisis has finished! Work with us!

2016-06-26 Thread dev
Hello!

We are looking for employees working remotely.

My name is Joan, am the personnel manager of a large International company.
Most of the work you can do from home, that is, at a distance.

Salary is $2500-$5000.

If you are interested in this offer, please visit 
Our Site

Best regards!___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCHv2] netdev-provider: Apply batch object to netdev provider.

2016-06-26 Thread Darrell Ball
On Sat, Jun 25, 2016 at 7:44 AM, William Tu  wrote:

> Commit 1895cc8dbb64 ("dpif-netdev: create batch object") introduces
> batch process functions and 'struct dp_packet_batch' to associate with
> batch-level metadata.  This patch applies the packet batch object to
> the netdev provider interface (dummy, Linux, BSD, and DPDK) so that
> batch APIs can be used in providers.  With batch metadata visible in
> providers, optimizations can be introduced at per-batch level instead
> of per-packet.
>
> Tested-at: https://travis-ci.org/williamtu/ovs-travis/builds/140135888
> 


The test shows as failed ?

The code change is replacing an array of ptrs to packets and count with a
packet batch and replacing some code blocks with equivalent existing inline
functions based on batchs.

I have some comments inline.




> Signed-off-by
> :
> William Tu 
> --
> v1->v2: make commit message more descriptive.
> ---
>  lib/netdev-bsd.c  |  9 --
>  lib/netdev-dpdk.c | 81
> +--
>  lib/netdev-dummy.c|  9 --
>  lib/netdev-linux.c|  9 --
>  lib/netdev-provider.h | 25 
>  lib/netdev.c  |  6 ++--
>  6 files changed, 72 insertions(+), 67 deletions(-)
>
> diff --git a/lib/netdev-bsd.c b/lib/netdev-bsd.c
> index 2e92d97..1b55b1a 100644
> --- a/lib/netdev-bsd.c
> +++ b/lib/netdev-bsd.c
> @@ -618,12 +618,13 @@ netdev_rxq_bsd_recv_tap(struct netdev_rxq_bsd *rxq,
> struct dp_packet *buffer)
>  }
>
>  static int
> -netdev_bsd_rxq_recv(struct netdev_rxq *rxq_, struct dp_packet **packets,
> -int *c)
> +netdev_bsd_rxq_recv(struct netdev_rxq *rxq_, struct dp_packet_batch
> *batch)
>  {
>  struct netdev_rxq_bsd *rxq = netdev_rxq_bsd_cast(rxq_);
>  struct netdev *netdev = rxq->up.netdev;
>  struct dp_packet *packet;
> +struct dp_packet **packets = batch->packets;
> +int *c = &batch->count;
>  ssize_t retval;
>  int mtu;
>
> @@ -681,10 +682,12 @@ netdev_bsd_rxq_drain(struct netdev_rxq *rxq_)
>   */
>  static int
>  netdev_bsd_send(struct netdev *netdev_, int qid OVS_UNUSED,
> -struct dp_packet **pkts, int cnt, bool may_steal)
> +struct dp_packet_batch *batch, bool may_steal)
>  {
>  struct netdev_bsd *dev = netdev_bsd_cast(netdev_);
>  const char *name = netdev_get_name(netdev_);
> +int cnt = batch->count;
> +struct dp_packet **okts = batch->packets;
>


"okts" is not used in the function; "pkts" is used in the function.
The function will no longer work.



>  int error;
>  int i;
>
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index ed14a21..3b1e7fa 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -1251,12 +1251,14 @@ netdev_dpdk_vhost_update_rx_counters(struct
> netdev_stats *stats,
>   */
>  static int
>  netdev_dpdk_vhost_rxq_recv(struct netdev_rxq *rxq,
> -   struct dp_packet **packets, int *c)
> +   struct dp_packet_batch *batch)
>  {
>  struct netdev_dpdk *dev = netdev_dpdk_cast(rxq->netdev);
>  struct virtio_net *virtio_dev = netdev_dpdk_get_virtio(dev);
>  int qid = rxq->queue_id;
>  struct ingress_policer *policer =
> netdev_dpdk_get_ingress_policer(dev);
> +struct dp_packet **packets = batch->packets;
> +int *c = &batch->count;
>

I see this pattern throughout where extra variables are used in all
functions.
There are 2 local variables for packets and count and also the batch
parameter,
which itself already has reference to packets and count from the start of
the call chain
in netdev_*().

Pre-change, there are two parameters for packets and count derived from the
batch
parameter at the start of the call chain in netdev_*().

These functions are intended to be fast.



>  uint16_t nb_rx = 0;
>  uint16_t dropped = 0;
>
> @@ -1292,12 +1294,13 @@ netdev_dpdk_vhost_rxq_recv(struct netdev_rxq *rxq,
>  }
>
>  static int
> -netdev_dpdk_rxq_recv(struct netdev_rxq *rxq, struct dp_packet **packets,
> - int *c)
> +netdev_dpdk_rxq_recv(struct netdev_rxq *rxq, struct dp_packet_batch
> *batch)
>  {
>  struct netdev_rxq_dpdk *rx = netdev_rxq_dpdk_cast(rxq);
>  struct netdev_dpdk *dev = netdev_dpdk_cast(rxq->netdev);
>  struct ingress_policer *policer =
> netdev_dpdk_get_ingress_policer(dev);
> +struct dp_packet **packets = batch->packets;
> +int *c = &batch->count;
>  int nb_rx;
>  int dropped = 0;
>
> @@ -1371,11 +1374,13 @@ netdev_dpdk_vhost_update_tx_counters(struct
> netdev_stats *stats,
>
>  static void
>  __netdev_dpdk_vhost_send(struct netdev *netdev, int qid,
> - struct dp_packet **pkts, int cnt,
> + struct dp_packet_batch *batch,
>   bool may_steal)
>  {
>  struct netdev_d

[ovs-dev] Bug#826780: Please package OVS >= 2.6.0.dev1

2016-06-26 Thread Ben Pfaff
On Thu, Jun 09, 2016 at 01:23:12AM +0200, Thomas Goirand wrote:
> Source: openvswitch
> Version: 2.3.0+git20140819-4
> Severity: normal
> 
> Hi,
> 
> OpenStack Neutron currently has:
> 
> ovs>=2.5.0;python_version=='2.7' # Apache-2.0
> ovs>=2.6.0.dev1;python_version>='3.4' # Apache-2.0
> 
> in its requirements.txt. Please package this at least to Debian Experimental,
> so that I can package Neutron Newton Beta 1.

I uploaded openvswitch_2.5.1~pre+git20160626-1 a couple of hours ago.
It's going through NEW processing.  I suspect that it will take a couple
of trial uploads to get the tests to pass reliably and on all
architectures.  I'm going to be traveling Monday through Thursday, with
limited time for computers, so absent helpful NMUs (which are welcome)
there will probably be at least limited breakage until Friday.

I honestly meant to upload this to experimental for the first one or two
tries but screwed up so it's destined for unstable.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] Valgrind errors on Bridge IPFIX statistics check

2016-06-26 Thread Ben Pfaff
Thanks William and Daniel.  I applied this to master.

On Sun, Jun 26, 2016 at 11:59:49PM +, Daniel Ye wrote:
> HI William and Ben,
> 
> Thanks for catching and fixing this problem. I applied the patch and tested. 
> The
> problem is gone. Thanks.
> 
> Bests,
> Daniel
> > On Jun 27, 2016, at 5:54 AM, Ben Pfaff  wrote:
> > 
> > On Sun, Jun 26, 2016 at 11:28:44AM -0700, William Tu wrote:
> >> Hi,
> >> 
> >> Valgrind reports the error below on
> >> # make check-valgrind TESTSUITEFLAGS='1055'
> >> Testcase 1055: ofproto-dpif - Bridge IPFIX statistics check
> >> 
> >> I'm not sure if it's a false positive or not, it looks like the memory
> >> is allocated by bridge level IPFIX test but error is triggerred from
> >> flow stat request (handle_ipfix_flow_stats_request)
> > 
> > Thanks for the report.
> > 
> > I posted a likely fix, but I did not test it with valgrind:
> >
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__openvswitch.org_pipermail_dev_2016-2DJune_073773.html&d=CwIBAg&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=AMeQBzObb3Yn4XemNxgato0M1gEhd6eNH0myARLK2io&m=A4t0EDwz4HnsJKlvdy10_25K1b86MdlhO2kUmP2GPSk&s=w43xuG0M3jrdKVjl_NCG0hbYZlfDqwgPs0jnyjYBxeI&e=
> >  
> 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] ofp-util: Zero out padding bytes in ofputil_ipfix_stats_to_reply().

2016-06-26 Thread Ben Pfaff
Thanks, applied to master.

On Sun, Jun 26, 2016 at 05:38:55PM -0700, William Tu wrote:
> Thanks, the patch solves the valgrind error.
> 
> Acked-by: William Tu 
> 
> On Sun, Jun 26, 2016 at 2:54 PM, Ben Pfaff  wrote:
> > Otherwise IPFIX statistics leak memory from ovs-vswitchd.
> >
> > Reported-by: William Tu 
> > Reported-at: http://openvswitch.org/pipermail/dev/2016-June/073769.html
> > Signed-off-by: Ben Pfaff 
> > ---
> >  lib/ofp-util.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> > index 6519e62..cc9f5e0 100644
> > --- a/lib/ofp-util.c
> > +++ b/lib/ofp-util.c
> > @@ -7982,6 +7982,7 @@ ofputil_ipfix_stats_to_reply(const struct 
> > ofputil_ipfix_stats *ois,
> >  reply->ipv6_error_pkts = htonll(ois->ipv6_error_pkts);
> >  reply->tx_pkts = htonll(ois->tx_pkts);
> >  reply->tx_errors = htonll(ois->tx_errors);
> > +memset(reply->pad, 0, sizeof reply->pad);
> >  }
> >
> >  /* Encode a ipfix stat for 'ois' and append it to 'replies'. */
> > --
> > 2.1.3
> >
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] util: New function nullable_xstrdup().

2016-06-26 Thread Ben Pfaff
Thanks, applied to master.

On Sat, Jun 25, 2016 at 01:09:40PM -0700, William Tu wrote:
> Looks good to me.
> 
> Acked-by: William Tu 
> 
> On Fri, Jun 24, 2016 at 9:23 PM, Ben Pfaff  wrote:
> > It's a pretty common pattern so create a function for it.
> >
> > Signed-off-by: Ben Pfaff 
> > ---
> >  lib/dpif-netdev.c| 6 ++
> >  lib/jsonrpc.c| 2 +-
> >  lib/ovsdb-error.c| 6 +++---
> >  lib/syslog-libc.c| 4 ++--
> >  lib/util.c   | 8 +++-
> >  lib/util.h   | 1 +
> >  lib/vlog.c   | 2 +-
> >  ofproto/ofproto-dpif-ipfix.c | 6 --
> >  ofproto/ofproto-dpif-sflow.c | 6 +++---
> >  ofproto/ofproto.c| 5 ++---
> >  ovn/utilities/ovn-nbctl.c| 2 +-
> >  ovn/utilities/ovn-sbctl.c| 2 +-
> >  ovsdb/replication.c  | 2 +-
> >  utilities/ovs-vsctl.c| 2 +-
> >  vswitchd/bridge.c| 8 ++--
> >  vtep/vtep-ctl.c  | 2 +-
> >  16 files changed, 29 insertions(+), 35 deletions(-)
> >
> > diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> > index 70f320d..ff4227c 100644
> > --- a/lib/dpif-netdev.c
> > +++ b/lib/dpif-netdev.c
> > @@ -2531,7 +2531,7 @@ dpif_netdev_pmd_set(struct dpif *dpif, const char 
> > *cmask)
> >
> >  if (!cmask_equals(dp->requested_pmd_cmask, cmask)) {
> >  free(dp->requested_pmd_cmask);
> > -dp->requested_pmd_cmask = cmask ? xstrdup(cmask) : NULL;
> > +dp->requested_pmd_cmask = nullable_xstrdup(cmask);
> >  }
> >
> >  return 0;
> > @@ -2690,9 +2690,7 @@ reconfigure_pmd_threads(struct dp_netdev *dp)
> >  /* Reconfigures the cpu mask. */
> >  ovs_numa_set_cpu_mask(dp->requested_pmd_cmask);
> >  free(dp->pmd_cmask);
> > -dp->pmd_cmask = dp->requested_pmd_cmask
> > -? xstrdup(dp->requested_pmd_cmask)
> > -: NULL;
> > +dp->pmd_cmask = nullable_xstrdup(dp->requested_pmd_cmask);
> >
> >  /* Restores the non-pmd. */
> >  dp_netdev_set_nonpmd(dp);
> > diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c
> > index 1112b4a..aba742c 100644
> > --- a/lib/jsonrpc.c
> > +++ b/lib/jsonrpc.c
> > @@ -512,7 +512,7 @@ jsonrpc_create(enum jsonrpc_msg_type type, const char 
> > *method,
> >  {
> >  struct jsonrpc_msg *msg = xmalloc(sizeof *msg);
> >  msg->type = type;
> > -msg->method = method ? xstrdup(method) : NULL;
> > +msg->method = nullable_xstrdup(method);
> >  msg->params = params;
> >  msg->result = result;
> >  msg->error = error;
> > diff --git a/lib/ovsdb-error.c b/lib/ovsdb-error.c
> > index d3549cb..dbe8149 100644
> > --- a/lib/ovsdb-error.c
> > +++ b/lib/ovsdb-error.c
> > @@ -1,4 +1,4 @@
> > -/* Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
> > +/* Copyright (c) 2009, 2010, 2011, 2012, 2016 Nicira, Inc.
> >   *
> >   * Licensed under the Apache License, Version 2.0 (the "License");
> >   * you may not use this file except in compliance with the License.
> > @@ -183,8 +183,8 @@ ovsdb_error_clone(const struct ovsdb_error *old)
> >  if (old) {
> >  struct ovsdb_error *new = xmalloc(sizeof *new);
> >  new->tag = old->tag;
> > -new->details = old->details ? xstrdup(old->details) : NULL;
> > -new->syntax = old->syntax ? xstrdup(old->syntax) : NULL;
> > +new->details = nullable_xstrdup(old->details);
> > +new->syntax = nullable_xstrdup(old->syntax);
> >  new->errno_ = old->errno_;
> >  return new;
> >  } else {
> > diff --git a/lib/syslog-libc.c b/lib/syslog-libc.c
> > index 8858c3c..b702d41 100644
> > --- a/lib/syslog-libc.c
> > +++ b/lib/syslog-libc.c
> > @@ -1,5 +1,5 @@
> >  /*
> > - * Copyright (c) 2015 Nicira, Inc.
> > + * Copyright (c) 2015, 2016 Nicira, Inc.
> >   *
> >   * Licensed under the Apache License, Version 2.0 (the "License");
> >   * you may not use this file except in compliance with the License.
> > @@ -64,7 +64,7 @@ syslog_libc_open(struct syslogger *this OVS_UNUSED, int 
> > facility)
> >   * 'program_name', so make a private copy just for openlog().  (We keep
> >   * a pointer to the private copy to suppress memory leak warnings in
> >   * case openlog() does make its own copy.) */
> > -ident = program_name ? xstrdup(program_name) : NULL;
> > +ident = nullable_xstrdup(program_name);
> >
> >  openlog(ident, LOG_NDELAY, facility);
> >  }
> > diff --git a/lib/util.c b/lib/util.c
> > index 6ca04ad..e1dc3d2 100644
> > --- a/lib/util.c
> > +++ b/lib/util.c
> > @@ -1,5 +1,5 @@
> >  /*
> > - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, 
> > Inc.
> > + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 
> > Nicira, Inc.
> >   *
> >   * Licensed under the Apache License, Version 2.0 (the "License");
> >   * you may not use this file except in compliance with the License.
> > @@ -151,6 +151,12 @@ xstrdup(const char *s)
> >  return xmemdup0(s, strlen(s));
> >  }
> >
> > +char *

Re: [ovs-dev] [PATCHv2] netdev-provider: Apply batch object to netdev provider.

2016-06-26 Thread William Tu
Hi Darrell,

Thanks for you feedback!

On Sun, Jun 26, 2016 at 8:02 PM, Darrell Ball  wrote:
>
>
> On Sat, Jun 25, 2016 at 7:44 AM, William Tu  wrote:
>>
>> Commit 1895cc8dbb64 ("dpif-netdev: create batch object") introduces
>> batch process functions and 'struct dp_packet_batch' to associate with
>> batch-level metadata.  This patch applies the packet batch object to
>> the netdev provider interface (dummy, Linux, BSD, and DPDK) so that
>> batch APIs can be used in providers.  With batch metadata visible in
>> providers, optimizations can be introduced at per-batch level instead
>> of per-packet.
>>
>> Tested-at: https://travis-ci.org/williamtu/ovs-travis/builds/140135888
>
>
> The test shows as failed ?

it's due to one of the OVN testcases, which sometimes fails.

>
> The code change is replacing an array of ptrs to packets and count with a
> packet batch and replacing some code blocks with equivalent existing inline
> functions based on batchs.
>
> I have some comments inline.
>
>> @@ -681,10 +682,12 @@ netdev_bsd_rxq_drain(struct netdev_rxq *rxq_)
>>   */
>>  static int
>>  netdev_bsd_send(struct netdev *netdev_, int qid OVS_UNUSED,
>> -struct dp_packet **pkts, int cnt, bool may_steal)
>> +struct dp_packet_batch *batch, bool may_steal)
>>  {
>>  struct netdev_bsd *dev = netdev_bsd_cast(netdev_);
>>  const char *name = netdev_get_name(netdev_);
>> +int cnt = batch->count;
>> +struct dp_packet **okts = batch->packets;
>
>
>
> "okts" is not used in the function; "pkts" is used in the function.
> The function will no longer work.

my mistake, will fix it in next version. thanks!

>
>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>> index ed14a21..3b1e7fa 100644
>> --- a/lib/netdev-dpdk.c
>> +++ b/lib/netdev-dpdk.c
>> @@ -1251,12 +1251,14 @@ netdev_dpdk_vhost_update_rx_counters(struct
>> netdev_stats *stats,
>>   */
>>  static int
>>  netdev_dpdk_vhost_rxq_recv(struct netdev_rxq *rxq,
>> -   struct dp_packet **packets, int *c)
>> +   struct dp_packet_batch *batch)
>>  {
>>  struct netdev_dpdk *dev = netdev_dpdk_cast(rxq->netdev);
>>  struct virtio_net *virtio_dev = netdev_dpdk_get_virtio(dev);
>>  int qid = rxq->queue_id;
>>  struct ingress_policer *policer =
>> netdev_dpdk_get_ingress_policer(dev);
>> +struct dp_packet **packets = batch->packets;
>> +int *c = &batch->count;
>
>
> I see this pattern throughout where extra variables are used in all
> functions.
> There are 2 local variables for packets and count and also the batch
> parameter,
> which itself already has reference to packets and count from the start of
> the call chain
> in netdev_*().
>
> Pre-change, there are two parameters for packets and count derived from the
> batch
> parameter at the start of the call chain in netdev_*().
>
> These functions are intended to be fast.

I don't think adding these 2 extra local variables will have overhead,
I believe it's the same because compiler will optimize it.

>> @@ -1517,7 +1519,12 @@ dpdk_do_tx_copy(struct netdev *netdev, int qid,
>> struct dp_packet **pkts,
>>  }
>>
>>  if (dev->type == DPDK_DEV_VHOST) {
>> -__netdev_dpdk_vhost_send(netdev, qid, (struct dp_packet **)
>> mbufs, newcnt, true);
>> +struct dp_packet_batch mbatch;
>> +
>> +dp_packet_batch_init(&mbatch);
>> +mbatch.count = newcnt;
>> +memcpy(mbatch.packets, mbufs, newcnt * sizeof(struct rte_mbuf
>> *));
>>
>> +__netdev_dpdk_vhost_send(netdev, qid, &mbatch, true);
>
>
> This looks more expensive to me in terms of processing performance in this
> caller especially and also the callee.
> This code is intended to be fast.

This isn't copying the packet contents but only the array of 8byte
pointers. It definitely has some overhead but should be minor.

Regards,
William
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v3 2/2] ovn: Add address_set() support for ACLs.

2016-06-26 Thread Babu Shanmugam



On Thursday 23 June 2016 12:03 PM, Han Zhou wrote:
It may be good to have column "external_ids", so that external names, 
such as security-group name in neutron, can be recognized easily.
Han, do you want the external_ids to be present in the table in OVN 
SouthBound DB? I feel that it would be good for the table in NorthBound 
DB to have the external_ids.


--
Babu
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] [PATCH, v7] ovn: Add 'na' action and lflow for ND

2016-06-26 Thread Zong Kai LI
This patch tries to support ND versus ARP for OVN.

It adds a new OVN action 'na' in ovn-controller side, and modify lflows
for 'na' action and relevant packets in ovn-northd.

First, for ovn-northd, it will generate lflows per each lport with its
IPv6 addresses and mac addresss, with 'na' action, such as:
  match=(icmp6 && icmp6.type == 135 &&
 (nd.target == fd81:ce49:a948:0:f816:3eff:fe46:8a42 ||
  nd.target == fd81:ce49:b123:0:f816:3eff:fe46:8a42)),
  action=(na { eth.src = fa:16:3e:46:8a:42; nd.tll = fa:16:3e:46:8a:42;
   outport = inport;
   inport = ""; /* Allow sending out inport. */ output; };)

and new lflows will be set in tabel ls_in_arp_nd_rsp, which is renamed
from previous ls_in_arp_rsp.

Later, for ovn-controller, when it received a ND packet, it frames a
template NA packet for reply. The NA packet will be initialized based on
ND packet, such as NA packet will use:
 - ND packet eth.src as eth.dst,
 - ND packet eth.dst as eth.src,
 - ND packet ip6.src as ip6.dst,
 - ND packet nd.target as ip6.src,
 - ND packet eth.dst as nd.tll.

Finally, nested actions in 'na' action will update necessary fileds
for NA packet, such as:
 - eth.src, nd.tll
 - inport, outport

Since patch port for IPv6 router interface is not ready yet, this
patch will only try to deal with ND from VM. This patch will set
RSO flags to 011 for NA packets.

This patch also modified current ACL lflows for ND, not to do conntrack
on ND and NA packets in following tables:
 - S_SWITCH_IN_PRE_ACL
 - S_SWITCH_OUT_PRE_ACL
 - S_SWITCH_IN_ACL
 - S_SWITCH_OUT_ACL

(Rebase on upstream)

Signed-off-by: Zong Kai LI 
---
 lib/packets.c|  29 ++
 lib/packets.h|   4 ++
 ovn/controller/pinctrl.c | 134 ++-
 ovn/lib/actions.c|  47 +
 ovn/lib/actions.h|   6 +++
 ovn/northd/ovn-northd.c  |  65 ---
 ovn/ovn-sb.xml   |  39 ++
 tests/ovn.at | 101 +++
 tutorial/OVN-Tutorial.md |   6 +--
 9 files changed, 395 insertions(+), 36 deletions(-)

diff --git a/lib/packets.c b/lib/packets.c
index 43b5a70..a27264c 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -1355,6 +1355,35 @@ compose_nd(struct dp_packet *b, const struct eth_addr 
eth_src,
   ND_MSG_LEN + 
ND_OPT_LEN));
 }
 
+void
+compose_na(struct dp_packet *b,
+   const struct eth_addr eth_src, const struct eth_addr eth_dst,
+   const ovs_be32 ipv6_src[4], const ovs_be32 ipv6_dst[4],
+   ovs_be32 rco_flags)
+{
+struct ovs_nd_msg *na;
+struct ovs_nd_opt *nd_opt;
+uint32_t icmp_csum;
+
+eth_compose(b, eth_dst, eth_src, ETH_TYPE_IPV6, IPV6_HEADER_LEN);
+na = compose_ipv6(b, IPPROTO_ICMPV6, ipv6_src, ipv6_dst, 0, 0, 255,
+  ND_MSG_LEN + ND_OPT_LEN);
+
+na->icmph.icmp6_type = ND_NEIGHBOR_ADVERT;
+na->icmph.icmp6_code = 0;
+put_16aligned_be32(&na->rco_flags, rco_flags);
+
+nd_opt = &na->options[0];
+nd_opt->nd_opt_type = ND_OPT_TARGET_LINKADDR;
+nd_opt->nd_opt_len = 1;
+
+packet_set_nd(b, ipv6_src, eth_addr_zero, eth_src);
+na->icmph.icmp6_cksum = 0;
+icmp_csum = packet_csum_pseudoheader6(dp_packet_l3(b));
+na->icmph.icmp6_cksum = csum_finish(csum_continue(icmp_csum, na,
+  ND_MSG_LEN + 
ND_OPT_LEN));
+}
+
 uint32_t
 packet_csum_pseudoheader(const struct ip_header *ip)
 {
diff --git a/lib/packets.h b/lib/packets.h
index 5945940..077ccfa 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -1069,6 +1069,10 @@ void compose_arp(struct dp_packet *, uint16_t arp_op,
  ovs_be32 arp_spa, ovs_be32 arp_tpa);
 void compose_nd(struct dp_packet *, const struct eth_addr eth_src,
 struct in6_addr *, struct in6_addr *);
+void compose_na(struct dp_packet *,
+const struct eth_addr eth_src, const struct eth_addr eth_dst,
+const ovs_be32 ipv6_src[4], const ovs_be32 ipv6_dst[4],
+ovs_be32 rco_flags);
 uint32_t packet_csum_pseudoheader(const struct ip_header *);
 void IP_ECN_set_ce(struct dp_packet *pkt, bool is_ipv6);
 
diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
index 200505a..f7edfd3 100644
--- a/ovn/controller/pinctrl.c
+++ b/ovn/controller/pinctrl.c
@@ -25,6 +25,8 @@
 #include "lport.h"
 #include "nx-match.h"
 #include "ovn-controller.h"
+#include "lib/byte-order.h"
+#include "lib/packets.h"
 #include "lib/sset.h"
 #include "openvswitch/ofp-actions.h"
 #include "openvswitch/ofp-msgs.h"
@@ -68,6 +70,11 @@ static void send_garp_run(const struct ovsrec_bridge *,
   const char *chassis_id,
   const struct lport_index *lports,
   struct hmap *local_datapaths);
+static void pinctrl_handle_na(const struct flow *ip_flow,
+