components/openvswitch/patches/01-solaris-port.patch
author Shawn Ferry <shawn.ferry@oracle.com>
Mon, 28 Nov 2016 16:54:02 -0800
changeset 7565 48aa82a0931f
parent 5730 cca4aa297e68
permissions -rw-r--r--
PSARC/2016/607 Puppet 4.7.0, Hiera 3.2.0 19429313 address_object type should support vrrp addresses 19888183 publisher provider is applied on each puppet run 22125767 nsswitch provider missing ipnodes, protocols, printers 22126108 add process scheduler administration provider 22960016 Puppet needs a native way to set ZFS ACLs 23107546 race condition with smf provider and manifest-import 23119445 Upgrade Ruby Hiera to 3.2.0 23547788 Add ILB type to Puppet 23593229 rspec tests need to be written for solaris_providers boot_environment 23593308 rspec tests need to be written for solaris_providers ipmp_interface 23593316 rspec tests need to be written for solaris_providers protocol_properties 23593225 rspec tests need to be written for solaris_providers etherstub 23593319 rspec tests need to be written for solaris_providers vnic 23593310 puppet module rspec tests and validation for nsswitch 24674283 current puppet.stencil implementation restricts some valid puppet use cases 24680838 puppet agent failures should be visible to administrator via SMF interfaces 24681179 puppet's logadm.conf is pointing at wrong location for master, ignoring agent 24696742 puppet svccfg doesn't work for some value types 24696809 Puppet link aggregation modules cascading errors 24825868 Update to Puppet 4, Puppet 3 is EOL 24836004 '-' is valid in pkg mediator implementation 24836209 nis provider needs to support multiple securenets entries 24928890 keystone and horizon modules patches create invalid metadata.json 25022632 puppet ipmp_interface type should not validate interface existence 25022714 Puppet SMF service should not refresh on every apply operation 25225039 puppet svccfg should not declare a property absent if it does not match desired 25060925 puppet resource address_object generates invalid puppet code for dhcp interfaces 25065015 update puppet oracle-solaris_providers 2.0.0 25071521 puppet svccfg type should return a clear error if value is not provided 25071681 puppet dns resource generates invalid manifest 25071686 puppet resource ldap; Error: Could not run: No ability to determine if ldap... 25071690 puppet resource nis; Error: Could not run: No ability to determine if nis exists 25092384 puppet module files should be owned by root 25093408 puppet-solaris should be part of puppet again 25106150 Nis provider is not idempotent 25106155 DNS provider is not idempotent 25163776 puppet link_aggregation misunderstands 'address' -u output 25163791 puppet link_aggregation should use resource values instead of property_hash 25163815 puppet address_object errors and validations could be better 25163840 puppet Puppet::Property::List types conflict with internally generated arrays 25163864 puppet link_aggregation type specs need to be written 25177901 puppet beadm should not use both -e and -p 25178928 puppet link_aggregation should try to copy existing values on change of mode 25179040 puppet link_aggregation should delete with -t for temporary 25192742 puppet svccfg shouldn't try to update properties for a non-existent fmri 25196056 puppet interface and address _properties namevars are problematic 25191982 puppet type 'dns' is not able to set 'options' property in resolv.conf 25211935 puppet link_aggregation needs to permanently delete before modifying temporary 25217063 puppet protocol_properties is not idempotent 25218036 puppet resource svccfg emits a warning for every property 25218053 puppet svccfg prefetch should match individually specified parameters 25218208 puppet svccfg should enforce well-formedness in fmri parameters 25224661 puppet resource address_properties shouldn't output read-only properties 25224777 puppet address_properties should not reset unchanged properties 25306835 puppet boot_environment needs to understand the new snapshot format 25306877 puppet svccfg should check for pg and allow nested property groups 25306904 puppet dns,nis,ldap,protocol_properties prefetch fails after input auto munge 25348321 puppet boot_environment needs to validate all properties and parameters 25354751 puppet vnic provider needs to support / and - as valid vnic name characters

