[ovs-dev] [PATCH v8] rhel: Make the version, displayed to the user, customizable.

2024-04-15 Thread Timothy Redaelli
Since on CentOS/RHEL the builds are based on stable branches and not on
tags for debugging purpose it's better to have the downstream version as
version so it's easier to know which commits are included in a build.

This commit adds --with-version-suffix as ./configure option in
order to set an OVS version suffix that should be shown to the user via
ovs-vsctl -V and, so, also on database, on ovs-vsctl show and the other
utilities.

--with-version-suffix is used in Fedora/CentOS/RHEL spec file in order to have
the version be aligned with the downstream one.

Signed-off-by: Timothy Redaelli 
---
v1 -> v2: Use --with-version-suffix= and add version to other utilies
  (as requested by Ilya).

v2 -> v3: Add versioning to python utilities and python library itself
  (as suggested by Aaron).

v3 -> v4: Remove versioning to python library itself to avoid breaking
  PEP440 (as requested by Ilya). Versioning is still used in
  python utilities.

v4 -> v5: Re-add versioning to python library itself, but don't use it on
  setup.py (to avoid breaking PEP440). This will permit to have the
  custom version as ovs.version.VERSION (in case somebody uses it) and,
  so, also in python/ovs/unixctl/server.py (as suggested by Ilya).

v5 -> v6: Fix some setup.py leftovers and change the test as a loop
  (as suggested by Ilya).

v6 -> v7: Rebase with last master (it should pass CI now)

v7 -> v8: Be sure python-sdist depends on python/setup.py and run flake8 on
  setup.py.template instead of setup.py (as suggested by Ilya).
  Fix commit summary to make checkpatch.py happy
---
 Makefile.am|  1 +
 acinclude.m4   | 13 +
 configure.ac   |  1 +
 include/openvswitch/version.h.in   |  2 +-
 lib/ovsdb-error.c  |  2 +-
 lib/util.c |  5 +++--
 ovsdb/ovsdb-server.c   |  3 ++-
 python/.gitignore  |  1 +
 python/automake.mk | 20 ++--
 python/{setup.py => setup.py.template} |  9 -
 rhel/openvswitch-fedora.spec.in|  1 +
 utilities/ovs-dpctl-top.in |  2 +-
 utilities/ovs-lib.in   |  2 +-
 utilities/ovs-parse-backtrace.in   |  2 +-
 utilities/ovs-pcap.in  |  2 +-
 utilities/ovs-pki.in   |  2 +-
 utilities/ovs-tcpdump.in   |  4 ++--
 utilities/ovs-tcpundump.in |  2 +-
 utilities/ovs-vlan-test.in |  2 +-
 vswitchd/bridge.c  |  3 ++-
 20 files changed, 53 insertions(+), 26 deletions(-)
 rename python/{setup.py => setup.py.template} (95%)

diff --git a/Makefile.am b/Makefile.am
index e6c90a911..fa89f591b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -163,6 +163,7 @@ SUFFIXES += .in
-e 's,[@]PYTHON3[@],$(PYTHON3),g' \
-e 's,[@]RUNDIR[@],$(RUNDIR),g' \
-e 's,[@]VERSION[@],$(VERSION),g' \
+   -e 's,[@]VERSION_SUFFIX[@],$(VERSION_SUFFIX),g' \
-e 's,[@]localstatedir[@],$(localstatedir),g' \
-e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
-e 's,[@]sysconfdir[@],$(sysconfdir),g' \
diff --git a/acinclude.m4 b/acinclude.m4
index f1ba046c2..f7a81a734 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -497,6 +497,19 @@ AC_DEFUN([OVS_CHECK_DPDK], [
   AM_CONDITIONAL([DPDK_NETDEV], test "$DPDKLIB_FOUND" = true)
 ])
 
