A possible solution to fix Open vSwitch

I think I might have solved the Open vSwitch issue that some people have been having (including myself).

So, since Open vSwitch was broken for me anyway I decided to do a little "hacking" of the files in the ports tree for OVS. I noticed that the Makefile configures OVS to be built with shared libraries instead of the default static libraries. What got me thinking about this was a post I stumbled upon in the Networking section of the forums. A poster mentioned how the issue is Open vSwitch is trying to use function that is getting mixed up with a similar function that is in libc.

I don't come from a software development background but I know a little bit here and there. I wondered what would happen if I built a version of OVS with static libraries since the functions needed would be included directly in the compiled libraries. That way there shouldn't be any mix up.

Here is what I did to build my "alternative" version with static libraries.

I changed the configuration options in the Makefile so it looks like this;

The modified:

Code:
CONFIGURE_ARGS= --disable-shared --enable-static --localstatedir=/var \
                --with-dbdir=/var/db/${PORTNAME} \
                --with-openssl=${OPENSSLBASE}

The original:

Code:
CONFIGURE_ARGS= --enabled-shared --disable-static --localstatedir=/var \
                --with-dbdir=/var/db/${PORTNAME} \
                --with-openssl=${OPENSSLBASE}

That allowed me to build openvswitch with static libaries when running make build

To get make package to work I had to alter pkg-plist and remove all of the references like this

Code:
lib/libofproto-%%SHLIB_VER%%.so.0
lib/libofproto-%%SHLIB_VER%%.so.0.0.1
lib/libofproto.so
lib/libopenvswitch-%%SHLIB_VER%%.so.0
lib/libopenvswitch-%%SHLIB_VER%%.so.0.0.1
lib/libopenvswitch.so
lib/libovn-%%SHLIB_VER%%.so.0
lib/libovn-%%SHLIB_VER%%.so.0.0.1
lib/libovn.so
lib/libovsdb-%%SHLIB_VER%%.so.0
lib/libovsdb-%%SHLIB_VER%%.so.0.0.1
lib/libovsdb.so
lib/libsflow-%%SHLIB_VER%%.so.0
lib/libsflow-%%SHLIB_VER%%.so.0.0.1
lib/libsflow.so
lib/libvtep-%%SHLIB_VER%%.so.0
lib/libvtep-%%SHLIB_VER%%.so.0.0.1
lib/libvtep.so

and replace them with these

Code:
lib/libofproto.a
lib/libopenvswitch.a
lib/libovn.a
lib/libovsdb.a
lib/libsflow.a
lib/libvtep.a

Once I did that make package completed successfully. I transferred the package to my test server vm and made a quick configuration with one switch using ovs-vsctl add-br vswtich0 --set bridge vswitch0 datapath_type=netdev. I rebooted the machine and when it can back vswitch0 was still there meaning the configuration persisted through a reboot.
 
One note from me, can be usefull.
ovsdb-server fails with segmentation fault every time ovs-vswitchd tries to get data from it (FreeBSD-12.1 amd64, openvswitch-2.12.0).
The solution described above helps.
 
Back
Top