This patch includes changes that allow OVS to build on
on Solaris. The specific changes are:

    acinclude.m4           Use dlmgr to identify Solaris build
    configure.ac

    include/automake.mk    Build for Solaris
    lib/automake.mk

    lib/byte-order.h       Solaris supports htonll natively

    lib/flow.h             Add ip6_ext structure for Solaris

    lib/sflow.h            Map OVS int types to Solaris
    lib/socket_util.h

    lib/socket-util.c      Fix set_dscp setsockopt error return for Solaris

    vswitchd/automake.mk   Solaris sed whitespace fix
    vtep/automake.mk

    lib/socket-util.c      Rename 'sun' variables.
    lib/lib-stream-unix.c

This patch has not been proposed upstream because we are not yet
proposing Solaris specific requirements upstream.

diff --git a/acinclude.m4 b/acinclude.m4
index 0f53ea7..f729947 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -407,6 +407,22 @@ AC_DEFUN([OVS_CHECK_IF_PACKET],
                 [Define to 1 if net/if_packet.h is available.])
    fi])
 
+dnl Checks for rad/client/1/dlmgr.h
+dnl
+dnl (For now, we use this as a proxy for checking whether we're building on
+dnl Solaris). Also, note that LDFLAGS has to be modified because
+dnl libopenvswitch.la consumes the dlmgr RAD client.
+AC_DEFUN([OVS_CHECK_DLMGR],
+  [AC_CHECK_HEADER([rad/client/1/dlmgr.h],
+                   [HAVE_DLMGR=yes],
+                   [HAVE_DLMGR=no])
+   AM_CONDITIONAL([SOLARIS], [test "$HAVE_DLMGR" = yes])
+   if test "$HAVE_DLMGR" = yes; then
+      AC_DEFINE([SOLARIS], [1],
+                [Define to 1 if rad/client/1/dlmgr.h is available.])
+      LDFLAGS="$LDFLAGS -R /usr/lib/rad/client/c/64"
+   fi])
+
 dnl Checks for net/if_dl.h.
 dnl
 dnl (We use this as a proxy for checking whether we're building on FreeBSD
@@ -415,6 +431,12 @@ AC_DEFUN([OVS_CHECK_IF_DL],
   [AC_CHECK_HEADER([net/if_dl.h],
                    [HAVE_IF_DL=yes],
                    [HAVE_IF_DL=no])
+   AC_CHECK_HEADER([rad/client/1/dlmgr.h],
+                   [HAVE_DLMGR=yes],
+                   [HAVE_DLMGR=no])
+   if test "$HAVE_DLMGR" = yes; then
+      HAVE_IF_DL=no
+   fi
    AM_CONDITIONAL([HAVE_IF_DL], [test "$HAVE_IF_DL" = yes])
    if test "$HAVE_IF_DL" = yes; then
       AC_DEFINE([HAVE_IF_DL], [1],
diff --git a/configure.ac b/configure.ac
index ae38a1e..0db0e6e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,6 +61,7 @@ OVS_CHECK_PYTHON_COMPAT
 OVS_CHECK_DOT
 OVS_CHECK_IF_PACKET
 OVS_CHECK_IF_DL
+OVS_CHECK_DLMGR
 OVS_CHECK_STRTOK_R
 AC_CHECK_DECLS([sys_siglist], [], [], [[#include <signal.h>]])
 AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec, struct stat.st_mtimensec],
diff --git a/include/automake.mk b/include/automake.mk
index 37a6f77..302329e 100644
--- a/include/automake.mk
+++ b/include/automake.mk
@@ -1,5 +1,6 @@
 include include/linux/automake.mk
 include include/openflow/automake.mk
 include include/openvswitch/automake.mk
+include include/solaris/automake.mk
 include include/sparse/automake.mk
 include include/windows/automake.mk
diff --git a/lib/automake.mk b/lib/automake.mk
index de3f068..b96eca7 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -13,8 +13,21 @@ if WIN32
 lib_libopenvswitch_la_LIBADD += ${PTHREAD_LIBS}
 endif
 
+if SOLARIS
+lib_libopenvswitch_la_LIBADD += -ldladm
+lib_libopenvswitch_la_LIBADD += -ldlpi
+lib_libopenvswitch_la_LIBADD += -ldlmgr_client
+lib_libopenvswitch_la_LIBADD += -lradclient
+lib_libopenvswitch_la_LIBADD += -lkstat2
+lib_libopenvswitch_la_LIBADD += -ladr
+endif
+
 lib_libopenvswitch_la_LDFLAGS = -release $(VERSION)
 
+if SOLARIS
+lib_libopenvswitch_la_LDFLAGS += -L/usr/lib/rad/client/c/64
+endif
+
 lib_libopenvswitch_la_SOURCES = \
 	lib/aes128.c \
 	lib/aes128.h \
@@ -304,6 +317,17 @@ lib_libopenvswitch_la_SOURCES += \
 	lib/route-table.h
 endif
 
+if SOLARIS
+lib_libopenvswitch_la_SOURCES += \
+	lib/dpif-solaris.c \
+	lib/dpif-solaris.h \
+	lib/netdev-solaris.c \
+	lib/netdev-solaris.h \
+	lib/route-table-solaris.c \
+	lib/util-solaris.c \
+	lib/util-solaris.h
+endif
+
 if DPDK_NETDEV
 lib_libopenvswitch_la_SOURCES += \
        lib/netdev-dpdk.c \
@@ -321,7 +345,7 @@ lib_libopenvswitch_la_SOURCES += \
         lib/route-table-stub.c
 endif
 
-if HAVE_IF_DL
+if HAVE_IF_DL 
 lib_libopenvswitch_la_SOURCES += \
 	lib/netdev-bsd.c \
 	lib/rtbsd.c \
diff --git a/lib/byte-order.h b/lib/byte-order.h
index 544f46f..b63a2b9 100644
--- a/lib/byte-order.h
+++ b/lib/byte-order.h
@@ -22,7 +22,7 @@
 #include "openvswitch/types.h"
 
 #ifndef __CHECKER__
-#ifndef _WIN32
+#if !defined (_WIN32) && !defined (__sun)
 static inline ovs_be64
 htonll(uint64_t n)
 {
@@ -34,7 +34,7 @@ ntohll(ovs_be64 n)
 {
     return htonl(1) == 1 ? n : ((uint64_t) ntohl(n) << 32) | ntohl(n >> 32);
 }
-#endif /* _WIN32 */
+#endif /* _WIN32/__sun */
 #else
 /* Making sparse happy with these functions also makes them unreadable, so
  * don't bother to show it their implementations. */
diff --git a/lib/flow.h b/lib/flow.h
index 0f3ffde..f141cb0 100644
--- a/lib/flow.h
+++ b/lib/flow.h
@@ -28,6 +28,10 @@
 #include "hash.h"
 #include "util.h"
 
+#ifdef __sun
+#include "solaris/solarisdefs.h"
+#endif
+
 struct dpif_flow_stats;
 struct ds;
 struct flow_wildcards;
diff --git a/lib/sflow.h b/lib/sflow.h
index c6cde7f..2279a62 100644
--- a/lib/sflow.h
+++ b/lib/sflow.h
@@ -12,6 +12,10 @@
 #include "windefs.h"
 #endif
 
+#ifdef __sun
+#include "solaris/solarisdefs.h"
+#endif
+
 typedef enum {
     SFL_DSCLASS_IFINDEX = 0,
     SFL_DSCLASS_VLAN = 1,
diff --git a/lib/socket-util.h b/lib/socket-util.h
index 63f1d5f..f99a6ee 100644
--- a/lib/socket-util.h
+++ b/lib/socket-util.h
@@ -27,6 +27,10 @@
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
 
+#ifdef __sun
+#include "solaris/solarisdefs.h"
+#endif
+
 int set_nonblocking(int fd);
 void xset_nonblocking(int fd);
 int set_dscp(int fd, int family, uint8_t dscp);
diff --git a/lib/socket-util.c b/lib/socket-util.c
index e32aa2b..e9c8ae5 100644
--- a/lib/socket-util.c
+++ b/lib/socket-util.c
@@ -493,11 +493,11 @@ free_sockaddr_un(int dirfd, const char *linkname)
 
 /* Binds Unix domain socket 'fd' to a file with permissions 0700. */
 static int
-bind_unix_socket(int fd, struct sockaddr *sun, socklen_t sun_len)
+bind_unix_socket(int fd, struct sockaddr *addr, socklen_t addrlen)
 {
     /* According to _Unix Network Programming_, umask should affect bind(). */
     mode_t old_umask = umask(0077);
-    int error = bind(fd, sun, sun_len) ? errno : 0;
+    int error = bind(fd, addr, addrlen) ? errno : 0;
     umask(old_umask);
     return error;
 }
@@ -1103,15 +1103,15 @@ describe_sockaddr(struct ds *string, int fd,
                           ss_get_port(&ss));
 #ifndef _WIN32
         } else if (ss.ss_family == AF_UNIX) {
-            struct sockaddr_un sun;
+            struct sockaddr_un addr;
             const char *null;
             size_t maxlen;
 
-            memcpy(&sun, &ss, sizeof sun);
+            memcpy(&addr, &ss, sizeof addr);
             maxlen = len - offsetof(struct sockaddr_un, sun_path);
-            null = memchr(sun.sun_path, '\0', maxlen);
-            ds_put_buffer(string, sun.sun_path,
-                          null ? null - sun.sun_path : maxlen);
+            null = memchr(addr.sun_path, '\0', maxlen);
+            ds_put_buffer(string, addr.sun_path,
+                          null ? null - addr.sun_path : maxlen);
 #endif
         }
 #ifdef HAVE_NETLINK
diff --git a/lib/stream-unix.c b/lib/stream-unix.c
index fafdc8d..53dddb7 100644
--- a/lib/stream-unix.c
+++ b/lib/stream-unix.c
@@ -108,12 +108,12 @@ static int
 punix_accept(int fd, const struct sockaddr_storage *ss, size_t ss_len,
              struct stream **streamp)
 {
-    const struct sockaddr_un *sun = (const struct sockaddr_un *) ss;
+    const struct sockaddr_un *addr = (const struct sockaddr_un *) ss;
     int name_len = get_unix_name_len(ss_len);
     char name[128];
 
     if (name_len > 0) {
-        snprintf(name, sizeof name, "unix:%.*s", name_len, sun->sun_path);
+        snprintf(name, sizeof name, "unix:%.*s", name_len, addr->sun_path);
     } else {
         strcpy(name, "unix");
     }
diff --git a/vswitchd/automake.mk b/vswitchd/automake.mk
index a09605f..19bf9ea 100644
--- a/vswitchd/automake.mk
+++ b/vswitchd/automake.mk
@@ -57,7 +57,7 @@ vswitchd/ovs-vswitchd.conf.db.5: \
 # Version checking for vswitch.ovsschema.
 ALL_LOCAL += vswitchd/vswitch.ovsschema.stamp
 vswitchd/vswitch.ovsschema.stamp: vswitchd/vswitch.ovsschema
-	@sum=`sed '/cksum/d' $? | cksum`; \
+	@sum=`sed '/cksum/d' $? | cksum | sed 's/	/ /'`; \
 	expected=`sed -n 's/.*"cksum": "\(.*\)".*/\1/p' $?`; \
 	if test "X$$sum" = "X$$expected"; then \
 	  touch $@; \
diff --git a/vtep/automake.mk b/vtep/automake.mk
index a15a067..9f8e9a9 100644
--- a/vtep/automake.mk
+++ b/vtep/automake.mk
@@ -59,7 +59,7 @@ $(srcdir)/vtep/vtep.5: \
 # Version checking for vtep.ovsschema.
 ALL_LOCAL += vtep/vtep.ovsschema.stamp
 vtep/vtep.ovsschema.stamp: vtep/vtep.ovsschema
-	@sum=`sed '/cksum/d' $? | cksum`; \
+	@sum=`sed '/cksum/d' $? | cksum | sed 's/	/ /'`; \
 	expected=`sed -n 's/.*"cksum": "\(.*\)".*/\1/p' $?`; \
 	if test "X$$sum" = "X$$expected"; then \
 	  touch $@; \