+dnl Append a version suffix
+
+AC_DEFUN([OVS_CHECK_VERSION_SUFFIX], [
+  AC_ARG_WITH([version-suffix],
+  [AS_HELP_STRING([--with-version-suffix=ver_suffix],
+  [Specify a version suffix that will be appended
+   to OVS version])])
+  AC_DEFINE_UNQUOTED([VERSION_SUFFIX], ["$with_version_suffix"],
+ [Package version suffix])
+  AC_SUBST([VERSION_SUFFIX], [$with_version_suffix])
+  ])
+])
+
 dnl Checks for net/if_dl.h.
 dnl
 dnl (We use this as a proxy for checking whether we're building on FreeBSD
diff --git a/configure.ac b/configure.ac
index dd6553fea..8323e481d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -202,6 +202,7 @@ OVS_CHECK_LINUX_SCTP_CT
 OVS_CHECK_LINUX_VIRTIO_TYPES
 OVS_CHECK_DPDK
 OVS_CHECK_PRAGMA_MESSAGE
+OVS_CHECK_VERSION_SUFFIX
 AC_SUBST([CFLAGS])
 AC_SUBST([OVS_CFLAGS])
 AC_SUBST([OVS_LDFLAGS])
diff --git a/include/openvswitch/version.h.in b/include/openvswitch/version.h.in
index 23d8fde4f..231f61e30 100644
--- a/include/openvswitch/version.h.in
+++ b/include/openvswitch/version.h.in
@@ -19,7 +19,7 @@
 #define OPENVSWITCH_VERSION_H 1
 
 #define OVS_PACKAGE_STRING  "@PACKAGE_STRING@"
-#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@"
+#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@@VERSION_SUFFIX@"
 
 #define OVS_LIB_VERSION @LT_CURRENT@
 #define OVS_LIB_REVISION@LT

[ovs-dev] [PATCH v7] rhel: make the version, displayed to the user, customizable

2024-04-03 Thread Timothy Redaelli
Since on CentOS/RHEL the builds are based on stable branches and not on
tags for debugging purpose it's better to have the downstream version as
version so it's easier to know which commits are included in a build.

This commit adds --with-version-suffix as ./configure option in
order to set an OVS version suffix that should be shown to the user via
ovs-vsctl -V and, so, also on database, on ovs-vsctl show and the other
utilities.

--with-version-suffix is used in Fedora/CentOS/RHEL spec file in order to have
the version be aligned with the downstream one.

Signed-off-by: Timothy Redaelli 
---
v1 -> v2: Use --with-version-suffix= and add version to other utilies
  (as requested by Ilya).

v2 -> v3: Add versioning to python utilities and python library itself
  (as suggested by Aaron).

v3 -> v4: Remove versioning to python library itself to avoid breaking
  PEP440 (as requested by Ilya). Versioning is still used in
  python utilities.

v4 -> v5: Re-add versioning to python library itself, but don't use it on
  setup.py (to avoid breaking PEP440). This will permit to have the
  custom version as ovs.version.VERSION (in case somebody uses it) and,
  so, also in python/ovs/unixctl/server.py (as suggested by Ilya).

v5 -> v6: Fix some setup.py leftovers and change the test as a loop
  (as suggested by Ilya).

v6 -> v7: Rebase with last master (it should pass CI now)
---
 Makefile.am|  1 +
 acinclude.m4   | 13 +
 configure.ac   |  1 +
 include/openvswitch/version.h.in   |  2 +-
 lib/ovsdb-error.c  |  2 +-
 lib/util.c |  5 +++--
 ovsdb/ovsdb-server.c   |  3 ++-
 python/.gitignore  |  1 +
 python/automake.mk | 11 ++-
 python/{setup.py => setup.py.template} |  9 -
 rhel/openvswitch-fedora.spec.in|  1 +
 utilities/ovs-dpctl-top.in |  2 +-
 utilities/ovs-lib.in   |  2 +-
 utilities/ovs-parse-backtrace.in   |  2 +-
 utilities/ovs-pcap.in  |  2 +-
 utilities/ovs-pki.in   |  2 +-
 utilities/ovs-tcpdump.in   |  4 ++--
 utilities/ovs-tcpundump.in |  2 +-
 utilities/ovs-vlan-test.in |  2 +-
 vswitchd/bridge.c  |  3 ++-
 20 files changed, 49 insertions(+), 21 deletions(-)
 rename python/{setup.py => setup.py.template} (95%)

diff --git a/Makefile.am b/Makefile.am
index 45fce1243..987bc89ca 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -163,6 +163,7 @@ SUFFIXES += .in
-e 's,[@]PYTHON3[@],$(PYTHON3),g' \
-e 's,[@]RUNDIR[@],$(RUNDIR),g' \
-e 's,[@]VERSION[@],$(VERSION),g' \
+   -e 's,[@]VERSION_SUFFIX[@],$(VERSION_SUFFIX),g' \
-e 's,[@]localstatedir[@],$(localstatedir),g' \
-e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
-e 's,[@]sysconfdir[@],$(sysconfdir),g' \
diff --git a/acinclude.m4 b/acinclude.m4
index f1ba046c2..f7a81a734 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -497,6 +497,19 @@ AC_DEFUN([OVS_CHECK_DPDK], [
   AM_CONDITIONAL([DPDK_NETDEV], test "$DPDKLIB_FOUND" = true)
 ])
 
+dnl Append a version suffix
+
+AC_DEFUN([OVS_CHECK_VERSION_SUFFIX], [
+  AC_ARG_WITH([version-suffix],
+  [AS_HELP_STRING([--with-version-suffix=ver_suffix],
+  [Specify a version suffix that will be appended
+   to OVS version])])
+  AC_DEFINE_UNQUOTED([VERSION_SUFFIX], ["$with_version_suffix"],
+ [Package version suffix])
+  AC_SUBST([VERSION_SUFFIX], [$with_version_suffix])
+  ])
+])
+
 dnl Checks for net/if_dl.h.
 dnl
 dnl (We use this as a proxy for checking whether we're building on FreeBSD
diff --git a/configure.ac b/configure.ac
index dd6553fea..8323e481d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -202,6 +202,7 @@ OVS_CHECK_LINUX_SCTP_CT
 OVS_CHECK_LINUX_VIRTIO_TYPES
 OVS_CHECK_DPDK
 OVS_CHECK_PRAGMA_MESSAGE
+OVS_CHECK_VERSION_SUFFIX
 AC_SUBST([CFLAGS])
 AC_SUBST([OVS_CFLAGS])
 AC_SUBST([OVS_LDFLAGS])
diff --git a/include/openvswitch/version.h.in b/include/openvswitch/version.h.in
index 23d8fde4f..231f61e30 100644
--- a/include/openvswitch/version.h.in
+++ b/include/openvswitch/version.h.in
@@ -19,7 +19,7 @@
 #define OPENVSWITCH_VERSION_H 1
 
 #define OVS_PACKAGE_STRING  "@PACKAGE_STRING@"
-#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@"
+#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@@VERSION_SUFFIX@"
 
 #define OVS_LIB_VERSION @LT_CURRENT@
 #define OVS_LIB_REVISION@LT_REVISION@
diff --git a/lib/ovsdb-error.c b/lib/ovsdb-error.c
index 9ad42b232..56512fc28 100644
--- a/lib/ovsdb-error.c
+++ b/lib/ovsdb-error.c
@@ -146,7 +146,7 @@ ovsdb_internal_error(struct ovsdb_error *inner_

[ovs-dev] [PATCH v2] bfd: Improve state change log message.

2024-03-05 Thread Timothy Redaelli
A log message like this one:

2024-01-09T06:45:17.201Z|00071|bfd(handler2)|INFO|ovn-0af536-0: BFD state
change: down->up "Neighbor Signaled Session Down"->"Neighbor Signaled Session
Down".

can be hard to read since '->' usually represents a status change, but
in this case the diagnostic code stays constant. Update the log message to
avoid such ambiguity. The log message for the above event become:

2024-01-09T06:45:16.211Z|00026|bfd(handler3)|INFO|ovn-0af536-0: BFD state
change: (bfd.SessionState: down, bfd.LocalDiag: "Neighbor Signaled Session
Down") -> (bfd.SessionState: up, bfd.LocalDiag: "Neighbor Signaled Session
Down")

Reported-by: Alex Stupnikov 
Reported-at: https://bugzilla.redhat.com/2258496
Signed-off-by: Timothy Redaelli 
---

v1 -> v2:
Restructured the message format as suggested by Ilya Maximets and Eelco
Chaudron to avoid ambiguity

---
 lib/bfd.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/bfd.c b/lib/bfd.c
index 9af258917..b8149e789 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -1130,10 +1130,11 @@ bfd_set_state(struct bfd *bfd, enum state state, enum 
diag diag)
 if (!VLOG_DROP_INFO()) {
 struct ds ds = DS_EMPTY_INITIALIZER;
 
-ds_put_format(, "%s: BFD state change: %s->%s"
-  " \"%s\"->\"%s\".\n",
+ds_put_format(, "%s: BFD state change: (bfd.SessionState: %s,"
+  " bfd.LocalDiag: \"%s\") -> (bfd.SessionState: %s,"
+  " bfd.LocalDiag: \"%s\")\n",
   bfd->name, bfd_state_str(bfd->state),
-  bfd_state_str(state), bfd_diag_str(bfd->diag),
+  bfd_diag_str(bfd->diag), bfd_state_str(state),
   bfd_diag_str(diag));
 bfd_put_details(, bfd);
 VLOG_INFO("%s", ds_cstr());
-- 
2.43.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] tests: Fix "SSL db: implementation" test with openssl > 3.2.0.

2024-03-05 Thread Timothy Redaelli
In OpenSSL 3.2.0 (81b741f) all the "alert" error messages was updated to
replace "sslv3" with "ssl/tls".

This commit updates the "SSL db: implementation" test to support both the
pre-openssl 3.2.0 error message: "sslv3 alert certificate unknown" and the
post-openssl 3.2.0 error message: "ssl/tls alert certificate unknown".

Signed-off-by: Timothy Redaelli 
---
 tests/ovsdb-server.at | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at
index b8ccc4c8e..35447a52e 100644
--- a/tests/ovsdb-server.at
+++ b/tests/ovsdb-server.at
@@ -936,8 +936,10 @@ AT_CHECK_UNQUOTED(
   [ignore])
 # The error message for being unable to negotiate a shared ciphersuite
 # is 'sslv3 alert handshake failure'. This is not the clearest message.
+# In openssl 3.2.0 all the error messages was updated to replace "sslv3" with
+# "ssl/tls".
 AT_CHECK_UNQUOTED(
-  [grep "sslv3 alert handshake failure" output], [0],
+  [grep -E "(sslv3|ssl/tls) alert handshake failure" output], [0],
   [stdout],
   [ignore])
 OVSDB_SERVER_SHUTDOWN(["
-- 
2.43.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] bfd: Improve state change log message.

2024-02-04 Thread Timothy Redaelli
A log message like this one:

2024-01-09T06:45:17.201Z|00071|bfd(handler2)|INFO|ovn-0af536-0: BFD state
change: down->up "Neighbor Signaled Session Down"->"Neighbor Signaled Session
Down".

can be hard to read since '->' usually represents a status change, but
in this case the diagnostic code stays constant. Update the log message to
avoid such ambiguity. The log message for the above event become:

2024-01-09T06:45:16.211Z|00026|bfd(handler3)|INFO|ovn-0af536-0: BFD state
change: up->down, previous failure: "Neighbor Signaled Session Down",
current failure: "Neighbor Signaled Session Down".

Reported-by: Alex Stupnikov 
Reported-at: https://bugzilla.redhat.com/2258496
Signed-off-by: Timothy Redaelli 
---
 lib/bfd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/bfd.c b/lib/bfd.c
index 9698576d0..8033c5117 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -1131,8 +1131,9 @@ bfd_set_state(struct bfd *bfd, enum state state, enum 
diag diag)
 if (!VLOG_DROP_INFO()) {
 struct ds ds = DS_EMPTY_INITIALIZER;
 
-ds_put_format(, "%s: BFD state change: %s->%s"
-  " \"%s\"->\"%s\".\n",
+ds_put_format(, "%s: BFD state change: %s->%s,"
+  " previous failure \"%s\", current failure"
+  " \"%s\".\n",
   bfd->name, bfd_state_str(bfd->state),
   bfd_state_str(state), bfd_diag_str(bfd->diag),
   bfd_diag_str(diag));
-- 
2.43.0

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v6] rhel: make the version, displayed to the user, customizable

2023-08-09 Thread Timothy Redaelli
Since on CentOS/RHEL the builds are based on stable branches and not on
tags for debugging purpose it's better to have the downstream version as
version so it's easier to know which commits are included in a build.

This commit adds --with-version-suffix as ./configure option in
order to set an OVS version suffix that should be shown to the user via
ovs-vsctl -V and, so, also on database, on ovs-vsctl show and the other
utilities.

--with-version-suffix is used in Fedora/CentOS/RHEL spec file in order to have
the version be aligned with the downstream one.

Signed-off-by: Timothy Redaelli 
---
v1 -> v2: Use --with-version-suffix= and add version to other utilies
  (as requested by Ilya).

v2 -> v3: Add versioning to python utilities and python library itself
  (as suggested by Aaron).

v3 -> v4: Remove versioning to python library itself to avoid breaking
  PEP440 (as requested by Ilya). Versioning is still used in
  python utilities.

v4 -> v5: Re-add versioning to python library itself, but don't use it on
  setup.py (to avoid breaking PEP440). This will permit to have the
  custom version as ovs.version.VERSION (in case somebody uses it) and,
  so, also in python/ovs/unixctl/server.py (as suggested by Ilya).

v5 -> v6: Fix some setup.py leftovers and change the test as a loop
  (as suggested by Ilya).
---
 Makefile.am|  1 +
 acinclude.m4   | 13 
 configure.ac   |  1 +
 include/openvswitch/version.h.in   |  2 +-
 lib/ovsdb-error.c  |  2 +-
 lib/util.c |  5 +++--
 ovsdb/ovsdb-server.c   |  3 ++-
 python/.gitignore  |  1 +
 python/automake.mk | 18 -
 python/{setup.py => setup.py.template} | 28 +-
 rhel/openvswitch-fedora.spec.in|  1 +
 utilities/ovs-dpctl-top.in |  2 +-
 utilities/ovs-lib.in   |  2 +-
 utilities/ovs-parse-backtrace.in   |  2 +-
 utilities/ovs-pcap.in  |  2 +-
 utilities/ovs-pki.in   |  2 +-
 utilities/ovs-tcpdump.in   |  4 ++--
 utilities/ovs-tcpundump.in |  2 +-
 utilities/ovs-vlan-test.in |  2 +-
 vswitchd/bridge.c  |  3 ++-
 20 files changed, 58 insertions(+), 38 deletions(-)
 rename python/{setup.py => setup.py.template} (87%)

diff --git a/Makefile.am b/Makefile.am
index db341504d..793cd10dc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -160,6 +160,7 @@ SUFFIXES += .in
-e 's,[@]PYTHON3[@],$(PYTHON3),g' \
-e 's,[@]RUNDIR[@],$(RUNDIR),g' \
-e 's,[@]VERSION[@],$(VERSION),g' \
+   -e 's,[@]VERSION_SUFFIX[@],$(VERSION_SUFFIX),g' \
-e 's,[@]localstatedir[@],$(localstatedir),g' \
-e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
-e 's,[@]sysconfdir[@],$(sysconfdir),g' \
diff --git a/acinclude.m4 b/acinclude.m4
index f1ba046c2..f7a81a734 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -497,6 +497,19 @@ AC_DEFUN([OVS_CHECK_DPDK], [
   AM_CONDITIONAL([DPDK_NETDEV], test "$DPDKLIB_FOUND" = true)
 ])
 
+dnl Append a version suffix
+
+AC_DEFUN([OVS_CHECK_VERSION_SUFFIX], [
+  AC_ARG_WITH([version-suffix],
+  [AS_HELP_STRING([--with-version-suffix=ver_suffix],
+  [Specify a version suffix that will be appended
+   to OVS version])])
+  AC_DEFINE_UNQUOTED([VERSION_SUFFIX], ["$with_version_suffix"],
+ [Package version suffix])
+  AC_SUBST([VERSION_SUFFIX], [$with_version_suffix])
+  ])
+])
+
 dnl Checks for net/if_dl.h.
 dnl
 dnl (We use this as a proxy for checking whether we're building on FreeBSD
diff --git a/configure.ac b/configure.ac
index c8708630e..049d37d7d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -198,6 +198,7 @@ OVS_CHECK_LINUX_SCTP_CT
 OVS_CHECK_LINUX_VIRTIO_TYPES
 OVS_CHECK_DPDK
 OVS_CHECK_PRAGMA_MESSAGE
+OVS_CHECK_VERSION_SUFFIX
 AC_SUBST([CFLAGS])
 AC_SUBST([OVS_CFLAGS])
 AC_SUBST([OVS_LDFLAGS])
diff --git a/include/openvswitch/version.h.in b/include/openvswitch/version.h.in
index 23d8fde4f..231f61e30 100644
--- a/include/openvswitch/version.h.in
+++ b/include/openvswitch/version.h.in
@@ -19,7 +19,7 @@
 #define OPENVSWITCH_VERSION_H 1
 
 #define OVS_PACKAGE_STRING  "@PACKAGE_STRING@"
-#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@"
+#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@@VERSION_SUFFIX@"
 
 #define OVS_LIB_VERSION @LT_CURRENT@
 #define OVS_LIB_REVISION@LT_REVISION@
diff --git a/lib/ovsdb-error.c b/lib/ovsdb-error.c
index 9ad42b232..56512fc28 100644
--- a/lib/ovsdb-error.c
+++ b/lib/ovsdb-error.c
@@ -146,7 +146,7 @@ ovsdb_internal_error(struct ovsdb_error *inner_error,
 ds_put_char(, ')');
 }
 
-   

[ovs-dev] [PATCH v5] rhel: make the version, displayed to the user, customizable

2023-06-27 Thread Timothy Redaelli
Since on CentOS/RHEL the builds are based on stable branches and not on
tags for debugging purpose it's better to have the downstream version as
version so it's easier to know which commits are included in a build.

This commit adds --with-version-suffix as ./configure option in
order to set an OVS version suffix that should be shown to the user via
ovs-vsctl -V and, so, also on database, on ovs-vsctl show and the other
utilities.

--with-version-suffix is used in Fedora/CentOS/RHEL spec file in order to have
the version be aligned with the downstream one.

Signed-off-by: Timothy Redaelli 
---
v1 -> v2: Use --with-version-suffix= and add version to other utilies
  (as requested by Ilya).

v2 -> v3: Add versioning to python utilities and python library itself
  (as suggested by Aaron).

v3 -> v4: Remove versioning to python library itself to avoid breaking
  PEP440 (as requested by Ilya). Versioning is still used in
  python utilities.

v4 -> v5: Re-add versioning to python library itself, but don't use it on
  setup.py (to avoid breaking PEP440). This will permit to have the
  custom version as ovs.version.VERSION (in case somebody uses it) and,
  so, also in python/ovs/unixctl/server.py (as suggested by Ilya).
---
 Makefile.am|  1 +
 acinclude.m4   | 13 +
 configure.ac   |  1 +
 include/openvswitch/version.h.in   |  2 +-
 lib/ovsdb-error.c  |  2 +-
 lib/util.c |  5 +++--
 ovsdb/ovsdb-server.c   |  3 ++-
 python/.gitignore  |  1 +
 python/automake.mk | 11 ++-
 python/{setup.py => setup.py.template} |  9 -
 rhel/openvswitch-fedora.spec.in|  1 +
 utilities/ovs-dpctl-top.in |  2 +-
 utilities/ovs-lib.in   |  2 +-
 utilities/ovs-parse-backtrace.in   |  2 +-
 utilities/ovs-pcap.in  |  2 +-
 utilities/ovs-pki.in   |  2 +-
 utilities/ovs-tcpdump.in   |  4 ++--
 utilities/ovs-tcpundump.in |  2 +-
 utilities/ovs-vlan-test.in |  2 +-
 vswitchd/bridge.c  |  3 ++-
 20 files changed, 49 insertions(+), 21 deletions(-)
 rename python/{setup.py => setup.py.template} (95%)

diff --git a/Makefile.am b/Makefile.am
index db341504d..793cd10dc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -160,6 +160,7 @@ SUFFIXES += .in
-e 's,[@]PYTHON3[@],$(PYTHON3),g' \
-e 's,[@]RUNDIR[@],$(RUNDIR),g' \
-e 's,[@]VERSION[@],$(VERSION),g' \
+   -e 's,[@]VERSION_SUFFIX[@],$(VERSION_SUFFIX),g' \
-e 's,[@]localstatedir[@],$(localstatedir),g' \
-e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
-e 's,[@]sysconfdir[@],$(sysconfdir),g' \
diff --git a/acinclude.m4 b/acinclude.m4
index ac1eab790..a02f5bb00 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -470,6 +470,19 @@ AC_DEFUN([OVS_CHECK_DPDK], [
   AM_CONDITIONAL([DPDK_NETDEV], test "$DPDKLIB_FOUND" = true)
 ])

+dnl Append a version suffix
+
+AC_DEFUN([OVS_CHECK_VERSION_SUFFIX], [
+  AC_ARG_WITH([version-suffix],
+  [AS_HELP_STRING([--with-version-suffix=ver_suffix],
+  [Specify a version suffix that will be appended
+   to OVS version])])
+  AC_DEFINE_UNQUOTED([VERSION_SUFFIX], ["$with_version_suffix"],
+ [Package version suffix])
+  AC_SUBST([VERSION_SUFFIX], [$with_version_suffix])
+  ])
+])
+
 dnl Checks for net/if_dl.h.
 dnl
 dnl (We use this as a proxy for checking whether we're building on FreeBSD
diff --git a/configure.ac b/configure.ac
index d05e544b5..3df7156da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -198,6 +198,7 @@ OVS_CHECK_LINUX_SCTP_CT
 OVS_CHECK_LINUX_VIRTIO_TYPES
 OVS_CHECK_DPDK
 OVS_CHECK_PRAGMA_MESSAGE
+OVS_CHECK_VERSION_SUFFIX
 AC_SUBST([CFLAGS])
 AC_SUBST([OVS_CFLAGS])
 AC_SUBST([OVS_LDFLAGS])
diff --git a/include/openvswitch/version.h.in b/include/openvswitch/version.h.in
index 23d8fde4f..231f61e30 100644
--- a/include/openvswitch/version.h.in
+++ b/include/openvswitch/version.h.in
@@ -19,7 +19,7 @@
 #define OPENVSWITCH_VERSION_H 1

 #define OVS_PACKAGE_STRING  "@PACKAGE_STRING@"
-#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@"
+#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@@VERSION_SUFFIX@"

 #define OVS_LIB_VERSION @LT_CURRENT@
 #define OVS_LIB_REVISION@LT_REVISION@
diff --git a/lib/ovsdb-error.c b/lib/ovsdb-error.c
index 9ad42b232..56512fc28 100644
--- a/lib/ovsdb-error.c
+++ b/lib/ovsdb-error.c
@@ -146,7 +146,7 @@ ovsdb_internal_error(struct ovsdb_error *inner_error,
 ds_put_char(, ')');
 }

-ds_put_format(, " (%s %s)", program_name, VERSION);
+ds_put_format(, " (%s %s)", program_name, VERSION

[ovs-dev] [PATCH v4] rhel: make the version, displayed to the user, customizable

2023-06-20 Thread Timothy Redaelli
Since on CentOS/RHEL the builds are based on stable branches and not on
tags for debugging purpose it's better to have the downstream version as
version so it's easier to know which commits are included in a build.

This commit adds --with-version-suffix as ./configure option in
order to set an OVS version suffix that should be shown to the user via
ovs-vsctl -V and, so, also on database, on ovs-vsctl show and the other
utilities.

--with-version-suffix is used in Fedora/CentOS/RHEL spec file in order to have
the version be aligned with the downstream one.

Signed-off-by: Timothy Redaelli 
---
v1 -> v2: Use --with-version-suffix= and add version to other utilies
  (as requested by Ilya).

v2 -> v3: Add versioning to python utilities and python library itself
  (as suggested by Aaron)

v3 -> v4: Remove versioning to python library itself to avoid breaking
  PEP440 (as requested by Ilya). Versioning is still used in
  python utilities.
---
 Makefile.am  |  1 +
 acinclude.m4 | 13 +
 configure.ac |  1 +
 include/openvswitch/version.h.in |  2 +-
 lib/ovsdb-error.c|  2 +-
 lib/util.c   |  5 +++--
 ovsdb/ovsdb-server.c |  3 ++-
 rhel/openvswitch-fedora.spec.in  |  1 +
 utilities/ovs-dpctl-top.in   |  2 +-
 utilities/ovs-lib.in |  2 +-
 utilities/ovs-parse-backtrace.in |  2 +-
 utilities/ovs-pcap.in|  2 +-
 utilities/ovs-pki.in |  2 +-
 utilities/ovs-tcpdump.in |  4 ++--
 utilities/ovs-tcpundump.in   |  2 +-
 utilities/ovs-vlan-test.in   |  2 +-
 vswitchd/bridge.c|  3 ++-
 17 files changed, 34 insertions(+), 15 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index db341504d..793cd10dc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -160,6 +160,7 @@ SUFFIXES += .in
-e 's,[@]PYTHON3[@],$(PYTHON3),g' \
-e 's,[@]RUNDIR[@],$(RUNDIR),g' \
-e 's,[@]VERSION[@],$(VERSION),g' \
+   -e 's,[@]VERSION_SUFFIX[@],$(VERSION_SUFFIX),g' \
-e 's,[@]localstatedir[@],$(localstatedir),g' \
-e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
-e 's,[@]sysconfdir[@],$(sysconfdir),g' \
diff --git a/acinclude.m4 b/acinclude.m4
index ac1eab790..a02f5bb00 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -470,6 +470,19 @@ AC_DEFUN([OVS_CHECK_DPDK], [
   AM_CONDITIONAL([DPDK_NETDEV], test "$DPDKLIB_FOUND" = true)
 ])

+dnl Append a version suffix
+
+AC_DEFUN([OVS_CHECK_VERSION_SUFFIX], [
+  AC_ARG_WITH([version-suffix],
+  [AS_HELP_STRING([--with-version-suffix=ver_suffix],
+  [Specify a version suffix that will be appended
+   to OVS version])])
+  AC_DEFINE_UNQUOTED([VERSION_SUFFIX], ["$with_version_suffix"],
+ [Package version suffix])
+  AC_SUBST([VERSION_SUFFIX], [$with_version_suffix])
+  ])
+])
+
 dnl Checks for net/if_dl.h.
 dnl
 dnl (We use this as a proxy for checking whether we're building on FreeBSD
diff --git a/configure.ac b/configure.ac
index d05e544b5..3df7156da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -198,6 +198,7 @@ OVS_CHECK_LINUX_SCTP_CT
 OVS_CHECK_LINUX_VIRTIO_TYPES
 OVS_CHECK_DPDK
 OVS_CHECK_PRAGMA_MESSAGE
+OVS_CHECK_VERSION_SUFFIX
 AC_SUBST([CFLAGS])
 AC_SUBST([OVS_CFLAGS])
 AC_SUBST([OVS_LDFLAGS])
diff --git a/include/openvswitch/version.h.in b/include/openvswitch/version.h.in
index 23d8fde4f..231f61e30 100644
--- a/include/openvswitch/version.h.in
+++ b/include/openvswitch/version.h.in
@@ -19,7 +19,7 @@
 #define OPENVSWITCH_VERSION_H 1

 #define OVS_PACKAGE_STRING  "@PACKAGE_STRING@"
-#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@"
+#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@@VERSION_SUFFIX@"

 #define OVS_LIB_VERSION @LT_CURRENT@
 #define OVS_LIB_REVISION@LT_REVISION@
diff --git a/lib/ovsdb-error.c b/lib/ovsdb-error.c
index 9ad42b232..56512fc28 100644
--- a/lib/ovsdb-error.c
+++ b/lib/ovsdb-error.c
@@ -146,7 +146,7 @@ ovsdb_internal_error(struct ovsdb_error *inner_error,
 ds_put_char(, ')');
 }

-ds_put_format(, " (%s %s)", program_name, VERSION);
+ds_put_format(, " (%s %s)", program_name, VERSION VERSION_SUFFIX);

 if (inner_error) {
 char *s = ovsdb_error_to_string_free(inner_error);
diff --git a/lib/util.c b/lib/util.c
index 3fb3a4b40..c1bfda0e6 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -617,8 +617,9 @@ ovs_set_program_name(const char *argv0, const char *version)
 program_name = basename;

 free(program_version);
-if (!strcmp(version, VERSION)) {
-program_version = xasprintf("%s (Open vSwitch) "VERSION"\n",
+if (!strcmp(version, VERSION VERSION_SUFFIX)) {
+program_version = xasprintf("%s (Open vSwitch) "VERSION
+  

[ovs-dev] [PATCH v2 1/1] utilities/bashcomp: Fix PS1 generation on new bash

2023-05-26 Thread Timothy Redaelli
The current implementation used to extract PS1 prompt for ovs-vsctl is
broken on recent Bash releases.
Starting from Bash 4.4 it's possible to use @P expansion in order to get
the quoted PS1 directly.

This commit makes the 2 bash completion files to use @P expansion in order
to get the quoted PS1 on Bash >= 4.4.

Reported-at: https://bugzilla.redhat.com/2170344
Reported-by: Martin Necas 
Signed-off-by: Timothy Redaelli 
---
 utilities/ovs-appctl-bashcomp.bash | 7 +++
 utilities/ovs-vsctl-bashcomp.bash  | 7 +++
 2 files changed, 14 insertions(+)

diff --git a/utilities/ovs-appctl-bashcomp.bash 
b/utilities/ovs-appctl-bashcomp.bash
index 4384be8ae..0a9af1a18 100644
--- a/utilities/ovs-appctl-bashcomp.bash
+++ b/utilities/ovs-appctl-bashcomp.bash
@@ -223,6 +223,13 @@ printf_stderr() {
 # The code below is taken from Peter Amidon.  His change makes it more
 # robust.
 extract_bash_prompt() {
+# On Bash 4.4+ just use the @P expansion
+if ((BASH_VERSINFO[0] > 4 ||
+(BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 4))); then
+_BASH_PROMPT="${PS1@P}"
+return
+fi
+
 local myPS1 v
 
 myPS1="$(sed 's/Begin prompt/\\Begin prompt/; s/End prompt/\\End prompt/' 
<<< "$PS1")"
diff --git a/utilities/ovs-vsctl-bashcomp.bash 
b/utilities/ovs-vsctl-bashcomp.bash
index fc8245bfb..c5ad24fb7 100644
--- a/utilities/ovs-vsctl-bashcomp.bash
+++ b/utilities/ovs-vsctl-bashcomp.bash
@@ -413,6 +413,13 @@ _ovs_vsctl_get_PS1 () {
 return;
 fi
 
+# On Bash 4.4+ just use the @P expansion
+if ((BASH_VERSINFO[0] > 4 ||
+(BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 4))); then
+printf '%s\n' "${PS1@P}"
+return
+fi
+
 # Original inspiration from
 # http://stackoverflow.com/questions/10060500/bash-how-to-evaluate-ps1-ps2,
 # but changed quite a lot to make it more robust.
-- 
2.40.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2 0/1] Fix PS1 generation on new bash

2023-05-26 Thread Timothy Redaelli
v1 -> v2:
Split if to avoid line > 79 characters

Timothy Redaelli (1):
  utilities/bashcomp: Fix PS1 generation on new bash

 utilities/ovs-appctl-bashcomp.bash | 7 +++
 utilities/ovs-vsctl-bashcomp.bash  | 7 +++
 2 files changed, 14 insertions(+)

-- 
2.40.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] utilities/bashcomp: Fix PS1 generation on new bash

2023-05-26 Thread Timothy Redaelli
The current implementation used to extract PS1 prompt for ovs-vsctl is
broken on recent Bash releases.
Starting from Bash 4.4 it's possible to use @P expansion in order to get
the quoted PS1 directly.

This commit makes the 2 bash completion files to use @P expansion in order
to get the quoted PS1 on Bash >= 4.4.

Reported-at: https://bugzilla.redhat.com/2170344
Reported-by: Martin Necas 
Signed-off-by: Timothy Redaelli 
---
 utilities/ovs-appctl-bashcomp.bash | 6 ++
 utilities/ovs-vsctl-bashcomp.bash  | 6 ++
 2 files changed, 12 insertions(+)

diff --git a/utilities/ovs-appctl-bashcomp.bash 
b/utilities/ovs-appctl-bashcomp.bash
index 4384be8ae..dc5a9c7b4 100644
--- a/utilities/ovs-appctl-bashcomp.bash
+++ b/utilities/ovs-appctl-bashcomp.bash
@@ -223,6 +223,12 @@ printf_stderr() {
 # The code below is taken from Peter Amidon.  His change makes it more
 # robust.
 extract_bash_prompt() {
+# On Bash 4.4+ just use the @P expansion
+if ((BASH_VERSINFO[0] > 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 
4))); then
+_BASH_PROMPT="${PS1@P}"
+return
+fi
+
 local myPS1 v
 
 myPS1="$(sed 's/Begin prompt/\\Begin prompt/; s/End prompt/\\End prompt/' 
<<< "$PS1")"
diff --git a/utilities/ovs-vsctl-bashcomp.bash 
b/utilities/ovs-vsctl-bashcomp.bash
index fc8245bfb..6d7e1912d 100644
--- a/utilities/ovs-vsctl-bashcomp.bash
+++ b/utilities/ovs-vsctl-bashcomp.bash
@@ -413,6 +413,12 @@ _ovs_vsctl_get_PS1 () {
 return;
 fi
 
+# On Bash 4.4+ just use the @P expansion
+if ((BASH_VERSINFO[0] > 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 
4))); then
+printf '%s\n' "${PS1@P}"
+return
+fi
+
 # Original inspiration from
 # http://stackoverflow.com/questions/10060500/bash-how-to-evaluate-ps1-ps2,
 # but changed quite a lot to make it more robust.
-- 
2.40.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v3] rhel: make the version, displayed to the user, customizable

2023-05-26 Thread Timothy Redaelli
Since on CentOS/RHEL the builds are based on stable branches and not on
tags for debugging purpose it's better to have the downstream version as
version so it's easier to know which commits are included in a build.

This commit adds --with-version-suffix as ./configure option in
order to set an OVS version suffix that should be shown to the user via
ovs-vsctl -V and, so, also on database, on ovs-vsctl show and the other
utilities.

--with-version-suffix is used in Fedora/CentOS/RHEL spec file in order to have
the version be aligned with the downstream one.

Signed-off-by: Timothy Redaelli 
---
 Makefile.am  |  1 +
 acinclude.m4 | 13 +
 configure.ac |  1 +
 include/openvswitch/version.h.in |  2 +-
 lib/ovsdb-error.c|  2 +-
 lib/util.c   |  5 +++--
 ovsdb/ovsdb-server.c |  3 ++-
 python/automake.mk   |  2 +-
 rhel/openvswitch-fedora.spec.in  |  1 +
 utilities/ovs-dpctl-top.in   |  2 +-
 utilities/ovs-lib.in |  2 +-
 utilities/ovs-parse-backtrace.in |  2 +-
 utilities/ovs-pcap.in|  2 +-
 utilities/ovs-pki.in |  2 +-
 utilities/ovs-tcpdump.in |  4 ++--
 utilities/ovs-tcpundump.in   |  2 +-
 utilities/ovs-vlan-test.in   |  2 +-
 vswitchd/bridge.c|  3 ++-
 18 files changed, 35 insertions(+), 16 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index e605187b8..2f4ce9f94 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -157,6 +157,7 @@ SUFFIXES += .in
-e 's,[@]PYTHON3[@],$(PYTHON3),g' \
-e 's,[@]RUNDIR[@],$(RUNDIR),g' \
-e 's,[@]VERSION[@],$(VERSION),g' \
+   -e 's,[@]VERSION_SUFFIX[@],$(VERSION_SUFFIX),g' \
-e 's,[@]localstatedir[@],$(localstatedir),g' \
-e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
-e 's,[@]sysconfdir[@],$(sysconfdir),g' \
diff --git a/acinclude.m4 b/acinclude.m4
index ac1eab790..a02f5bb00 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -470,6 +470,19 @@ AC_DEFUN([OVS_CHECK_DPDK], [
   AM_CONDITIONAL([DPDK_NETDEV], test "$DPDKLIB_FOUND" = true)
 ])
 
+dnl Append a version suffix
+
+AC_DEFUN([OVS_CHECK_VERSION_SUFFIX], [
+  AC_ARG_WITH([version-suffix],
+  [AS_HELP_STRING([--with-version-suffix=ver_suffix],
+  [Specify a version suffix that will be appended
+   to OVS version])])
+  AC_DEFINE_UNQUOTED([VERSION_SUFFIX], ["$with_version_suffix"],
+ [Package version suffix])
+  AC_SUBST([VERSION_SUFFIX], [$with_version_suffix])
+  ])
+])
+
 dnl Checks for net/if_dl.h.
 dnl
 dnl (We use this as a proxy for checking whether we're building on FreeBSD
diff --git a/configure.ac b/configure.ac
index d05e544b5..3df7156da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -198,6 +198,7 @@ OVS_CHECK_LINUX_SCTP_CT
 OVS_CHECK_LINUX_VIRTIO_TYPES
 OVS_CHECK_DPDK
 OVS_CHECK_PRAGMA_MESSAGE
+OVS_CHECK_VERSION_SUFFIX
 AC_SUBST([CFLAGS])
 AC_SUBST([OVS_CFLAGS])
 AC_SUBST([OVS_LDFLAGS])
diff --git a/include/openvswitch/version.h.in b/include/openvswitch/version.h.in
index 23d8fde4f..231f61e30 100644
--- a/include/openvswitch/version.h.in
+++ b/include/openvswitch/version.h.in
@@ -19,7 +19,7 @@
 #define OPENVSWITCH_VERSION_H 1
 
 #define OVS_PACKAGE_STRING  "@PACKAGE_STRING@"
-#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@"
+#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@@VERSION_SUFFIX@"
 
 #define OVS_LIB_VERSION @LT_CURRENT@
 #define OVS_LIB_REVISION@LT_REVISION@
diff --git a/lib/ovsdb-error.c b/lib/ovsdb-error.c
index a75ad36b7..65bbfe876 100644
--- a/lib/ovsdb-error.c
+++ b/lib/ovsdb-error.c
@@ -150,7 +150,7 @@ ovsdb_internal_error(struct ovsdb_error *inner_error,
 ds_put_char(, ')');
 }
 
-ds_put_format(, " (%s %s)", program_name, VERSION);
+ds_put_format(, " (%s %s)", program_name, VERSION VERSION_SUFFIX);
 
 if (inner_error) {
 char *s = ovsdb_error_to_string_free(inner_error);
diff --git a/lib/util.c b/lib/util.c
index 96a71550d..f9e9c5b4c 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -617,8 +617,9 @@ ovs_set_program_name(const char *argv0, const char *version)
 program_name = basename;
 
 free(program_version);
-if (!strcmp(version, VERSION)) {
-program_version = xasprintf("%s (Open vSwitch) "VERSION"\n",
+if (!strcmp(version, VERSION VERSION_SUFFIX)) {
+program_version = xasprintf("%s (Open vSwitch) "VERSION
+VERSION_SUFFIX"\n",
 program_name);
 } else {
 program_version = xasprintf("%s %s\n"
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index 33ca4910d..d3e20af5d 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -424,7 +424,8 @@ main(int argc, char *argv[

[ovs-dev] [PATCH] rhel: avoid creating an empty database file

2022-12-16 Thread Timothy Redaelli
In 59e8cb8a053d ("rhel: Move conf.db to /var/lib/openvswitch, using symlinks.")
conf.db is created as empty file in /var/lib/openvswitch, if it doesn't
exists, but this prevent ovsdb-server to start.

This commit changes the previous behaviour to set
/var/lib/openvswitch owner to openvswitch:hugetlbfs, if built with
dpdk, or openvswitch:openvswitch.

Fixes: 59e8cb8a053d ("rhel: Move conf.db to /var/lib/openvswitch, using 
symlinks.")
Reported-at: 
https://mail.openvswitch.org/pipermail/ovs-dev/2022-December/400045.html
Reported-by: Roi Dayan 
Signed-off-by: Timothy Redaelli 
---
 rhel/openvswitch-fedora.spec.in | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index 8d692b36c..6c8813793 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -340,12 +340,6 @@ for base in conf.db .conf.db.~lock~; do
 if test ! -e $old && test ! -h $old; then
 ln -s $new $old
 fi
-touch $new
-%if %{with dpdk}
-chown openvswitch:hugetlbfs $new
-%else
-chown openvswitch:openvswitch $new
-%endif
 done
 
 %if 0%{?systemd_post:1}
@@ -506,7 +500,11 @@ fi
 %{_prefix}/lib/udev/rules.d/91-vfio.rules
 %endif
 %doc NOTICE README.rst NEWS rhel/README.RHEL.rst
-/var/lib/openvswitch
+%if %{with dpdk}
+%attr(750,openvswitch,hugetlbfs) /var/lib/openvswitch
+%else
+%attr(750,openvswitch,openvswitch) /var/lib/openvswitch
+%endif
 %attr(750,root,root) /var/log/openvswitch
 %ghost %attr(755,root,root) %{_rundir}/openvswitch
 %ghost %attr(644,root,root) %{_rundir}/openvswitch.useropts
-- 
2.38.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] rhel: move conf.db to /var/lib/openvswitch, using symlinks

2022-12-15 Thread Timothy Redaelli
On Tue, 13 Dec 2022 12:57:08 +0100
Ilya Maximets  wrote:

> On 12/5/22 15:36, Ilya Maximets wrote:
> > On 12/4/22 09:23, Roi Dayan wrote:
> >>
> >>
> >> On 30/11/2022 17:55, Ilya Maximets wrote:
> >>> On 11/14/22 20:41, Timothy Redaelli wrote:
> >>>> conf.db is by default at /etc/openvswitch, but it should be at
> >>>> /var/lib/openvswitch like on Debian or like ovnnb_db.db and ovnsb_db.db.
> >>>>
> >>>> If conf.db already exists in /etc/openvswitch then it's moved to
> >>>> /var/lib/openvswitch.
> >>>> Symlinks are created for conf.db and .conf.db.~lock~ into 
> >>>> /etc/openvswitch
> >>>> for backward compatibility.
> >>>>
> >>>> Reported-at: 
> >>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.redhat.com%2F1830857data=05%7C01%7Croid%40nvidia.com%7Cd69116141ff645fc2c7308dad2eb4612%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638054205222362304%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=%2BIcIVZBKrfhIpq%2B6r6I3QvjdZ9KvjLsrRSlvi9kFHzc%3Dreserved=0
> >>>> Reported-by: Yedidyah Bar David 
> >>>> Signed-off-by: Timothy Redaelli 
> >>>> ---
> >>>> v1 -> v2:
> >>>> - Use hugetlbfs group instead of openvswitch when the package is built
> >>>>   with dpdk (as reported by Flavio)
> >>>> ---
> >>>>  rhel/openvswitch-fedora.spec.in | 27 +++
> >>>>  1 file changed, 23 insertions(+), 4 deletions(-)
> >>>
> >>> If that works for Fedora, then LGTM.  Applied.
> >>>
> >>> Thanks!
> >>> Best regards, Ilya Maximets.
> >>> ___
> >>> dev mailing list
> >>> d...@openvswitch.org
> >>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.openvswitch.org%2Fmailman%2Flistinfo%2Fovs-devdata=05%7C01%7Croid%40nvidia.com%7Cd69116141ff645fc2c7308dad2eb4612%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638054205222362304%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=fZZh4iYeUu%2BL2%2F%2FWTIgPNzpvfhpe%2F9MANkVPLmv57aY%3Dreserved=0
> >>
> >>
> >> hi,
> >>
> >> This commit expose some kind of issue and cause openvswitch not
> >> to start on clean systems.
> >>
> >> If old conf.db file didn't exists it creates an empty conf.db with
> >> the touch command.
> >> Empty conf.db cause ovsdb-server not to start.
> >>
> >> #  /usr/share/openvswitch/scripts/ovs-ctl start
> >> ovsdb-tool: ovsdb error: /etc/openvswitch/conf.db: cannot identify file 
> >> type
> >> Starting ovsdb-server ovsdb-server: ovsdb error: /etc/openvswitch/conf.db: 
> >> cannot identify file type
> >>[FAILED]
> >>
> >> If I remove the conf.db file (can leave the symbolic link in /etc)
> >> then ovs starts fine.
> >> # rm /var/lib/openvswitch/conf.db
> >> #  /usr/share/openvswitch/scripts/ovs-ctl start
> >> /etc/openvswitch/conf.db does not exist ... (warning).
> >> Creating empty database /etc/openvswitch/conf.db   [  OK  ]
> >> Starting ovsdb-server  [  OK  ]
> >> system ID not configured, please use --system-id ... failed!
> >> Configuring Open vSwitch system IDs[  OK  ]
> >> Starting ovs-vswitchd  [  OK  ]
> >> Enabling remote OVSDB managers [  OK  ]
> >>
> >>
> >> I'm not sure where it's better to fix this. either the spec here
> >> not to create an empty file or in ovsdb/log.c to an accept empty conf.db,
> >> or maybe even upgrade_db() in ovs-lib bash file to call create_db
> >> even if conf.db exists but it's empty.
> > 
> > Thanks, Roi, for the report!
> > I think, fixing the spec should be the right approach here.
> 
> Hi, Timothy.  Do you plan to work on the fix for this issue?

Yes sure, I'll do that today or tomorrow

> Otherwise we may just revert the change for now until the proper
> fix is available.  Thoughts?

I prefer just to fix it, without the revert, if it's possible

> Best regards, Ilya Maximets.
> 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] rhel: move conf.db to /var/lib/openvswitch, using symlinks

2022-11-14 Thread Timothy Redaelli
conf.db is by default at /etc/openvswitch, but it should be at
/var/lib/openvswitch like on Debian or like ovnnb_db.db and ovnsb_db.db.

If conf.db already exists in /etc/openvswitch then it's moved to
/var/lib/openvswitch.
Symlinks are created for conf.db and .conf.db.~lock~ into /etc/openvswitch
for backward compatibility.

Reported-at: https://bugzilla.redhat.com/1830857
Reported-by: Yedidyah Bar David 
Signed-off-by: Timothy Redaelli 
---
v1 -> v2:
- Use hugetlbfs group instead of openvswitch when the package is built
  with dpdk (as reported by Flavio)
---
 rhel/openvswitch-fedora.spec.in | 27 +++
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index df296ea08..c8d238fbc 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -239,8 +239,6 @@ rm -rf $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
 
 install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
 
-touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
-touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/.conf.db.~lock~
 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/system-id.conf
 
 install -p -m 644 -D selinux/openvswitch-custom.pp \
@@ -329,6 +327,27 @@ if [ $1 -eq 1 ]; then
 fi
 %endif
 
+# Ensure that /etc/openvswitch/conf.db links to /var/lib/openvswitch,
+# moving an existing file if there is one.
+#
+# Ditto for .conf.db.~lock~.
+for base in conf.db .conf.db.~lock~; do
+new=/var/lib/openvswitch/$base
+old=/etc/openvswitch/$base
+if test -f $old && test ! -e $new; then
+mv $old $new
+fi
+if test ! -e $old && test ! -h $old; then
+ln -s $new $old
+fi
+touch $new
+%if %{with dpdk}
+chown openvswitch:hugetlbfs $new
+%else
+chown openvswitch:openvswitch $new
+%endif
+done
+
 %if 0%{?systemd_post:1}
 # This may not enable openvswitch service or do daemon-reload.
 %systemd_post %{name}.service
@@ -414,8 +433,8 @@ fi
 %endif
 %dir %{_sysconfdir}/openvswitch
 %{_sysconfdir}/openvswitch/default.conf
-%config %ghost %{_sysconfdir}/openvswitch/conf.db
-%ghost %{_sysconfdir}/openvswitch/.conf.db.~lock~
+%config %ghost %{_sharedstatedir}/openvswitch/conf.db
+%ghost %{_sharedstatedir}/openvswitch/.conf.db.~lock~
 %config %ghost %{_sysconfdir}/openvswitch/system-id.conf
 %config(noreplace) %{_sysconfdir}/sysconfig/openvswitch
 %defattr(-,root,root)
-- 
2.38.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] rhel: move conf.db to /var/lib/openvswitch, using symlinks

2022-11-11 Thread Timothy Redaelli
On Thu, 17 Sep 2020 17:24:49 -0300
Flavio Leitner  wrote:

> On Thu, Sep 10, 2020 at 03:38:04PM +0200, Timothy Redaelli wrote:
> > conf.db is by default at /etc/openvswitch, but it should be at
> > /var/lib/openvswitch like on Debian or like ovnnb_db.db and ovnsb_db.db.
> > 
> > If conf.db already exists in /etc/openvswitch then it's moved to
> > /var/lib/openvswitch.
> > Symlinks are created for conf.db and .conf.db.~lock~ into /etc/openvswitch
> > for backward compatibility.
> > 
> > Reported-at: https://bugzilla.redhat.com/1830857
> > Reported-by: Yedidyah Bar David 
> > Signed-off-by: Timothy Redaelli 
> > ---
> >  rhel/openvswitch-fedora.spec.in | 23 +++
> >  1 file changed, 19 insertions(+), 4 deletions(-)
> > 
> > diff --git a/rhel/openvswitch-fedora.spec.in 
> > b/rhel/openvswitch-fedora.spec.in
> > index e3e0d8acf..d70959eba 100644
> > --- a/rhel/openvswitch-fedora.spec.in
> > +++ b/rhel/openvswitch-fedora.spec.in
> > @@ -244,8 +244,6 @@ rm -rf $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
> >  
> >  install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
> >  
> > -touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
> > -touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/.conf.db.~lock~
> >  touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/system-id.conf
> >  
> >  install -p -m 644 -D selinux/openvswitch-custom.pp \
> > @@ -333,6 +331,23 @@ if [ $1 -eq 1 ]; then
> >  fi
> >  %endif
> >  
> > +# Ensure that /etc/openvswitch/conf.db links to /var/lib/openvswitch,
> > +# moving an existing file if there is one.
> > +#
> > +# Ditto for .conf.db.~lock~.
> > +for base in conf.db .conf.db.~lock~; do
> > +new=/var/lib/openvswitch/$base
> > +old=/etc/openvswitch/$base
> > +if test -f $old && test ! -e $new; then
> > +mv $old $new
> > +fi
> > +if test ! -e $old && test ! -h $old; then
> 
> This doesn't look correct to me. The -e covers -h.

This line is correct (I copied this part from
debian/openvswitch-switch.postinst), and it's needed to skip doing ln
if $old is a broken symlink (since, in this case, test -e returns 1 and
test -h returns 0)

> > +ln -s $new $old
> > +fi
> > +touch $new
> > +chown openvswitch: $new
> 
> This should consider if dpdk is enabled or not and then
> set the correct group?

This makes sense, I'll send a v2 using %{with dpdk}

> Thanks,

Thank you

> fbl
> 
> > +done
> > +
> >  %if 0%{?systemd_post:1}
> >  # This may not enable openvswitch service or do daemon-reload.
> >  %systemd_post %{name}.service
> > @@ -418,8 +433,8 @@ fi
> >  %endif
> >  %dir %{_sysconfdir}/openvswitch
> >  %{_sysconfdir}/openvswitch/default.conf
> > -%config %ghost %{_sysconfdir}/openvswitch/conf.db
> > -%ghost %{_sysconfdir}/openvswitch/.conf.db.~lock~
> > +%config %ghost %{_sharedstatedir}/openvswitch/conf.db
> > +%ghost %{_sharedstatedir}/openvswitch/.conf.db.~lock~
> >  %config %ghost %{_sysconfdir}/openvswitch/system-id.conf
> >  %config(noreplace) %{_sysconfdir}/sysconfig/openvswitch
> >  %defattr(-,root,root)
> > -- 
> > 2.26.2
> > 
> > ___
> > dev mailing list
> > d...@openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] rhel: make the version, displayed to the user, customizable

2022-11-09 Thread Timothy Redaelli
Since on CentOS/RHEL the builds are based on stable branches and not on
tags for debugging purpose it's better to have the downstream version as
version so it's easier to know which commits are included in a build.

This commit adds --with-version-suffix as ./configure option in
order to set an OVS version suffix that should be shown to the user via
ovs-vsctl -V and, so, also on database and on ovs-vsctl show.

--with-version-suffix is used in Fedora/CentOS/RHEL spec file in order to have
the version be aligned with the downstream one.

Signed-off-by: Timothy Redaelli 
---
 acinclude.m4 | 13 +
 configure.ac |  1 +
 include/openvswitch/version.h.in |  2 +-
 lib/ovsdb-error.c|  2 +-
 lib/util.c   |  5 +++--
 ovsdb/ovsdb-server.c |  3 ++-
 python/automake.mk   |  2 +-
 rhel/openvswitch-fedora.spec.in  |  1 +
 vswitchd/bridge.c|  3 ++-
 9 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index aa9af5506..09d528675 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -440,6 +440,19 @@ AC_DEFUN([OVS_CHECK_DPDK], [
   AM_CONDITIONAL([DPDK_NETDEV], test "$DPDKLIB_FOUND" = true)
 ])
 
+dnl Append a version suffix
+
+AC_DEFUN([OVS_CHECK_VERSION_SUFFIX], [
+  AC_ARG_WITH([version-suffix],
+  [AS_HELP_STRING([--with-version-suffix=ver_suffix],
+  [Specify a version suffix that will be appended
+   to OVS version])])
+  AC_DEFINE_UNQUOTED([VERSION_SUFFIX], ["$with_version_suffix"],
+ [Package version suffix])
+  AC_SUBST([VERSION_SUFFIX], [$with_version_suffix])
+  ])
+])
+
 dnl Checks for net/if_dl.h.
 dnl
 dnl (We use this as a proxy for checking whether we're building on FreeBSD
diff --git a/configure.ac b/configure.ac
index adfd9f006..6c977351d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -198,6 +198,7 @@ OVS_CHECK_LINUX_SCTP_CT
 OVS_CHECK_LINUX_VIRTIO_TYPES
 OVS_CHECK_DPDK
 OVS_CHECK_PRAGMA_MESSAGE
+OVS_CHECK_VERSION_SUFFIX
 AC_SUBST([CFLAGS])
 AC_SUBST([OVS_CFLAGS])
 AC_SUBST([OVS_LDFLAGS])
diff --git a/include/openvswitch/version.h.in b/include/openvswitch/version.h.in
index 23d8fde4f..231f61e30 100644
--- a/include/openvswitch/version.h.in
+++ b/include/openvswitch/version.h.in
@@ -19,7 +19,7 @@
 #define OPENVSWITCH_VERSION_H 1
 
 #define OVS_PACKAGE_STRING  "@PACKAGE_STRING@"
-#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@"
+#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@@VERSION_SUFFIX@"
 
 #define OVS_LIB_VERSION @LT_CURRENT@
 #define OVS_LIB_REVISION@LT_REVISION@
diff --git a/lib/ovsdb-error.c b/lib/ovsdb-error.c
index a75ad36b7..65bbfe876 100644
--- a/lib/ovsdb-error.c
+++ b/lib/ovsdb-error.c
@@ -150,7 +150,7 @@ ovsdb_internal_error(struct ovsdb_error *inner_error,
 ds_put_char(, ')');
 }
 
-ds_put_format(, " (%s %s)", program_name, VERSION);
+ds_put_format(, " (%s %s)", program_name, VERSION VERSION_SUFFIX);
 
 if (inner_error) {
 char *s = ovsdb_error_to_string_free(inner_error);
diff --git a/lib/util.c b/lib/util.c
index 1195c7982..be350ab66 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -614,8 +614,9 @@ ovs_set_program_name(const char *argv0, const char *version)
 program_name = basename;
 
 free(program_version);
-if (!strcmp(version, VERSION)) {
-program_version = xasprintf("%s (Open vSwitch) "VERSION"\n",
+if (!strcmp(version, VERSION VERSION_SUFFIX)) {
+program_version = xasprintf("%s (Open vSwitch) "VERSION
+VERSION_SUFFIX"\n",
 program_name);
 } else {
 program_version = xasprintf("%s %s\n"
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index 7a6bfe0a0..b43d739e8 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -424,7 +424,8 @@ main(int argc, char *argv[])
 /* ovsdb-server is usually a long-running process, in which case it
  * makes plenty of sense to log the version, but --run makes
  * ovsdb-server more like a command-line tool, so skip it.  */
-VLOG_INFO("%s (Open vSwitch) %s", program_name, VERSION);
+VLOG_INFO("%s (Open vSwitch) %s", program_name,
+  VERSION VERSION_SUFFIX);
 }
 
 unixctl_command_register("exit", "", 0, 0, ovsdb_server_exit, );
diff --git a/python/automake.mk b/python/automake.mk
index d00911828..81fbc12d2 100644
--- a/python/automake.mk
+++ b/python/automake.mk
@@ -124,7 +124,7 @@ ovs-uninstall-local:
 ALL_LOCAL += $(srcdir)/python/ovs/version.py
 $(srcdir)/python/ovs/version.py: config.status
$(AM_V_GEN)$(ro_shell) > $(@F).tmp && \
-   echo 'VERSION = "$(VERSION)"' >> $(@F).tmp &&

[ovs-dev] [PATCH 2/2] Add support for OpenSSL 3.0 functions

2022-09-22 Thread Timothy Redaelli
In OpenSSL 3.0 some functions were deprecated and replaced.
This commit adds some #ifdef to build without warning on both
OpenSSL 1.x and OpenSSL 3.x.

For OpenSSL 3.x, the default built-in DH parameters are used (as
suggested by SSL_CTX_set_dh_auto manpage).

Signed-off-by: Timothy Redaelli 
---
 build-aux/generate-dhparams-c |  2 ++
 lib/dhparams.c|  2 ++
 lib/stream-ssl.c  | 12 
 3 files changed, 16 insertions(+)

diff --git a/build-aux/generate-dhparams-c b/build-aux/generate-dhparams-c
index a80db6207..aca1dbca9 100755
--- a/build-aux/generate-dhparams-c
+++ b/build-aux/generate-dhparams-c
@@ -78,6 +78,7 @@ cat <<'EOF'
 #include "lib/dhparams.h"
 #include "openvswitch/util.h"
 
+#if OPENSSL_VERSION_NUMBER < 0x300fL
 static int
 my_DH_set0_pqg(DH *dh, BIGNUM *p, const BIGNUM **q OVS_UNUSED, BIGNUM *g)
 {
@@ -93,3 +94,4 @@ my_DH_set0_pqg(DH *dh, BIGNUM *p, const BIGNUM **q 
OVS_UNUSED, BIGNUM *g)
 EOF
 dhparam_to_c lib/dh2048.pem
 dhparam_to_c lib/dh4096.pem
+echo "#endif"
diff --git a/lib/dhparams.c b/lib/dhparams.c
index 85123863f..50209d5d8 100644
--- a/lib/dhparams.c
+++ b/lib/dhparams.c
@@ -6,6 +6,7 @@
 #include "lib/dhparams.h"
 #include "openvswitch/util.h"
 
+#if OPENSSL_VERSION_NUMBER < 0x300fL
 static int
 my_DH_set0_pqg(DH *dh, BIGNUM *p, const BIGNUM **q OVS_UNUSED, BIGNUM *g)
 {
@@ -142,3 +143,4 @@ DH *get_dh4096(void)
 }
 return dh;
 }
+#endif
diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c
index f4fe3432e..62da9febb 100644
--- a/lib/stream-ssl.c
+++ b/lib/stream-ssl.c
@@ -193,7 +193,9 @@ static void ssl_clear_txbuf(struct ssl_stream *);
 static void interpret_queued_ssl_error(const char *function);
 static int interpret_ssl_error(const char *function, int ret, int error,
int *want);
+#if OPENSSL_VERSION_NUMBER < 0x300fL
 static DH *tmp_dh_callback(SSL *ssl, int is_export OVS_UNUSED, int keylength);
+#endif
 static void log_ca_cert(const char *file_name, X509 *cert);
 static void stream_ssl_set_ca_cert_file__(const char *file_name,
   bool bootstrap, bool force);
@@ -471,7 +473,11 @@ static char *
 get_peer_common_name(const struct ssl_stream *sslv)
 {
 char *peer_name = NULL;
+#if OPENSSL_VERSION_NUMBER < 0x300fL
 X509 *peer_cert = SSL_get_peer_certificate(sslv->ssl);
+#else
+X509 *peer_cert = SSL_get1_peer_certificate(sslv->ssl);
+#endif
 if (!peer_cert) {
 return NULL;
 }
@@ -1070,7 +1076,11 @@ do_ssl_init(void)
 return ENOPROTOOPT;
 }
 SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
+#if OPENSSL_VERSION_NUMBER < 0x300fL
 SSL_CTX_set_tmp_dh_callback(ctx, tmp_dh_callback);
+#else
+SSL_CTX_set_dh_auto(ctx, 1);
+#endif
 SSL_CTX_set_mode(ctx, SSL_MODE_ENABLE_PARTIAL_WRITE);
 SSL_CTX_set_mode(ctx, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
 SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
@@ -1081,6 +1091,7 @@ do_ssl_init(void)
 return 0;
 }
 
+#if OPENSSL_VERSION_NUMBER < 0x300fL
 static DH *
 tmp_dh_callback(SSL *ssl OVS_UNUSED, int is_export OVS_UNUSED, int keylength)
 {
@@ -1112,6 +1123,7 @@ tmp_dh_callback(SSL *ssl OVS_UNUSED, int is_export 
OVS_UNUSED, int keylength)
 keylength);
 return NULL;
 }
+#endif
 
 /* Returns true if SSL is at least partially configured. */
 bool
-- 
2.37.3

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 0/2] Remove deprecated OpenSSL functions on openssl 3.0

2022-09-22 Thread Timothy Redaelli
Currently, it's not possible to build OVS using OpenSSL 3.0 with
--enable-Werror since OpenSSL 3.0 deprecated some functions.
Moreover, it's not possible to generate dhparams.c anymore on
OpenSSL 3.0 since -C option was removed from openssl dhparam tool.

With this series, it's possible to generate lib/dhparams.c using OpenSSL 3.0
and to replace the deprecated function by using the new one.

OpenSSL team also suggests using SSL_CTX_set_dh_auto to set DH keys instead of
use build-time hardcoded keys (it's also a good idea for FIPS compliance).

Timothy Redaelli (2):
  dhparams: Fix .c file generation with OpenSSL >= 3.0
  Add support for openssl 3.0 functions

 build-aux/generate-dhparams-c | 81 +++
 lib/dhparams.c|  2 +
 lib/stream-ssl.c  | 12 ++
 3 files changed, 87 insertions(+), 8 deletions(-)

-- 
2.37.3

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 1/2] dhparams: Fix .c file generation with OpenSSL >= 3.0

2022-09-22 Thread Timothy Redaelli
Since OpenSSL upstream commit 1696b8909bbe
("Remove -C from dhparam,dsaparam,ecparam") "openssl dhparam" doesn't
support -C anymore.

This commit changes generate-dhparams-c to generate dhparams.c by parsing
"openssl dhparam -in "$1" -text -noout" output directly.

The generated file won't be used on OpenSSL >= 3.0, but it's still
needed to be generated if OVS is built on OpenSSL < 3.0.

Signed-off-by: Timothy Redaelli 
---
 build-aux/generate-dhparams-c | 79 +++
 1 file changed, 71 insertions(+), 8 deletions(-)

diff --git a/build-aux/generate-dhparams-c b/build-aux/generate-dhparams-c
index 1884c99e1..a80db6207 100755
--- a/build-aux/generate-dhparams-c
+++ b/build-aux/generate-dhparams-c
@@ -1,5 +1,74 @@
 #! /bin/sh -e
 
+dhparam_to_c() {
+local bits
+local get_p=0
+local line
+local nl="
+"
+local p
+local i=0
+while read -r line; do
+case "$line" in
+*"DH Parameters: "*)
+bits=${line#*DH Parameters: (}
+bits=${bits% bit)}
+continue
+;;
+"P:"|"prime:")
+get_p=1
+continue
+;;
+"G: "*|"generator: "*)
+g=${line#*(}
+g=${g%)}
+g=$(printf "0x%.2X" "$g")
+continue
+;;
+esac
+if [ "$get_p" = 1 ]; then
+IFS=":"
+for x in $line; do
+[ -z "$p" ] && [ "$x" = "00" ] && continue
+[ $i -ge 10 ] && i=0
+[ $i -eq 0 ] && p="$p$nl   "
+x=0x$x
+p=$(printf "%s 0x%.2X," "$p" "$x")
+i=$((i + 1))
+done
+unset IFS
+fi
+done <https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] python: Do not send non-zero flag for a SSL socket

2022-08-10 Thread Timothy Redaelli
On Mon,  8 Aug 2022 12:32:42 -0500
Miro Tomaska  wrote:

> Python std library SSLSocket.send does not allow non-zero value for the 
> optional flag.
> 
> pyOpenSSL was recently switched for the Python standard library ssl module
> commit 68543dd523bd00f53fa7b91777b962ccb22ce679 (python: Replace pyOpenSSL 
> with ssl).
> Python SSLsocket.send() does not allow non-zero optional flag and it will 
> explicitly
> raise an exception for that. pyOpenSSL did not nothing with this flag but kept
> it to be compatible with socket API.
> https://github.com/pyca/pyopenssl/blob/main/src/OpenSSL/SSL.py#L1844
> 
> Signed-off-by: Miro Tomaska 
> Reported-at: https://bugzilla.redhat.com/2115035
> ---
>  python/ovs/socket_util.py | 12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)

Thank you, I missed that one when I ported Python stuff from the
deprecated pyOpenSSL to ssl module and unluckily no tests detected this
problem, since it's only executed in case of socket errors

Acked-By: Timothy Redaelli 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] python: Send non-zero flag for a SSL socket

2022-08-08 Thread Timothy Redaelli
On Mon, 8 Aug 2022 11:42:55 +0200
Ilya Maximets  wrote:

> On 8/8/22 04:27, Miro Tomaska wrote:
> > Python std library SSLSocket.send does not allow non-zero value for the 
> > optional flag.
> > 
> > pyOpenSSL was recently switched for the Python standard library ssl module
> > commit 68543dd523bd00f53fa7b91777b962ccb22ce679 (python: Replace pyOpenSSL 
> > with ssl).
> > Python SSLsocket.send() does not allow non-zero optional flag and it will 
> > explicitly
> > raise an exception for that. pyOpenSSL did not nothing with this flag but 
> > kept
> > it to be compatible with socket API.
> > https://github.com/pyca/pyopenssl/blob/main/src/OpenSSL/SSL.py#L1844
> 
> Hi, Miro.  Thanks for the patch!
> I'm puzzled though, how come our unit tests are not all failing?
> I'm sure we have tests for SSL connections with python.  And the
> cited commit was tested with the neutron ml2/ovn tests over SSL
> before being accepted with no issues observed.

Because this code is only executed when you have an error
(POLLERR or POLLHUP) and so it's very unlucky you enter this path of
the code, that should definitely be fixed with your patch.

> > 
> > In addition, expect for ImportError is not necessary anymore as ssl is part 
> > of
> > the Python standard library. This type of exception should not happen.
> 
> IIRC, if openssl is not installed in the system, import will fail.
> Python itself doesn't contain the implementation for SSL protocols,
> it relies on shared libraries which are not obligatory.  So, we,
> likely, still need an import check.

Yes, you may build python without ssl support (if ssl libraries are not
available when you build it) and so try is still necessary (they also
do that in cpython, for example in asyncio
https://github.com/python/cpython/blob/main/Lib/asyncio/sslproto.py)

So, please do a v2 by restoring the try: / except ImportError: part and
I'll ack your patch.

Thank you

> Best regards, Ilya Maximets.
> 
> > 
> > Signed-off-by: Miro Tomaska 
> > Reported-at: https://bugzilla.redhat.com/2115035
> > ---
> >  python/ovs/poller.py  | 5 +
> >  python/ovs/socket_util.py | 7 ++-
> >  python/ovs/stream.py  | 9 ++---
> >  3 files changed, 9 insertions(+), 12 deletions(-)
> > 
> > diff --git a/python/ovs/poller.py b/python/ovs/poller.py
> > index 157719c3a..0723ed1f6 100644
> > --- a/python/ovs/poller.py
> > +++ b/python/ovs/poller.py
> > @@ -17,6 +17,7 @@ import os
> >  
> >  import select
> >  import socket
> > +import ssl
> >  import sys
> >  
> >  import ovs.timeval
> > @@ -25,10 +26,6 @@ import ovs.vlog
> >  if sys.platform == "win32":
> >  import ovs.winutils as winutils
> >  
> > -try:
> > -import ssl
> > -except ImportError:
> > -ssl = None
> >  
> >  try:
> >  from eventlet import patcher as eventlet_patcher
> > diff --git a/python/ovs/socket_util.py b/python/ovs/socket_util.py
> > index 651012bf0..5f2201bbb 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 ssl
> >  import sys
> >  
> >  import ovs.fatal_signal
> > @@ -178,7 +179,11 @@ def check_connection_completion(sock):
> >  if revents & ovs.poller.POLLERR or revents & ovs.poller.POLLHUP:
> >  try:
> >  # The following should raise an exception.
> > -sock.send("\0".encode(), socket.MSG_DONTWAIT)
> > +if isinstance(sock, ssl.SSLSocket):
> > +# a SSL wrapped socket does not allow non-zero 
> > optional flag
> > +sock.send("\0".encode())
> > +else:
> > +sock.send("\0".encode(), socket.MSG_DONTWAIT)
> >  
> >  # (Here's where we end up if it didn't.)
> >  # XXX rate-limit
> > diff --git a/python/ovs/stream.py b/python/ovs/stream.py
> > index ac5b0fd0c..14a3c4946 100644
> > --- a/python/ovs/stream.py
> > +++ b/python/ovs/stream.py
> > @@ -15,16 +15,13 @@
> >  import errno
> >  import os
> >  import socket
> > +import ssl
> >  import sys
> >  
> >  import ovs.poller
> >  import ovs.socket_util
> >  import ovs.vlog
> >  
> > -try:
> > -import ssl
> > -except ImportError:
> > -ssl = None
> >  
> >  if sys.platform == 'win32':
> >  import ovs.winutils as winutils
> > @@ -860,6 +857,4 @@ class SSLStream(Stream):
> >  return super(SSLStream, self).close()
> >  
> >  
> > -if ssl:
> > -# Register SSL only if the OpenSSL module is available
> > -Stream.register_method("ssl", SSLStream)
> > +Stream.register_method("ssl", SSLStream)
> 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] rhel: make the version, displayed to the user, customizable

2022-08-01 Thread Timothy Redaelli
Since on CentOS/RHEL the builds are based on stable branches and not on
tags for debugging purpose it's better to have the downstream version as
version so it's easier to know which commits are included in a build.

This commit adds DISPLAY_VERSION as ./configure environment variable in
order to set an OVS version that should be shown to the user via
ovs-vsctl -V and, so, also on database and on ovs-vsctl show.

DISPLAY_VERSION is used in Fedora/CentOS/RHEL spec file in order to have
the version be aligned with the downstream one.

Signed-off-by: Timothy Redaelli 
---
 configure.ac| 1 +
 lib/util.c  | 5 -
 m4/openvswitch.m4   | 8 
 rhel/openvswitch-fedora.spec.in | 3 ++-
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index ef2d75bcb..845953665 100644
--- a/configure.ac
+++ b/configure.ac
@@ -189,6 +189,7 @@ OVS_CHECK_DPCLS_AUTOVALIDATOR
 OVS_CHECK_DPIF_AVX512_DEFAULT
 OVS_CHECK_MFEX_AUTOVALIDATOR
 OVS_CHECK_AVX512
+OVS_DISPLAY_VERSION
 
 AC_ARG_VAR(KARCH, [Kernel Architecture String])
 AC_SUBST(KARCH)
diff --git a/lib/util.c b/lib/util.c
index 1195c7982..9d8873f36 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -41,6 +41,9 @@
 #ifdef _WIN32
 #include 
 #endif
+#ifndef DISPLAY_VERSION
+#define DISPLAY_VERSION VERSION
+#endif
 
 VLOG_DEFINE_THIS_MODULE(util);
 
@@ -615,7 +618,7 @@ ovs_set_program_name(const char *argv0, const char *version)
 
 free(program_version);
 if (!strcmp(version, VERSION)) {
-program_version = xasprintf("%s (Open vSwitch) "VERSION"\n",
+program_version = xasprintf("%s (Open vSwitch) "DISPLAY_VERSION"\n",
 program_name);
 } else {
 program_version = xasprintf("%s %s\n"
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 6eef1fb35..4eb68f2bd 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -720,3 +720,11 @@ AC_DEFUN([OVS_CHECK_UNWIND],
fi
AM_CONDITIONAL([HAVE_UNWIND], [test "$HAVE_UNWIND" = yes])
AC_SUBST([HAVE_UNWIND])])
+
+dnl Set a specific OVS version.
+AC_DEFUN([OVS_DISPLAY_VERSION],
+  [AC_ARG_VAR(DISPLAY_VERSION, [Set a specific OVS version])
+   if test "$DISPLAY_VERSION"; then
+ AC_DEFINE_UNQUOTED([DISPLAY_VERSION], ["$DISPLAY_VERSION"],
+[Set a specific OVS version])
+   fi])
diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index 67268cb78..da4ca12b1 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -176,7 +176,8 @@ This package provides IPsec tunneling support for OVS 
tunnels.
 --disable-static \
 --enable-shared \
 --with-pkidir=%{_sharedstatedir}/openvswitch/pki \
-PYTHON3=%{__python3}
+PYTHON3=%{__python3} \
+DISPLAY_VERSION=%{version}-%{release}
 
 build-aux/dpdkstrip.py \
 %if %{with dpdk}
-- 
2.37.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2 2/2] python-c-ext: fix a couple of build warnings

2022-07-18 Thread Timothy Redaelli
ovs/_json.c:67:20: warning: assignment discards ‘const’ qualifier from pointer
target type [-Wdiscarded-qualifiers]

ovs/_json.c:132:27: warning: comparison of integer expressions of different
signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]

Signed-off-by: Timothy Redaelli 
---
 python/ovs/_json.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/python/ovs/_json.c b/python/ovs/_json.c
index 80bf9dea3..0b980038b 100644
--- a/python/ovs/_json.c
+++ b/python/ovs/_json.c
@@ -50,7 +50,7 @@ Parser_feed(json_ParserObject * self, PyObject * args)
 Py_ssize_t input_sz;
 PyObject *input;
 size_t rd;
-char *input_str;
+const char *input_str;
 
 if (self->_parser == NULL) {
 return NULL;
@@ -111,7 +111,7 @@ json_to_python(struct json *json)
 return dict;
 }
 case JSON_ARRAY:{
-int i;
+size_t i;
 PyObject *arr = PyList_New(json->array.n);
 
 if (arr == NULL) {
-- 
2.36.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2 0/2] fix a couple of build warnings

2022-07-18 Thread Timothy Redaelli
v1 -> v2:
- Removed Python 2 support as requested by Ilya

Timothy Redaelli (2):
  python-c-ext: Remove Python 2 support
  python-c-ext: fix a couple of build warnings

 python/ovs/_json.c | 38 +++---
 1 file changed, 3 insertions(+), 35 deletions(-)

-- 
2.36.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2 1/2] python-c-ext: Remove Python 2 support

2022-07-18 Thread Timothy Redaelli
Since Python 2 is not supported anymore, remove Python 2 support from C
extension too

Fixes: 1ca0323e7c29 ("Require Python 3 and remove support for Python 2.")
Signed-off-by: Timothy Redaelli 
---
 python/ovs/_json.c | 34 +-
 1 file changed, 1 insertion(+), 33 deletions(-)

diff --git a/python/ovs/_json.c b/python/ovs/_json.c
index ef7bb4b8e..80bf9dea3 100644
--- a/python/ovs/_json.c
+++ b/python/ovs/_json.c
@@ -2,10 +2,6 @@
 #include 
 #include "structmember.h"
 
-#if PY_MAJOR_VERSION >= 3
-#define IS_PY3K
-#endif
-
 typedef struct {
 PyObject_HEAD
 struct json_parser *_parser;
@@ -63,21 +59,13 @@ Parser_feed(json_ParserObject * self, PyObject * args)
 if (!PyArg_UnpackTuple(args, "input", 1, 1, )) {
 return NULL;
 }
-#ifdef IS_PY3K
 if ((input_str = PyUnicode_AsUTF8AndSize(input, _sz)) == NULL) {
-#else
-if (PyString_AsStringAndSize(input, _str, _sz) < 0) {
-#endif
 return NULL;
 }
 
 rd = json_parser_feed(self->_parser, input_str, (size_t) input_sz);
 
-#ifdef IS_PY3K
 return PyLong_FromSize_t(rd);
-#else
-return PyInt_FromSize_t(rd);
-#endif
 }
 
 static PyObject *
@@ -144,11 +132,7 @@ json_to_python(struct json *json)
 return PyFloat_FromDouble(json->real);
 } /* fall through to treat 0 as int */
 case JSON_INTEGER:
-#ifdef IS_PY3K
 return PyLong_FromLong((long) json->integer);
-#else
-return PyInt_FromLong((long) json->integer);
-#endif
 
 case JSON_STRING:
 return PyUnicode_FromString(json->string);
@@ -225,7 +209,6 @@ static PyTypeObject json_ParserType = {
 Parser_new, /* tp_new */
 };
 
-#ifdef IS_PY3K
 static struct PyModuleDef moduledef = {
 PyModuleDef_HEAD_INIT,
 "ovs._json",/* m_name */
@@ -238,32 +221,17 @@ static struct PyModuleDef moduledef = {
 0,  /* m_free */
 };
 
-#define INITERROR return NULL
-#else /* !IS_PY3K */
-#define INITERROR return
-#endif
-
 PyMODINIT_FUNC
-#ifdef IS_PY3K
 PyInit__json(void)
-#else
-init_json(void)
-#endif
 {
 PyObject *m;
 
 if (PyType_Ready(_ParserType) < 0) {
-INITERROR;
+return NULL;
 }
-#ifdef IS_PY3K
 m = PyModule_Create();
-#else
-m = Py_InitModule3("ovs._json", NULL, "OVS JSON Parser module");
-#endif
 
 Py_INCREF(_ParserType);
 PyModule_AddObject(m, "Parser", (PyObject *) & json_ParserType);
-#ifdef IS_PY3K
 return m;
-#endif
 }
-- 
2.36.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] python-c-ext: fix a couple of build warnings

2022-06-30 Thread Timothy Redaelli
ovs/_json.c:67:20: warning: assignment discards ‘const’ qualifier from pointer
target type [-Wdiscarded-qualifiers]

ovs/_json.c:132:27: warning: comparison of integer expressions of different
signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]

Signed-off-by: Timothy Redaelli 
---
 python/ovs/_json.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/python/ovs/_json.c b/python/ovs/_json.c
index ef7bb4b8e..237beb86f 100644
--- a/python/ovs/_json.c
+++ b/python/ovs/_json.c
@@ -54,7 +54,7 @@ Parser_feed(json_ParserObject * self, PyObject * args)
 Py_ssize_t input_sz;
 PyObject *input;
 size_t rd;
-char *input_str;
+const char *input_str;
 
 if (self->_parser == NULL) {
 return NULL;
@@ -123,7 +123,7 @@ json_to_python(struct json *json)
 return dict;
 }
 case JSON_ARRAY:{
-int i;
+size_t i;
 PyObject *arr = PyList_New(json->array.n);
 
 if (arr == NULL) {
-- 
2.36.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] python: use setuptools instead of distutils

2022-06-29 Thread Timothy Redaelli
On Python 3.12, distutils will be removed and it's currently (3.10+)
deprecated (see PEP 632).

Since the suggested and simplest replacement is setuptools, this commit
replaces distutils to use setuptools instead.

setuptools < 59.0 doesn't have setuptools.errors and so, in this case,
distutils.errors is still used.

Signed-off-by: Timothy Redaelli 
---

v1 -> v2:
 - As reported by Mike Pattrick, use distutils.errors if setuptools.errors is
   not available (for setuptools < 59.0).

---
 python/setup.py | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/python/setup.py b/python/setup.py
index cfe01763f..8ff5bb0e9 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -12,9 +12,13 @@
 
 import sys
 
-from distutils.command.build_ext import build_ext
-from distutils.errors import CCompilerError, DistutilsExecError, \
-DistutilsPlatformError
+from setuptools.command.build_ext import build_ext
+try:
+from setuptools.errors import CCompilerError, ExecError, PlatformError
+except ImportError:  # Needed for setuptools < 59.0
+from distutils.errors import CCompilerError
+from distutils.errors import DistutilsExecError as ExecError
+from distutils.errors import DistutilsPlatformError as PlatformError
 
 import setuptools
 
@@ -37,7 +41,7 @@ except IOError:
   file=sys.stderr)
 sys.exit(-1)
 
-ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
+ext_errors = (CCompilerError, ExecError, PlatformError)
 if sys.platform == 'win32':
 ext_errors += (IOError, ValueError)
 
@@ -53,7 +57,7 @@ class try_build_ext(build_ext):
 def run(self):
 try:
 build_ext.run(self)
-except DistutilsPlatformError:
+except PlatformError:
 raise BuildFailed()
 
 def build_extension(self, ext):
-- 
2.36.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [RFC PATCH 0/2] rhel: use the complete version as OVS version

2022-06-10 Thread Timothy Redaelli
Since on CentOS/RHEL the builds are based on stable branches and not on
tags for debugging purpose it's better to have the downstream version as
version so it's easier to know which commits are included in a build.

This series changes the version of OVS on Fedora/CentOS/RHEL to be aligned
with the downstream one.

Timothy Redaelli (2):
  selinux: restore static versioning
  rhel: use the complete version as OVS version

 rhel/openvswitch-fedora.spec.in  | 3 +++
 selinux/openvswitch-custom.te.in | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

-- 
2.36.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [RFC PATCH 2/2] rhel: use the complete version as OVS version

2022-06-10 Thread Timothy Redaelli
Since on CentOS/RHEL the builds are based on stable branches and not on
tags for debugging purpose it's better to have the downstream version as
version so it's easier to know which commits are included in a build.

This commit changes the version of OVS on Fedora/CentOS/RHEL to be aligned
with the downstream one.

Signed-off-by: Timothy Redaelli 
---
 rhel/openvswitch-fedora.spec.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index 16ef1ac3a..f8398c74c 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -162,6 +162,9 @@ This package provides IPsec tunneling support for OVS 
tunnels.
 %setup -q
 
 %build
+# Append release to version
+sed -i -e "s/^AC_INIT(openvswitch,.*,/AC_INIT(openvswitch, 
%{version}-%{release},/" configure.ac
+
 %configure \
 %if %{with libcapng}
 --enable-libcapng \
-- 
2.36.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [RFC PATCH 1/2] selinux: restore static versioning

2022-06-10 Thread Timothy Redaelli
This is needed for the upcoming commit that changes the version of OVS,
on Fedora/CentOS/RHEL, by using the complete version that includes a
dash, but dashes are not valid in selinux version.

Signed-off-by: Timothy Redaelli 
---
 selinux/openvswitch-custom.te.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/selinux/openvswitch-custom.te.in b/selinux/openvswitch-custom.te.in
index beb0ab0d6..907e3c447 100644
--- a/selinux/openvswitch-custom.te.in
+++ b/selinux/openvswitch-custom.te.in
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: Apache-2.0
 
-module openvswitch-custom @VERSION@;
+module openvswitch-custom 1.0.2;
 
 require {
 role system_r;
-- 
2.36.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] python: use setuptools instead of distutils

2022-05-11 Thread Timothy Redaelli
On Python 3.12, distutils will be removed and it's currently (3.10+)
deprecated (see PEP 632).

Since the suggested and simplest replacement is setuptools, this commit
replaces distutils to use setuptools instead.

Signed-off-by: Timothy Redaelli 
---
 python/setup.py | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/python/setup.py b/python/setup.py
index cfe01763f..7c7418bd9 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -12,9 +12,8 @@
 
 import sys
 
-from distutils.command.build_ext import build_ext
-from distutils.errors import CCompilerError, DistutilsExecError, \
-DistutilsPlatformError
+from setuptools.command.build_ext import build_ext
+from setuptools.errors import CCompilerError, ExecError, PlatformError
 
 import setuptools
 
@@ -37,7 +36,7 @@ except IOError:
   file=sys.stderr)
 sys.exit(-1)
 
-ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
+ext_errors = (CCompilerError, ExecError, PlatformError)
 if sys.platform == 'win32':
 ext_errors += (IOError, ValueError)
 
@@ -53,7 +52,7 @@ class try_build_ext(build_ext):
 def run(self):
 try:
 build_ext.run(self)
-except DistutilsPlatformError:
+except PlatformError:
 raise BuildFailed()
 
 def build_extension(self, ext):
-- 
2.36.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v4] python: Politely handle misuse of table.condition

2022-04-26 Thread Timothy Redaelli
On Wed, 13 Apr 2022 08:52:26 -0500
Terry Wilson  wrote:

> Before 46d44cf3b, it was technically possible to assign a monitor
> condition directly to Idl.tables[table_name].condition. If done
> before the connection was established, it would successfully apply
> the condition (where cond_change() actually would fail).
> 
> Although this wasn't meant to be supported, several OpenStack
> projects made use of this. After 46d44cf3b, .condition is no
> longer a list, but a ConditionState. Assigning a list to it breaks
> the Idl.
> 
> The Neutron and ovsdbapp projects have patches in-flight to
> use Idl.cond_change() if ConditionState exists, as it now works
> before connection as well, but here could be other users that also
> start failing when upgrading to OVS 2.17.
> 
> Instead of directly adding attributes to TableSchema, this adds
> the IdlTable/IdlColumn objects which hold Idl-specific data and
> adds a 'condition' property to TableSchema that maintains the old
> interface.
> 
> Fixes: 46d44cf3b ("python: idl: Add monitor_cond_since support")
> Signed-off-by: Terry Wilson 
> ---

LGTM

Acked-By: Timothy Redaelli 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] python: regenerate dirs.py when Makefile is updated

2022-03-25 Thread Timothy Redaelli
Currently dirs.py is not generated when Makefile is updated, so if
prefix is changed dirs.py is not updated with the new prefix.

This patch adds a Makefile dependency on dirs.py, so it's regenerated
correctly when prefix is updated.

Fixes: 943c4a325045 ("python: set ovs.dirs variables with build system values")

Signed-off-by: Timothy Redaelli 
---
 python/automake.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/python/automake.mk b/python/automake.mk
index c32ac3b6a..e36094168 100644
--- a/python/automake.mk
+++ b/python/automake.mk
@@ -106,7 +106,7 @@ $(srcdir)/python/ovs/version.py: config.status
if cmp -s $(@F).tmp $@; then touch $@; rm $(@F).tmp; else mv $(@F).tmp 
$@; fi
 
 ALL_LOCAL += $(srcdir)/python/ovs/dirs.py
-$(srcdir)/python/ovs/dirs.py: python/ovs/dirs.py.template
+$(srcdir)/python/ovs/dirs.py: python/ovs/dirs.py.template Makefile
$(AM_V_GEN)sed \
-e '/^##/d' \
-e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
@@ -115,7 +115,7 @@ $(srcdir)/python/ovs/dirs.py: python/ovs/dirs.py.template
-e 's,[@]bindir[@],$(bindir),g' \
-e 's,[@]sysconfdir[@],$(sysconfdir),g' \
-e 's,[@]DBDIR[@],$(sysconfdir)/openvswitch,g' \
-   < $? > $@.tmp && \
+   <  $(srcdir)/python/ovs/dirs.py.template > $@.tmp && \
mv $@.tmp $@
 EXTRA_DIST += python/ovs/dirs.py.template
 CLEANFILES += python/ovs/dirs.py
-- 
2.35.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] python: don't ship dirs.py in tarball

2022-03-25 Thread Timothy Redaelli
Currently dirs.py is included in released tarball (make dist), but it
should be generated during build, since it includes the prefix that may
change by configure --prefix and other options.

This commit removes dirs.py from EXTRA_DIST so it's not included in
released tarball (make dist).

Reported-at: https://bugzilla.redhat.com/2055576
Fixes: 943c4a325045 ("python: set ovs.dirs variables with build system values")

Signed-off-by: Timothy Redaelli 
---
 python/automake.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/python/automake.mk b/python/automake.mk
index 767512f17..c32ac3b6a 100644
--- a/python/automake.mk
+++ b/python/automake.mk
@@ -42,6 +42,9 @@ ovs_pyfiles = \
python/ovs/version.py \
python/ovs/vlog.py \
python/ovs/winutils.py
+
+EXTRA_DIST += $(ovs_pyfiles) $(ovstest_pyfiles)
+
 # These python files are used at build time but not runtime,
 # so they are not installed.
 EXTRA_DIST += \
@@ -59,7 +62,6 @@ EXTRA_DIST += \
 EXTRA_DIST += python/ovs/_json.c
 
 PYFILES = $(ovs_pyfiles) python/ovs/dirs.py $(ovstest_pyfiles)
-EXTRA_DIST += $(PYFILES)
 PYCOV_CLEAN_FILES += $(PYFILES:.py=.py,cover)
 
 FLAKE8_PYFILES += \
-- 
2.35.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v1 02/18] python: add mask, ip and eth decoders

2021-11-22 Thread Timothy Redaelli
On Mon, 22 Nov 2021 12:22:40 +0100
Adrian Moreno  wrote:

> Add more decoders that can be used by KVParser.
> 
> For IPv4 and IPv6 addresses, create a new class that wraps
> netaddr.IPAddress.
> For Ethernet addresses, create a new class that wraps netaddr.EUI.
> For Integers, create a new class that performs basic bitwise mask
> comparisons
> 
> Signed-off-by: Adrian Moreno 
> ---
>  python/ovs/flows/decoders.py | 341 +++
>  python/setup.py  |   2 +-
>  2 files changed, 342 insertions(+), 1 deletion(-)
> 
> diff --git a/python/ovs/flows/decoders.py b/python/ovs/flows/decoders.py
> index bfb64e70e..bf7a94ae8 100644
> --- a/python/ovs/flows/decoders.py
> +++ b/python/ovs/flows/decoders.py
> @@ -5,6 +5,15 @@ A decoder is generally a callable that accepts a string and 
> returns the value
>  object.
>  """
>  
> +import netaddr
> +
> +
> +class Decoder:
> +"""Base class for all decoder classes"""
> +
> +def to_json(self):
> +assert "function must be implemented by derived class"

I think it's better to use "raise NotImplementedError" here

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v4 2/2] python: replace pyOpenSSL with ssl

2021-10-29 Thread Timothy Redaelli
Currently, pyOpenSSL is half-deprecated upstream and so it's removed on
some distributions (for example on CentOS Stream 9,
https://issues.redhat.com/browse/CS-336), but since OVS only
supports Python 3 it's possible to replace pyOpenSSL with "import ssl"
included in base Python 3.

Stream recv and send had to be splitted as _recv and _send, since SSLError
is a subclass of socket.error and so it was not possible to except for
SSLWantReadError and SSLWantWriteError in recv and send of SSLStream.

TCPstream._open cannot be used in SSLStream, since Python ssl module
requires the SSL socket to be created before connecting it, so
SSLStream._open needs to create the socket, create SSL socket and then
connect the SSL socket.

Reported-by: Timothy Redaelli 
Reported-at: https://bugzilla.redhat.com/1988429
Signed-off-by: Timothy Redaelli 
---
v3 -> v4:
 - Remove useless ValueError in self.socket.shutdown, as reported by
   Terry Wilson. It was wrongly here due to some previous tests, but
   it's not needed.
---
 .ci/linux-prepare.sh |  2 +-
 .cirrus.yml  |  2 +-
 .travis.yml  |  1 -
 python/ovs/poller.py |  6 +--
 python/ovs/stream.py | 91 ++--
 tests/ovsdb-idl.at   |  2 +-
 6 files changed, 60 insertions(+), 44 deletions(-)

diff --git a/.ci/linux-prepare.sh b/.ci/linux-prepare.sh
index c55125cf7..b9b499bad 100755
--- a/.ci/linux-prepare.sh
+++ b/.ci/linux-prepare.sh
@@ -21,7 +21,7 @@ make -j4 HAVE_LLVM= HAVE_SQLITE= install
 cd ..
 
 pip3 install --disable-pip-version-check --user \
-flake8 hacking sphinx pyOpenSSL wheel setuptools
+flake8 hacking sphinx wheel setuptools
 pip3 install --user --upgrade docutils
 pip3 install --user  'meson==0.47.1'
 
diff --git a/.cirrus.yml b/.cirrus.yml
index 480fea242..a7ae793bc 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -9,7 +9,7 @@ freebsd_build_task:
 
   env:
 DEPENDENCIES: automake libtool gmake gcc wget openssl python3
-PY_DEPS:  sphinx|openssl
+PY_DEPS:  sphinx
 matrix:
   COMPILER: gcc
   COMPILER: clang
diff --git a/.travis.yml b/.travis.yml
index 51d051108..c7aeede06 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,7 +17,6 @@ addons:
   - libjemalloc-dev
   - libnuma-dev
   - libpcap-dev
-  - python3-openssl
   - python3-pip
   - python3-sphinx
   - libelf-dev
diff --git a/python/ovs/poller.py b/python/ovs/poller.py
index 3624ec865..157719c3a 100644
--- a/python/ovs/poller.py
+++ b/python/ovs/poller.py
@@ -26,9 +26,9 @@ if sys.platform == "win32":
 import ovs.winutils as winutils
 
 try:
-from OpenSSL import SSL
+import ssl
 except ImportError:
-SSL = None
+ssl = None
 
 try:
 from eventlet import patcher as eventlet_patcher
@@ -73,7 +73,7 @@ class _SelectSelect(object):
 def register(self, fd, events):
 if isinstance(fd, socket.socket):
 fd = fd.fileno()
-if SSL and isinstance(fd, SSL.Connection):
+if ssl and isinstance(fd, ssl.SSLSocket):
 fd = fd.fileno()
 
 if sys.platform != 'win32':
diff --git a/python/ovs/stream.py b/python/ovs/stream.py
index f5a520862..ac5b0fd0c 100644
--- a/python/ovs/stream.py
+++ b/python/ovs/stream.py
@@ -22,9 +22,9 @@ import ovs.socket_util
 import ovs.vlog
 
 try:
-from OpenSSL import SSL
+import ssl
 except ImportError:
-SSL = None
+ssl = None
 
 if sys.platform == 'win32':
 import ovs.winutils as winutils
@@ -322,6 +322,12 @@ class Stream(object):
 The recv function will not block waiting for data to arrive.  If no
 data have been received, it returns (errno.EAGAIN, "") immediately."""
 
+try:
+return self._recv(n)
+except socket.error as e:
+return (ovs.socket_util.get_exception_errno(e), "")
+
+def _recv(self, n):
 retval = self.connect()
 if retval != 0:
 return (retval, "")
@@ -331,10 +337,7 @@ class Stream(object):
 if sys.platform == 'win32' and self.socket is None:
 return self.__recv_windows(n)
 
-try:
-return (0, self.socket.recv(n))
-except socket.error as e:
-return (ovs.socket_util.get_exception_errno(e), "")
+return (0, self.socket.recv(n))
 
 def __recv_windows(self, n):
 if self._read_pending:
@@ -396,6 +399,12 @@ class Stream(object):
 Will not block.  If no bytes can be immediately accepted for
 transmission, returns -errno.EAGAIN immediately."""
 
+try:
+return self._send(buf)
+except socket.error as e:
+return -ovs.socket_util.get_exception_errno(e)
+
+def _send(self, buf):
 retval = self.connect()
 if retval != 0:
 return -retval
@@ -409,10 +418,7 @@ class Stream(object):
 if sys.platform == 'win32' and self.socket is None:

[ovs-dev] [PATCH v3 2/2] python: replace pyOpenSSL with ssl

2021-10-25 Thread Timothy Redaelli
Currently, pyOpenSSL is half-deprecated upstream and so it's removed on
some distributions (for example on CentOS Stream 9,
https://issues.redhat.com/browse/CS-336), but since OVS only
supports Python 3 it's possible to replace pyOpenSSL with "import ssl"
included in base Python 3.

Stream recv and send had to be splitted as _recv and _send, since SSLError
is a subclass of socket.error and so it was not possible to except for
SSLWantReadError and SSLWantWriteError in recv and send of SSLStream.

TCPstream._open cannot be used in SSLStream, since Python ssl module
requires the SSL socket to be created before connecting it, so
SSLStream._open needs to create the socket, create SSL socket and then
connect the SSL socket.

Reported-by: Timothy Redaelli 
Reported-at: https://bugzilla.redhat.com/1988429
Signed-off-by: Timothy Redaelli 
---
 .ci/linux-prepare.sh |  2 +-
 .cirrus.yml  |  2 +-
 .travis.yml  |  1 -
 python/ovs/poller.py |  6 +--
 python/ovs/stream.py | 91 ++--
 tests/ovsdb-idl.at   |  2 +-
 6 files changed, 60 insertions(+), 44 deletions(-)

diff --git a/.ci/linux-prepare.sh b/.ci/linux-prepare.sh
index c55125cf7..b9b499bad 100755
--- a/.ci/linux-prepare.sh
+++ b/.ci/linux-prepare.sh
@@ -21,7 +21,7 @@ make -j4 HAVE_LLVM= HAVE_SQLITE= install
 cd ..
 
 pip3 install --disable-pip-version-check --user \
-flake8 hacking sphinx pyOpenSSL wheel setuptools
+flake8 hacking sphinx wheel setuptools
 pip3 install --user --upgrade docutils
 pip3 install --user  'meson==0.47.1'
 
diff --git a/.cirrus.yml b/.cirrus.yml
index 480fea242..a7ae793bc 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -9,7 +9,7 @@ freebsd_build_task:
 
   env:
 DEPENDENCIES: automake libtool gmake gcc wget openssl python3
-PY_DEPS:  sphinx|openssl
+PY_DEPS:  sphinx
 matrix:
   COMPILER: gcc
   COMPILER: clang
diff --git a/.travis.yml b/.travis.yml
index 51d051108..c7aeede06 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,7 +17,6 @@ addons:
   - libjemalloc-dev
   - libnuma-dev
   - libpcap-dev
-  - python3-openssl
   - python3-pip
   - python3-sphinx
   - libelf-dev
diff --git a/python/ovs/poller.py b/python/ovs/poller.py
index 3624ec865..157719c3a 100644
--- a/python/ovs/poller.py
+++ b/python/ovs/poller.py
@@ -26,9 +26,9 @@ if sys.platform == "win32":
 import ovs.winutils as winutils
 
 try:
-from OpenSSL import SSL
+import ssl
 except ImportError:
-SSL = None
+ssl = None
 
 try:
 from eventlet import patcher as eventlet_patcher
@@ -73,7 +73,7 @@ class _SelectSelect(object):
 def register(self, fd, events):
 if isinstance(fd, socket.socket):
 fd = fd.fileno()
-if SSL and isinstance(fd, SSL.Connection):
+if ssl and isinstance(fd, ssl.SSLSocket):
 fd = fd.fileno()
 
 if sys.platform != 'win32':
diff --git a/python/ovs/stream.py b/python/ovs/stream.py
index f5a520862..40d484827 100644
--- a/python/ovs/stream.py
+++ b/python/ovs/stream.py
@@ -22,9 +22,9 @@ import ovs.socket_util
 import ovs.vlog
 
 try:
-from OpenSSL import SSL
+import ssl
 except ImportError:
-SSL = None
+ssl = None
 
 if sys.platform == 'win32':
 import ovs.winutils as winutils
@@ -322,6 +322,12 @@ class Stream(object):
 The recv function will not block waiting for data to arrive.  If no
 data have been received, it returns (errno.EAGAIN, "") immediately."""
 
+try:
+return self._recv(n)
+except socket.error as e:
+return (ovs.socket_util.get_exception_errno(e), "")
+
+def _recv(self, n):
 retval = self.connect()
 if retval != 0:
 return (retval, "")
@@ -331,10 +337,7 @@ class Stream(object):
 if sys.platform == 'win32' and self.socket is None:
 return self.__recv_windows(n)
 
-try:
-return (0, self.socket.recv(n))
-except socket.error as e:
-return (ovs.socket_util.get_exception_errno(e), "")
+return (0, self.socket.recv(n))
 
 def __recv_windows(self, n):
 if self._read_pending:
@@ -396,6 +399,12 @@ class Stream(object):
 Will not block.  If no bytes can be immediately accepted for
 transmission, returns -errno.EAGAIN immediately."""
 
+try:
+return self._send(buf)
+except socket.error as e:
+return -ovs.socket_util.get_exception_errno(e)
+
+def _send(self, buf):
 retval = self.connect()
 if retval != 0:
 return -retval
@@ -409,10 +418,7 @@ class Stream(object):
 if sys.platform == 'win32' and self.socket is None:
 return self.__send_windows(buf)
 
-try:
-return self.socket.send(buf)
-except socket.error as e:
-return -ovs.socket_util.get_ex

[ovs-dev] [PATCH v3 1/2] socket-util: split inet_open_active function and use connect_ex

2021-10-25 Thread Timothy Redaelli
In an upcoming patch, PyOpenSSL will be replaced with Python ssl module,
but in order to do an async connection with Python ssl module the ssl
socket must be created when the socket is created, but before the
socket is connected.

So, inet_open_active function is splitted in 3 parts:
- inet_create_socket_active: creates the socket and returns the family and
  the socket, or (error, None) if some error needs to be returned.
- inet_connect_active: connect the socket and returns the errno (it
  returns 0 if errno is EINPROGRESS or EWOULDBLOCK).

connect is replaced by connect_ex, since Python suggest to use it for
asynchronous connects and it's also cleaner since inet_connect_active
returns errno that connect_ex already returns, moreover due to a Python
limitation connect cannot not be used with ssl module.

inet_open_active function is changed in order to use the new functions
inet_create_socket_active and inet_connect_active.

Signed-off-by: Timothy Redaelli 
---
 python/ovs/socket_util.py | 36 ++--
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/python/ovs/socket_util.py b/python/ovs/socket_util.py
index 3faa64e9d..651012bf0 100644
--- a/python/ovs/socket_util.py
+++ b/python/ovs/socket_util.py
@@ -222,8 +222,7 @@ def inet_parse_active(target, default_port):
 return (host_name, port)
 
 
-def inet_open_active(style, target, default_port, dscp):
-address = inet_parse_active(target, default_port)
+def inet_create_socket_active(style, address):
 try:
 is_addr_inet = is_valid_ipv4_address(address[0])
 if is_addr_inet:
@@ -235,23 +234,32 @@ def inet_open_active(style, target, default_port, dscp):
 except socket.error as e:
 return get_exception_errno(e), None
 
+return family, sock
+
+
+def inet_connect_active(sock, address, family, dscp):
 try:
 set_nonblocking(sock)
 set_dscp(sock, family, dscp)
-try:
-sock.connect(address)
-except socket.error as e:
-error = get_exception_errno(e)
-if sys.platform == 'win32' and error == errno.WSAEWOULDBLOCK:
-# WSAEWOULDBLOCK would be the equivalent on Windows
-# for EINPROGRESS on Unix.
-error = errno.EINPROGRESS
-if error != errno.EINPROGRESS:
-raise
-return 0, sock
+error = sock.connect_ex(address)
+if error not in (0, errno.EINPROGRESS, errno.EWOULDBLOCK):
+sock.close()
+return error
+return 0
 except socket.error as e:
 sock.close()
-return get_exception_errno(e), None
+return get_exception_errno(e)
+
+
+def inet_open_active(style, target, default_port, dscp):
+address = inet_parse_active(target, default_port)
+family, sock = inet_create_socket_active(style, address)
+if sock is None:
+return family, sock
+error = inet_connect_active(sock, address, family, dscp)
+if error:
+return error, None
+return 0, sock
 
 
 def get_exception_errno(e):
-- 
2.31.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v3 0/2] replace pyOpenSSL with ssl

2021-10-25 Thread Timothy Redaelli
Currently, pyOpenSSL is half-deprecated upstream and so it's removed on
some distributions (for example on CentOS Stream 9,
https://issues.redhat.com/browse/CS-336), but since OVS only
supports Python 3 it's possible to replace pyOpenSSL with "import ssl"
included in base Python 3.

v2 -> v3:
As suggested by Ilya, split up inet_open_active and use connect_ex.
connect_ex is suggested upstream to be used for asynchronous connects
and so it should be used also for "standard" TCP sockets.

Removed raises in connect_ex, since from Python 3.3 (and OVS supports
3.4+) any errors returned by connect are a subclass of socket.error, or
better OSError, so the errno can be used directly.

Added a comment in "python: replace pyOpenSSL with ssl" patch that
explains why TCPStream._open cannot be used.

Timothy Redaelli (2):
  socket-util: split inet_open_active function and use connect_ex
  python: replace pyOpenSSL with ssl

 .ci/linux-prepare.sh  |  2 +-
 .cirrus.yml   |  2 +-
 .travis.yml   |  1 -
 python/ovs/poller.py  |  6 +--
 python/ovs/socket_util.py | 36 ++--
 python/ovs/stream.py  | 91 +++
 tests/ovsdb-idl.at|  2 +-
 7 files changed, 82 insertions(+), 58 deletions(-)

-- 
2.31.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [RFC ovn 0/5] Facilitate external use of ovn-detrace

2021-10-18 Thread Timothy Redaelli
On Mon, 18 Oct 2021 18:18:07 +0200
Adrian Moreno  wrote:

> 
> 
> On 10/18/21 14:51, Dumitru Ceara wrote:
> > On 10/14/21 6:41 PM, Adrian Moreno wrote:
> >> ovn-detrace is a very useful tool for debugging OVN issues.
> >>
> >> It's core logic (mapping openflow cookies / ports with OVN objects) can
> >> be used for a variety of troubleshooting tools. Therefore, it would be
> >> desirable to make use of such logic from an external python program.
> >>
> >> This could be done by creating a python library (similarly to what ovs
> >> provides) that is built and pushed to PyPi for other projects to
> >> consume.
> >>
> >> However, being the only python script that lives in OVN, this might be a
> >> bit of an overkill, so what this series proposes is an intermediate step
> >> that does not require that much extra maintenance and still alleviates
> >> the main obstacles one finds when trying to use ovn-detrace as a python
> >> module which are:
> >> - python expects module names to end in .py and use underscores instead
> >>of hyphens
> >> - internally, ovn-detrace prints directy to stdout, the output of the
> >>ovn-detrace information should be configurable
> >> - the version information is not easily available
> >>
> >> With this series, ovn-detrace is renamed to ovn_detrace.py and a
> >> symlink with the old name is created for backwards compatibility. As a
> >> result, a use can point her PYTHONPATH to ovn's installation path,
> >> run "import ovn_detrace", and make use of ovn-detrace's logic with, say,
> >> individual openflow cookies instead of ofproto/trace outputs.
> >>
> >> I know it's not the cleanest way to do it. I'd love to hear your opinion
> >> on the matter.
> >>
> >> Reviewing notes:
> >> - The first patch is a small fix I spotted when playing around with
> >> ovn-detrace
> >> - I have not tested the debian package thoroughly
> >>
> > 
> > Hi Adrian,
> > 
> > I briefly tried the RFC series out and I don't see any functional
> > changes, so that works for me.
> > 
> > I quickly glanced at the patches too and they also look OK to me.
> > 
> > Looking forward to the v1.
> > 
> > Regards,
> > Dumitru
> > 
> 
> Thanks Dumitru,
> 
> If the general approach seems OK, I'll send v1.
> 
> Timothy, do you foresee any issues on the packaging side?

Hi,
I sent you a couple of comments inline, but for packaging point of view
I don't see any problem. Just copy the modifications you did in
ovn-fedora.spec.in (symlink + adding the .py in %files) in our
downstream spec file.

> Thanks

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [RFC ovn 3/5] ovn-detrace: rename ovn-detrace to ovn_detrace.py

2021-10-18 Thread Timothy Redaelli
On Thu, 14 Oct 2021 18:41:28 +0200
Adrian Moreno  wrote:

> For external python programs to be able to load ovn-detrace as a python
> module easily, it should end in .py and should have underscores.
> 
> Move ovn-detrace to ovn-detrac.py and create a symlink with the old name
> for backwards compatibility.
> 
> Signed-off-by: Adrian Moreno 
> ---
>  debian/ovn-common.install   |  2 +-
>  debian/ovn-common.postinst  |  1 +
>  debian/ovn-common.postrm|  1 +
>  rhel/ovn-fedora.spec.in |  9 +
>  utilities/automake.mk   | 14 --
>  utilities/{ovn-detrace.in => ovn_detrace.py.in} |  0
>  6 files changed, 24 insertions(+), 3 deletions(-)
>  rename utilities/{ovn-detrace.in => ovn_detrace.py.in} (100%)
> 
> diff --git a/debian/ovn-common.install b/debian/ovn-common.install
> index 8e5915724..050d1c63a 100644
> --- a/debian/ovn-common.install
> +++ b/debian/ovn-common.install
> @@ -4,7 +4,7 @@ usr/bin/ovn-sbctl
>  usr/bin/ovn-ic-nbctl
>  usr/bin/ovn-ic-sbctl
>  usr/bin/ovn-trace
> -usr/bin/ovn-detrace
> +usr/bin/ovn_detrace.py
>  usr/share/ovn/scripts/ovn-ctl
>  usr/share/ovn/scripts/ovndb-servers.ocf
>  usr/share/ovn/scripts/ovn-lib
> diff --git a/debian/ovn-common.postinst b/debian/ovn-common.postinst
> index 15f3c7577..dfddb1f08 100644
> --- a/debian/ovn-common.postinst
> +++ b/debian/ovn-common.postinst
> @@ -9,6 +9,7 @@ case "$1" in
>  configure)
>  mkdir -p /usr/lib/ocf/resource.d/ovn
>  ln -sf /usr/share/ovn/scripts/ovndb-servers.ocf 
> /usr/lib/ocf/resource.d/ovn/ovndb-servers
> +ln -sf /usr/bin/ovn_detrace.py /usr/bin/ovn-detrace
>  ;;
>  abort-upgrade|abort-remove|abort-deconfigure)
>  ;;
> diff --git a/debian/ovn-common.postrm b/debian/ovn-common.postrm
> index 9face726b..d607a66d5 100644
> --- a/debian/ovn-common.postrm
> +++ b/debian/ovn-common.postrm
> @@ -8,6 +8,7 @@ set -e
>  case "$1" in
>  purge|remove)
>  rm -rf /usr/lib/ocf/resource.d/ovn
> +rm -f /usr/bin/ovn-detrace
>  ;;
>  upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
>  ;;
> diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in
> index 9c8647b5a..fc0992263 100644
> --- a/rhel/ovn-fedora.spec.in
> +++ b/rhel/ovn-fedora.spec.in
> @@ -264,6 +264,12 @@ if [ $1 -eq 1 ] ; then
>  fi
>  fi
>  
> +%preun
> +if [ $1 -eq 0 ] ; then
> +# Package removal, not upgrade
> +rm %{_bindir}/ovn-detrace
> +fi
> +

This is not necessary, since the symlink is installed in %files,
it's removed during uninstall by rpm without using %preun

>  %preun central
>  %if 0%{?systemd_preun:1}
>  %systemd_preun ovn-northd.service
> @@ -318,6 +324,8 @@ fi
>  %endif
>  
>  %post
> +ln -sf ovn_detrace.py %{_bindir}/ovn-detrace
> +
>  %if %{with libcapng}
>  if [ $1 -eq 1 ]; then
>  sed -i 's:^#OVN_USER_ID=:OVN_USER_ID=:' %{_sysconfdir}/sysconfig/ovn
> @@ -462,6 +470,7 @@ fi
>  %{_bindir}/ovn-nbctl
>  %{_bindir}/ovn-sbctl
>  %{_bindir}/ovn-trace
> +%{_bindir}/ovn_detrace.py
>  %{_bindir}/ovn-detrace
>  %{_bindir}/ovn-appctl
>  %{_bindir}/ovn-ic-nbctl
> diff --git a/utilities/automake.mk b/utilities/automake.mk
> index a03892f20..67b04cbff 100644
> --- a/utilities/automake.mk
> +++ b/utilities/automake.mk
> @@ -20,7 +20,7 @@ MAN_ROOTS += \
>  bin_SCRIPTS += \
>  utilities/ovn-docker-overlay-driver \
>  utilities/ovn-docker-underlay-driver \
> -utilities/ovn-detrace
> +utilities/ovn_detrace.py
>  
>  EXTRA_DIST += \
>  utilities/ovn-ctl \
> @@ -34,7 +34,7 @@ EXTRA_DIST += \
>  utilities/ovn-ic-sbctl.8.xml \
>  utilities/ovn-appctl.8.xml \
>  utilities/ovn-trace.8.xml \
> -utilities/ovn-detrace.in \
> +utilities/ovn_detrace.py.in \
>  utilities/ovndb-servers.ocf \
>  utilities/checkpatch.py \
>  utilities/docker/Makefile \
> @@ -60,6 +60,7 @@ CLEANFILES += \
>  utilities/ovn-trace.8 \
>  utilities/ovn-detrace.1 \
>  utilities/ovn-detrace \
> +utilities/ovn_detrace.py \
>  utilities/ovn-appctl.8 \
>  utilities/ovn-appctl \
>  utilities/ovn-sim
> @@ -105,4 +106,13 @@ bin_PROGRAMS += utilities/ovn-appctl
>  utilities_ovn_appctl_SOURCES = utilities/ovn-appctl.c
>  utilities_ovn_appctl_LDADD = lib/libovn.la $(OVSDB_LIBDIR)/libovsdb.la 
> $(OVS_LIBDIR)/libopenvswitch.la
>  
> +# ovn-detrace
> +INSTALL_DATA_LOCAL += ovn-detrace-install
> +ovn-detrace-install:
> + ln -sf ovn_detrace.py $(DESTDIR)$(bindir)/ovn-detrace
> +
> +UNINSTALL_LOCAL += ovn-detrace-uninstall
> +ovn-detrace-uninstall:
> + rm -f $(DESTDIR)$(bindir)/ovn-detrace
> +
>  include utilities/bugtool/automake.mk
> diff --git a/utilities/ovn-detrace.in b/utilities/ovn_detrace.py.in
> similarity index 100%
> rename from utilities/ovn-detrace.in
> rename to utilities/ovn_detrace.py.in

___
dev mailing list
d...@openvswitch.org

Re: [ovs-dev] [RFC ovn 3/5] ovn-detrace: rename ovn-detrace to ovn_detrace.py

2021-10-18 Thread Timothy Redaelli
On Thu, 14 Oct 2021 18:41:28 +0200
Adrian Moreno  wrote:

> For external python programs to be able to load ovn-detrace as a python
> module easily, it should end in .py and should have underscores.
> 
> Move ovn-detrace to ovn-detrac.py and create a symlink with the old name
Nit: multiple typo   ^  ^

> for backwards compatibility.
> 
> Signed-off-by: Adrian Moreno 
> ---
>  debian/ovn-common.install   |  2 +-
>  debian/ovn-common.postinst  |  1 +
>  debian/ovn-common.postrm|  1 +
>  rhel/ovn-fedora.spec.in |  9 +
>  utilities/automake.mk   | 14 --
>  utilities/{ovn-detrace.in => ovn_detrace.py.in} |  0
>  6 files changed, 24 insertions(+), 3 deletions(-)
>  rename utilities/{ovn-detrace.in => ovn_detrace.py.in} (100%)
> 
> diff --git a/debian/ovn-common.install b/debian/ovn-common.install
> index 8e5915724..050d1c63a 100644
> --- a/debian/ovn-common.install
> +++ b/debian/ovn-common.install
> @@ -4,7 +4,7 @@ usr/bin/ovn-sbctl
>  usr/bin/ovn-ic-nbctl
>  usr/bin/ovn-ic-sbctl
>  usr/bin/ovn-trace
> -usr/bin/ovn-detrace
> +usr/bin/ovn_detrace.py
>  usr/share/ovn/scripts/ovn-ctl
>  usr/share/ovn/scripts/ovndb-servers.ocf
>  usr/share/ovn/scripts/ovn-lib
> diff --git a/debian/ovn-common.postinst b/debian/ovn-common.postinst
> index 15f3c7577..dfddb1f08 100644
> --- a/debian/ovn-common.postinst
> +++ b/debian/ovn-common.postinst
> @@ -9,6 +9,7 @@ case "$1" in
>  configure)
>  mkdir -p /usr/lib/ocf/resource.d/ovn
>  ln -sf /usr/share/ovn/scripts/ovndb-servers.ocf 
> /usr/lib/ocf/resource.d/ovn/ovndb-servers
> +ln -sf /usr/bin/ovn_detrace.py /usr/bin/ovn-detrace
>  ;;
>  abort-upgrade|abort-remove|abort-deconfigure)
>  ;;
> diff --git a/debian/ovn-common.postrm b/debian/ovn-common.postrm
> index 9face726b..d607a66d5 100644
> --- a/debian/ovn-common.postrm
> +++ b/debian/ovn-common.postrm
> @@ -8,6 +8,7 @@ set -e
>  case "$1" in
>  purge|remove)
>  rm -rf /usr/lib/ocf/resource.d/ovn
> +rm -f /usr/bin/ovn-detrace
>  ;;
>  upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
>  ;;
> diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in
> index 9c8647b5a..fc0992263 100644
> --- a/rhel/ovn-fedora.spec.in
> +++ b/rhel/ovn-fedora.spec.in
> @@ -264,6 +264,12 @@ if [ $1 -eq 1 ] ; then
>  fi
>  fi
>  
> +%preun
> +if [ $1 -eq 0 ] ; then
> +# Package removal, not upgrade
> +rm %{_bindir}/ovn-detrace
> +fi
> +
>  %preun central
>  %if 0%{?systemd_preun:1}
>  %systemd_preun ovn-northd.service
> @@ -318,6 +324,8 @@ fi
>  %endif
>  
>  %post
> +ln -sf ovn_detrace.py %{_bindir}/ovn-detrace
> +
>  %if %{with libcapng}
>  if [ $1 -eq 1 ]; then
>  sed -i 's:^#OVN_USER_ID=:OVN_USER_ID=:' %{_sysconfdir}/sysconfig/ovn
> @@ -462,6 +470,7 @@ fi
>  %{_bindir}/ovn-nbctl
>  %{_bindir}/ovn-sbctl
>  %{_bindir}/ovn-trace
> +%{_bindir}/ovn_detrace.py
>  %{_bindir}/ovn-detrace
>  %{_bindir}/ovn-appctl
>  %{_bindir}/ovn-ic-nbctl
> diff --git a/utilities/automake.mk b/utilities/automake.mk
> index a03892f20..67b04cbff 100644
> --- a/utilities/automake.mk
> +++ b/utilities/automake.mk
> @@ -20,7 +20,7 @@ MAN_ROOTS += \
>  bin_SCRIPTS += \
>  utilities/ovn-docker-overlay-driver \
>  utilities/ovn-docker-underlay-driver \
> -utilities/ovn-detrace
> +utilities/ovn_detrace.py
>  
>  EXTRA_DIST += \
>  utilities/ovn-ctl \
> @@ -34,7 +34,7 @@ EXTRA_DIST += \
>  utilities/ovn-ic-sbctl.8.xml \
>  utilities/ovn-appctl.8.xml \
>  utilities/ovn-trace.8.xml \
> -utilities/ovn-detrace.in \
> +utilities/ovn_detrace.py.in \
>  utilities/ovndb-servers.ocf \
>  utilities/checkpatch.py \
>  utilities/docker/Makefile \
> @@ -60,6 +60,7 @@ CLEANFILES += \
>  utilities/ovn-trace.8 \
>  utilities/ovn-detrace.1 \
>  utilities/ovn-detrace \
> +utilities/ovn_detrace.py \
>  utilities/ovn-appctl.8 \
>  utilities/ovn-appctl \
>  utilities/ovn-sim
> @@ -105,4 +106,13 @@ bin_PROGRAMS += utilities/ovn-appctl
>  utilities_ovn_appctl_SOURCES = utilities/ovn-appctl.c
>  utilities_ovn_appctl_LDADD = lib/libovn.la $(OVSDB_LIBDIR)/libovsdb.la 
> $(OVS_LIBDIR)/libopenvswitch.la
>  
> +# ovn-detrace
> +INSTALL_DATA_LOCAL += ovn-detrace-install
> +ovn-detrace-install:
> + ln -sf ovn_detrace.py $(DESTDIR)$(bindir)/ovn-detrace
> +
> +UNINSTALL_LOCAL += ovn-detrace-uninstall
> +ovn-detrace-uninstall:
> + rm -f $(DESTDIR)$(bindir)/ovn-detrace
> +
>  include utilities/bugtool/automake.mk
> diff --git a/utilities/ovn-detrace.in b/utilities/ovn_detrace.py.in
> similarity index 100%
> rename from utilities/ovn-detrace.in
> rename to utilities/ovn_detrace.py.in

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] tunnel-push-pop.at: Mask source port in tunnel header.

2021-10-13 Thread Timothy Redaelli
On Tue, 12 Oct 2021 15:33:07 +0200
Ilya Maximets  wrote:

> Source port is based on a packet hash and hash depends on a chosen
> implementation.  Masking it to avoid test failures with '-msse4.2'.
> 
> Fixes: 7e6b41ac8d9d ("dpif-netdev: Fix crash when PACKET_OUT is metered.")
> Reported-by: Kumar Amber 
> Signed-off-by: Ilya Maximets 
> ---
>  tests/tunnel-push-pop.at | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/tunnel-push-pop.at b/tests/tunnel-push-pop.at
> index 12fc1ef91..636465397 100644
> --- a/tests/tunnel-push-pop.at
> +++ b/tests/tunnel-push-pop.at
> @@ -628,20 +628,22 @@ AT_CHECK([
>  AT_CHECK([ovs-vsctl -- set Interface p0 options:tx_pcap=p0.pcap])
>  
>  packet=5054000a50540009123
> -encap=f8bc124434b6aa55aa5508004532400040113406010102580101025c83a917c1001e65587b00
> +dnl Source port is based on a packet hash, so it may differ depending on the
> +dnl compiler flags and CPU type.  Masked with ''.
> +encap=f8bc124434b6aa55aa5508004532400040113406010102580101025c17c1001e65587b00
>  
>  dnl Output to tunnel from a int-br internal port.
>  dnl Checking that the packet arrived and it was correctly encapsulated.
>  AT_CHECK([ovs-ofctl add-flow int-br 
> "in_port=LOCAL,actions=debug_slow,output:2"])
>  AT_CHECK([ovs-appctl netdev-dummy/receive int-br "${packet}4"])
> -OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | grep "${encap}${packet}4" | wc -l` 
> -ge 1])
> +OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | egrep "${encap}${packet}4" | wc -l` 
> -ge 1])
>  dnl Sending again to exercise the non-miss upcall path.
>  AT_CHECK([ovs-appctl netdev-dummy/receive int-br "${packet}4"])
> -OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | grep "${encap}${packet}4" | wc -l` 
> -ge 2])
> +OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | egrep "${encap}${packet}4" | wc -l` 
> -ge 2])
>  
>  dnl Output to tunnel from the controller.
>  AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out int-br CONTROLLER 
> "debug_slow,output:2" "${packet}5"])
> -OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | grep "${encap}${packet}5" | wc -l` 
> -ge 1])
> +OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | egrep "${encap}${packet}5" | wc -l` 
> -ge 1])
>  
>  dnl Datapath actions should not have tunnel push action.
>  AT_CHECK([ovs-appctl dpctl/dump-flows | grep -q tnl_push], [1])

Hi,
egrep should not be needed in this case, since . is part of basic
regexp (see man 1 grep and [1]) and so plain grep is enough.

[1] 
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_04

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] [python] Avoid alloc of an attr dict/row+column

2021-10-13 Thread Timothy Redaelli
On Tue, 12 Oct 2021 14:13:31 -0500
Terry Wilson  wrote:

> Python objects normally have a dictionary named __dict__ allocated
> for handling dynamically assigned attributes. Depending on
> architecture and Python version, that empty dict may be between
> 64 and 280 bytes.
> 
> Seeing as Atom and Datum objects do not need dynamic attribute
> support and there can be millions of rows in a database, avoiding
> this allocation with __slots__ can save 100s of MBs of memory per
> Idl process.
> 
> Signed-off-by: Terry Wilson 

It reduce the memory usage and it's also faster:

print(min(timeit.repeat(lambda:
data.Atom.default(ovs.db.types.ATOMIC_TYPES[1]

0.7460950060049072 (w/o patch) vs 0.6909653190232348 (with patch)


[data.Atom.default(ovs.db.types.ATOMIC_TYPES[1]) for x in
range(100)]

print(guppy.hpy().heap())

322605613 bytes (w/o patch) vs 114605277 bytes (with patch)


Acked-by: Timothy Redaelli 
Tested-by: Timothy Redaelli 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] python: replace pyOpenSSL with ssl

2021-10-06 Thread Timothy Redaelli
Currently, pyOpenSSL is half-deprecated upstream and so it's removed on
some distributions (for example on CentOS Stream 9,
https://issues.redhat.com/browse/CS-336), but since OVS only
supports Python 3 it's possible to replace pyOpenSSL with "import ssl"
included in base Python 3.

Stream recv and send had to be splitted as _recv and _send, since SSLError
is a subclass of socket.error and so it was not possible to except for
SSLWantReadError and SSLWantWriteError in recv and send of SSLStream.

Reported-by: Timothy Redaelli 
Reported-at: https://bugzilla.redhat.com/1988429
Signed-off-by: Timothy Redaelli 
---
v1 -> v2:
- asyncronous connect with ssl is different than with pyOpenSSL, so a
  different approach is needed or it fails when connect is not ready
  when ctx.wrap_socket is executed.
  Moreover it's not possible to use connect, but it's necessary to use
  connect_ex (probably due to a python bug or limitation).
  So to do not behave diffently than TCPSocket, it's necessary to raise
  the errno exception like connect do.
---
 .ci/linux-prepare.sh |   2 +-
 .cirrus.yml  |   2 +-
 .travis.yml  |   1 -
 python/ovs/poller.py |   6 +--
 python/ovs/stream.py | 118 +--
 tests/ovsdb-idl.at   |   2 +-
 6 files changed, 86 insertions(+), 45 deletions(-)

diff --git a/.ci/linux-prepare.sh b/.ci/linux-prepare.sh
index c55125cf7..b9b499bad 100755
--- a/.ci/linux-prepare.sh
+++ b/.ci/linux-prepare.sh
@@ -21,7 +21,7 @@ make -j4 HAVE_LLVM= HAVE_SQLITE= install
 cd ..
 
 pip3 install --disable-pip-version-check --user \
-flake8 hacking sphinx pyOpenSSL wheel setuptools
+flake8 hacking sphinx wheel setuptools
 pip3 install --user --upgrade docutils
 pip3 install --user  'meson==0.47.1'
 
diff --git a/.cirrus.yml b/.cirrus.yml
index 358f2ba25..bb206f35f 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -9,7 +9,7 @@ freebsd_build_task:
 
   env:
 DEPENDENCIES: automake libtool gmake gcc wget openssl python3
-PY_DEPS:  sphinx|openssl
+PY_DEPS:  sphinx
 matrix:
   COMPILER: gcc
   COMPILER: clang
diff --git a/.travis.yml b/.travis.yml
index 51d051108..c7aeede06 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,7 +17,6 @@ addons:
   - libjemalloc-dev
   - libnuma-dev
   - libpcap-dev
-  - python3-openssl
   - python3-pip
   - python3-sphinx
   - libelf-dev
diff --git a/python/ovs/poller.py b/python/ovs/poller.py
index 3624ec865..157719c3a 100644
--- a/python/ovs/poller.py
+++ b/python/ovs/poller.py
@@ -26,9 +26,9 @@ if sys.platform == "win32":
 import ovs.winutils as winutils
 
 try:
-from OpenSSL import SSL
+import ssl
 except ImportError:
-SSL = None
+ssl = None
 
 try:
 from eventlet import patcher as eventlet_patcher
@@ -73,7 +73,7 @@ class _SelectSelect(object):
 def register(self, fd, events):
 if isinstance(fd, socket.socket):
 fd = fd.fileno()
-if SSL and isinstance(fd, SSL.Connection):
+if ssl and isinstance(fd, ssl.SSLSocket):
 fd = fd.fileno()
 
 if sys.platform != 'win32':
diff --git a/python/ovs/stream.py b/python/ovs/stream.py
index f5a520862..205e74888 100644
--- a/python/ovs/stream.py
+++ b/python/ovs/stream.py
@@ -22,9 +22,9 @@ import ovs.socket_util
 import ovs.vlog
 
 try:
-from OpenSSL import SSL
+import ssl
 except ImportError:
-SSL = None
+ssl = None
 
 if sys.platform == 'win32':
 import ovs.winutils as winutils
@@ -322,6 +322,12 @@ class Stream(object):
 The recv function will not block waiting for data to arrive.  If no
 data have been received, it returns (errno.EAGAIN, "") immediately."""
 
+try:
+return self._recv(n)
+except socket.error as e:
+return (ovs.socket_util.get_exception_errno(e), "")
+
+def _recv(self, n):
 retval = self.connect()
 if retval != 0:
 return (retval, "")
@@ -331,10 +337,7 @@ class Stream(object):
 if sys.platform == 'win32' and self.socket is None:
 return self.__recv_windows(n)
 
-try:
-return (0, self.socket.recv(n))
-except socket.error as e:
-return (ovs.socket_util.get_exception_errno(e), "")
+return (0, self.socket.recv(n))
 
 def __recv_windows(self, n):
 if self._read_pending:
@@ -396,6 +399,12 @@ class Stream(object):
 Will not block.  If no bytes can be immediately accepted for
 transmission, returns -errno.EAGAIN immediately."""
 
+try:
+return self._send(buf)
+except socket.error as e:
+return -ovs.socket_util.get_exception_errno(e)
+
+def _send(self, buf):
 retval = self.connect()
 if retval != 0:
 return -retval
@@ -409,10 +418,7 @@ class Stream(object):
 if sys.platform ==

[ovs-dev] [PATCH] python: replace pyOpenSSL with ssl

2021-09-10 Thread Timothy Redaelli
Currently, pyOpenSSL is half-deprecated upstream and so it's removed on
some distributions (for example on CentOS Stream 9,
https://issues.redhat.com/browse/CS-336), but since OVS only
supports Python 3 it's possible to replace pyOpenSSL with "import ssl"
included in base Python 3.

Stream recv and send had to be splitted as _recv and _send, since SSLError
is a subclass of socket.error and so it was not possible to except for
SSLWantReadError and SSLWantWriteError in recv and send of SSLStream.

Reported-by: Timothy Redaelli 
Reported-at: https://bugzilla.redhat.com/1988429
Signed-off-by: Timothy Redaelli 
---
 .ci/linux-prepare.sh |  2 +-
 .cirrus.yml  |  2 +-
 .travis.yml  |  1 -
 python/ovs/poller.py |  6 ++--
 python/ovs/stream.py | 75 +++-
 tests/ovsdb-idl.at   |  2 +-
 6 files changed, 46 insertions(+), 42 deletions(-)

diff --git a/.ci/linux-prepare.sh b/.ci/linux-prepare.sh
index c55125cf7..b9b499bad 100755
--- a/.ci/linux-prepare.sh
+++ b/.ci/linux-prepare.sh
@@ -21,7 +21,7 @@ make -j4 HAVE_LLVM= HAVE_SQLITE= install
 cd ..
 
 pip3 install --disable-pip-version-check --user \
-flake8 hacking sphinx pyOpenSSL wheel setuptools
+flake8 hacking sphinx wheel setuptools
 pip3 install --user --upgrade docutils
 pip3 install --user  'meson==0.47.1'
 
diff --git a/.cirrus.yml b/.cirrus.yml
index 358f2ba25..bb206f35f 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -9,7 +9,7 @@ freebsd_build_task:
 
   env:
 DEPENDENCIES: automake libtool gmake gcc wget openssl python3
-PY_DEPS:  sphinx|openssl
+PY_DEPS:  sphinx
 matrix:
   COMPILER: gcc
   COMPILER: clang
diff --git a/.travis.yml b/.travis.yml
index 51d051108..c7aeede06 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,7 +17,6 @@ addons:
   - libjemalloc-dev
   - libnuma-dev
   - libpcap-dev
-  - python3-openssl
   - python3-pip
   - python3-sphinx
   - libelf-dev
diff --git a/python/ovs/poller.py b/python/ovs/poller.py
index 3624ec865..157719c3a 100644
--- a/python/ovs/poller.py
+++ b/python/ovs/poller.py
@@ -26,9 +26,9 @@ if sys.platform == "win32":
 import ovs.winutils as winutils
 
 try:
-from OpenSSL import SSL
+import ssl
 except ImportError:
-SSL = None
+ssl = None
 
 try:
 from eventlet import patcher as eventlet_patcher
@@ -73,7 +73,7 @@ class _SelectSelect(object):
 def register(self, fd, events):
 if isinstance(fd, socket.socket):
 fd = fd.fileno()
-if SSL and isinstance(fd, SSL.Connection):
+if ssl and isinstance(fd, ssl.SSLSocket):
 fd = fd.fileno()
 
 if sys.platform != 'win32':
diff --git a/python/ovs/stream.py b/python/ovs/stream.py
index f5a520862..cd74b46be 100644
--- a/python/ovs/stream.py
+++ b/python/ovs/stream.py
@@ -22,9 +22,9 @@ import ovs.socket_util
 import ovs.vlog
 
 try:
-from OpenSSL import SSL
+import ssl
 except ImportError:
-SSL = None
+ssl = None
 
 if sys.platform == 'win32':
 import ovs.winutils as winutils
@@ -322,6 +322,12 @@ class Stream(object):
 The recv function will not block waiting for data to arrive.  If no
 data have been received, it returns (errno.EAGAIN, "") immediately."""
 
+try:
+return self._recv(n)
+except socket.error as e:
+return (ovs.socket_util.get_exception_errno(e), "")
+
+def _recv(self, n):
 retval = self.connect()
 if retval != 0:
 return (retval, "")
@@ -331,10 +337,7 @@ class Stream(object):
 if sys.platform == 'win32' and self.socket is None:
 return self.__recv_windows(n)
 
-try:
-return (0, self.socket.recv(n))
-except socket.error as e:
-return (ovs.socket_util.get_exception_errno(e), "")
+return (0, self.socket.recv(n))
 
 def __recv_windows(self, n):
 if self._read_pending:
@@ -396,6 +399,12 @@ class Stream(object):
 Will not block.  If no bytes can be immediately accepted for
 transmission, returns -errno.EAGAIN immediately."""
 
+try:
+return self._send(buf)
+except socket.error as e:
+return -ovs.socket_util.get_exception_errno(e)
+
+def _send(self, buf):
 retval = self.connect()
 if retval != 0:
 return -retval
@@ -409,10 +418,7 @@ class Stream(object):
 if sys.platform == 'win32' and self.socket is None:
 return self.__send_windows(buf)
 
-try:
-return self.socket.send(buf)
-except socket.error as e:
-return -ovs.socket_util.get_exception_errno(e)
+return self.socket.send(buf)
 
 def __send_windows(self, buf):
 if self._write_pending:
@@ -769,17 +775,13 @@ class SSLStream(Stream):
 def check_connection_completion(sock):

[ovs-dev] [PATCH v2] checkpatch: check if some tags are wrongly written

2021-09-10 Thread Timothy Redaelli
Currently, there are some patches with the tags wrongly written (with
space instead of dash ) and this may prevent some automatic system or CI
to detect them correctly.

This commit adds a check in checkpatch to be sure the tag is written
correctly with dash and not with space.

The tags supported by the commit are:
Acked-by, Reported-at, Reported-by, Requested-by, Reviewed-by, Submitted-at
and Suggested-by.

It's not necessary to add "Signed-off-by" since it's already checked in
checkpatch.

Signed-off-by: Timothy Redaelli 
---
v2:
  - Removed multiple spaces to make flake8 happy, as reported by Aaron
Conole)
  - Added Acked-by and Reviewed-by, as requested by Paolo Valerio.
---
 tests/checkpatch.at | 60 +
 utilities/checkpatch.py | 15 +++
 2 files changed, 75 insertions(+)

diff --git a/tests/checkpatch.at b/tests/checkpatch.at
index 0718acd99..246170a26 100755
--- a/tests/checkpatch.at
+++ b/tests/checkpatch.at
@@ -348,3 +348,63 @@ try_checkpatch \
 "
 
 AT_CLEANUP
+
+AT_SETUP([checkpatch - malformed tags])
+try_checkpatch \
+   "Author: A
+
+Acked by: foo...
+Signed-off-by: A" \
+"ERROR: Acked-by tag is malformed.
+1: Acked by: foo...
+"
+try_checkpatch \
+   "Author: A
+
+Reported at: foo...
+Signed-off-by: A" \
+"ERROR: Reported-at tag is malformed.
+1: Reported at: foo...
+"
+try_checkpatch \
+   "Author: A
+
+Reported by: foo...
+Signed-off-by: A" \
+"ERROR: Reported-by tag is malformed.
+1: Reported by: foo...
+"
+try_checkpatch \
+   "Author: A
+
+Requested by: foo...
+Signed-off-by: A" \
+"ERROR: Requested-by tag is malformed.
+1: Requested by: foo...
+"
+try_checkpatch \
+   "Author: A
+
+Reviewed by: foo...
+Signed-off-by: A" \
+"ERROR: Reviewed-by tag is malformed.
+1: Reviewed by: foo...
+"
+try_checkpatch \
+   "Author: A
+
+Submitted at: foo...
+Signed-off-by: A" \
+"ERROR: Submitted-at tag is malformed.
+1: Submitted at: foo...
+"
+try_checkpatch \
+   "Author: A
+
+Suggested by: foo...
+Signed-off-by: A" \
+"ERROR: Suggested-by tag is malformed.
+1: Suggested by: foo...
+"
+
+AT_CLEANUP
diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index 699fb4b02..d9d90847f 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -749,6 +749,16 @@ def ovs_checkpatch_parse(text, filename, author=None, 
committer=None):
 is_gerrit_change_id = re.compile(r'(\s*(change-id: )(.*))$',
  re.I | re.M | re.S)
 
+tags_typos = {
+r'^Acked by:': 'Acked-by:',
+r'^Reported at:': 'Reported-at:',
+r'^Reported by:': 'Reported-by:',
+r'^Requested by:': 'Requested-by:',
+r'^Reviewed by:': 'Reviewed-by:',
+r'^Submitted at:': 'Submitted-at:',
+r'^Suggested by:': 'Suggested-by:',
+}
+
 reset_counters()
 
 for line in text.splitlines():
@@ -838,6 +848,11 @@ def ovs_checkpatch_parse(text, filename, author=None, 
committer=None):
 print("%d: %s\n" % (lineno, line))
 elif spellcheck:
 check_spelling(line, False)
+for typo, correct in tags_typos.items():
+m = re.match(typo, line, re.I)
+if m:
+print_error("%s tag is malformed." % (correct[:-1]))
+print("%d: %s\n" % (lineno, line))
 
 elif parse == PARSE_STATE_CHANGE_BODY:
 newfile = hunks.match(line)
-- 
2.31.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] rhel: Fix dual kernel rpm install for RHEL 8.4

2021-09-08 Thread Timothy Redaelli
On Mon, Aug 23, 2021 at 6:33 PM Greg Rose  wrote:
>
> RHEL 8.4 is the first of the RHEL 8.x kernels that has broken ABI so
> it requires the same sort of fix as we did for several RHEL 7.x kernel
> that needed two kernel rpms to work for all minor revisions of the
> baseline kernel module.
>
> Signed-off-by: Greg Rose 
> ---
>  rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh | 8 
>  1 file changed, 8 insertions(+)
>
> diff --git a/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh 
> b/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
> index 22bebaa58..01d31a216 100644
> --- a/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
> +++ b/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
> @@ -24,6 +24,7 @@
>  #   - 3.10.0 major revision 1160 (RHEL 7.9)
>  #   - 4.4.x,  x >= 73   (SLES 12 SP3)
>  #   - 4.12.x, x >= 14   (SLES 12 SP4).
> +#   - 4.18.x major revision 305  (RHEL 8.4)
>  # It is packaged in the openvswitch kmod RPM and run in the post-install
>  # scripts.
>  #
> @@ -139,6 +140,13 @@ elif [ "$mainline_major" = "4" ] && [ "$mainline_minor" 
> = "12" ]; then
>  ver_offset=2
>  installed_ver="$mainline_patch"
>  fi
> +elif [ "$mainline_major" = "4" ] && [ "$mainline_minor" = "18" ]; then
> +if [ "$major_rev" = "305" ]; then
> +echo "rhel84"

Are you sure you need that echo since it's commented on the other
entries and it seems only used for debugging / development?

> +comp_ver=9
> +ver_offset=4
> +installed_ver="$minor_rev"
> +fi
>  fi
>
>  if [ X"$ver_offset" = X ]; then
> --
> 2.17.1
>
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>


-- 
Timothy Redaelli
Software Engineer
Red Hat Italia

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] checkpatch: check if some tags are wrongly written

2021-08-10 Thread Timothy Redaelli
Currently, there are some patches with the tags wrongly written (with
space instead of dash ) and this may prevent some automatic system or CI
to detect them correctly.

This commit adds a check in checkpatch to be sure the tag is written
correctly with dash and not with space.

The tags supported by the commit are:
Reported-by, Requested-by, Suggested-by, Reported-at, and Submitted-at

It's not necessary to add "Signed-off-by" since it's already checked in
checkpatch.

Signed-off-by: Timothy Redaelli 
---
 tests/checkpatch.at | 44 +
 utilities/checkpatch.py | 13 
 2 files changed, 57 insertions(+)

diff --git a/tests/checkpatch.at b/tests/checkpatch.at
index 0718acd99..8eb6a7558 100755
--- a/tests/checkpatch.at
+++ b/tests/checkpatch.at
@@ -348,3 +348,47 @@ try_checkpatch \
 "
 
 AT_CLEANUP
+
+AT_SETUP([checkpatch - malformed tags])
+try_checkpatch \
+   "Author: A
+
+Reported by: foo...
+Signed-off-by: A" \
+"ERROR: Reported-by tag is malformed.
+1: Reported by: foo...
+"
+try_checkpatch \
+   "Author: A
+
+Requested by: foo...
+Signed-off-by: A" \
+"ERROR: Requested-by tag is malformed.
+1: Requested by: foo...
+"
+try_checkpatch \
+   "Author: A
+
+Suggested by: foo...
+Signed-off-by: A" \
+"ERROR: Suggested-by tag is malformed.
+1: Suggested by: foo...
+"
+try_checkpatch \
+   "Author: A
+
+Reported at: foo...
+Signed-off-by: A" \
+"ERROR: Reported-at tag is malformed.
+1: Reported at: foo...
+"
+try_checkpatch \
+   "Author: A
+
+Submitted at: foo...
+Signed-off-by: A" \
+"ERROR: Submitted-at tag is malformed.
+1: Submitted at: foo...
+"
+
+AT_CLEANUP
diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index 699fb4b02..97e21eeaa 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -749,6 +749,14 @@ def ovs_checkpatch_parse(text, filename, author=None, 
committer=None):
 is_gerrit_change_id = re.compile(r'(\s*(change-id: )(.*))$',
  re.I | re.M | re.S)
 
+tags_typos = {
+r'^Reported by:':  'Reported-by:',
+r'^Requested by:': 'Requested-by:',
+r'^Suggested by:': 'Suggested-by:',
+r'^Reported at:':  'Reported-at:',
+r'^Submitted at:': 'Submitted-at:'
+}
+
 reset_counters()
 
 for line in text.splitlines():
@@ -838,6 +846,11 @@ def ovs_checkpatch_parse(text, filename, author=None, 
committer=None):
 print("%d: %s\n" % (lineno, line))
 elif spellcheck:
 check_spelling(line, False)
+for typo, correct in tags_typos.items():
+m = re.match(typo, line, re.I)
+if m:
+print_error("%s tag is malformed." % (correct[:-1]))
+print("%d: %s\n" % (lineno, line))
 
 elif parse == PARSE_STATE_CHANGE_BODY:
 newfile = hunks.match(line)
-- 
2.31.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v4 1/2] ovs-save: Save igmp flows in ofp_parse syntax

2021-07-26 Thread Timothy Redaelli
On Fri, 23 Jul 2021 10:58:40 -0400
Salvatore Daniele  wrote:

> match.c generates the keyword "igmp", which is not supported in ofp-parse.
> This means that flow dumps containing 'igmp' can not be restored.
> 
> Removing the 'igmp' keyword entirely could break existing scripts in stable
> branches, so this patch creates a workaround within ovs-save by converting any
> instances of "igmp" within $bridge.flows.dump into "ip, nw_proto=2".
> 
> Signed-off-by: Salvatore Daniele 
> Acked-by: Aaron Conole 

Acked-by: Timothy Redaelli 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] dpif-netdev: apply subtable-lookup-prio-set on any datapath

2021-06-23 Thread Timothy Redaelli
Currently, if you try to set subtable-lookup-prio-set when you don't have
any datapath (for example if an user wants to set AVX512 before creating
any bridge) it sets it globally (dpcls_subtable_set_prio),
but it returns an error:

  please specify an existing datapath
  ovs-appctl: ovs-vswitchd: server returned an error

and, in this case, the exit code of ovs-appctl is 2.

This commit changes the behaviour by removing the [datapath] optional
parameter of subtable-lookup-prio-set and by changing the priority
level on any datapath and globally. This means if you don't have any
datapath or if you have only one datapath, the behaviour is the same as
now, but without the confusing error when you don't have any datapath.

Fixes: 3d018c3ea79d ("dpif-netdev: add subtable lookup prio set command.")
Cc: harry.van.haa...@intel.com
Signed-off-by: Timothy Redaelli 

--
v2:
- Fixed one warning and one coding style issue found by 0-day Robot.
---
 lib/dpif-netdev.c | 80 +++
 1 file changed, 33 insertions(+), 47 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 8fa7eb6d4..c557daa9c 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -1339,19 +1339,21 @@ dpif_netdev_subtable_lookup_get(struct unixctl_conn 
*conn, int argc OVS_UNUSED,
 }
 
 static void
-dpif_netdev_subtable_lookup_set(struct unixctl_conn *conn, int argc,
+dpif_netdev_subtable_lookup_set(struct unixctl_conn *conn, int argc OVS_UNUSED,
 const char *argv[], void *aux OVS_UNUSED)
 {
 /* This function requires 2 parameters (argv[1] and argv[2]) to execute.
  *   argv[1] is subtable name
  *   argv[2] is priority
- *   argv[3] is the datapath name (optional if only 1 datapath exists)
  */
 const char *func_name = argv[1];
 
 errno = 0;
 char *err_char;
 uint32_t new_prio = strtoul(argv[2], _char, 10);
+uint32_t lookup_dpcls_changed = 0;
+uint32_t lookup_subtable_changed = 0;
+struct shash_node *node;
 if (errno != 0 || new_prio > UINT8_MAX) {
 unixctl_command_reply_error(conn,
 "error converting priority, use integer in range 0-255\n");
@@ -1365,58 +1367,42 @@ dpif_netdev_subtable_lookup_set(struct unixctl_conn 
*conn, int argc,
 return;
 }
 
-/* argv[3] is optional datapath instance. If no datapath name is provided
- * and only one datapath exists, the one existing datapath is reprobed.
- */
 ovs_mutex_lock(_netdev_mutex);
-struct dp_netdev *dp = NULL;
-
-if (argc == 4) {
-dp = shash_find_data(_netdevs, argv[3]);
-} else if (shash_count(_netdevs) == 1) {
-dp = shash_first(_netdevs)->data;
-}
-
-if (!dp) {
-ovs_mutex_unlock(_netdev_mutex);
-unixctl_command_reply_error(conn,
-"please specify an existing datapath");
-return;
-}
-
-/* Get PMD threads list, required to get DPCLS instances. */
-size_t n;
-uint32_t lookup_dpcls_changed = 0;
-uint32_t lookup_subtable_changed = 0;
-struct dp_netdev_pmd_thread **pmd_list;
-sorted_poll_thread_list(dp, _list, );
+SHASH_FOR_EACH (node, _netdevs) {
+struct dp_netdev *dp = node->data;
 
-/* take port mutex as HMAP iters over them. */
-ovs_mutex_lock(>port_mutex);
+/* Get PMD threads list, required to get DPCLS instances. */
+size_t n;
+struct dp_netdev_pmd_thread **pmd_list;
+sorted_poll_thread_list(dp, _list, );
 
-for (size_t i = 0; i < n; i++) {
-struct dp_netdev_pmd_thread *pmd = pmd_list[i];
-if (pmd->core_id == NON_PMD_CORE_ID) {
-continue;
-}
+/* take port mutex as HMAP iters over them. */
+ovs_mutex_lock(>port_mutex);
 
-struct dp_netdev_port *port = NULL;
-HMAP_FOR_EACH (port, node, >ports) {
-odp_port_t in_port = port->port_no;
-struct dpcls *cls = dp_netdev_pmd_lookup_dpcls(pmd, in_port);
-if (!cls) {
+for (size_t i = 0; i < n; i++) {
+struct dp_netdev_pmd_thread *pmd = pmd_list[i];
+if (pmd->core_id == NON_PMD_CORE_ID) {
 continue;
 }
-uint32_t subtbl_changes = dpcls_subtable_lookup_reprobe(cls);
-if (subtbl_changes) {
-lookup_dpcls_changed++;
-lookup_subtable_changed += subtbl_changes;
+
+struct dp_netdev_port *port = NULL;
+HMAP_FOR_EACH (port, node, >ports) {
+odp_port_t in_port = port->port_no;
+struct dpcls *cls = dp_netdev_pmd_lookup_dpcls(pmd, in_port);
+if (!cls) {
+continue;
+}
+uint32_t subtbl_changes = dpcls_subtable_lookup_reprobe(cls);
+if (subtbl_changes) {
+lookup_dpcls_chan

[ovs-dev] [PATCH] dpif-netdev: apply subtable-lookup-prio-set on any datapath

2021-06-23 Thread Timothy Redaelli
Currently, if you try to set subtable-lookup-prio-set when you don't have
any datapath (for example if an user wants to set AVX512 before creating
any bridge) it sets it globally (dpcls_subtable_set_prio),
but it returns an error:

  please specify an existing datapath
  ovs-appctl: ovs-vswitchd: server returned an error

and, in this case, the exit code of ovs-appctl is 2.

This commit changes the behaviour by removing the [dp] optional
parameter of subtable-lookup-prio-set and by changing the priority
level on any datapath and globally. This means if you don't have any
datapath or if you have only one datapath, the behaviour is the same as
now, but without the confusing error when you don't have any datapath.

Signed-off-by: Timothy Redaelli 
Fixes: 3d018c3ea79d ("dpif-netdev: add subtable lookup prio set command.")
Cc: harry.van.haa...@intel.com
---
 lib/dpif-netdev.c | 78 +++
 1 file changed, 32 insertions(+), 46 deletions(-)
---
There is no need to change the documentation, since the manpage is not
merged and it's currently part of another series [1], but the optional
datapath parameter is not present in the patchset and so there is not need
to change it. Currently the only document that contains a reference to
subtable-lookup-prio-set (Documentation/topics/dpdk/bridge.rst),
doesn't contain any reference to the optional datapath parameter too.

[1] 
https://patchwork.ozlabs.org/project/openvswitch/patch/20210617161825.94741-9-cian.ferri...@intel.com/

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 8fa7eb6d4..478eb7cf3 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -1345,13 +1345,15 @@ dpif_netdev_subtable_lookup_set(struct unixctl_conn 
*conn, int argc,
 /* This function requires 2 parameters (argv[1] and argv[2]) to execute.
  *   argv[1] is subtable name
  *   argv[2] is priority
- *   argv[3] is the datapath name (optional if only 1 datapath exists)
  */
 const char *func_name = argv[1];
 
 errno = 0;
 char *err_char;
 uint32_t new_prio = strtoul(argv[2], _char, 10);
+uint32_t lookup_dpcls_changed = 0;
+uint32_t lookup_subtable_changed = 0;
+struct shash_node *node;
 if (errno != 0 || new_prio > UINT8_MAX) {
 unixctl_command_reply_error(conn,
 "error converting priority, use integer in range 0-255\n");
@@ -1365,58 +1367,42 @@ dpif_netdev_subtable_lookup_set(struct unixctl_conn 
*conn, int argc,
 return;
 }
 
-/* argv[3] is optional datapath instance. If no datapath name is provided
- * and only one datapath exists, the one existing datapath is reprobed.
- */
 ovs_mutex_lock(_netdev_mutex);
-struct dp_netdev *dp = NULL;
-
-if (argc == 4) {
-dp = shash_find_data(_netdevs, argv[3]);
-} else if (shash_count(_netdevs) == 1) {
-dp = shash_first(_netdevs)->data;
-}
-
-if (!dp) {
-ovs_mutex_unlock(_netdev_mutex);
-unixctl_command_reply_error(conn,
-"please specify an existing datapath");
-return;
-}
-
-/* Get PMD threads list, required to get DPCLS instances. */
-size_t n;
-uint32_t lookup_dpcls_changed = 0;
-uint32_t lookup_subtable_changed = 0;
-struct dp_netdev_pmd_thread **pmd_list;
-sorted_poll_thread_list(dp, _list, );
+SHASH_FOR_EACH(node, _netdevs) {
+struct dp_netdev *dp = node->data;
 
-/* take port mutex as HMAP iters over them. */
-ovs_mutex_lock(>port_mutex);
+/* Get PMD threads list, required to get DPCLS instances. */
+size_t n;
+struct dp_netdev_pmd_thread **pmd_list;
+sorted_poll_thread_list(dp, _list, );
 
-for (size_t i = 0; i < n; i++) {
-struct dp_netdev_pmd_thread *pmd = pmd_list[i];
-if (pmd->core_id == NON_PMD_CORE_ID) {
-continue;
-}
+/* take port mutex as HMAP iters over them. */
+ovs_mutex_lock(>port_mutex);
 
-struct dp_netdev_port *port = NULL;
-HMAP_FOR_EACH (port, node, >ports) {
-odp_port_t in_port = port->port_no;
-struct dpcls *cls = dp_netdev_pmd_lookup_dpcls(pmd, in_port);
-if (!cls) {
+for (size_t i = 0; i < n; i++) {
+struct dp_netdev_pmd_thread *pmd = pmd_list[i];
+if (pmd->core_id == NON_PMD_CORE_ID) {
 continue;
 }
-uint32_t subtbl_changes = dpcls_subtable_lookup_reprobe(cls);
-if (subtbl_changes) {
-lookup_dpcls_changed++;
-lookup_subtable_changed += subtbl_changes;
+
+struct dp_netdev_port *port = NULL;
+HMAP_FOR_EACH (port, node, >ports) {
+odp_port_t in_port = port->port_no;
+struct dpcls *cls = dp_netdev_pmd_lookup_dpcls(pmd, in_port);
+if (!cls) {
+ 

[ovs-dev] [PATCH] dpif-netlink: "bonding_masters" is a reserved name

2021-06-23 Thread Timothy Redaelli
Currently, on Linux, if you try to create a system datapath called
"bonding_masters", when you have bonding module loaded, you have a
kernel trace
("sysfs: cannot create duplicate filename '/class/net/bonding_masters'").

This trace appears since "bonding" kernel modules creates a file called
"/sys/class/net/bonding_masters", that prevents any network interface to
be called "bonding_masters".

This commits forbid an user to create a system datapath (that is a network
interface) called "bonding_masters" to avoid the kernel trace and to
avoid that bonding module can't work if it's loaded after
"bonding_masters" interface is created.

Reported-at: https://bugzilla.redhat.com/1974303
Signed-off-by: Timothy Redaelli 
---
 lib/dpif-netlink.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index 73d5608a8..ada1d8479 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -330,6 +330,14 @@ dpif_netlink_open(const struct dpif_class *class 
OVS_UNUSED, const char *name,
 uint32_t upcall_pid;
 int error;
 
+/* "bonding_masters" is a reserved interface name under Linux,
+ * since bonding module creates /sys/class/net/bonding_masters
+ * and so no interface can be called "bonding_masters".
+ */
+if (!strcmp(name, "bonding_masters")) {
+return EINVAL;
+}
+
 error = dpif_netlink_init();
 if (error) {
 return error;
-- 
2.31.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2 1/2] Remove Python 2 leftovers.

2021-06-10 Thread Timothy Redaelli
On Wed,  9 Jun 2021 17:25:45 -0400
Rosemarie O'Riorden  wrote:

> Fixes: 1ca0323e7c29 ("Require Python 3 and remove support for Python 2.")
> Reported at: https://bugzilla.redhat.com/show_bug.cgi?id=1949875
> Signed-off-by: Rosemarie O'Riorden 
> ---
> Fix import errors in v1.
> Remove lines that indicate compatibility with python 2.
> 
>  ofproto/ipfix-gen-entities|  2 --
>  ovsdb/ovsdb-idlc.in   |  1 -
>  .../ovs/compat/sortedcontainers/sortedlist.py |  2 --
>  python/ovstest/tests.py   |  2 --
>  python/ovstest/util.py|  2 +-
>  python/setup.py   |  4 ---
>  tests/test-jsonrpc.py |  2 --
>  utilities/checkpatch.py   |  1 -
>  utilities/gdb/ovs_gdb.py  |  1 -
>  utilities/ovs-l3ping.in   | 14 +-
>  utilities/ovs-parse-backtrace.in  | 12 
>  utilities/ovs-pcap.in |  4 +--
>  utilities/ovs-vlan-test.in| 28 +--
>  13 files changed, 29 insertions(+), 46 deletions(-)

Hi,
thank you for your work.

It looks almost good and it passes "make flake8-check". I only added a
small suggestion (see inline), but LTGM.

> diff --git a/ofproto/ipfix-gen-entities b/ofproto/ipfix-gen-entities
> index d5abe9c2e..dcecdab21 100755
> --- a/ofproto/ipfix-gen-entities
> +++ b/ofproto/ipfix-gen-entities
> @@ -7,8 +7,6 @@
>  # notice and this notice are preserved.  This file is offered as-is,
>  # without warranty of any kind.
>  
> -from __future__ import print_function
> -
>  import getopt
>  import re
>  import sys
> diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
> index 5914e0878..61cded16d 100755
> --- a/ovsdb/ovsdb-idlc.in
> +++ b/ovsdb/ovsdb-idlc.in
> @@ -1,6 +1,5 @@
>  #! @PYTHON3@
>  
> -from __future__ import print_function
>  import getopt
>  import os
>  import re
> diff --git a/python/ovs/compat/sortedcontainers/sortedlist.py 
> b/python/ovs/compat/sortedcontainers/sortedlist.py
> index 8aec6bbac..ba5556692 100644
> --- a/python/ovs/compat/sortedcontainers/sortedlist.py
> +++ b/python/ovs/compat/sortedcontainers/sortedlist.py
> @@ -3,8 +3,6 @@
>  """
>  # pylint: disable=redefined-builtin, ungrouped-imports
>  
> -from __future__ import print_function
> -
>  from bisect import bisect_left, bisect_right, insort
>  from collections import Sequence, MutableSequence
>  from functools import wraps
> diff --git a/python/ovstest/tests.py b/python/ovstest/tests.py
> index 6de3cc3af..f959f945e 100644
> --- a/python/ovstest/tests.py
> +++ b/python/ovstest/tests.py
> @@ -10,8 +10,6 @@
>  # See the License for the specific language governing permissions and
>  # limitations under the License.
>  
> -from __future__ import print_function
> -
>  import math
>  import time
>  
> diff --git a/python/ovstest/util.py b/python/ovstest/util.py
> index 72457158f..4caf6c352 100644
> --- a/python/ovstest/util.py
> +++ b/python/ovstest/util.py
> @@ -26,7 +26,7 @@ import socket
>  import struct
>  import subprocess
>  
> -import exceptions
> +import builtins as exceptions

Nit: to avoid possibile misunderstanding since calling builtins
"exceptions" is semantically wrong. Since exceptions is only used for a
single except I guest we could just change the line that uses exceptions
to do directly "except OSError:"

>  import xmlrpc.client
>  
> diff --git a/python/setup.py b/python/setup.py
> index d385d8372..cfe01763f 100644
> --- a/python/setup.py
> +++ b/python/setup.py
> @@ -10,8 +10,6 @@
>  # See the License for the specific language governing permissions and
>  # limitations under the License.
>  
> -from __future__ import print_function
> -
>  import sys
>  
>  from distutils.command.build_ext import build_ext
> @@ -82,8 +80,6 @@ setup_args = dict(
>  'Topic :: Software Development :: Libraries :: Python Modules',
>  'Topic :: System :: Networking',
>  'License :: OSI Approved :: Apache Software License',
> -'Programming Language :: Python :: 2',
> -'Programming Language :: Python :: 2.7',
>  'Programming Language :: Python :: 3',
>  'Programming Language :: Python :: 3.4',
>  'Programming Language :: Python :: 3.5',
> diff --git a/tests/test-jsonrpc.py b/tests/test-jsonrpc.py
> index 3eabcd78d..1df5afa22 100644
> --- a/tests/test-jsonrpc.py
> +++ b/tests/test-jsonrpc.py
> @@ -12,8 +12,6 @@
>  # See the License for the specific language governing permissions and
>  # limitations under the License.
>  
> -from __future__ import print_function
> -
>  import argparse
>  import errno
>  import os
> diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
> index bc6bfae15..ac14da29b 100755
> --- a/utilities/checkpatch.py
> +++ b/utilities/checkpatch.py
> @@ -13,7 +13,6 @@
>  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  # See the License for the 

Re: [ovs-dev] [PATCH v2] ofproto-dpif-xlate: avoid successive ct_clear datapath actions

2021-05-24 Thread Timothy Redaelli
On Tue, 18 May 2021 06:17:48 -0400
Eelco Chaudron  wrote:

> Due to flow lookup optimizations, especially in the resubmit/clone cases,
> we might end up with multiple ct_clear actions, which are not necessary.
> 
> This patch only adds the ct_clear action to the datapath if any ct state
> is tracked.
> 
> Signed-off-by: Eelco Chaudron 
> ---
> v2: Insert ct_clear only when ct information is tracked vs tracking successive
> ct_clear actions.
> 
> ofproto/ofproto-dpif-xlate.c |4 +++-
>  tests/ofproto-dpif.at|   25 +
>  2 files changed, 28 insertions(+), 1 deletion(-)


Acked-By: Timothy Redaelli 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [v2 v2 0/6] MFEX Infrastructure + Optimizations

2021-05-13 Thread Timothy Redaelli
On Thu, 13 May 2021 10:27:19 -0400
Jean Hsiao  wrote:

> 
> On 5/11/21 7:35 AM, Van Haaren, Harry wrote:
> >> -Original Message-----
> >> From: Timothy Redaelli 
> >> Sent: Monday, May 10, 2021 6:43 PM
> >> To: Amber, Kumar ; d...@openvswitch.org
> >> Cc: i.maxim...@ovn.org; jhs...@redhat.com; f...@redhat.com; Van Haaren, 
> >> Harry
> >> 
> >> Subject: Re: [ovs-dev] [v2 v2 0/6] MFEX Infrastructure + Optimizations
> > 
> >
> >> Hi,
> >> we (as Red Hat) did some tests with a "special" build created on top of
> >> master (a019868a6268 at that time) with with the 2 series ("DPIF
> >> Framework + Optimizations" and "MFEX Infrastructure + Optimizations")
> >> cherry-picked.
> >> The spec file was also modified in order to use add "-msse4.2 -mpopcnt"
> >> to OVS CFLAGS.
> > Hi Timothy,
> >
> > Thanks for testing and reporting back your findings! Most of the 
> > configuration is clear to me, but I have a few open questions inline below 
> > for context.
> >
> > The performance numbers reported in the email below do not show benefit 
> > when enabling AVX512, which contradicts our
> > recent whitepaper on benchmarking an Optimized Deployment of OVS, which 
> > includes the AVX512 patches you've benchmarked too.
> > Specifically Table 8. for DPIF/MFEX patches, and Table 9. for the overall 
> > optimizations at a platform level are relevant:
> > https://networkbuilders.intel.com/solutionslibrary/open-vswitch-optimized-deployment-benchmark-technology-guide
> >
> > Based on the differences between these performance reports, there must be 
> > some discrepancy in our testing/measurements.
> > I hope that the questions below help us understand any differences so we 
> > can all measure the benefits from these optimizations.
> >
> > Regards, -Harry
> >
> >
> >> RPM=openvswitch2.15-2.15.0-37.avx512.1.el8fdp (the "special" build with
> >> the patches backported)
> >>
> >> * Master --- 15.2 Mpps
> >> * Plus "avx512_gather 3" Only --- 15.2 Mpps
> >> * Plus "dpif-set dpif_avx512" Only --- 10.1 Mpps
> >> * Plus "miniflow-parser-set study" --- Failed to converge
> >> * Plus all three --- 13.5 Mpps
> > Open questions:
> > 1) Is CPU frequency turbo enabled in any scenario, or always pinned to the 
> > 2.6 GHz base frequency?
> > - A "perf top -C x,y"   (where x,y are datapath hyperthread ids) would 
> > be interesting to compare with 3) below.
> See attached screentshoots for two samples --- master-0 and master-1
> >
> > 2) "plus Avx512 gather 3" (aka, DPCLS in AVX512), we see same performance. 
> > Is DPCLS in use, or is EMC doing all the work?
> > - The output of " ovs-appctl dpif-netdev/pmd-perf-show" would be 
> > interesting to understand where packets are classified.
> 
> EMC doing all the work --- see log below. This could explain why setting 
> avx512 is not helping.
> 
> NOTE: Our initial study showed that disabling EMC didn't help avx512 
> wining the case.
> 
> [root@netqe29 jhsiao]# ovs-appctl dpif-netdev/subtable-lookup-prio-get
> Available lookup functions (priority : name)
>    0 : autovalidator
> *1 : generic*
>    0 : avx512_gather
> [root@netqe29 jhsiao]#
> 
> sleep 60; ovs-appctl dpif-netdev/pmd-perf-show
> 
> 
> Time: 13:54:40.213
> Measurement duration: 2242.679 s
> 
> pmd thread numa_id 0 core_id 24:
> 
>    Iterations: 17531214131  (0.13 us/it)
>    - Used TSC cycles: 5816810246080  (100.1 % of total cycles)
>    - idle iterations:  17446464548  ( 84.1 % of used cycles)
>    - busy iterations: 84749583  ( 15.9 % of used cycles)
>    Rx packets:  2711982944  (1209 Kpps, 340 cycles/pkt)
>    Datapath passes: 2711982944  (1.00 passes/pkt)
>    - EMC hits:  2711677677  (100.0 %)
>    - SMC hits:   0  (  0.0 %)
>    - Megaflow hits: 305261  (  0.0 %, 1.00 subtbl lookups/hit)
>    - Upcalls:    6  (  0.0 %, 0.0 us/upcall)
>    - Lost upcalls:   0  (  0.0 %)
>    Tx packets:  2711982944  (1209 Kpps)
>    Tx batches:    84749583  (32.00 pkts/batch)
> 
> Time: 13:54:40.213
> Measurement duration: 2242.675 s
> 
> pmd thread numa_id 0 core_id 52:
> 
>    Iterations: 17529480287  (0.13 us/it)
>    - Used TSC cycles: 5816709563052  (100.1 % of total cycles)
>    - idle iterations:  17444555421  ( 84.1 % of used cycles)
>  

