Split libopenvswitch into two libraries:

 - libopenvswitchutils: containers, utilities, I/O, threading,
   logging, and OVSDB client modules.
 - libopenvswitch: datapath, OpenFlow, netdev, dpif, flow,
   conntrack, and related modules.

Both libraries are installed.  A shared convenience library
(libovsutil) is compiled once, then its objects are absorbed into
both installed libraries.  This ensures identical compilation flags
for header-only code (hashes, atomics) in both libraries, addressing
the concern that divergent CFLAGS could produce different hash values.

Programs that do not need datapath functionality now link only
libopenvswitchutils, reducing their dependency footprint:
ovsdb-server, ovsdb-client, ovsdb-tool, ovs-appctl, vtep-ctl,
test-lib.

Programs that link libopenvswitch do not need to also link
libopenvswitchutils, since libopenvswitch already contains all
utils symbols through the convenience library.

USDT probe scripts updated to also search libopenvswitchutils
for struct definitions.

Signed-off-by: Timothy Redaelli <[email protected]>
---
 NEWS                                         |   6 +
 configure.ac                                 |   2 +
 debian/rules                                 |   4 +-
 lib/.gitignore                               |   1 +
 lib/automake.mk                              | 374 ++++++++++---------
 lib/libopenvswitchutils.pc.in                |  11 +
 lib/libopenvswitchutils.sym.in               |   4 +
 ovsdb/automake.mk                            |   6 +-
 python/setup.py.template                     |   2 +-
 tests/automake.mk                            |   6 +-
 tests/oss-fuzz/automake.mk                   |   2 +-
 tests/test-lib.c                             |   1 -
 utilities/automake.mk                        |   2 +-
 utilities/usdt-scripts/flow_reval_monitor.py |   1 +
 utilities/usdt-scripts/reval_monitor.py      |   4 +-
 vtep/automake.mk                             |   2 +-
 16 files changed, 234 insertions(+), 194 deletions(-)
 create mode 100644 lib/libopenvswitchutils.pc.in
 create mode 100644 lib/libopenvswitchutils.sym.in

diff --git a/NEWS b/NEWS
index 58bf25767..f09eb5d11 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,12 @@ Post-v4.0.0
 
 v4.0.0 - xx xxx xxxx
 --------------------
+   - The libopenvswitch library has been split into libopenvswitch (datapath,
+     OpenFlow, netdev) and libopenvswitchutils (utilities, containers, I/O,
+     OVSDB client).  Programs that do not need the datapath functionality
+     (e.g. ovsdb-server, ovsdb-client) now link only libopenvswitchutils.
+     Address parsing and formatting functions have been moved from packets.[ch]
+     to netaddr.[ch] in the utils library.
    - Userspace datapath:
      * ARP/ND lookups for native tunnel are now rate limited. The holdout
        timer can be configured with 'tnl/neigh/retrans_time'.
diff --git a/configure.ac b/configure.ac
index db233fad4..25eced908 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,6 +149,7 @@ AC_CONFIG_FILES([
     ofproto/libofproto.sym
     lib/libsflow.sym
     lib/libopenvswitch.sym
+    lib/libopenvswitchutils.sym
     vtep/libvtep.sym])
 
 OVS_ENABLE_OPTION([-Wall])
@@ -204,6 +205,7 @@ AC_SUBST([OVS_LDFLAGS])
 AC_CONFIG_FILES(Makefile)
 AC_CONFIG_FILES(tests/atlocal)
 AC_CONFIG_FILES(lib/libopenvswitch.pc)
+AC_CONFIG_FILES(lib/libopenvswitchutils.pc)
 AC_CONFIG_FILES(lib/libsflow.pc)
 AC_CONFIG_FILES(ofproto/libofproto.pc)
 AC_CONFIG_FILES(ovsdb/libovsdb.pc)
diff --git a/debian/rules b/debian/rules
index df07ffb39..fb41a8370 100755
--- a/debian/rules
+++ b/debian/rules
@@ -88,8 +88,8 @@ pybuild = \
        export PKG_CONFIG_SYSTEM_INCLUDE_PATH=/; \
        export PKG_CONFIG_SYSTEM_LIBRARY_PATH=/; \
        enable_shared=no \
-       extra_cflags="`pkg-config --cflags libopenvswitch`" \
-       extra_libs="-Wl,-Bstatic -lopenvswitch -Wl,-Bdynamic `pkg-config --libs 
--static libopenvswitch`" \
+       extra_cflags="`pkg-config --cflags libopenvswitchutils`" \
+       extra_libs="-Wl,-Bstatic -lopenvswitchutils -Wl,-Bdynamic `pkg-config 
--libs --static libopenvswitchutils`" \
        pybuild
 
 override_dh_auto_build:
diff --git a/lib/.gitignore b/lib/.gitignore
index ec9bdb092..31575a202 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -19,4 +19,5 @@
 /vswitch-idl.h
 /vswitch-idl.ovsidl
 /libopenvswitch.pc
+/libopenvswitchutils.pc
 /libsflow.pc
diff --git a/lib/automake.mk b/lib/automake.mk
index 7107780f7..2ecc6bfe4 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -5,36 +5,18 @@
 # notice and this notice are preserved.  This file is offered as-is,
 # without warranty of any kind.
 
-lib_LTLIBRARIES += lib/libopenvswitch.la
-
-lib_libopenvswitch_la_LIBADD = $(SSL_LIBS)
-lib_libopenvswitch_la_LIBADD += $(CAPNG_LDADD)
+noinst_LTLIBRARIES += lib/libovsutil.la
 
-lib_libopenvswitch_la_LDFLAGS = \
-        $(OVS_LTINFO) \
-        -Wl,--version-script=$(top_builddir)/lib/libopenvswitch.sym \
-        $(AM_LDFLAGS)
-
-# Build core vswitch libraries as before
-lib_libopenvswitch_la_SOURCES = \
+lib_libovsutil_la_SOURCES = \
        lib/aes128.c \
        lib/aes128.h \
        lib/async-append.h \
        lib/backtrace.c \
        lib/backtrace.h \
-       lib/bfd.c \
-       lib/bfd.h \
        lib/bitmap.h \
-       lib/bundle.c \
-       lib/bundle.h \
        lib/byte-order.h \
        lib/byteq.c \
        lib/byteq.h \
-       lib/cfm.c \
-       lib/cfm.h \
-       lib/classifier.c \
-       lib/classifier.h \
-       lib/classifier-private.h \
        lib/ccmap.c \
        lib/ccmap.h \
        lib/cmap.c \
@@ -44,16 +26,6 @@ lib_libopenvswitch_la_SOURCES = \
        lib/command-line.c \
        lib/command-line.h \
        lib/compiler.h \
-       lib/connectivity.c \
-       lib/connectivity.h \
-       lib/conntrack-icmp.c \
-       lib/conntrack-private.h \
-       lib/conntrack-tcp.c \
-       lib/conntrack-tp.c \
-       lib/conntrack-tp.h \
-       lib/conntrack-other.c \
-       lib/conntrack.c \
-       lib/conntrack.h \
        lib/cooperative-multitasking.c \
        lib/cooperative-multitasking.h \
        lib/cooperative-multitasking-private.h \
@@ -63,42 +35,13 @@ lib_libopenvswitch_la_SOURCES = \
        lib/crc32c.h \
        lib/csum.c \
        lib/csum.h \
-       lib/ct-dpif.c \
-       lib/ct-dpif.h \
        lib/daemon.c \
        lib/daemon.h \
        lib/daemon-private.h \
        lib/db-ctl-base.c \
        lib/db-ctl-base.h \
-       lib/dhcp.h \
-       lib/dummy.c \
-       lib/dummy.h \
        lib/dhparams.h \
        lib/dirs.h \
-       lib/dpctl.c \
-       lib/dpctl.h \
-       lib/dp-packet.h \
-       lib/dp-packet.c \
-       lib/dp-packet-gso.c \
-       lib/dp-packet-gso.h \
-       lib/dpdk.h \
-       lib/dpif-netdev-dfc.c \
-       lib/dpif-netdev-dfc.h \
-       lib/dpif-netdev-dpcls.c \
-       lib/dpif-netdev-dpcls.h \
-       lib/dpif-netdev-flow.h \
-       lib/dpif-netdev-perf.c \
-       lib/dpif-netdev-perf.h \
-       lib/dpif-netdev-thread.h \
-       lib/dpif-netdev.c \
-       lib/dpif-netdev.h \
-       lib/dpif-offload.c \
-       lib/dpif-offload.h \
-       lib/dpif-offload-dummy.c \
-       lib/dpif-offload-provider.h \
-       lib/dpif-provider.h \
-       lib/dpif.c \
-       lib/dpif.h \
        lib/heap.c \
        lib/heap.h \
        lib/dynamic-string.c \
@@ -108,8 +51,6 @@ lib_libopenvswitch_la_SOURCES = \
        lib/fat-rwlock.h \
        lib/fatal-signal.c \
        lib/fatal-signal.h \
-       lib/flow.c \
-       lib/flow.h \
        lib/guarded-list.c \
        lib/guarded-list.h \
        lib/hash.c \
@@ -124,85 +65,25 @@ lib_libopenvswitch_la_SOURCES = \
        lib/id-fpool.h \
        lib/id-pool.c \
        lib/id-pool.h \
-       lib/if-notifier-manual.c \
-       lib/if-notifier.h \
-       lib/ipf.c \
-       lib/ipf.h \
        lib/jhash.c \
        lib/jhash.h \
        lib/json.c \
        lib/json.h \
        lib/jsonrpc.c \
        lib/jsonrpc.h \
-       lib/lacp.c \
-       lib/lacp.h \
        lib/latch.h \
-       lib/learn.c \
-       lib/learn.h \
-       lib/learning-switch.c \
-       lib/learning-switch.h \
        lib/lockfile.c \
        lib/lockfile.h \
-       lib/mac-learning.c \
-       lib/mac-learning.h \
-       lib/match.c \
-       lib/mcast-snooping.c \
-       lib/mcast-snooping.h \
        lib/memory.c \
        lib/memory.h \
-       lib/meta-flow.c \
        lib/mov-avg.h \
        lib/mpsc-queue.c \
        lib/mpsc-queue.h \
-       lib/multipath.c \
-       lib/multipath.h \
        lib/namemap.c \
-       lib/netdev-dpdk.h \
-       lib/netdev-dummy.c \
-       lib/netdev-provider.h \
-       lib/netdev-vport.c \
-       lib/netdev-vport.h \
-       lib/netdev-vport-private.h \
-       lib/netdev.c \
-       lib/netdev.h \
-       lib/netflow.h \
-       lib/netlink.c \
-       lib/netlink.h \
-       lib/netnsid.c \
-       lib/netnsid.h \
-       lib/nx-match.c \
-       lib/nx-match.h \
+       lib/netaddr.c \
+       lib/netaddr.h \
        lib/object-collection.c \
        lib/object-collection.h \
-       lib/odp-execute.c \
-       lib/odp-execute.h \
-       lib/odp-util.c \
-       lib/odp-util.h \
-       lib/ofp-actions.c \
-       lib/ofp-bundle.c \
-       lib/ofp-connection.c \
-       lib/ofp-ct.c \
-       lib/ofp-ed-props.c \
-       lib/ofp-errors.c \
-       lib/ofp-flow.c \
-       lib/ofp-group.c \
-       lib/ofp-ipfix.c \
-       lib/ofp-match.c \
-       lib/ofp-meter.c \
-       lib/ofp-monitor.c \
-       lib/ofp-msgs.c \
-       lib/ofp-packet.c \
-       lib/ofp-parse.c \
-       lib/ofp-port.c \
-       lib/ofp-print.c \
-       lib/ofp-prop.c \
-       lib/ofp-protocol.c \
-       lib/ofp-queue.c \
-       lib/ofp-switch.c \
-       lib/ofp-table.c \
-       lib/ofp-util.c \
-       lib/ofp-version-opt.h \
-       lib/ofp-version-opt.c \
        lib/ofpbuf.c \
        lib/ovs-atomic-c++.h \
        lib/ovs-atomic-c11.h \
@@ -216,16 +97,12 @@ lib_libopenvswitch_la_SOURCES = \
        lib/ovs-atomic-pthreads.h \
        lib/ovs-atomic-x86_64.h \
        lib/ovs-atomic.h \
-       lib/ovs-lldp.c \
-       lib/ovs-lldp.h \
        lib/ovs-numa.c \
        lib/ovs-numa.h \
        lib/ovs-rcu.c \
        lib/ovs-rcu.h \
        lib/ovs-replay.c \
        lib/ovs-replay.h \
-       lib/ovs-router.h \
-       lib/ovs-router.c \
        lib/ovs-thread.c \
        lib/ovs-thread.h \
        lib/ovsdb-cs.c \
@@ -249,14 +126,6 @@ lib_libopenvswitch_la_SOURCES = \
        lib/ovsdb-session.h \
        lib/ovsdb-types.c \
        lib/ovsdb-types.h \
-       lib/ox-stat.c \
-       lib/ox-stat.h \
-       lib/netaddr.c \
-       lib/netaddr.h \
-       lib/packets.c \
-       lib/packets.h \
-       lib/pcap-file.c \
-       lib/pcap-file.h \
        lib/perf-counter.h \
        lib/perf-counter.c \
        lib/stopwatch.h \
@@ -268,15 +137,9 @@ lib_libopenvswitch_la_SOURCES = \
        lib/pvector.h \
        lib/random.c \
        lib/random.h \
-       lib/rconn.c \
        lib/rculist.h \
        lib/reconnect.c \
        lib/reconnect.h \
-       lib/rstp.c \
-       lib/rstp.h \
-       lib/rstp-common.h \
-       lib/rstp-state-machines.c \
-       lib/rstp-state-machines.h \
        lib/sat-math.h \
        lib/seq.c \
        lib/seq.h \
@@ -295,8 +158,6 @@ lib_libopenvswitch_la_SOURCES = \
        lib/sort.h \
        lib/sset.c \
        lib/sset.h \
-       lib/stp.c \
-       lib/stp.h \
        lib/stream-fd.c \
        lib/stream-fd.h \
        lib/stream-provider.h \
@@ -321,22 +182,12 @@ lib_libopenvswitch_la_SOURCES = \
        lib/timer.h \
        lib/timeval.c \
        lib/timeval.h \
-       lib/tnl-neigh-cache.c \
-       lib/tnl-neigh-cache.h \
-       lib/tnl-ports.c \
-       lib/tnl-ports.h \
-       lib/netdev-native-tnl.c \
-       lib/netdev-native-tnl.h \
        lib/token-bucket.c \
-       lib/tun-metadata.c \
-       lib/tun-metadata.h \
        lib/unaligned.h \
        lib/unicode.c \
        lib/unicode.h \
        lib/unixctl.c \
        lib/unixctl.h \
-       lib/userspace-tso.c \
-       lib/userspace-tso.h \
        lib/util.c \
        lib/util.h \
        lib/uuid.c \
@@ -344,24 +195,9 @@ lib_libopenvswitch_la_SOURCES = \
        lib/uuidset.c \
        lib/uuidset.h \
        lib/valgrind.h \
-       lib/vconn-provider.h \
-       lib/vconn-stream.c \
-       lib/vconn.c \
-       lib/versions.h \
-       lib/vl-mff-map.h \
-       lib/vlan-bitmap.c \
-       lib/vlan-bitmap.h \
-       lib/vlog.c \
-       lib/lldp/aa-structs.h \
-       lib/lldp/lldp.c \
-       lib/lldp/lldp-const.h \
-       lib/lldp/lldp-tlv.h \
-       lib/lldp/lldpd.c \
-       lib/lldp/lldpd.h \
-       lib/lldp/lldpd-structs.c \
-       lib/lldp/lldpd-structs.h
+       lib/vlog.c
 
-lib_libopenvswitch_la_SOURCES += \
+lib_libovsutil_la_SOURCES += \
        lib/daemon-unix.c \
        lib/latch-unix.c \
        lib/signals.c \
@@ -372,14 +208,193 @@ lib_libopenvswitch_la_SOURCES += \
 EXTRA_DIST += \
        lib/string.h.in
 
-nodist_lib_libopenvswitch_la_SOURCES = \
+nodist_lib_libovsutil_la_SOURCES = \
        lib/dirs.c \
        lib/ovsdb-server-idl.c \
-       lib/ovsdb-server-idl.h \
+       lib/ovsdb-server-idl.h
+CLEANFILES += $(nodist_lib_libovsutil_la_SOURCES)
+
+lib_LTLIBRARIES += lib/libopenvswitchutils.la
+
+lib_libopenvswitchutils_la_SOURCES =
+lib_libopenvswitchutils_la_LIBADD = lib/libovsutil.la $(SSL_LIBS) 
$(CAPNG_LDADD)
+
+lib_libopenvswitchutils_la_LDFLAGS = \
+        $(OVS_LTINFO) \
+        -Wl,--version-script=$(top_builddir)/lib/libopenvswitchutils.sym \
+        $(AM_LDFLAGS)
+
+lib_LTLIBRARIES += lib/libopenvswitch.la
+
+lib_libopenvswitch_la_LIBADD = lib/libovsutil.la $(SSL_LIBS) $(CAPNG_LDADD)
+
+lib_libopenvswitch_la_LDFLAGS = \
+        $(OVS_LTINFO) \
+        -Wl,--version-script=$(top_builddir)/lib/libopenvswitch.sym \
+        $(AM_LDFLAGS)
+
+nodist_lib_libopenvswitch_la_SOURCES = \
        lib/vswitch-idl.c \
        lib/vswitch-idl.h
 CLEANFILES += $(nodist_lib_libopenvswitch_la_SOURCES)
 
+lib_libopenvswitch_la_SOURCES = \
+       lib/bfd.c \
+       lib/bfd.h \
+       lib/bundle.c \
+       lib/bundle.h \
+       lib/cfm.c \
+       lib/cfm.h \
+       lib/classifier.c \
+       lib/classifier.h \
+       lib/classifier-private.h \
+       lib/connectivity.c \
+       lib/connectivity.h \
+       lib/conntrack-icmp.c \
+       lib/conntrack-private.h \
+       lib/conntrack-tcp.c \
+       lib/conntrack-tp.c \
+       lib/conntrack-tp.h \
+       lib/conntrack-other.c \
+       lib/conntrack.c \
+       lib/conntrack.h \
+       lib/ct-dpif.c \
+       lib/ct-dpif.h \
+       lib/dhcp.h \
+       lib/dummy.c \
+       lib/dummy.h \
+       lib/dpctl.c \
+       lib/dpctl.h \
+       lib/dp-packet.h \
+       lib/dp-packet.c \
+       lib/dp-packet-gso.c \
+       lib/dp-packet-gso.h \
+       lib/dpdk.h \
+       lib/dpif-netdev-dfc.c \
+       lib/dpif-netdev-dfc.h \
+       lib/dpif-netdev-dpcls.c \
+       lib/dpif-netdev-dpcls.h \
+       lib/dpif-netdev-flow.h \
+       lib/dpif-netdev-perf.c \
+       lib/dpif-netdev-perf.h \
+       lib/dpif-netdev-thread.h \
+       lib/dpif-netdev.c \
+       lib/dpif-netdev.h \
+       lib/dpif-offload.c \
+       lib/dpif-offload.h \
+       lib/dpif-offload-dummy.c \
+       lib/dpif-offload-provider.h \
+       lib/dpif-provider.h \
+       lib/dpif.c \
+       lib/dpif.h \
+       lib/flow.c \
+       lib/flow.h \
+       lib/if-notifier-manual.c \
+       lib/if-notifier.h \
+       lib/ipf.c \
+       lib/ipf.h \
+       lib/lacp.c \
+       lib/lacp.h \
+       lib/learn.c \
+       lib/learn.h \
+       lib/learning-switch.c \
+       lib/learning-switch.h \
+       lib/mac-learning.c \
+       lib/mac-learning.h \
+       lib/match.c \
+       lib/mcast-snooping.c \
+       lib/mcast-snooping.h \
+       lib/meta-flow.c \
+       lib/multipath.c \
+       lib/multipath.h \
+       lib/netdev-dpdk.h \
+       lib/netdev-dummy.c \
+       lib/netdev-provider.h \
+       lib/netdev-vport.c \
+       lib/netdev-vport.h \
+       lib/netdev-vport-private.h \
+       lib/netdev.c \
+       lib/netdev.h \
+       lib/netflow.h \
+       lib/netlink.c \
+       lib/netlink.h \
+       lib/netnsid.c \
+       lib/netnsid.h \
+       lib/nx-match.c \
+       lib/nx-match.h \
+       lib/odp-execute.c \
+       lib/odp-execute.h \
+       lib/odp-util.c \
+       lib/odp-util.h \
+       lib/ofp-actions.c \
+       lib/ofp-bundle.c \
+       lib/ofp-connection.c \
+       lib/ofp-ct.c \
+       lib/ofp-ed-props.c \
+       lib/ofp-errors.c \
+       lib/ofp-flow.c \
+       lib/ofp-group.c \
+       lib/ofp-ipfix.c \
+       lib/ofp-match.c \
+       lib/ofp-meter.c \
+       lib/ofp-monitor.c \
+       lib/ofp-msgs.c \
+       lib/ofp-packet.c \
+       lib/ofp-parse.c \
+       lib/ofp-port.c \
+       lib/ofp-print.c \
+       lib/ofp-prop.c \
+       lib/ofp-protocol.c \
+       lib/ofp-queue.c \
+       lib/ofp-switch.c \
+       lib/ofp-table.c \
+       lib/ofp-util.c \
+       lib/ofp-version-opt.h \
+       lib/ofp-version-opt.c \
+       lib/ovs-lldp.c \
+       lib/ovs-lldp.h \
+       lib/ovs-router.h \
+       lib/ovs-router.c \
+       lib/ox-stat.c \
+       lib/ox-stat.h \
+       lib/packets.c \
+       lib/packets.h \
+       lib/pcap-file.c \
+       lib/pcap-file.h \
+       lib/rconn.c \
+       lib/rstp.c \
+       lib/rstp.h \
+       lib/rstp-common.h \
+       lib/rstp-state-machines.c \
+       lib/rstp-state-machines.h \
+       lib/stp.c \
+       lib/stp.h \
+       lib/tnl-neigh-cache.c \
+       lib/tnl-neigh-cache.h \
+       lib/tnl-ports.c \
+       lib/tnl-ports.h \
+       lib/netdev-native-tnl.c \
+       lib/netdev-native-tnl.h \
+       lib/tun-metadata.c \
+       lib/tun-metadata.h \
+       lib/userspace-tso.c \
+       lib/userspace-tso.h \
+       lib/vconn-provider.h \
+       lib/vconn-stream.c \
+       lib/vconn.c \
+       lib/versions.h \
+       lib/vl-mff-map.h \
+       lib/vlan-bitmap.c \
+       lib/vlan-bitmap.h \
+       lib/lldp/aa-structs.h \
+       lib/lldp/lldp.c \
+       lib/lldp/lldp-const.h \
+       lib/lldp/lldp-tlv.h \
+       lib/lldp/lldpd.c \
+       lib/lldp/lldpd.h \
+       lib/lldp/lldpd-structs.c \
+       lib/lldp/lldpd-structs.h
+
 lib_LTLIBRARIES += lib/libsflow.la
 lib_libsflow_la_LDFLAGS = \
         $(OVS_LTINFO) \
@@ -450,9 +465,9 @@ lib_libopenvswitch_la_SOURCES += \
 endif
 
 if HAVE_POSIX_AIO
-lib_libopenvswitch_la_SOURCES += lib/async-append-aio.c
+lib_libovsutil_la_SOURCES += lib/async-append-aio.c
 else
-lib_libopenvswitch_la_SOURCES += lib/async-append-null.c
+lib_libovsutil_la_SOURCES += lib/async-append-null.c
 endif
 
 if HAVE_IF_DL
@@ -466,7 +481,7 @@ endif
 
 .PHONY: generate-dhparams-c
 if HAVE_OPENSSL
-lib_libopenvswitch_la_SOURCES += lib/stream-ssl.c lib/dhparams.c
+lib_libovsutil_la_SOURCES += lib/stream-ssl.c lib/dhparams.c
 
 # Manually regenerates lib/dhparams.c.  Not normally necessary since
 # lib/dhparams.c is part of the repository and doesn't normally need
@@ -476,18 +491,19 @@ generate-dhparams-c:
        build-aux/generate-dhparams-c > lib/dhparams.c.tmp && \
        mv lib/dhparams.c.tmp lib/dhparams.c
 else
-lib_libopenvswitch_la_SOURCES += lib/stream-nossl.c
+lib_libovsutil_la_SOURCES += lib/stream-nossl.c
 endif
 
-lib_libopenvswitch_la_SOURCES += lib/dns-resolve.h
+lib_libovsutil_la_SOURCES += lib/dns-resolve.h
 if HAVE_UNBOUND
-lib_libopenvswitch_la_SOURCES += lib/dns-resolve.c
+lib_libovsutil_la_SOURCES += lib/dns-resolve.c
 else
-lib_libopenvswitch_la_SOURCES += lib/dns-resolve-stub.c
+lib_libovsutil_la_SOURCES += lib/dns-resolve-stub.c
 endif
 
 pkgconfig_DATA += \
        lib/libopenvswitch.pc \
+       lib/libopenvswitchutils.pc \
        lib/libsflow.pc
 
 EXTRA_DIST += \
diff --git a/lib/libopenvswitchutils.pc.in b/lib/libopenvswitchutils.pc.in
new file mode 100644
index 000000000..d8915d4eb
--- /dev/null
+++ b/lib/libopenvswitchutils.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libopenvswitchutils
+Description: Open vSwitch common library
+Version: @VERSION@
+Libs: -L${libdir} -lopenvswitchutils
+Libs.private: @LIBS@ @SSL_LIBS@ @CAPNG_LDADD@
+Cflags: -I${includedir}
diff --git a/lib/libopenvswitchutils.sym.in b/lib/libopenvswitchutils.sym.in
new file mode 100644
index 000000000..f7e32afba
--- /dev/null
+++ b/lib/libopenvswitchutils.sym.in
@@ -0,0 +1,4 @@
+libopenvswitchutils_@LT_CURRENT@ {
+global:
+        *;
+};
diff --git a/ovsdb/automake.mk b/ovsdb/automake.mk
index d484fe9de..de9489442 100644
--- a/ovsdb/automake.mk
+++ b/ovsdb/automake.mk
@@ -63,7 +63,7 @@ MAN_FRAGMENTS += ovsdb/ovsdb-schemas.man
 # ovsdb-tool
 bin_PROGRAMS += ovsdb/ovsdb-tool
 ovsdb_ovsdb_tool_SOURCES = ovsdb/ovsdb-tool.c
-ovsdb_ovsdb_tool_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la
+ovsdb_ovsdb_tool_LDADD = ovsdb/libovsdb.la lib/libopenvswitchutils.la
 # ovsdb-tool.1
 man_MANS += ovsdb/ovsdb-tool.1
 CLEANFILES += ovsdb/ovsdb-tool.1
@@ -72,7 +72,7 @@ MAN_ROOTS += ovsdb/ovsdb-tool.1.in
 # ovsdb-client
 bin_PROGRAMS += ovsdb/ovsdb-client
 ovsdb_ovsdb_client_SOURCES = ovsdb/ovsdb-client.c
-ovsdb_ovsdb_client_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la
+ovsdb_ovsdb_client_LDADD = ovsdb/libovsdb.la lib/libopenvswitchutils.la
 # ovsdb-client.1
 man_MANS += ovsdb/ovsdb-client.1
 CLEANFILES += ovsdb/ovsdb-client.1
@@ -81,7 +81,7 @@ MAN_ROOTS += ovsdb/ovsdb-client.1.in
 # ovsdb-server
 sbin_PROGRAMS += ovsdb/ovsdb-server
 ovsdb_ovsdb_server_SOURCES = ovsdb/ovsdb-server.c
-ovsdb_ovsdb_server_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la
+ovsdb_ovsdb_server_LDADD = ovsdb/libovsdb.la lib/libopenvswitchutils.la
 # ovsdb-server.1
 man_MANS += ovsdb/ovsdb-server.1
 CLEANFILES += ovsdb/ovsdb-server.1
diff --git a/python/setup.py.template b/python/setup.py.template
index 56a426dad..88d5402f5 100644
--- a/python/setup.py.template
+++ b/python/setup.py.template
@@ -69,7 +69,7 @@ class try_build_ext(build_ext):
 if os.environ.get('enable_shared', '') == 'no':
     libraries = []
 else:
-    libraries = ['openvswitch']
+    libraries = ['openvswitchutils']
 
 extra_cflags = os.environ.get('extra_cflags', '').split()
 extra_libs = os.environ.get('extra_libs', '').split()
diff --git a/tests/automake.mk b/tests/automake.mk
index 2f3e4f7ef..c479165b4 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -441,12 +441,12 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
 noinst_PROGRAMS += tests/test-ovsdb
 tests_test_ovsdb_SOURCES = tests/test-ovsdb.c
 nodist_tests_test_ovsdb_SOURCES = tests/idltest.c tests/idltest.h
-tests_test_ovsdb_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la
+tests_test_ovsdb_LDADD = ovsdb/libovsdb.la lib/libopenvswitchutils.la
 
 noinst_PROGRAMS += tests/test-lib
 tests_test_lib_SOURCES = \
        tests/test-lib.c
-tests_test_lib_LDADD = lib/libopenvswitch.la
+tests_test_lib_LDADD = lib/libopenvswitchutils.la
 
 # idltest schema and IDL
 OVSIDL_BUILT += tests/idltest.c tests/idltest.h tests/idltest.ovsidl
@@ -521,7 +521,7 @@ tests_ovstest_LDADD = lib/libopenvswitch.la
 
 noinst_PROGRAMS += tests/test-stream
 tests_test_stream_SOURCES = tests/test-stream.c
-tests_test_stream_LDADD = lib/libopenvswitch.la
+tests_test_stream_LDADD = lib/libopenvswitchutils.la
 
 noinst_PROGRAMS += tests/test-strtok_r
 tests_test_strtok_r_SOURCES = tests/test-strtok_r.c
diff --git a/tests/oss-fuzz/automake.mk b/tests/oss-fuzz/automake.mk
index 2b116e7a5..208ebe590 100644
--- a/tests/oss-fuzz/automake.mk
+++ b/tests/oss-fuzz/automake.mk
@@ -17,7 +17,7 @@ tests_oss_fuzz_flow_extract_target_LDFLAGS = 
$(LIB_FUZZING_ENGINE) -lc++
 tests_oss_fuzz_json_parser_target_SOURCES = \
        tests/oss-fuzz/json_parser_target.c \
        tests/oss-fuzz/fuzzer.h
-tests_oss_fuzz_json_parser_target_LDADD = lib/libopenvswitch.la
+tests_oss_fuzz_json_parser_target_LDADD = lib/libopenvswitchutils.la
 tests_oss_fuzz_json_parser_target_LDFLAGS = $(LIB_FUZZING_ENGINE) -lc++
 
 tests_oss_fuzz_ofp_print_target_SOURCES = \
diff --git a/tests/test-lib.c b/tests/test-lib.c
index bcb5bb782..223077fca 100644
--- a/tests/test-lib.c
+++ b/tests/test-lib.c
@@ -22,7 +22,6 @@
 #include <openvswitch/thread.h>
 #include <openvswitch/types.h>
 #include <openvswitch/util.h>
-#include <openvswitch/vconn.h>
 #include <openvswitch/vlog.h>
 
 static void
diff --git a/utilities/automake.mk b/utilities/automake.mk
index 840eaec94..2fa704736 100644
--- a/utilities/automake.mk
+++ b/utilities/automake.mk
@@ -111,7 +111,7 @@ man_MANS += \
        utilities/ovs-vsctl.8
 
 utilities_ovs_appctl_SOURCES = utilities/ovs-appctl.c
-utilities_ovs_appctl_LDADD = lib/libopenvswitch.la
+utilities_ovs_appctl_LDADD = lib/libopenvswitchutils.la
 
 utilities_ovs_testcontroller_SOURCES = utilities/ovs-testcontroller.c
 utilities_ovs_testcontroller_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
diff --git a/utilities/usdt-scripts/flow_reval_monitor.py 
b/utilities/usdt-scripts/flow_reval_monitor.py
index 80c9c98bd..291d82080 100755
--- a/utilities/usdt-scripts/flow_reval_monitor.py
+++ b/utilities/usdt-scripts/flow_reval_monitor.py
@@ -383,6 +383,7 @@ def get_ovs_definitions(objects, pahole="pahole", pid=None):
         ovs_libs = [
             "libofproto",
             "libopenvswitch",
+            "libopenvswitchutils",
             "libovsdb",
             "libsflow",
             "libvtep",
diff --git a/utilities/usdt-scripts/reval_monitor.py 
b/utilities/usdt-scripts/reval_monitor.py
index 5f69998c8..d8a976857 100755
--- a/utilities/usdt-scripts/reval_monitor.py
+++ b/utilities/usdt-scripts/reval_monitor.py
@@ -402,8 +402,8 @@ def get_ovs_definitions(objects, pahole="pahole", pid=None):
         return dbg_file
 
     def get_from_shared_library(debug_file):
-        ovs_libs = ['libofproto', 'libopenvswitch', 'libovsdb', 'libsflow',
-                    'libvtep']
+        ovs_libs = ['libofproto', 'libopenvswitch', 'libopenvswitchutils',
+                    'libovsdb', 'libsflow', 'libvtep']
         error, ldd_result = run_program(['ldd', debug_file])
 
         if error:
diff --git a/vtep/automake.mk b/vtep/automake.mk
index e549922d9..e513abeea 100644
--- a/vtep/automake.mk
+++ b/vtep/automake.mk
@@ -34,7 +34,7 @@ man_MANS += \
    vtep/vtep-ctl.8
 
 vtep_vtep_ctl_SOURCES = vtep/vtep-ctl.c
-vtep_vtep_ctl_LDADD = vtep/libvtep.la lib/libopenvswitch.la
+vtep_vtep_ctl_LDADD = vtep/libvtep.la lib/libopenvswitchutils.la
 
 # ovs-vtep
 scripts_SCRIPTS += \
-- 
2.55.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to