[ovs-dev] [PATCH] ovs-dpctl-top: fix ovs-dpctl-top via pipe

2021-05-12 Thread Timothy Redaelli
Currently it's not possible to use ovs-dpctl-top via pipe (eg:
ovs-dpctl dump-flows | ovs-dpctl-top --script --verbose) since Python3
doesn't allow to open a file (stdin in our case) in binary mode without
buffering enabled.

This commit changes the behaviour in order to directly pass stdin to
flows_read instead of re-opening it without buffering.

Signed-off-by: Timothy Redaelli 
---
 utilities/ovs-dpctl-top.in | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/utilities/ovs-dpctl-top.in b/utilities/ovs-dpctl-top.in
index fbe6e4f56..2c1766eff 100755
--- a/utilities/ovs-dpctl-top.in
+++ b/utilities/ovs-dpctl-top.in
@@ -1236,11 +1236,7 @@ def flows_script(args):
 
 if (args.flowFiles is None):
 logging.info("reading flows from stdin")
-ihdl = os.fdopen(sys.stdin.fileno(), 'r', 0)
-try:
-flow_db = flows_read(ihdl, flow_db)
-finally:
-ihdl.close()
+flow_db = flows_read(sys.stdin, flow_db)
 else:
 for flowFile in args.flowFiles:
 logging.info("reading flows from %s", flowFile)
-- 
2.31.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] rhel: use /run instead of /var/run

2021-05-12 Thread Timothy Redaelli
Systemd unit file generates warnings about PID file path since /var/run
is a legacy path so just use /run instead of /var/run.

/var/run is a symlink of /run starting from RHEL7 (and any other distribution
that uses systemd).

Reported-at: https://bugzilla.redhat.com/1952081
Signed-off-by: Timothy Redaelli 
---
 rhel/etc_logrotate.d_openvswitch| 4 ++--
 rhel/usr_lib_systemd_system_openvswitch-ipsec.service   | 2 +-
 ...sr_lib_systemd_system_ovs-delete-transient-ports.service | 2 +-
 rhel/usr_lib_systemd_system_ovs-vswitchd.service.in | 6 +++---
 rhel/usr_lib_systemd_system_ovsdb-server.service| 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/rhel/etc_logrotate.d_openvswitch b/rhel/etc_logrotate.d_openvswitch
index f4302ffbc..c0f476744 100644
--- a/rhel/etc_logrotate.d_openvswitch
+++ b/rhel/etc_logrotate.d_openvswitch
@@ -13,8 +13,8 @@
 missingok
 postrotate
 # Tell Open vSwitch daemons to reopen their log files
-if [ -d /var/run/openvswitch ]; then
-for ctl in /var/run/openvswitch/*.ctl; do
+if [ -d /run/openvswitch ]; then
+for ctl in /run/openvswitch/*.ctl; do
 ovs-appctl -t "$ctl" vlog/reopen 2>/dev/null || :
 done
 fi
diff --git a/rhel/usr_lib_systemd_system_openvswitch-ipsec.service 
b/rhel/usr_lib_systemd_system_openvswitch-ipsec.service
index d8f47af68..92dad44f9 100644
--- a/rhel/usr_lib_systemd_system_openvswitch-ipsec.service
+++ b/rhel/usr_lib_systemd_system_openvswitch-ipsec.service
@@ -5,7 +5,7 @@ After=openvswitch.service
 
 [Service]
 Type=forking
-PIDFile=/var/run/openvswitch/ovs-monitor-ipsec.pid
+PIDFile=/run/openvswitch/ovs-monitor-ipsec.pid
 ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \
 --ike-daemon=libreswan start-ovs-ipsec
 ExecStop=/usr/share/openvswitch/scripts/ovs-ctl stop-ovs-ipsec
diff --git a/rhel/usr_lib_systemd_system_ovs-delete-transient-ports.service 
b/rhel/usr_lib_systemd_system_ovs-delete-transient-ports.service
index 4cd4d7f57..d4d7b204b 100644
--- a/rhel/usr_lib_systemd_system_ovs-delete-transient-ports.service
+++ b/rhel/usr_lib_systemd_system_ovs-delete-transient-ports.service
@@ -2,7 +2,7 @@
 Description=Open vSwitch Delete Transient Ports
 After=ovsdb-server.service
 Before=ovs-vswitchd.service
-AssertPathExists=/var/run/openvswitch/db.sock
+AssertPathExists=/run/openvswitch/db.sock
 
 [Service]
 Type=oneshot
diff --git a/rhel/usr_lib_systemd_system_ovs-vswitchd.service.in 
b/rhel/usr_lib_systemd_system_ovs-vswitchd.service.in
index ff43dae96..6d021618b 100644
--- a/rhel/usr_lib_systemd_system_ovs-vswitchd.service.in
+++ b/rhel/usr_lib_systemd_system_ovs-vswitchd.service.in
@@ -4,14 +4,14 @@ After=ovsdb-server.service network-pre.target 
systemd-udev-settle.service
 Before=network.target network.service
 Requires=ovsdb-server.service
 ReloadPropagatedFrom=ovsdb-server.service
-AssertPathIsReadWrite=/var/run/openvswitch/db.sock
+AssertPathIsReadWrite=/run/openvswitch/db.sock
 PartOf=openvswitch.service
 
 [Service]
 Type=forking
-PIDFile=/var/run/openvswitch/ovs-vswitchd.pid
+PIDFile=/run/openvswitch/ovs-vswitchd.pid
 Restart=on-failure
-Environment=XDG_RUNTIME_DIR=/var/run/openvswitch
+Environment=XDG_RUNTIME_DIR=/run/openvswitch
 EnvironmentFile=/etc/openvswitch/default.conf
 EnvironmentFile=-/etc/sysconfig/openvswitch
 EnvironmentFile=-/run/openvswitch.useropts
diff --git a/rhel/usr_lib_systemd_system_ovsdb-server.service 
b/rhel/usr_lib_systemd_system_ovsdb-server.service
index ed6419f31..558632320 100644
--- a/rhel/usr_lib_systemd_system_ovsdb-server.service
+++ b/rhel/usr_lib_systemd_system_ovsdb-server.service
@@ -7,7 +7,7 @@ PartOf=openvswitch.service
 
 [Service]
 Type=forking
-PIDFile=/var/run/openvswitch/ovsdb-server.pid
+PIDFile=/run/openvswitch/ovsdb-server.pid
 Restart=on-failure
 EnvironmentFile=/etc/openvswitch/default.conf
 EnvironmentFile=-/etc/sysconfig/openvswitch
@@ -18,7 +18,7 @@ EnvironmentFile=-/run/openvswitch.useropts
 # OVS_USER_ID from default.conf or sysconfig.
 ExecStartPre=/usr/bin/rm -f /run/openvswitch.useropts
 
-ExecStartPre=-/usr/bin/chown ${OVS_USER_ID} /var/run/openvswitch 
/var/log/openvswitch
+ExecStartPre=-/usr/bin/chown ${OVS_USER_ID} /run/openvswitch 
/var/log/openvswitch
 ExecStartPre=/bin/sh -c '/usr/bin/echo "OVS_USER_ID=${OVS_USER_ID}" > 
/run/openvswitch.useropts'
 ExecStartPre=/bin/sh -c 'if [ "$${OVS_USER_ID/:*/}" != "root" ]; then 
/usr/bin/echo "OVS_USER_OPT=--ovs-user=${OVS_USER_ID}" >> 
/run/openvswitch.useropts; fi'
 ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \
-- 
2.31.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [v2 v2 0/6] MFEX Infrastructure + Optimizations

2021-05-10 Thread Timothy Redaelli

On 4/28/21 11:19 AM, Kumar Amber wrote:

v2 updates:
- reabse on to latest DPIF v11

This patchset introduces miniflow extract Infrastructure changes
which allows user to choose different type of ISA based optimized
miniflow extract variants which can be user choosen or set based on
packets studies automatically by OVS using different commands.

The Infrastructure also provides a way to check the correctness of
different ISA optimized miniflow extract variants against the scalar
version.

This Patchset depends on the DPIF patchsets :
http://patchwork.ozlabs.org/project/openvswitch/list/?series=240997

Kumar Amber (6):
   dpif-netdev: Add command line and function pointer for miniflow
 extract
   dpif-netdev: Add auto validation function for miniflow extract
   dpif-netdev: Add study function to select the best mfex function
   dpif-netdev: add avx512 miniflow extract for traffic ip/udp
   docs/dpdk/bridge: add miniflow extract section.
   dpif-netdev: Add configure to enable autovalidator at build time.

  Documentation/topics/dpdk/bridge.rst |  85 +++
  NEWS |  10 ++
  acinclude.m4 |  16 ++
  configure.ac |   1 +
  lib/automake.mk  |   4 +
  lib/dpdk.c   |   1 +
  lib/dpif-netdev-avx512.c |  23 ++-
  lib/dpif-netdev-extract-avx512.c | 218 +++
  lib/dpif-netdev-extract-study.c  | 120 +++
  lib/dpif-netdev-private-extract.c| 190 +++
  lib/dpif-netdev-private-extract.h| 137 +
  lib/dpif-netdev-private-thread.h |   4 +
  lib/dpif-netdev.c| 126 +++-
  13 files changed, 928 insertions(+), 7 deletions(-)
  create mode 100644 lib/dpif-netdev-extract-avx512.c
  create mode 100644 lib/dpif-netdev-extract-study.c
  create mode 100644 lib/dpif-netdev-private-extract.c
  create mode 100644 lib/dpif-netdev-private-extract.h



Hi,
we (as Red Hat) did some tests with a "special" build created on top of 
master (a019868a6268 at that time) with with the 2 series ("DPIF
Framework + Optimizations" and "MFEX Infrastructure + Optimizations") 
cherry-picked.
The spec file was also modified in order to use add "-msse4.2 -mpopcnt" 
to OVS CFLAGS.


RPM=openvswitch2.15-2.15.0-37.avx512.1.el8fdp (the "special" build with 
the patches backported)


  * Master --- 15.2 Mpps
  * Plus "avx512_gather 3" Only --- 15.2 Mpps
  * Plus "dpif-set dpif_avx512" Only --- 10.1 Mpps
  * Plus "miniflow-parser-set study" --- Failed to converge
  * Plus all three --- 13.5 Mpps

RPM=openvswitch2.15-2.15.0-15.el8fdp (w/o "-msse4.2 -mpopcnt")

  * 15.2 Mpps

P2P benchmark
  * ovs-dpdk/25 Gb i40e <-> trex/i40e
  * single queue two pmd's --- two HT's  out of a CPU core.

Host CPU
Model name:  Intel(R) Xeon(R) Gold 6132 CPU @ 2.60GHz

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] Add ability to override default Release suffix in RPM packages

2021-05-05 Thread Timothy Redaelli
On Tue, 4 May 2021 06:24:33 +
Guzowski Adrian via dev  wrote:

> In some cases, like building OvS packages in Jenkins, it may be
> useful to set a custom version suffix that will correspond with
> job's build number, etc. Currently, version number is explicitly
> set to 1. This change adds a define "release_number" that may be
> overridden during package bulding process:
> 
> rpmbuild -ba --define="release_number X" ...
> 
> Signed-off-by: Adrian Guzowski 
> ---
>  rhel/kmod-openvswitch-rhel6.spec.in  | 3 ++-
>  rhel/openvswitch-dkms.spec.in| 4 ++--
>  rhel/openvswitch-fedora.spec.in  | 4 +++-
>  rhel/openvswitch-kmod-fedora.spec.in | 4 +++-
>  rhel/openvswitch.spec.in | 4 +++-
>  5 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/rhel/kmod-openvswitch-rhel6.spec.in 
> b/rhel/kmod-openvswitch-rhel6.spec.in
> index 7d3d9b498..de69863d7 100644
> --- a/rhel/kmod-openvswitch-rhel6.spec.in
> +++ b/rhel/kmod-openvswitch-rhel6.spec.in
> @@ -9,10 +9,11 @@
>  # without warranty of any kind.
> 
>  %define oname openvswitch
> +%{!?release_number:%define release_number 1}
> 
>  Name:   kmod-%{oname}
>  Version:@VERSION@
> -Release:1%{?dist}
> +Release:%{release_number}%{?dist}

Hi,
%{?release_number}%{?!release_number:1}
^ this pattern is more common, instead of defining if not defined, but I
don't have a strong preference about it

I also see that "0-day Robot" reported an error since the From: field
of you email is ovs-dev@openvswitch.org instead of your email address

>  Summary:Open vSwitch kernel module
> 
>  Group:  System/Kernel
> diff --git a/rhel/openvswitch-dkms.spec.in b/rhel/openvswitch-dkms.spec.in
> index a47c038fd..c8a978a17 100644
> --- a/rhel/openvswitch-dkms.spec.in
> +++ b/rhel/openvswitch-dkms.spec.in
> @@ -8,10 +8,11 @@
>  # without warranty of any kind.
> 
>  %define oname openvswitch
> +%{!?release_number:%define release_number 1}
> 
>  Name: %{oname}-dkms
>  Version:  @VERSION@
> -Release:  1%{?dist}
> +Release:  %{release_number}%{?dist}
>  Summary:  Open vSwitch kernel module
> 
>  Group:System/Kernel
> @@ -27,7 +28,6 @@ BuildRoot:%(mktemp -ud 
> %{_tmppath}/%{name}-%{version}-%{release}-XX)
>  # conflicts with the openvswitch-debuginfo package for OVS userspace).
>  %undefine _enable_debug_packages
> 
> -
>  %description
>  Open vSwitch Linux kernel module.
> 
> diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
> index e457fa679..90f242b1f 100644
> --- a/rhel/openvswitch-fedora.spec.in
> +++ b/rhel/openvswitch-fedora.spec.in
> @@ -44,6 +44,8 @@
>  %define _rundir /run
>  %endif
> 
> +%{!?release_number:%define release_number 1}
> +
>  Name: openvswitch
>  Summary: Open vSwitch
>  Group: System Environment/Daemons
> @@ -54,7 +56,7 @@ Version: @VERSION@
>  # lib/sflow*.[ch] files are SISSL
>  # datapath/ is GPLv2 (although not built into any of the binary packages)
>  License: ASL 2.0 and LGPLv2+ and SISSL
> -Release: 1%{?dist}
> +Release: %{release_number}%{?dist}
>  Source: http://openvswitch.org/releases/%{name}-%{version}.tar.gz
> 
>  BuildRequires: gcc gcc-c++
> diff --git a/rhel/openvswitch-kmod-fedora.spec.in 
> b/rhel/openvswitch-kmod-fedora.spec.in
> index ff190064f..e5f78701f 100644
> --- a/rhel/openvswitch-kmod-fedora.spec.in
> +++ b/rhel/openvswitch-kmod-fedora.spec.in
> @@ -25,6 +25,8 @@
>  #define kernel %{kernel_source}
>  %{?kversion:%define kernel %kversion}
> 
> +%{!?release_number:%define release_number 1}
> +
>  Name: openvswitch-kmod
>  Summary: Open vSwitch Kernel Modules
>  Group: System Environment/Daemons
> @@ -34,7 +36,7 @@ Version: @VERSION@
> 
>  # The entire source code is ASL 2.0 except datapath/ which is GPLv2
>  License: GPLv2
> -Release: 1%{?dist}
> +Release: %{release_number}%{?dist}
>  Source: openvswitch-%{version}.tar.gz
>  #Source1: openvswitch-init
>  Buildroot: /tmp/openvswitch-xen-rpm
> diff --git a/rhel/openvswitch.spec.in b/rhel/openvswitch.spec.in
> index ee8b3c9ea..220e5c747 100644
> --- a/rhel/openvswitch.spec.in
> +++ b/rhel/openvswitch.spec.in
> @@ -21,6 +21,8 @@
>  # testing out of tree kernel modules the appropriate openvswitch-kmod
>  # package should be installed first.
> 
> +%{!?release_number:%define release_number 1}
> +
>  Name: openvswitch
>  Summary: Open vSwitch daemon/database/utilities
>  Group: System Environment/Daemons
> @@ -29,7 +31,7 @@ Vendor: Nicira, Inc.
>  Version: @VERSION@
> 
>  License: ASL 2.0
> -Release: 1
> +Release: %{release_number}%{?dist}
>  Source: openvswitch-%{version}.tar.gz
>  Buildroot: /tmp/openvswitch-rpm
>  Requires: logrotate, hostname, python >= 2.7, python-six
> --
> 2.30.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] rpm: Don't mangle shebangs when building DKMS RPM package

2021-05-05 Thread Timothy Redaelli
On Wed, 5 May 2021 05:37:41 +
Guzowski Adrian via dev  wrote:

> While building the package, some .in files are being subject to shebang
> substitution, but the process fails, because given scripts have
> placeholders in place of shebangs. In order to fix the issue, don't mangle
> shebangs in this specific package.
> 
> Signed-off-by: Guzowski Adrian 
> ---
>  rhel/openvswitch-dkms.spec.in | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/rhel/openvswitch-dkms.spec.in b/rhel/openvswitch-dkms.spec.in
> index a47c038fd..d9955f361 100644
> --- a/rhel/openvswitch-dkms.spec.in
> +++ b/rhel/openvswitch-dkms.spec.in
> @@ -27,6 +27,8 @@ BuildRoot:%(mktemp -ud 
> %{_tmppath}/%{name}-%{version}-%{release}-XX)
>  # conflicts with the openvswitch-debuginfo package for OVS userspace).
>  %undefine _enable_debug_packages
> 
> +# Exclude input files from mangling
> +%global __brp_mangle_shebangs_exclude_from ^/usr/src/.*$
> 
>  %description
>  Open vSwitch Linux kernel module.
> --
> 2.30.2

Hi,
since almost any file is under /usr/src, you could just disable the
mangling feature entirely [1] instead of specify a regexp:

%undefine __brp_mangle_shebangs

[1]
https://docs.fedoraproject.org/en-US/packaging-guidelines/#_shebang_lines

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [v2 v2 4/6] dpif-netdev: add avx512 miniflow extract for traffic ip/udp

2021-04-29 Thread Timothy Redaelli
On Wed, 28 Apr 2021 14:49:29 +0530
Kumar Amber  wrote:

> This patch introduces avx512 optimized function
> pointer for IP/UDP traffic type and supporting
> functions in dpif-netdev-extract-avx512.
> 
> Signed-off-by: Harry van Haaren 
> Co-authored-by: Kumar Amber 
> Signed-off-by: Kumar Amber 
> ---
>  lib/automake.mk   |   1 +
>  lib/dpdk.c|   1 +
>  lib/dpif-netdev-extract-avx512.c  | 218 ++
>  lib/dpif-netdev-private-extract.c |   5 +
>  lib/dpif-netdev-private-extract.h |  11 ++
>  5 files changed, 236 insertions(+)
>  create mode 100644 lib/dpif-netdev-extract-avx512.c
> 

Hi,
unlucky this patch breaks compilation on non-x86 arches:

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I ../include -I ./include -I 
../lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare 
-Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter 
-Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition 
-Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing 
-Wswitch-bool -Wlogical-not-parentheses -Wsizeof-array-argument -Wbool-compare 
-Wshift-negative-value -Wduplicated-cond -Wshadow -Wmultistatement-macros 
-Wcast-align=strict -O2 -g -pipe -Wall -Werror=format-security 
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions 
-fstack-protector-strong -grecord-gcc-switches 
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13 -mtune=z14 
-fasynchronous-unwind-tables -fstack-clash-protection -c 
../lib/dpif-netdev-extract-avx512.c  -fPIC -DPIC -o 
lib/.libs/dpif-netdev-extract-avx512.o
../lib/dpif-netdev-extract-avx512.c:18:10: fatal error: immintrin.h: No such 
file or directory
 #include 
  ^
compilation terminated.
make[2]: *** [Makefile:4562: lib/dpif-netdev-extract-avx512.lo] Error 1
make[2]: *** Waiting for unfinished jobs

You should, probably, keep all the file content inside an #ifdef
__x86_64__, and probably also inside an #if !defined(__CHECKER__), like
dpif-netdev-lookup-avx512-gather.c and dpif-netdev-avx512.c.

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] xml2nroff: Fix formatting of action headers in ovs-actions(7) manpage.

2021-04-16 Thread Timothy Redaelli
On Wed, 14 Apr 2021 13:40:20 -0700
Ben Pfaff  wrote:

> The action headings were coming out all smashed together, like
> "Theoutputaction".  This fixes them so that they appear correctly, like
> "The output action".
> 
> The previous code stripped starting and ending spaces on a per-node
> basis, so that "The ", "output", and " action" each got
> stripped down to "The", "output", "action" after processing.  This
> commit changes it so that stripping happens after concatenation, fixing
> the problem.
> 
> Signed-off-by: Ben Pfaff 
> ---
>  python/build/nroff.py | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)

Patch applied, manpages rebuilt and did "man -l lib/ovs-actions.7"

Acked-By: Timothy Redaelli 
Tested-By: Timothy Redaelli 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] rhel: increase timeout of ovsdb-server.service to 300s

2021-03-08 Thread Timothy Redaelli
On Fri, 5 Mar 2021 10:34:36 -0800
Ben Pfaff  wrote:

> On Fri, Mar 05, 2021 at 12:47:05PM +0100, Timothy Redaelli wrote:
> > In some scenarios starting ovsdb-server takes more than 90 seconds and
> > so ovsdb-server.service is marked as failed.
> > 
> > Signed-off-by: Timothy Redaelli 
> 
> I'm surprised it takes so long.  What leads to that?  Is it a bug in
> ovsdb-server?

Hi,
The scenario is an openshift (RHOCP4.6) server in low-performance mode
after a reboot of the server.

After the failure systemd automatically restarts ovsdb-server.service
(that starts successfully at this time), but due to [1]
openvswitch.service and ovs-vswitchd.service are not started and they
needs to be started manually.
In the meanwhile systemd implements the RFE in [1], I think changing the
timeout to 300 seconds (the same timeout we already use for
ovs-vswitchd.service) is a good workaround.

[1] https://github.com/systemd/systemd/issues/18856

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] rhel: increase timeout of ovsdb-server.service to 300s

2021-03-05 Thread Timothy Redaelli
In some scenarios starting ovsdb-server takes more than 90 seconds and
so ovsdb-server.service is marked as failed.

Signed-off-by: Timothy Redaelli 
---
NOTE: Currently systemd will not start openvswitch.service
and ovs-vswitchd.service if ovsdb-server.service is automatically restarted
after a failure, but this is a feature that needs to be implemented in systemd
itself (systemd#18856).
---
 rhel/usr_lib_systemd_system_ovsdb-server.service | 1 +
 1 file changed, 1 insertion(+)

diff --git a/rhel/usr_lib_systemd_system_ovsdb-server.service 
b/rhel/usr_lib_systemd_system_ovsdb-server.service
index 98338b9df..ed6419f31 100644
--- a/rhel/usr_lib_systemd_system_ovsdb-server.service
+++ b/rhel/usr_lib_systemd_system_ovsdb-server.service
@@ -29,3 +29,4 @@ ExecStop=/usr/share/openvswitch/scripts/ovs-ctl 
--no-ovs-vswitchd stop
 ExecReload=/usr/share/openvswitch/scripts/ovs-ctl --no-ovs-vswitchd \
${OVS_USER_OPT} \
--no-monitor restart $OPTIONS
+TimeoutSec=300
-- 
2.29.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] rhel: Update for DPDK 20.11

2021-01-22 Thread Timothy Redaelli
With DPDK 20.11, meson and pkgconfig are used instead of the old
Makefile-based system and so --with-dpdk option is changed to only
accept shared or static instead of the directory.

This commit uses --with-dpdk=shared since Fedora and RHEL ship shared
libraries of DPDK.

Fixes: 252e1e576443 ("dpdk: Update to use DPDK v20.11.")
Signed-off-by: Timothy Redaelli 
---
 rhel/openvswitch-fedora.spec.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index 2c0c4fa18..21929e6cf 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -162,7 +162,7 @@ This package provides IPsec tunneling support for OVS 
tunnels.
 --disable-libcapng \
 %endif
 %if %{with dpdk}
---with-dpdk=$(dirname %{_datadir}/dpdk/*/.config) \
+--with-dpdk=shared \
 %endif
 --enable-ssl \
 --disable-static \
-- 
2.29.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v4 2/2] python: set ovs.dirs variables with build system values

2020-11-12 Thread Timothy Redaelli
On Wed, 11 Nov 2020 04:25:30 -0500
Mark Gray  wrote:

> ovs/dirs.py should be auto-generated using the template
> ovs/dirs.py.template at build time. This will set the
> ovs.dirs python variables with a value specified by the
> environment or, if the environment variable is not set, from
> the build system.
> 
> Signed-off-by: Mark Gray 

Acked-By: Timothy Redaelli 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v3 2/2] python: set ovs.dirs variables with build system values

2020-11-09 Thread Timothy Redaelli
On Tue, 27 Oct 2020 10:45:18 -0400
Mark Gray  wrote:

> ovs/dirs.py should be auto-generated using the template
> ovs/dirs.py.template at build time. This will set the
> ovs.dirs python variables with a value specified by the
> environment or, if the environment variable is not set, from
> the build system.
> 
> Signed-off-by: Mark Gray 
> ---
>  lib/automake.mk   |  2 +-
>  python/automake.mk| 13 +++--
>  python/ovs/.gitignore |  1 +
>  python/ovs/dirs.py| 31 ---
>  4 files changed, 9 insertions(+), 38 deletions(-)
>  delete mode 100644 python/ovs/dirs.py
> 
> diff --git a/lib/automake.mk b/lib/automake.mk
> index 380a672287ac..8eeb6c3f676c 100644
> --- a/lib/automake.mk
> +++ b/lib/automake.mk
> @@ -575,7 +575,7 @@ MAN_FRAGMENTS += \
>  OVSIDL_BUILT += lib/vswitch-idl.c lib/vswitch-idl.h lib/vswitch-idl.ovsidl
>  
>  EXTRA_DIST += lib/vswitch-idl.ann
> -lib/vswitch-idl.ovsidl: vswitchd/vswitch.ovsschema lib/vswitch-idl.ann
> +lib/vswitch-idl.ovsidl: vswitchd/vswitch.ovsschema lib/vswitch-idl.ann 
> python/ovs/dirs.py
>   $(AM_V_GEN)$(OVSDB_IDLC) annotate $(srcdir)/vswitchd/vswitch.ovsschema 
> $(srcdir)/lib/vswitch-idl.ann > $@.tmp && mv $@.tmp $@
>  
>  lib/dirs.c: lib/dirs.c.in Makefile
> diff --git a/python/automake.mk b/python/automake.mk
> index 2f08c7701484..a88addf72326 100644
> --- a/python/automake.mk
> +++ b/python/automake.mk
> @@ -107,12 +107,13 @@ ALL_LOCAL += $(srcdir)/python/ovs/dirs.py
>  $(srcdir)/python/ovs/dirs.py: python/ovs/dirs.py.template
>   $(AM_V_GEN)sed \
>   -e '/^##/d' \
> --e 's,[@]pkgdatadir[@],/usr/local/share/openvswitch,g' \
> --e 's,[@]RUNDIR[@],/var/run,g' \
> --e 's,[@]LOGDIR[@],/usr/local/var/log,g' \
> --e 's,[@]bindir[@],/usr/local/bin,g' \
> --e 's,[@]sysconfdir[@],/usr/local/etc,g' \
> --e 's,[@]DBDIR[@],/usr/local/etc/openvswitch,g' \
> +-e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
> +-e 's,[@]RUNDIR[@],$(RUNDIR),g' \
> +-e 's,[@]LOGDIR[@],$(LOGDIR),g' \
> +-e 's,[@]bindir[@],$(bindir),g' \
> +-e 's,[@]sysconfdir[@],$(sysconfdir),g' \
> +-e 's,[@]DBDIR[@],$(sysconfdir),g' \

This should be $(sysconfdir)/openvswitch or DBDIR will be
/usr/local/etc instead of /usr/local/etc/openvswitch

>   < $? > $@.tmp && \
>   mv $@.tmp $@
>  EXTRA_DIST += python/ovs/dirs.py.template
> +CLEANFILES += python/ovs/dirs.py
> diff --git a/python/ovs/.gitignore b/python/ovs/.gitignore
> index 98527864664d..51030beca437 100644
> --- a/python/ovs/.gitignore
> +++ b/python/ovs/.gitignore
> @@ -1 +1,2 @@
>  version.py
> +dir.py
> diff --git a/python/ovs/dirs.py b/python/ovs/dirs.py
> deleted file mode 100644
> index c67aecbb46da..
> --- a/python/ovs/dirs.py
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -# Licensed under the Apache License, Version 2.0 (the "License");
> -# you may not use this file except in compliance with the License.
> -# You may obtain a copy of the License at:
> -#
> -# http://www.apache.org/licenses/LICENSE-2.0
> -#
> -# Unless required by applicable law or agreed to in writing, software
> -# distributed under the License is distributed on an "AS IS" BASIS,
> -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> -# See the License for the specific language governing permissions and
> -# limitations under the License.
> -
> -# The @variables@ in this file are replaced by default directories for
> -# use in python/ovs/dirs.py in the source directory and replaced by the
> -# configured directories for use in the installed python/ovs/dirs.py.
> -#
> -import os
> -
> -# Note that the use of """ is to aid in dealing with paths with quotes in 
> them.
> -PKGDATADIR = os.environ.get("OVS_PKGDATADIR", 
> """/usr/local/share/openvswitch""")
> -RUNDIR = os.environ.get("OVS_RUNDIR", """/var/run""")
> -LOGDIR = os.environ.get("OVS_LOGDIR", """/usr/local/var/log""")
> -BINDIR = os.environ.get("OVS_BINDIR", """/usr/local/bin""")
> -
> -DBDIR = os.environ.get("OVS_DBDIR")
> -if not DBDIR:
> -sysconfdir = os.environ.get("OVS_SYSCONFDIR")
> -if sysconfdir:
> -DBDIR = "%s/openvswitch" % sysconfdir
> -else:
> -DBDIR = """/usr/local/etc/openvswitch"""

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] Documentation: Fix rendering of extra repo info for RHEL 8

2020-11-03 Thread Timothy Redaelli
In commit a82083ee3091 ("Documentation: Add extra repo info for RHEL 8")
a newline was missing to correctly generate the code block to add
codeready-builder repository.

This commit adds the missing newline to correctly generate the code block
with the RHEL 8 codeready-builder instructions.

Fixes: a82083ee3091 ("Documentation: Add extra repo info for RHEL 8")
Cc: gvrose8...@gmail.com
Signed-off-by: Timothy Redaelli 
---
 Documentation/intro/install/fedora.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/intro/install/fedora.rst 
b/Documentation/intro/install/fedora.rst
index e5324e1df..4a2f3507c 100644
--- a/Documentation/intro/install/fedora.rst
+++ b/Documentation/intro/install/fedora.rst
@@ -70,6 +70,7 @@ repositories to help yum-builddep, e.g.::
 $ subscription-manager repos --enable=rhel-7-server-optional-rpms
 
 or for RHEL 8::
+
 $ subscription-manager repos \
   --enable=codeready-builder-for-rhel-8-x86_64-rpms
 
-- 
2.28.0

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 2/1] tests: Add parse-flow tests for MPLS fields

2020-10-26 Thread Timothy Redaelli
Currently "ovs-ofctl parse-flows (NXM)" test doesn't test MPLS fields at all.

This commit adds a test for the the 4 MPLS fields (mpls_label, mpls_tc,
mpls_bos and mpls_ttl) to "ovs-ofctl parse-flows (NXM)" test.

Signed-off-by: Timothy Redaelli 
---
 tests/ovs-ofctl.at | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
index b6951f404..7876b474b 100644
--- a/tests/ovs-ofctl.at
+++ b/tests/ovs-ofctl.at
@@ -434,6 +434,7 @@ tcp,actions=fin_timeout(idle_timeout=5,hard_timeout=15)
 actions=controller(max_len=123,reason=invalid_ttl,id=555)
 
actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
 
actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678,sampling_port=56789)
+mpls,mpls_label=5,mpls_tc=1,mpls_ttl=1,mpls_bos=0,actions=drop
 ip,actions=ct(commit,zone=5)
 ip,actions=ct(commit,exec(load(1->NXM_NX_CT_MARK[])))
 ip,actions=ct(commit,exec(load(0x1->NXM_NX_CT_LABEL[])))
@@ -490,6 +491,7 @@ NXT_FLOW_MOD: ADD table:255 tcp 
actions=fin_timeout(idle_timeout=5,hard_timeout=
 NXT_FLOW_MOD: ADD table:255 
actions=controller(reason=invalid_ttl,max_len=123,id=555)
 NXT_FLOW_MOD: ADD table:255 
actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
 NXT_FLOW_MOD: ADD table:255 
actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678,sampling_port=56789)
+NXT_FLOW_MOD: ADD table:255 mpls,mpls_label=5,mpls_tc=1,mpls_ttl=1,mpls_bos=0 
actions=drop
 NXT_FLOW_MOD: ADD table:255 ip actions=ct(commit,zone=5)
 NXT_FLOW_MOD: ADD table:255 ip 
actions=ct(commit,exec(load:0x1->NXM_NX_CT_MARK[]))
 NXT_FLOW_MOD: ADD table:255 ip 
actions=ct(commit,exec(load:0x1->NXM_NX_CT_LABEL[0..63],load:0->NXM_NX_CT_LABEL[64..127]))
-- 
2.26.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] ofp-actions: Fix userspace support for mpls_ttl

2020-09-18 Thread Timothy Redaelli
Currently mpls_ttl is ignored when a flow is added because MFF_MPLS_TTL is
not handled in nx_put_raw().

This commit adds the correct handling of MFF_MPLS_TTL in nx_put_raw().

Fixes: bef3f465bcd5 ("openflow: Support matching and modifying MPLS TTL field.")
Cc: b...@ovn.org
Signed-off-by: Timothy Redaelli 
---
 lib/nx-match.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/lib/nx-match.c b/lib/nx-match.c
index 3ffd7d9d7..325a20ec6 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -1133,6 +1133,11 @@ nx_put_raw(struct ofpbuf *b, enum ofp_version oxm, const 
struct match *match,
   mpls_lse_to_bos(flow->mpls_lse[0]));
 }
 
+if (match->wc.masks.mpls_lse[0] & htonl(MPLS_TTL_MASK)) {
+nxm_put_8(, MFF_MPLS_TTL, oxm,
+   mpls_lse_to_ttl(flow->mpls_lse[0]));
+}
+
 if (match->wc.masks.mpls_lse[0] & htonl(MPLS_LABEL_MASK)) {
 nxm_put_32(, MFF_MPLS_LABEL, oxm,
htonl(mpls_lse_to_label(flow->mpls_lse[0])));
-- 
2.26.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] rhel: move conf.db to /var/lib/openvswitch, using symlinks

2020-09-10 Thread Timothy Redaelli
conf.db is by default at /etc/openvswitch, but it should be at
/var/lib/openvswitch like on Debian or like ovnnb_db.db and ovnsb_db.db.

If conf.db already exists in /etc/openvswitch then it's moved to
/var/lib/openvswitch.
Symlinks are created for conf.db and .conf.db.~lock~ into /etc/openvswitch
for backward compatibility.

Reported-at: https://bugzilla.redhat.com/1830857
Reported-by: Yedidyah Bar David 
Signed-off-by: Timothy Redaelli 
---
 rhel/openvswitch-fedora.spec.in | 23 +++
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index e3e0d8acf..d70959eba 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -244,8 +244,6 @@ rm -rf $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
 
 install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
 
-touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
-touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/.conf.db.~lock~
 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/system-id.conf
 
 install -p -m 644 -D selinux/openvswitch-custom.pp \
@@ -333,6 +331,23 @@ if [ $1 -eq 1 ]; then
 fi
 %endif
 
+# Ensure that /etc/openvswitch/conf.db links to /var/lib/openvswitch,
+# moving an existing file if there is one.
+#
+# Ditto for .conf.db.~lock~.
+for base in conf.db .conf.db.~lock~; do
+new=/var/lib/openvswitch/$base
+old=/etc/openvswitch/$base
+if test -f $old && test ! -e $new; then
+mv $old $new
+fi
+if test ! -e $old && test ! -h $old; then
+ln -s $new $old
+fi
+touch $new
+chown openvswitch: $new
+done
+
 %if 0%{?systemd_post:1}
 # This may not enable openvswitch service or do daemon-reload.
 %systemd_post %{name}.service
@@ -418,8 +433,8 @@ fi
 %endif
 %dir %{_sysconfdir}/openvswitch
 %{_sysconfdir}/openvswitch/default.conf
-%config %ghost %{_sysconfdir}/openvswitch/conf.db
-%ghost %{_sysconfdir}/openvswitch/.conf.db.~lock~
+%config %ghost %{_sharedstatedir}/openvswitch/conf.db
+%ghost %{_sharedstatedir}/openvswitch/.conf.db.~lock~
 %config %ghost %{_sysconfdir}/openvswitch/system-id.conf
 %config(noreplace) %{_sysconfdir}/sysconfig/openvswitch
 %defattr(-,root,root)
-- 
2.26.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] Remove manpages.mk from git

2020-09-03 Thread Timothy Redaelli
manpages.mk is generated at build-time using sodepends.py and so there is no
need to keep it in git.

Signed-off-by: Timothy Redaelli 
---
v2:
generate manpages.mk in builddir instead of srcdir and add it to
CLEANFILES to make "make distcleancheck" happy.
Thank you Ilya and travis for reporting.
---
 .gitignore  |   1 +
 Makefile.am |   5 +-
 manpages.mk | 266 
 3 files changed, 4 insertions(+), 268 deletions(-)
 delete mode 100644 manpages.mk

diff --git a/.gitignore b/.gitignore
index 2ac9cdac7..f1cdcf124 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,6 +55,7 @@
 /docs-check
 /install-sh
 /libtool
+/manpages.mk
 /manpage-check
 /missing
 /missing-distfiles
diff --git a/Makefile.am b/Makefile.am
index 27ef9e4b4..6981b943e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -412,8 +412,8 @@ flake8-check: $(FLAKE8_PYFILES)
 endif
 CLEANFILES += flake8-check
 
-include $(srcdir)/manpages.mk
-$(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.py 
python/build/soutil.py
+-include manpages.mk
+manpages.mk: $(MAN_ROOTS) build-aux/sodepends.py python/build/soutil.py
@PYTHONPATH=$$PYTHONPATH$(psep)$(srcdir)/python $(PYTHON3) 
$(srcdir)/build-aux/sodepends.py -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
@if cmp -s $(@F).tmp $@; then \
  touch $@; \
@@ -421,6 +421,7 @@ $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.py 
python/build/soutil.p
else \
  mv $(@F).tmp $@; \
fi
+CLEANFILES += manpages.mk
 CLEANFILES += manpage-dep-check
 
 if VSTUDIO_DDK
diff --git a/manpages.mk b/manpages.mk
deleted file mode 100644
index dc201484c..0
--- a/manpages.mk
+++ /dev/null
@@ -1,266 +0,0 @@
-# Generated automatically -- do not modify!-*- buffer-read-only: t -*-
-
-ovsdb/ovsdb-client.1: \
-   ovsdb/ovsdb-client.1.in \
-   lib/common-syn.man \
-   lib/common.man \
-   lib/daemon-syn.man \
-   lib/daemon.man \
-   lib/ovs.tmac \
-   lib/ssl-bootstrap-syn.man \
-   lib/ssl-bootstrap.man \
-   lib/ssl-connect-syn.man \
-   lib/ssl-connect.man \
-   lib/ssl-syn.man \
-   lib/ssl.man \
-   lib/table.man \
-   lib/vlog-syn.man \
-   lib/vlog.man \
-   ovsdb/ovsdb-schemas.man
-ovsdb/ovsdb-client.1.in:
-lib/common-syn.man:
-lib/common.man:
-lib/daemon-syn.man:
-lib/daemon.man:
-lib/ovs.tmac:
-lib/ssl-bootstrap-syn.man:
-lib/ssl-bootstrap.man:
-lib/ssl-connect-syn.man:
-lib/ssl-connect.man:
-lib/ssl-syn.man:
-lib/ssl.man:
-lib/table.man:
-lib/vlog-syn.man:
-lib/vlog.man:
-ovsdb/ovsdb-schemas.man:
-
-ovsdb/ovsdb-server.1: \
-   ovsdb/ovsdb-server.1.in \
-   lib/common-syn.man \
-   lib/common.man \
-   lib/coverage-unixctl.man \
-   lib/daemon-syn.man \
-   lib/daemon.man \
-   lib/memory-unixctl.man \
-   lib/ovs.tmac \
-   lib/service-syn.man \
-   lib/service.man \
-   lib/ssl-bootstrap-syn.man \
-   lib/ssl-bootstrap.man \
-   lib/ssl-connect-syn.man \
-   lib/ssl-connect.man \
-   lib/ssl-peer-ca-cert-syn.man \
-   lib/ssl-peer-ca-cert.man \
-   lib/ssl-syn.man \
-   lib/ssl.man \
-   lib/unixctl-syn.man \
-   lib/unixctl.man \
-   lib/vlog-syn.man \
-   lib/vlog-unixctl.man \
-   lib/vlog.man
-ovsdb/ovsdb-server.1.in:
-lib/common-syn.man:
-lib/common.man:
-lib/coverage-unixctl.man:
-lib/daemon-syn.man:
-lib/daemon.man:
-lib/memory-unixctl.man:
-lib/ovs.tmac:
-lib/service-syn.man:
-lib/service.man:
-lib/ssl-bootstrap-syn.man:
-lib/ssl-bootstrap.man:
-lib/ssl-connect-syn.man:
-lib/ssl-connect.man:
-lib/ssl-peer-ca-cert-syn.man:
-lib/ssl-peer-ca-cert.man:
-lib/ssl-syn.man:
-lib/ssl.man:
-lib/unixctl-syn.man:
-lib/unixctl.man:
-lib/vlog-syn.man:
-lib/vlog-unixctl.man:
-lib/vlog.man:
-
-ovsdb/ovsdb-tool.1: \
-   ovsdb/ovsdb-tool.1.in \
-   lib/common-syn.man \
-   lib/common.man \
-   lib/ovs.tmac \
-   lib/vlog-syn.man \
-   lib/vlog.man \
-   ovsdb/ovsdb-schemas.man
-ovsdb/ovsdb-tool.1.in:
-lib/common-syn.man:
-lib/common.man:
-lib/ovs.tmac:
-lib/vlog-syn.man:
-lib/vlog.man:
-ovsdb/ovsdb-schemas.man:
-
-utilities/bugtool/ovs-bugtool.8: \
-   utilities/bugtool/ovs-bugtool.8.in \
-   lib/ovs.tmac
-utilities/bugtool/ovs-bugtool.8.in:
-lib/ovs.tmac:
-
-
-utilities/ovs-dpctl-top.8: \
-   utilities/ovs-dpctl-top.8.in \
-   lib/ovs.tmac
-utilities/ovs-dpctl-top.8.in:
-lib/ovs.tmac:
-
-utilities/ovs-dpctl.8: \
-   utilities/ovs-dpctl.8.in \
-   lib/common.man \
-   lib/dpctl.man \
-   lib/ovs.tmac \
-   lib/vlog.man
-utilities/ovs-dpctl.8.in:
-lib/common.man:
-lib/dpctl.man:
-lib/ovs.tmac:
-lib/vlog.man:
-
-utilities/ovs-ofctl.8: \
-   utilities/ovs-ofctl.8.in \
-   lib/colors.man \
-   lib/common.man \
-   lib/daemon.man \
-   lib/ofp-version.man \
-   lib/ovs.tmac \
-   lib/ssl.man \
-   lib/unixctl.man \
-   lib/vconn-active.man \
-   lib/vlog.m

Re: [ovs-dev] [PATCH] Remove manpages.mk from git

2020-09-01 Thread Timothy Redaelli
On Wed, 12 Aug 2020 16:12:03 -0300
Flavio Leitner  wrote:

> On Wed, Aug 05, 2020 at 01:38:47PM +0200, Timothy Redaelli wrote:
> > manpages.mk is generated at build-time using sodepends.py and so there is no
> > need to keep it in git.
> > 
> > Signed-off-by: Timothy Redaelli 
> > ---
> >  .gitignore  |   1 +
> >  Makefile.am |   2 +-
> >  manpages.mk | 266 
> >  3 files changed, 2 insertions(+), 267 deletions(-)
> >  delete mode 100644 manpages.mk
> > 
> > diff --git a/.gitignore b/.gitignore
> > index 2ac9cdac7..f1cdcf124 100644
> > --- a/.gitignore
> > +++ b/.gitignore
> > @@ -55,6 +55,7 @@
> >  /docs-check
> >  /install-sh
> >  /libtool
> > +/manpages.mk
> >  /manpage-check
> >  /missing
> >  /missing-distfiles
> > diff --git a/Makefile.am b/Makefile.am
> > index 27ef9e4b4..8ead17029 100644
> > --- a/Makefile.am
> > +++ b/Makefile.am
> > @@ -412,7 +412,7 @@ flake8-check: $(FLAKE8_PYFILES)
> >  endif
> >  CLEANFILES += flake8-check
> >  
> > -include $(srcdir)/manpages.mk
> > +-include $(srcdir)/manpages.mk
> 
> Why is the error ignored? 

Because automake tries to include manpages.mk during boot.sh phase and
if it not exists it fails:

automake: error: cannot open < manpages.mk: No such file or directory


> fbl
> 
> 
> >  $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.py 
> > python/build/soutil.py
> > @PYTHONPATH=$$PYTHONPATH$(psep)$(srcdir)/python $(PYTHON3) 
> > $(srcdir)/build-aux/sodepends.py -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
> > @if cmp -s $(@F).tmp $@; then \
> > diff --git a/manpages.mk b/manpages.mk
> > deleted file mode 100644
> > index dc201484c..0
> > --- a/manpages.mk
> > +++ /dev/null
> > @@ -1,266 +0,0 @@
> > -# Generated automatically -- do not modify!-*- buffer-read-only: t -*-
> > -
> > -ovsdb/ovsdb-client.1: \
> > -   ovsdb/ovsdb-client.1.in \
> > -   lib/common-syn.man \
> > -   lib/common.man \
> > -   lib/daemon-syn.man \
> > -   lib/daemon.man \
> > -   lib/ovs.tmac \
> > -   lib/ssl-bootstrap-syn.man \
> > -   lib/ssl-bootstrap.man \
> > -   lib/ssl-connect-syn.man \
> > -   lib/ssl-connect.man \
> > -   lib/ssl-syn.man \
> > -   lib/ssl.man \
> > -   lib/table.man \
> > -   lib/vlog-syn.man \
> > -   lib/vlog.man \
> > -   ovsdb/ovsdb-schemas.man
> > -ovsdb/ovsdb-client.1.in:
> > -lib/common-syn.man:
> > -lib/common.man:
> > -lib/daemon-syn.man:
> > -lib/daemon.man:
> > -lib/ovs.tmac:
> > -lib/ssl-bootstrap-syn.man:
> > -lib/ssl-bootstrap.man:
> > -lib/ssl-connect-syn.man:
> > -lib/ssl-connect.man:
> > -lib/ssl-syn.man:
> > -lib/ssl.man:
> > -lib/table.man:
> > -lib/vlog-syn.man:
> > -lib/vlog.man:
> > -ovsdb/ovsdb-schemas.man:
> > -
> > -ovsdb/ovsdb-server.1: \
> > -   ovsdb/ovsdb-server.1.in \
> > -   lib/common-syn.man \
> > -   lib/common.man \
> > -   lib/coverage-unixctl.man \
> > -   lib/daemon-syn.man \
> > -   lib/daemon.man \
> > -   lib/memory-unixctl.man \
> > -   lib/ovs.tmac \
> > -   lib/service-syn.man \
> > -   lib/service.man \
> > -   lib/ssl-bootstrap-syn.man \
> > -   lib/ssl-bootstrap.man \
> > -   lib/ssl-connect-syn.man \
> > -   lib/ssl-connect.man \
> > -   lib/ssl-peer-ca-cert-syn.man \
> > -   lib/ssl-peer-ca-cert.man \
> > -   lib/ssl-syn.man \
> > -   lib/ssl.man \
> > -   lib/unixctl-syn.man \
> > -   lib/unixctl.man \
> > -   lib/vlog-syn.man \
> > -   lib/vlog-unixctl.man \
> > -   lib/vlog.man
> > -ovsdb/ovsdb-server.1.in:
> > -lib/common-syn.man:
> > -lib/common.man:
> > -lib/coverage-unixctl.man:
> > -lib/daemon-syn.man:
> > -lib/daemon.man:
> > -lib/memory-unixctl.man:
> > -lib/ovs.tmac:
> > -lib/service-syn.man:
> > -lib/service.man:
> > -lib/ssl-bootstrap-syn.man:
> > -lib/ssl-bootstrap.man:
> > -lib/ssl-connect-syn.man:
> > -lib/ssl-connect.man:
> > -lib/ssl-peer-ca-cert-syn.man:
> > -lib/ssl-peer-ca-cert.man:
> > -lib/ssl-syn.man:
> > -lib/ssl.man:
> > -lib/unixctl-syn.man:
> > -lib/unixctl.man:
> > -lib/vlog-syn.man:
> > -lib/vlog-unixctl.man:
> > -lib/vlog.man:
> > -
> > -ovsdb/ovsdb-tool.1: \
> > -   ovsdb/ovsdb-tool.1.in \
> > -   lib/common-syn.man \
> > -   lib/common.man \
> > -   lib/ovs.tmac \
> > -   lib/vlog-syn.ma

[ovs-dev] [PATCH] meta-flow: fix a typo in "MPLS Bottom of Stack Field" paragraph

2020-08-06 Thread Timothy Redaelli
In the ovs-fields.7 manual page, the "MPLS Bottom of Stack Field" paragraph
says:
 * When mpls_bos is 1, there is another MPLS label following this one,
   so the Ethertype passed to pop_mpls should be an MPLS Ethertype. [...]

 * When mpls_bos is 0, this MPLS label is the last one, so the Ethertype
   passed to pop_mpls should be a non-MPLS Ethertype such as IPv4. [...]

The values 0 and 1 have been swapped: when BOS is 1,
then no more label stack entries follows.

Fixes: 96fee5e0a2a0 ("ovs-fields: New manpage to document Open vSwitch and 
OpenFlow fields.")
Cc: b...@ovn.org
Reported-at: https://bugzilla.redhat.com/1842032
Reported-by: Guillaume Nault 
Signed-off-by: Timothy Redaelli 
---
 lib/meta-flow.xml | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/meta-flow.xml b/lib/meta-flow.xml
index 154675874..e72ba52ec 100644
--- a/lib/meta-flow.xml
+++ b/lib/meta-flow.xml
@@ -3920,18 +3920,18 @@ r r c c c.
 
   
 
-  When  is 1, there is another MPLS label
+  When  is 0, there is another MPLS label
   following this one, so the Ethertype passed to pop_mpls
   should be an MPLS Ethertype.  For example: table=0,
-  dl_type=0x8847, mpls_bos=1, actions=pop_mpls:0x8847,
+  dl_type=0x8847, mpls_bos=0, actions=pop_mpls:0x8847,
   goto_table:1
 
 
 
-  When  is 0, this MPLS label is the last one,
+  When  is 1, this MPLS label is the last one,
   so the Ethertype passed to pop_mpls should be a non-MPLS
   Ethertype such as IPv4.  For example: table=1, dl_type=0x8847,
-  mpls_bos=0, actions=pop_mpls:0x0800, goto_table:2
+  mpls_bos=1, actions=pop_mpls:0x0800, goto_table:2
 
   
 
-- 
2.26.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] Remove manpages.mk from git

2020-08-05 Thread Timothy Redaelli
manpages.mk is generated at build-time using sodepends.py and so there is no
need to keep it in git.

Signed-off-by: Timothy Redaelli 
---
 .gitignore  |   1 +
 Makefile.am |   2 +-
 manpages.mk | 266 
 3 files changed, 2 insertions(+), 267 deletions(-)
 delete mode 100644 manpages.mk

diff --git a/.gitignore b/.gitignore
index 2ac9cdac7..f1cdcf124 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,6 +55,7 @@
 /docs-check
 /install-sh
 /libtool
+/manpages.mk
 /manpage-check
 /missing
 /missing-distfiles
diff --git a/Makefile.am b/Makefile.am
index 27ef9e4b4..8ead17029 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -412,7 +412,7 @@ flake8-check: $(FLAKE8_PYFILES)
 endif
 CLEANFILES += flake8-check
 
-include $(srcdir)/manpages.mk
+-include $(srcdir)/manpages.mk
 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.py 
python/build/soutil.py
@PYTHONPATH=$$PYTHONPATH$(psep)$(srcdir)/python $(PYTHON3) 
$(srcdir)/build-aux/sodepends.py -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
@if cmp -s $(@F).tmp $@; then \
diff --git a/manpages.mk b/manpages.mk
deleted file mode 100644
index dc201484c..0
--- a/manpages.mk
+++ /dev/null
@@ -1,266 +0,0 @@
-# Generated automatically -- do not modify!-*- buffer-read-only: t -*-
-
-ovsdb/ovsdb-client.1: \
-   ovsdb/ovsdb-client.1.in \
-   lib/common-syn.man \
-   lib/common.man \
-   lib/daemon-syn.man \
-   lib/daemon.man \
-   lib/ovs.tmac \
-   lib/ssl-bootstrap-syn.man \
-   lib/ssl-bootstrap.man \
-   lib/ssl-connect-syn.man \
-   lib/ssl-connect.man \
-   lib/ssl-syn.man \
-   lib/ssl.man \
-   lib/table.man \
-   lib/vlog-syn.man \
-   lib/vlog.man \
-   ovsdb/ovsdb-schemas.man
-ovsdb/ovsdb-client.1.in:
-lib/common-syn.man:
-lib/common.man:
-lib/daemon-syn.man:
-lib/daemon.man:
-lib/ovs.tmac:
-lib/ssl-bootstrap-syn.man:
-lib/ssl-bootstrap.man:
-lib/ssl-connect-syn.man:
-lib/ssl-connect.man:
-lib/ssl-syn.man:
-lib/ssl.man:
-lib/table.man:
-lib/vlog-syn.man:
-lib/vlog.man:
-ovsdb/ovsdb-schemas.man:
-
-ovsdb/ovsdb-server.1: \
-   ovsdb/ovsdb-server.1.in \
-   lib/common-syn.man \
-   lib/common.man \
-   lib/coverage-unixctl.man \
-   lib/daemon-syn.man \
-   lib/daemon.man \
-   lib/memory-unixctl.man \
-   lib/ovs.tmac \
-   lib/service-syn.man \
-   lib/service.man \
-   lib/ssl-bootstrap-syn.man \
-   lib/ssl-bootstrap.man \
-   lib/ssl-connect-syn.man \
-   lib/ssl-connect.man \
-   lib/ssl-peer-ca-cert-syn.man \
-   lib/ssl-peer-ca-cert.man \
-   lib/ssl-syn.man \
-   lib/ssl.man \
-   lib/unixctl-syn.man \
-   lib/unixctl.man \
-   lib/vlog-syn.man \
-   lib/vlog-unixctl.man \
-   lib/vlog.man
-ovsdb/ovsdb-server.1.in:
-lib/common-syn.man:
-lib/common.man:
-lib/coverage-unixctl.man:
-lib/daemon-syn.man:
-lib/daemon.man:
-lib/memory-unixctl.man:
-lib/ovs.tmac:
-lib/service-syn.man:
-lib/service.man:
-lib/ssl-bootstrap-syn.man:
-lib/ssl-bootstrap.man:
-lib/ssl-connect-syn.man:
-lib/ssl-connect.man:
-lib/ssl-peer-ca-cert-syn.man:
-lib/ssl-peer-ca-cert.man:
-lib/ssl-syn.man:
-lib/ssl.man:
-lib/unixctl-syn.man:
-lib/unixctl.man:
-lib/vlog-syn.man:
-lib/vlog-unixctl.man:
-lib/vlog.man:
-
-ovsdb/ovsdb-tool.1: \
-   ovsdb/ovsdb-tool.1.in \
-   lib/common-syn.man \
-   lib/common.man \
-   lib/ovs.tmac \
-   lib/vlog-syn.man \
-   lib/vlog.man \
-   ovsdb/ovsdb-schemas.man
-ovsdb/ovsdb-tool.1.in:
-lib/common-syn.man:
-lib/common.man:
-lib/ovs.tmac:
-lib/vlog-syn.man:
-lib/vlog.man:
-ovsdb/ovsdb-schemas.man:
-
-utilities/bugtool/ovs-bugtool.8: \
-   utilities/bugtool/ovs-bugtool.8.in \
-   lib/ovs.tmac
-utilities/bugtool/ovs-bugtool.8.in:
-lib/ovs.tmac:
-
-
-utilities/ovs-dpctl-top.8: \
-   utilities/ovs-dpctl-top.8.in \
-   lib/ovs.tmac
-utilities/ovs-dpctl-top.8.in:
-lib/ovs.tmac:
-
-utilities/ovs-dpctl.8: \
-   utilities/ovs-dpctl.8.in \
-   lib/common.man \
-   lib/dpctl.man \
-   lib/ovs.tmac \
-   lib/vlog.man
-utilities/ovs-dpctl.8.in:
-lib/common.man:
-lib/dpctl.man:
-lib/ovs.tmac:
-lib/vlog.man:
-
-utilities/ovs-ofctl.8: \
-   utilities/ovs-ofctl.8.in \
-   lib/colors.man \
-   lib/common.man \
-   lib/daemon.man \
-   lib/ofp-version.man \
-   lib/ovs.tmac \
-   lib/ssl.man \
-   lib/unixctl.man \
-   lib/vconn-active.man \
-   lib/vlog.man
-utilities/ovs-ofctl.8.in:
-lib/colors.man:
-lib/common.man:
-lib/daemon.man:
-lib/ofp-version.man:
-lib/ovs.tmac:
-lib/ssl.man:
-lib/unixctl.man:
-lib/vconn-active.man:
-lib/vlog.man:
-
-utilities/ovs-pcap.1: \
-   utilities/ovs-pcap.1.in \
-   lib/common-syn.man \
-   lib/common.man \
-   lib/ovs.tmac
-utilities/ovs-pcap.1.in:
-lib/common-syn.man:
-lib/common.man:
-lib/ovs.tmac:
-
-lib/ovs.tmac:
-
-utilities/ovs-testcontroller.8: \
-   utilities/ovs-testcontrolle

Re: [ovs-dev] [PATCH] acinclude: Remove libmnl for MLX5 PMD

2020-06-25 Thread Timothy Redaelli
On Thu, 25 Jun 2020 09:32:23 +0200
Thomas Monjalon  wrote:

> On Tue, Jun 23, 2020 at 6:49 PM Timothy Redaelli  wrote:
> >
> > libmnl is not used anymore for MLX5 PMD since DPDK 19.08.
> 
> Why don't you use pkg-config?
> All these kind of dependencies are managed through libdpdk.pc
> which is generated with meson.

Because on Fedora/RHEL we don't use meson (yet) since it's not possible
to choose the list of PMDs to build and testpmd links to some of the
PMDs we don't ship

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] acinclude: Remove libmnl for MLX5 PMD

2020-06-23 Thread Timothy Redaelli
libmnl is not used anymore for MLX5 PMD since DPDK 19.08.

Signed-off-by: Timothy Redaelli 
---
 acinclude.m4 | 1 -
 1 file changed, 1 deletion(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 8847b8145..5be2a2f1c 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -368,7 +368,6 @@ AC_DEFUN([OVS_CHECK_DPDK], [
 ], [], [[#include ]])
 
 AC_CHECK_DECL([RTE_LIBRTE_MLX5_PMD], [dnl found
-  OVS_FIND_DEPENDENCY([mnl_attr_put], [mnl], [libmnl])
   AC_CHECK_DECL([RTE_IBVERBS_LINK_DLOPEN], [], [dnl not found
 OVS_FIND_DEPENDENCY([mlx5dv_create_wq], [mlx5], [libmlx5])
 OVS_FIND_DEPENDENCY([verbs_init_cq], [ibverbs], [libibverbs])
-- 
2.26.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] ovs-dpctl-top: Skip "eth()" element

2020-06-19 Thread Timothy Redaelli
With commit efde188622ae ("odp-util: Print eth() for Ethernet flows if
packet_type is absent.") "eth()" is printed for Ethernet flows if packet_type
is absent, but this broke "ovs-dpctl-top" since it expects that every
element has a value.

This commit skips the parsing of the empty "eth()" element.

Fixes: efde188622ae ("odp-util: Print eth() for Ethernet flows if packet_type
is absent.")
Cc: b...@ovn.org
Signed-off-by: Timothy Redaelli 
---
v2:
- Added missing Signed-off-by

 utilities/ovs-dpctl-top.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/utilities/ovs-dpctl-top.in b/utilities/ovs-dpctl-top.in
index 011cc64b7..fbe6e4f56 100755
--- a/utilities/ovs-dpctl-top.in
+++ b/utilities/ovs-dpctl-top.in
@@ -480,6 +480,8 @@ def elements_to_dict(elements):
 """ Convert line to a hierarchy of dictionaries. """
 result = {}
 for element in elements:
+if (element == "eth()"):
+continue
 match = FIELDS_CMPND.search(element)
 if (match):
 key = match.group(1)
-- 
2.26.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] ovs-dpctl-top: Open stdin in binary mode

2020-06-19 Thread Timothy Redaelli
On Python3 buffering can only be disabled on files opened in binary mode.

Signed-off-by: Timothy Redaelli 
---
v2:
- Added missing Signed-off-by

 utilities/ovs-dpctl-top.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utilities/ovs-dpctl-top.in b/utilities/ovs-dpctl-top.in
index fbe6e4f56..97dc12f27 100755
--- a/utilities/ovs-dpctl-top.in
+++ b/utilities/ovs-dpctl-top.in
@@ -1236,7 +1236,7 @@ def flows_script(args):

 if (args.flowFiles is None):
 logging.info("reading flows from stdin")
-ihdl = os.fdopen(sys.stdin.fileno(), 'r', 0)
+ihdl = os.fdopen(sys.stdin.fileno(), 'rb', 0)
 try:
 flow_db = flows_read(ihdl, flow_db)
 finally:
--
2.26.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] ovs-dpctl-top: open stdin in binary mode

2020-06-19 Thread Timothy Redaelli
On Python3 buffering can only be disabled on files opened in binary mode.
---
 utilities/ovs-dpctl-top.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utilities/ovs-dpctl-top.in b/utilities/ovs-dpctl-top.in
index fbe6e4f56..97dc12f27 100755
--- a/utilities/ovs-dpctl-top.in
+++ b/utilities/ovs-dpctl-top.in
@@ -1236,7 +1236,7 @@ def flows_script(args):
 
 if (args.flowFiles is None):
 logging.info("reading flows from stdin")
-ihdl = os.fdopen(sys.stdin.fileno(), 'r', 0)
+ihdl = os.fdopen(sys.stdin.fileno(), 'rb', 0)
 try:
 flow_db = flows_read(ihdl, flow_db)
 finally:
-- 
2.26.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] ovs-dpctl-top: Skip "eth()" element

2020-06-19 Thread Timothy Redaelli
With commit efde188622ae ("odp-util: Print eth() for Ethernet flows if
packet_type is absent.") "eth()" is printed for Ethernet flows if packet_type
is absent, but this broke "ovs-dpctl-top" since it expects that every
element has a value.

This commit skips the parsing of the empty "eth()" element.

Fixes: efde188622ae ("odp-util: Print eth() for Ethernet flows if packet_type
is absent.")
Cc: b...@ovn.org
---
 utilities/ovs-dpctl-top.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/utilities/ovs-dpctl-top.in b/utilities/ovs-dpctl-top.in
index 011cc64b7..fbe6e4f56 100755
--- a/utilities/ovs-dpctl-top.in
+++ b/utilities/ovs-dpctl-top.in
@@ -480,6 +480,8 @@ def elements_to_dict(elements):
 """ Convert line to a hierarchy of dictionaries. """
 result = {}
 for element in elements:
+if (element == "eth()"):
+continue
 match = FIELDS_CMPND.search(element)
 if (match):
 key = match.group(1)
-- 
2.26.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] bugtool: Fix for Python3

2020-03-19 Thread Timothy Redaelli
Currently ovs-bugtool tool doesn't start on Python 3.
This commit fixes ovs-bugtool to make it works on Python 3.

Replaced StringIO.StringIO with io.BytesIO since the script is
processing binary data.

Reported-at: https://bugzilla.redhat.com/1809241
Reported-by: Flavio Leitner 
Signed-off-by: Timothy Redaelli 
---
Changes since v1:
  * Converted StringIO to BytesIO
  * Fix some other string/bytes conversion
---
 utilities/bugtool/ovs-bugtool.in | 45 
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/utilities/bugtool/ovs-bugtool.in b/utilities/bugtool/ovs-bugtool.in
index e55bfc2ed..c26c2be7a 100755
--- a/utilities/bugtool/ovs-bugtool.in
+++ b/utilities/bugtool/ovs-bugtool.in
@@ -33,8 +33,7 @@
 # or func_output().
 #
 
-import StringIO
-import commands
+from io import BytesIO
 import fcntl
 import getopt
 import hashlib
@@ -48,7 +47,7 @@ import warnings
 import zipfile
 from select import select
 from signal import SIGTERM
-from subprocess import PIPE, Popen
+from subprocess import PIPE, Popen, check_output
 
 from xml.dom.minidom import getDOMImplementation, parse
 
@@ -348,7 +347,7 @@ def collect_data():
 cap = v['cap']
 if 'cmd_args' in v:
 if 'output' not in v.keys():
-v['output'] = StringIOmtime()
+v['output'] = BytesIOmtime()
 if v['repeat_count'] > 0:
 if cap not in process_lists:
 process_lists[cap] = []
@@ -373,20 +372,20 @@ def collect_data():
 if 'filename' in v and v['filename'].startswith('/proc/'):
 # proc files must be read into memory
 try:
-f = open(v['filename'], 'r')
+f = open(v['filename'], 'rb')
 s = f.read()
 f.close()
 if check_space(cap, v['filename'], len(s)):
-v['output'] = StringIOmtime(s)
+v['output'] = BytesIOmtime(s)
 except:
 pass
 elif 'func' in v:
 try:
 s = v['func'](cap)
 except Exception as e:
-s = str(e)
+s = str(e).encode()
 if check_space(cap, k, len(s)):
-v['output'] = StringIOmtime(s)
+v['output'] = BytesIOmtime(s)
 
 
 def main(argv=None):
@@ -704,7 +703,7 @@ exclude those logs from the archive.
 
 # permit the user to filter out data
 # We cannot use iteritems, since we modify 'data' as we pass through
-for (k, v) in sorted(data.items()):
+for (k, v) in data.items():
 cap = v['cap']
 if 'filename' in v:
 key = k[0]
@@ -721,7 +720,7 @@ exclude those logs from the archive.
 
 # include inventory
 data['inventory.xml'] = {'cap': None,
-'output': StringIOmtime(make_inventory(data, subdir))}
+'output': BytesIOmtime(make_inventory(data, subdir))}
 
 # create archive
 if output_fd == -1:
@@ -782,7 +781,7 @@ def dump_scsi_hosts(cap):
 
 
 def module_info(cap):
-output = StringIO.StringIO()
+output = BytesIO()
 modules = open(PROC_MODULES, 'r')
 procs = []
 
@@ -806,7 +805,7 @@ def multipathd_topology(cap):
 
 
 def dp_list():
-output = StringIO.StringIO()
+output = BytesIO()
 procs = [ProcOutput([OVS_DPCTL, 'dump-dps'],
  caps[CAP_NETWORK_STATUS][MAX_TIME], output)]
 
@@ -828,7 +827,7 @@ def collect_ovsdb():
 if os.path.isfile(OPENVSWITCH_COMPACT_DB):
 os.unlink(OPENVSWITCH_COMPACT_DB)
 
-output = StringIO.StringIO()
+output = BytesIO()
 max_time = 5
 procs = [ProcOutput(['ovsdb-tool', 'compact',
 OPENVSWITCH_CONF_DB, OPENVSWITCH_COMPACT_DB],
@@ -871,7 +870,7 @@ def fd_usage(cap):
 
 
 def dump_rdac_groups(cap):
-output = StringIO.StringIO()
+output = BytesIO()
 procs = [ProcOutput([MPPUTIL, '-a'], caps[cap][MAX_TIME], output)]
 
 run_procs([procs])
@@ -896,7 +895,7 @@ def load_plugins(just_capabilities=False, filter=None):
 for node in nodelist:
 if node.nodeType == node.TEXT_NODE:
 rc += node.data
-return rc.encode()
+return rc
 
 def getBoolAttr(el, attr, default=False):
 ret = default
@@ -1037,7 +1036,7 @@ def make_tar(subdir, suffix, output_fd, output_file):
 s = os.stat(v['filename'])
 ti.mtime = s.st_mtime
 ti.size = s.st_size
-tf.addfile(ti, open(v['filename']))
+tf.addfile(ti, open(v['filename'], 'rb'))
 except:
 pass
 finally:
@@ -1095,12 +1094,12 @@ def make_inventory(inventory, subdir):
 s.setAttribute('date', time.strftime('%c'))
 s.setAttribute('hostname', platform.node())
 s.setAttribute('un

Re: [ovs-dev] [PATCH] bugtool: Fix for Python3

2020-03-19 Thread Timothy Redaelli
On Wed, 18 Mar 2020 14:25:43 -0700
William Tu  wrote:

> On Wed, Mar 18, 2020 at 8:23 AM Timothy Redaelli  wrote:
> >
> > Currently ovs-bugtool tool doesn't start on Python3.
> > This commit fixes ovs-bugtool to make it works on Python.3
> >
> > Reported-at: https://bugzilla.redhat.com/1809241
> > Reported-by: Flavio Leitner 
> > Signed-off-by: Timothy Redaelli 
> > ---
> 
> Thanks for the patch. I tried to fix it before but haven't get it done yet.
> I run your patch and got this error, can you take a look?
> 
> ovs# ./utilities/bugtool/ovs-bugtool -y -s --output=tar.gz
> --outfile=/var/log/bugtool-report.tgz
> Traceback (most recent call last):
>   File "./utilities/bugtool/ovs-bugtool", line 1405, in 
> sys.exit(main())
>   File "./utilities/bugtool/ovs-bugtool", line 717, in main
> collect_data()
>   File "./utilities/bugtool/ovs-bugtool", line 366, in collect_data
> run_procs(process_lists.values())
>   File "./utilities/bugtool/ovs-bugtool", line 1344, in run_procs
> p.read_line()
>   File "./utilities/bugtool/ovs-bugtool", line 1313, in read_line
> self.inst.write(line.decode())
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcb in position
> 67: invalid continuation byte
> 
> Thanks
> William
> 

Thank you,
I'll send a v2 as soon as possibile

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] bugtool: Fix for Python3

2020-03-18 Thread Timothy Redaelli
Currently ovs-bugtool tool doesn't start on Python3.
This commit fixes ovs-bugtool to make it works on Python.3

Reported-at: https://bugzilla.redhat.com/1809241
Reported-by: Flavio Leitner 
Signed-off-by: Timothy Redaelli 
---
 utilities/bugtool/ovs-bugtool.in | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/utilities/bugtool/ovs-bugtool.in b/utilities/bugtool/ovs-bugtool.in
index e55bfc2ed..7021305c4 100755
--- a/utilities/bugtool/ovs-bugtool.in
+++ b/utilities/bugtool/ovs-bugtool.in
@@ -33,8 +33,7 @@
 # or func_output().
 #
 
-import StringIO
-import commands
+from io import StringIO
 import fcntl
 import getopt
 import hashlib
@@ -48,7 +47,7 @@ import warnings
 import zipfile
 from select import select
 from signal import SIGTERM
-from subprocess import PIPE, Popen
+from subprocess import PIPE, Popen, check_output
 
 from xml.dom.minidom import getDOMImplementation, parse
 
@@ -704,7 +703,7 @@ exclude those logs from the archive.
 
 # permit the user to filter out data
 # We cannot use iteritems, since we modify 'data' as we pass through
-for (k, v) in sorted(data.items()):
+for (k, v) in data.items():
 cap = v['cap']
 if 'filename' in v:
 key = k[0]
@@ -782,7 +781,7 @@ def dump_scsi_hosts(cap):
 
 
 def module_info(cap):
-output = StringIO.StringIO()
+output = StringIO()
 modules = open(PROC_MODULES, 'r')
 procs = []
 
@@ -806,7 +805,7 @@ def multipathd_topology(cap):
 
 
 def dp_list():
-output = StringIO.StringIO()
+output = StringIO()
 procs = [ProcOutput([OVS_DPCTL, 'dump-dps'],
  caps[CAP_NETWORK_STATUS][MAX_TIME], output)]
 
@@ -828,7 +827,7 @@ def collect_ovsdb():
 if os.path.isfile(OPENVSWITCH_COMPACT_DB):
 os.unlink(OPENVSWITCH_COMPACT_DB)
 
-output = StringIO.StringIO()
+output = StringIO()
 max_time = 5
 procs = [ProcOutput(['ovsdb-tool', 'compact',
 OPENVSWITCH_CONF_DB, OPENVSWITCH_COMPACT_DB],
@@ -871,7 +870,7 @@ def fd_usage(cap):
 
 
 def dump_rdac_groups(cap):
-output = StringIO.StringIO()
+output = StringIO()
 procs = [ProcOutput([MPPUTIL, '-a'], caps[cap][MAX_TIME], output)]
 
 run_procs([procs])
@@ -1095,7 +1094,7 @@ def make_inventory(inventory, subdir):
 s.setAttribute('date', time.strftime('%c'))
 s.setAttribute('hostname', platform.node())
 s.setAttribute('uname', ' '.join(platform.uname()))
-s.setAttribute('uptime', commands.getoutput(UPTIME))
+s.setAttribute('uptime', check_output(UPTIME).decode())
 document.getElementsByTagName(INVENTORY_XML_ROOT)[0].appendChild(s)
 
 map(lambda k_v: inventory_entry(document, subdir, k_v[0], k_v[1]),
@@ -1301,7 +1300,7 @@ class ProcOutput(object):
 line = self.proc.stdout.readline()
 else:
 line = self.proc.stdout.read(self.bufsize)
-if line == '':
+if line == b'':
 # process exited
 self.proc.stdout.close()
 self.status = self.proc.wait()
@@ -1311,7 +1310,7 @@ class ProcOutput(object):
 if self.filter:
 line = self.filter(line, self.filter_state)
 if self.inst:
-self.inst.write(line)
+self.inst.write(line.decode())
 
 
 def run_procs(procs):
@@ -1391,13 +1390,13 @@ def get_free_disk_space(path):
 return s.f_frsize * s.f_bfree
 
 
-class StringIOmtime(StringIO.StringIO):
+class StringIOmtime(StringIO):
 def __init__(self, buf=''):
-StringIO.StringIO.__init__(self, buf)
+StringIO.__init__(self, buf)
 self.mtime = time.time()
 
 def write(self, s):
-StringIO.StringIO.write(self, s)
+StringIO.write(self, s)
 self.mtime = time.time()
 
 
-- 
2.25.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH ovn] automake.mk: Use PYTHON3 to generate the ovn-ic-{n, sb} pics

2020-02-18 Thread Timothy Redaelli
Currently $(PYTHON) is used in order to launch dot2pic script to generate
the diagram, but this is wrong since PYTHON variable is NOT defined by
the build system and so it fails when "python" binary doesn't exists
(like on RHEL8).

This commit fixes this by using the correct PYTHON3 variable that is
defined by the build system (in OVN_CHECK_PYTHON3).

Fixes: 2992f74bf515 ("ovn-ic-nb: Interconnection northbound DB schema and CLI.")
Fixes: 1c3c4108e602 ("ovn-ic-sb: Interconnection southbound DB schema and CLI.")
Cc: hz...@ovn.org
Signed-off-by: Timothy Redaelli 
---
 automake.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/automake.mk b/automake.mk
index 2b0bb4b12..a7947a3f5 100644
--- a/automake.mk
+++ b/automake.mk
@@ -70,7 +70,7 @@ if HAVE_DOT
 ovn-ic-nb.gv: ${OVSDIR}/ovsdb/ovsdb-dot.in $(srcdir)/ovn-ic-nb.ovsschema
$(AM_V_GEN)$(OVSDB_DOT) --no-arrows $(srcdir)/ovn-ic-nb.ovsschema > $@
 ovn-ic-nb.pic: ovn-ic-nb.gv ${OVSDIR}/ovsdb/dot2pic
-   $(AM_V_GEN)(dot -T plain < ovn-ic-nb.gv | $(PYTHON) 
${OVSDIR}/ovsdb/dot2pic -f 3) > $@.tmp && \
+   $(AM_V_GEN)(dot -T plain < ovn-ic-nb.gv | $(PYTHON3) 
${OVSDIR}/ovsdb/dot2pic -f 3) > $@.tmp && \
mv $@.tmp $@
 OVN_IC_NB_PIC = ovn-ic-nb.pic
 OVN_IC_NB_DOT_DIAGRAM_ARG = --er-diagram=$(OVN_IC_NB_PIC)
@@ -99,7 +99,7 @@ if HAVE_DOT
 ovn-ic-sb.gv: ${OVSDIR}/ovsdb/ovsdb-dot.in $(srcdir)/ovn-ic-sb.ovsschema
$(AM_V_GEN)$(OVSDB_DOT) --no-arrows $(srcdir)/ovn-ic-sb.ovsschema > $@
 ovn-ic-sb.pic: ovn-ic-sb.gv ${OVSDIR}/ovsdb/dot2pic
-   $(AM_V_GEN)(dot -T plain < ovn-ic-sb.gv | $(PYTHON) 
${OVSDIR}/ovsdb/dot2pic -f 3) > $@.tmp && \
+   $(AM_V_GEN)(dot -T plain < ovn-ic-sb.gv | $(PYTHON3) 
${OVSDIR}/ovsdb/dot2pic -f 3) > $@.tmp && \
mv $@.tmp $@
 OVN_IC_SB_PIC = ovn-ic-sb.pic
 OVN_IC_SB_DOT_DIAGRAM_ARG = --er-diagram=$(OVN_IC_SB_PIC)
-- 
2.24.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] Documentation: Fix building with Python 3.9

2020-01-16 Thread Timothy Redaelli
open(), io.open(), codecs.open() and fileinput.FileInput no longer accept 'U'
("universal newline") in the file mode.
This flag was deprecated since Python 3.3.
In Python 3, the "universal newline" is used by default when a file is open
in text mode.

Reported-at: https://bugzilla.redhat.com/1791681
Reported-by: Miro Hrončok 
Signed-off-by: Timothy Redaelli 
---
 Documentation/conf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/conf.py b/Documentation/conf.py
index 6bbfc02bd..37d92c36f 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -58,7 +58,7 @@ author = u'The Open vSwitch Development Community'
 # The full version, including alpha/beta/rc tags.
 release = None
 filename = "../configure.ac"
-with open(filename, 'rU') as f:
+with open(filename, 'r') as f:
 for line in f:
 if 'AC_INIT' in line:
 # Parse "AC_INIT(openvswitch, 2.7.90, b...@openvswitch.org)":
-- 
2.24.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] ovs-tcpdump: Fallback to read /proc/net/dev on Linux

2020-01-13 Thread Timothy Redaelli
Currently, ovs-tcpdump uses python3-netifaces in order to get the list of
the network interfaces, but python3-netifaces may not be installed nor
available on some distributions (for example on RHEL7).

This commit adds, only for Linux, an alternative way (that is only used
when netifaces is not available) to read the list of the network interfaces
by reading "/proc/net/dev".

Signed-off-by: Timothy Redaelli 
---
 utilities/ovs-tcpdump.in | 20 +---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
index 0fa5dc418..5ec02383c 100755
--- a/utilities/ovs-tcpdump.in
+++ b/utilities/ovs-tcpdump.in
@@ -24,7 +24,21 @@ import subprocess
 import sys
 import time
 
-import netifaces
+try:
+from netifaces import interfaces
+except ImportError:
+if sys.platform in ['linux', 'linux2']:
+def interfaces():
+devices = []
+with open("/proc/net/dev", "r") as f_netdev:
+for line in f_netdev:
+if ":" not in line:
+continue
+devices.append(line.split(":")[0].strip())
+return devices
+else:
+print("ERROR: Please install netifaces Python library.")
+sys.exit(1)
 
 try:
 from ovs.db import idl
@@ -438,11 +452,11 @@ def main():
 mirror_interface = _make_mirror_name[sys.platform](interface)
 
 if sys.platform in _make_taps and \
-   mirror_interface not in netifaces.interfaces():
+   mirror_interface not in interfaces():
 _make_taps[sys.platform](mirror_interface,
  ovsdb.interface_mtu(interface))
 
-if mirror_interface not in netifaces.interfaces():
+if mirror_interface not in interfaces():
 print("ERROR: Please create an interface called `%s`" %
   mirror_interface)
 print("See your OS guide for how to do this.")
-- 
2.24.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] acinclude: Use RTE_IBVERBS_LINK_DLOPEN

2020-01-08 Thread Timothy Redaelli
On DPDK 19.11 RTE_IBVERBS_LINK_DLOPEN is used by Mellanox PMDs (mlx4 and
mlx5) instead of RTE_LIBRTE_MLX{4,5}_DLOPEN_DEPS.

Without this commit is not possible to statically link OVS with DPDK when MLX4
or MLX5 PMDs are enabled.

Signed-off-by: Timothy Redaelli 
---
 acinclude.m4 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 18264c43b..1c8791d53 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -378,14 +378,14 @@ AC_DEFUN([OVS_CHECK_DPDK], [
 
 AC_CHECK_DECL([RTE_LIBRTE_MLX5_PMD], [dnl found
   OVS_FIND_DEPENDENCY([mnl_attr_put], [mnl], [libmnl])
-  AC_CHECK_DECL([RTE_LIBRTE_MLX5_DLOPEN_DEPS], [], [dnl not found
+  AC_CHECK_DECL([RTE_IBVERBS_LINK_DLOPEN], [], [dnl not found
 OVS_FIND_DEPENDENCY([mlx5dv_create_wq], [mlx5], [libmlx5])
 OVS_FIND_DEPENDENCY([verbs_init_cq], [ibverbs], [libibverbs])
   ], [[#include ]])
 ], [], [[#include ]])
 
 AC_CHECK_DECL([RTE_LIBRTE_MLX4_PMD], [dnl found
-  AC_CHECK_DECL([RTE_LIBRTE_MLX4_DLOPEN_DEPS], [], [dnl not found
+  AC_CHECK_DECL([RTE_IBVERBS_LINK_DLOPEN], [], [dnl not found
 OVS_FIND_DEPENDENCY([mlx4dv_init_obj], [mlx4], [libmlx4])
 OVS_FIND_DEPENDENCY([verbs_init_cq], [ibverbs], [libibverbs])
   ], [[#include ]])
-- 
2.24.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2 1/2] Remove dependency on python3-six

2019-12-20 Thread Timothy Redaelli
Since Python 2 support was removed in 1ca0323e7c29 ("Require Python 3 and
remove support for Python 2."), python3-six is not needed anymore.

Moreover python3-six is not available on RHEL/CentOS7 without using EPEL
and so this patch is needed in order to release OVS 2.13 on RHEL7.

Signed-off-by: Timothy Redaelli 
---
 .cirrus.yml   |  2 +-
 .travis/linux-prepare.sh  |  2 +-
 .travis/osx-prepare.sh|  1 -
 Documentation/intro/install/general.rst   |  6 +-
 Documentation/intro/install/netbsd.rst|  3 +-
 Documentation/intro/install/rhel.rst  |  2 +-
 Documentation/intro/install/windows.rst   |  5 +-
 Vagrantfile   |  7 ++-
 Vagrantfile-FreeBSD   |  2 +-
 appveyor.yml  |  2 +-
 configure.ac  |  1 -
 debian/control|  4 +-
 m4/openvswitch.m4 | 12 
 python/ovs/db/data.py | 30 +
 python/ovs/db/idl.py  | 60 +-
 python/ovs/db/parser.py   |  8 +--
 python/ovs/db/schema.py   | 34 +-
 python/ovs/db/types.py| 29 -
 python/ovs/json.py| 18 ++
 python/ovs/jsonrpc.py | 11 ++--
 python/ovs/ovsuuid.py |  7 +--
 python/ovs/socket_util.py |  7 +--
 python/ovs/stream.py  |  6 +-
 python/ovs/unixctl/__init__.py|  9 +--
 python/ovs/unixctl/client.py  |  7 +--
 python/ovs/unixctl/server.py  | 15 ++---
 python/ovs/vlog.py|  7 +--
 python/ovstest/rpcserver.py   |  7 +--
 python/ovstest/util.py|  6 +-
 rhel/openvswitch-fedora.spec.in   |  1 -
 tests/test-json.py| 13 +---
 tests/test-ovsdb.py   | 41 +---
 tests/test-vlog.py|  2 -
 utilities/bugtool/ovs-bugtool.in  |  3 -
 .../docker/debian/build-kernel-modules.sh |  3 +-
 utilities/gdb/ovs_gdb.py  | 62 ---
 vtep/ovs-vtep.in  | 23 +++
 ...sr_share_openvswitch_scripts_ovs-xapi-sync | 10 ++-
 38 files changed, 181 insertions(+), 287 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index ec48202dd..f7a625f01 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -9,7 +9,7 @@ freebsd_build_task:
 
   env:
 DEPENDENCIES: automake libtool gmake gcc wget openssl
-  python3 py36-six py36-openssl py36-sphinx
+  python3 py36-openssl py36-sphinx
 matrix:
   COMPILER: gcc
   COMPILER: clang
diff --git a/.travis/linux-prepare.sh b/.travis/linux-prepare.sh
index 13390afc0..fda13e7d2 100755
--- a/.travis/linux-prepare.sh
+++ b/.travis/linux-prepare.sh
@@ -12,7 +12,7 @@ cd sparse
 make -j4 HAVE_LLVM= install
 cd ..
 
-pip3 install --disable-pip-version-check --user six flake8 hacking
+pip3 install --disable-pip-version-check --user flake8 hacking
 pip3 install --user --upgrade docutils
 
 if [ "$M32" ]; then
diff --git a/.travis/osx-prepare.sh b/.travis/osx-prepare.sh
index 78d5bb579..b6447aba1 100755
--- a/.travis/osx-prepare.sh
+++ b/.travis/osx-prepare.sh
@@ -1,4 +1,3 @@
 #!/bin/bash
 set -ev
-pip3 install --user six
 pip3 install --user --upgrade docutils
diff --git a/Documentation/intro/install/general.rst 
b/Documentation/intro/install/general.rst
index e62501be7..09f2c13f1 100644
--- a/Documentation/intro/install/general.rst
+++ b/Documentation/intro/install/general.rst
@@ -90,8 +90,7 @@ need the following software:
   If libcap-ng is installed, then Open vSwitch will automatically build with
   support for it.
 
-- Python 3.4 or later. You must also have the Python ``six`` library
-  version 1.4.0 or later.
+- Python 3.4 or later.
 
 - Unbound library, from http://www.unbound.net, is optional but recommended if
   you want to enable ovs-vswitchd and other utilities to use DNS names when
@@ -203,8 +202,7 @@ simply install and run Open vSwitch you require the 
following software:
   from iproute2 (part of all major distributions and available at
   https://wiki.linuxfoundation.org/networking/iproute2).
 
-- Python 3.4 or later. You must also have the Python six library
-  version 1.4.0 or later.
+- Python 3.4 or later.
 
 On Linux you should ensure that ``/dev/urandom`` exists. To support TAP
 devices, you must also ensure that ``/dev/net/tun`` exists.
diff --git a/Documentation/intro/install/netbsd.rst 
b/Documentation/intro/install/netbsd.rst
index 4f60dad86..d5bd3660a 100644
--- a/Documentation/intro/install/netbsd.rst
+++ b/Documentation/intro/install/netbsd.rst
@@ -32,7 +32,6 

[ovs-dev] [PATCH v2 2/2] Revert "docs: To build OVS on RHEL7 EPEL is needed"

2019-12-20 Thread Timothy Redaelli
This reverts commit 9e334d91b3ea95e2b96f7b3edcb2ba9c3353288a.

This commit is not needed since OVS doesn't use six anymore.

Signed-off-by: Timothy Redaelli 
---
 Documentation/intro/install/fedora.rst | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Documentation/intro/install/fedora.rst 
b/Documentation/intro/install/fedora.rst
index c6d1d83ae..6fe1fb5b2 100644
--- a/Documentation/intro/install/fedora.rst
+++ b/Documentation/intro/install/fedora.rst
@@ -63,12 +63,11 @@ The command below will create a temporary SPEC file::
   > /tmp/ovs.spec
 
 And to install specific dependencies, use the corresponding tool below.
-For some of the dependencies on RHEL 7 you may need to add three additional
+For some of the dependencies on RHEL you may need to add two additional
 repositories to help yum-builddep, e.g.::
 
 $ subscription-manager repos --enable=rhel-7-server-extras-rpms
 $ subscription-manager repos --enable=rhel-7-server-optional-rpms
-$ yum install 
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 
 DNF::
 
-- 
2.23.0

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2 0/2] Remove dependency on python3-six

2019-12-20 Thread Timothy Redaelli
Since Python 2 support was removed in 1ca0323e7c29 ("Require Python 3 and
remove support for Python 2."), python3-six is not needed anymore.

Moreover python3-six is not available on RHEL/CentOS7 without using EPEL
and so this patch is needed in order to release OVS 2.13 on RHEL7.


Changes in v2:

- Fixed a typo in commit message "Moveover" => "Moreover"
- Added missing "Signed-off-by" in Revert "docs: To build OVS on RHEL7 EPEL
  is needed"

Timothy Redaelli (2):
  Remove dependency on python3-six
  Revert "docs: To build OVS on RHEL7 EPEL is needed"

 .cirrus.yml   |  2 +-
 .travis/linux-prepare.sh  |  2 +-
 .travis/osx-prepare.sh|  1 -
 Documentation/intro/install/fedora.rst|  3 +-
 Documentation/intro/install/general.rst   |  6 +-
 Documentation/intro/install/netbsd.rst|  3 +-
 Documentation/intro/install/rhel.rst  |  2 +-
 Documentation/intro/install/windows.rst   |  5 +-
 Vagrantfile   |  7 ++-
 Vagrantfile-FreeBSD   |  2 +-
 appveyor.yml  |  2 +-
 configure.ac  |  1 -
 debian/control|  4 +-
 m4/openvswitch.m4 | 12 
 python/ovs/db/data.py | 30 +
 python/ovs/db/idl.py  | 60 +-
 python/ovs/db/parser.py   |  8 +--
 python/ovs/db/schema.py   | 34 +-
 python/ovs/db/types.py| 29 -
 python/ovs/json.py| 18 ++
 python/ovs/jsonrpc.py | 11 ++--
 python/ovs/ovsuuid.py |  7 +--
 python/ovs/socket_util.py |  7 +--
 python/ovs/stream.py  |  6 +-
 python/ovs/unixctl/__init__.py|  9 +--
 python/ovs/unixctl/client.py  |  7 +--
 python/ovs/unixctl/server.py  | 15 ++---
 python/ovs/vlog.py|  7 +--
 python/ovstest/rpcserver.py   |  7 +--
 python/ovstest/util.py|  6 +-
 rhel/openvswitch-fedora.spec.in   |  1 -
 tests/test-json.py| 13 +---
 tests/test-ovsdb.py   | 41 +---
 tests/test-vlog.py|  2 -
 utilities/bugtool/ovs-bugtool.in  |  3 -
 .../docker/debian/build-kernel-modules.sh |  3 +-
 utilities/gdb/ovs_gdb.py  | 62 ---
 vtep/ovs-vtep.in  | 23 +++
 ...sr_share_openvswitch_scripts_ovs-xapi-sync | 10 ++-
 39 files changed, 182 insertions(+), 289 deletions(-)

-- 
2.23.0

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 1/2] Remove dependency on python3-six

2019-12-20 Thread Timothy Redaelli
Since Python 2 support was removed in 1ca0323e7c29 ("Require Python 3 and
remove support for Python 2."), python3-six is not needed anymore.

Moveover python3-six is not available on RHEL/CentOS7 without using EPEL
and so this patch is needed in order to release OVS 2.13 on RHEL7.

Signed-off-by: Timothy Redaelli 
---
 .cirrus.yml   |  2 +-
 .travis/linux-prepare.sh  |  2 +-
 .travis/osx-prepare.sh|  1 -
 Documentation/intro/install/general.rst   |  6 +-
 Documentation/intro/install/netbsd.rst|  3 +-
 Documentation/intro/install/rhel.rst  |  2 +-
 Documentation/intro/install/windows.rst   |  5 +-
 Vagrantfile   |  7 ++-
 Vagrantfile-FreeBSD   |  2 +-
 appveyor.yml  |  2 +-
 configure.ac  |  1 -
 debian/control|  4 +-
 m4/openvswitch.m4 | 12 
 python/ovs/db/data.py | 30 +
 python/ovs/db/idl.py  | 60 +-
 python/ovs/db/parser.py   |  8 +--
 python/ovs/db/schema.py   | 34 +-
 python/ovs/db/types.py| 29 -
 python/ovs/json.py| 18 ++
 python/ovs/jsonrpc.py | 11 ++--
 python/ovs/ovsuuid.py |  7 +--
 python/ovs/socket_util.py |  7 +--
 python/ovs/stream.py  |  6 +-
 python/ovs/unixctl/__init__.py|  9 +--
 python/ovs/unixctl/client.py  |  7 +--
 python/ovs/unixctl/server.py  | 15 ++---
 python/ovs/vlog.py|  7 +--
 python/ovstest/rpcserver.py   |  7 +--
 python/ovstest/util.py|  6 +-
 rhel/openvswitch-fedora.spec.in   |  1 -
 tests/test-json.py| 13 +---
 tests/test-ovsdb.py   | 41 +---
 tests/test-vlog.py|  2 -
 utilities/bugtool/ovs-bugtool.in  |  3 -
 .../docker/debian/build-kernel-modules.sh |  3 +-
 utilities/gdb/ovs_gdb.py  | 62 ---
 vtep/ovs-vtep.in  | 23 +++
 ...sr_share_openvswitch_scripts_ovs-xapi-sync | 10 ++-
 38 files changed, 181 insertions(+), 287 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index ec48202dd..f7a625f01 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -9,7 +9,7 @@ freebsd_build_task:
 
   env:
 DEPENDENCIES: automake libtool gmake gcc wget openssl
-  python3 py36-six py36-openssl py36-sphinx
+  python3 py36-openssl py36-sphinx
 matrix:
   COMPILER: gcc
   COMPILER: clang
diff --git a/.travis/linux-prepare.sh b/.travis/linux-prepare.sh
index 13390afc0..fda13e7d2 100755
--- a/.travis/linux-prepare.sh
+++ b/.travis/linux-prepare.sh
@@ -12,7 +12,7 @@ cd sparse
 make -j4 HAVE_LLVM= install
 cd ..
 
-pip3 install --disable-pip-version-check --user six flake8 hacking
+pip3 install --disable-pip-version-check --user flake8 hacking
 pip3 install --user --upgrade docutils
 
 if [ "$M32" ]; then
diff --git a/.travis/osx-prepare.sh b/.travis/osx-prepare.sh
index 78d5bb579..b6447aba1 100755
--- a/.travis/osx-prepare.sh
+++ b/.travis/osx-prepare.sh
@@ -1,4 +1,3 @@
 #!/bin/bash
 set -ev
-pip3 install --user six
 pip3 install --user --upgrade docutils
diff --git a/Documentation/intro/install/general.rst 
b/Documentation/intro/install/general.rst
index e62501be7..09f2c13f1 100644
--- a/Documentation/intro/install/general.rst
+++ b/Documentation/intro/install/general.rst
@@ -90,8 +90,7 @@ need the following software:
   If libcap-ng is installed, then Open vSwitch will automatically build with
   support for it.
 
-- Python 3.4 or later. You must also have the Python ``six`` library
-  version 1.4.0 or later.
+- Python 3.4 or later.
 
 - Unbound library, from http://www.unbound.net, is optional but recommended if
   you want to enable ovs-vswitchd and other utilities to use DNS names when
@@ -203,8 +202,7 @@ simply install and run Open vSwitch you require the 
following software:
   from iproute2 (part of all major distributions and available at
   https://wiki.linuxfoundation.org/networking/iproute2).
 
-- Python 3.4 or later. You must also have the Python six library
-  version 1.4.0 or later.
+- Python 3.4 or later.
 
 On Linux you should ensure that ``/dev/urandom`` exists. To support TAP
 devices, you must also ensure that ``/dev/net/tun`` exists.
diff --git a/Documentation/intro/install/netbsd.rst 
b/Documentation/intro/install/netbsd.rst
index 4f60dad86..d5bd3660a 100644
--- a/Documentation/intro/install/netbsd.rst
+++ b/Documentation/intro/install/netbsd.rst
@@ -32,7 +32,6 

[ovs-dev] [PATCH 2/2] Revert "docs: To build OVS on RHEL7 EPEL is needed"

2019-12-20 Thread Timothy Redaelli
This reverts commit 9e334d91b3ea95e2b96f7b3edcb2ba9c3353288a.

This commit is not needed since OVS doesn't use six anymore.
---
 Documentation/intro/install/fedora.rst | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Documentation/intro/install/fedora.rst 
b/Documentation/intro/install/fedora.rst
index c6d1d83ae..6fe1fb5b2 100644
--- a/Documentation/intro/install/fedora.rst
+++ b/Documentation/intro/install/fedora.rst
@@ -63,12 +63,11 @@ The command below will create a temporary SPEC file::
   > /tmp/ovs.spec
 
 And to install specific dependencies, use the corresponding tool below.
-For some of the dependencies on RHEL 7 you may need to add three additional
+For some of the dependencies on RHEL you may need to add two additional
 repositories to help yum-builddep, e.g.::
 
 $ subscription-manager repos --enable=rhel-7-server-extras-rpms
 $ subscription-manager repos --enable=rhel-7-server-optional-rpms
-$ yum install 
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 
 DNF::
 
-- 
2.23.0

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 0/2] Remove dependency on python3-six

2019-12-20 Thread Timothy Redaelli
Since Python 2 support was removed in 1ca0323e7c29 ("Require Python 3 and
remove support for Python 2."), python3-six is not needed anymore.

Moveover python3-six is not available on RHEL/CentOS7 without using EPEL
and so this patch is needed in order to release OVS 2.13 on RHEL7.

Tested locally and with travis:
https://travis-ci.org/drizzt/ovs/builds/627763532

Timothy Redaelli (2):
  Remove dependency on python3-six
  Revert "docs: To build OVS on RHEL7 EPEL is needed"

 .cirrus.yml   |  2 +-
 .travis/linux-prepare.sh  |  2 +-
 .travis/osx-prepare.sh|  1 -
 Documentation/intro/install/fedora.rst|  3 +-
 Documentation/intro/install/general.rst   |  6 +-
 Documentation/intro/install/netbsd.rst|  3 +-
 Documentation/intro/install/rhel.rst  |  2 +-
 Documentation/intro/install/windows.rst   |  5 +-
 Vagrantfile   |  7 ++-
 Vagrantfile-FreeBSD   |  2 +-
 appveyor.yml  |  2 +-
 configure.ac  |  1 -
 debian/control|  4 +-
 m4/openvswitch.m4 | 12 
 python/ovs/db/data.py | 30 +
 python/ovs/db/idl.py  | 60 +-
 python/ovs/db/parser.py   |  8 +--
 python/ovs/db/schema.py   | 34 +-
 python/ovs/db/types.py| 29 -
 python/ovs/json.py| 18 ++
 python/ovs/jsonrpc.py | 11 ++--
 python/ovs/ovsuuid.py |  7 +--
 python/ovs/socket_util.py |  7 +--
 python/ovs/stream.py  |  6 +-
 python/ovs/unixctl/__init__.py|  9 +--
 python/ovs/unixctl/client.py  |  7 +--
 python/ovs/unixctl/server.py  | 15 ++---
 python/ovs/vlog.py|  7 +--
 python/ovstest/rpcserver.py   |  7 +--
 python/ovstest/util.py|  6 +-
 rhel/openvswitch-fedora.spec.in   |  1 -
 tests/test-json.py| 13 +---
 tests/test-ovsdb.py   | 41 +---
 tests/test-vlog.py|  2 -
 utilities/bugtool/ovs-bugtool.in  |  3 -
 .../docker/debian/build-kernel-modules.sh |  3 +-
 utilities/gdb/ovs_gdb.py  | 62 ---
 vtep/ovs-vtep.in  | 23 +++
 ...sr_share_openvswitch_scripts_ovs-xapi-sync | 10 ++-
 39 files changed, 182 insertions(+), 289 deletions(-)

-- 
2.23.0

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] travis: Use pip3 to install the python packages on linux

2019-12-19 Thread Timothy Redaelli
On Wed, 18 Dec 2019 16:50:05 -0800
Ben Pfaff  wrote:

> On Wed, Dec 18, 2019 at 04:53:10PM +0100, Timothy Redaelli wrote:
> > Currently pip is used to install the python packages on linux by travis,
> > but pip3 should be used since pip is a symlink of pip2.
> > 
> > Fixes: 1ca0323e7c29 ("Require Python 3 and remove support for Python 2.")
> > Cc: b...@ovn.org
> > Signed-off-by: Timothy Redaelli 
> 
> Does it pass on Travis?  If so, I'll apply it.

Sure,
https://travis-ci.org/drizzt/ovs/builds/626747307

Thank you

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] travis: Use pip3 to install the python packages on linux

2019-12-18 Thread Timothy Redaelli
Currently pip is used to install the python packages on linux by travis,
but pip3 should be used since pip is a symlink of pip2.

Fixes: 1ca0323e7c29 ("Require Python 3 and remove support for Python 2.")
Cc: b...@ovn.org
Signed-off-by: Timothy Redaelli 
---
 .travis.yml  | 1 +
 .travis/linux-prepare.sh | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 2dc4d436b..abd2a9117 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,6 +21,7 @@ addons:
   - libnuma-dev
   - libpcap-dev
   - python3-openssl
+  - python3-pip
   - python3-sphinx
   - libelf-dev
   - selinux-policy-dev
diff --git a/.travis/linux-prepare.sh b/.travis/linux-prepare.sh
index 2e57945f5..13390afc0 100755
--- a/.travis/linux-prepare.sh
+++ b/.travis/linux-prepare.sh
@@ -12,8 +12,8 @@ cd sparse
 make -j4 HAVE_LLVM= install
 cd ..
 
-pip install --disable-pip-version-check --user six flake8 hacking
-pip install --user --upgrade docutils
+pip3 install --disable-pip-version-check --user six flake8 hacking
+pip3 install --user --upgrade docutils
 
 if [ "$M32" ]; then
 # Installing 32-bit libraries.
-- 
2.23.0

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] docs: To build OVS on RHEL7 EPEL is needed

2019-10-25 Thread Timothy Redaelli
Since Python 3 is now mandatory, Extra Packages for Enterprise Linux
(EPEL) repository is needed in order to build OVS on RHEL7.

Signed-off-by: Timothy Redaelli 
---
 Documentation/intro/install/fedora.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/intro/install/fedora.rst 
b/Documentation/intro/install/fedora.rst
index 6fe1fb5b2..c6d1d83ae 100644
--- a/Documentation/intro/install/fedora.rst
+++ b/Documentation/intro/install/fedora.rst
@@ -63,11 +63,12 @@ The command below will create a temporary SPEC file::
   > /tmp/ovs.spec
 
 And to install specific dependencies, use the corresponding tool below.
-For some of the dependencies on RHEL you may need to add two additional
+For some of the dependencies on RHEL 7 you may need to add three additional
 repositories to help yum-builddep, e.g.::
 
 $ subscription-manager repos --enable=rhel-7-server-extras-rpms
 $ subscription-manager repos --enable=rhel-7-server-optional-rpms
+$ yum install 
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 
 DNF::
 
-- 
2.21.0

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 1/2] fedora: Ability to auto enable openvswitch service.

2019-05-10 Thread Timothy Redaelli
On Fri,  3 May 2019 00:05:34 -0700
Gurucharan Shetty  wrote:

> We currently have rhel/openvswitch.spec.in that automatically
> enables openvswitch service when the package is installed using
> chkconfig.
> 
> But fedora rpm may not enable openvswitch service automatically.
> The macro currently being used in fedora rpm (systemd_post) will
> look for preset files in /etc/systemd/system-preset/ to figure
> out whether openvswitch service needs to be automatically enabled.
> But, the fedora package does not provide such a file. The argument
> is that people may want to install the package for binaries and
> not necessarily to run OVS.
> 
> If someone now wants to install the fedora package and automatically
> enable openvswitch, he will have to create a new package that OVS
> package depends on to install the preset file. This is unwieldy.
> 
> This commit, provides a rpm build time option to enable the openvswitch
> service automatically. If you now run the below command, openvswitch
> service will be automatically enabled during package installation.
> 
> make rpm-fedora RPMBUILD_OPT="--with autoenable"
> 
> Signed-off-by: Gurucharan Shetty 
> ---
>  rhel/openvswitch-fedora.spec.in | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
> index ce728b4..e8165f9 100644
> --- a/rhel/openvswitch-fedora.spec.in
> +++ b/rhel/openvswitch-fedora.spec.in
> @@ -32,6 +32,9 @@
>  # This is enabled by default for versions of the distribution that
>  # have Python 3 by default (Fedora > 22).
>  %bcond_with build_python3
> +# If there is a need to automatically enable the package after installation,
> +# specify the "--with autoenable"
> +%bcond_with autoenable
>  
>  # Enable PIE, bz#955181
>  %global _hardened_build 1
> @@ -382,6 +385,7 @@ fi
>  %endif
>  
>  %if 0%{?systemd_post:1}
> +# This may not enable openvswitch service or do daemon-reload.
>  %systemd_post %{name}.service
>  %else
>  # Package install, not upgrade
> @@ -390,6 +394,11 @@ fi
>  fi
>  %endif
>  
> +%if %{with autoenable}
> +systemctl daemon-reload
> +systemctl enable openvswitch
> +%endif
> +
>  %post selinux-policy
>  %selinux_modules_install -s targeted 
> %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp
>  

Hi,
usually a package on Fedora/RHEL7+ is never enabled by default, unless
it's necessary to enable it for a really good reason.

So any Fedora/RHEL7+ user knows (and expect) that he need to manually
enable/start a service after it's installed.

Probably it's better to put something like (postun?):

if /sbin/chkconfig --level 3 openvswitch; then  
   
/bin/systemctl enable openvswitch.service >/dev/null 2>&1 || :
/bin/systemctl restart openvswitch.service >/dev/null 2>&1 || :
fi

Just to enable it if it was enabled before on sysv?

I didn't tested it, but usually (on Fedora spec files) it's the correct
way to do that.

Thank you

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


  1   2   3   >