--- old/src/dep/constants_dep.h	Thu Feb 20 15:42:10 2014
+++ new/src/dep/constants_dep.h	Thu Feb 20 15:42:10 2014
@@ -16,7 +16,7 @@
 /* platform dependent */
 
 #if !defined(linux) && !defined(__NetBSD__) && !defined(__FreeBSD__) && \
-  !defined(__APPLE__) && !defined(__OpenBSD__)
+  !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__sun)
 #error PTPD hasn't been ported to this OS - should be possible \
 if it's POSIX compatible, if you succeed, report it to ptpd-devel@sourceforge.net
 #endif
@@ -74,6 +74,36 @@
 # endif
 #endif
 
+#ifdef __sun
+/* Solarish (Illumos & Oracle Solaris) definitions. */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <netinet/in.h>
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_types.h>
+#include <sys/ethernet.h>
+#include <sys/uio.h>
+#include <ifaddrs.h>
+
+#define ETHER_ADDR_LEN ETHERADDRL
+#define IFACE_NAME_LENGTH         IF_NAMESIZE
+#define NET_ADDRESS_LENGTH        INET_ADDRSTRLEN
+#define ETHER_HDR_LEN	sizeof (struct ether_header)
+
+#define	adjtimex ntp_adjtime
+
+#include <sys/isa_defs.h>
+#ifdef _LITTLE_ENDIAN
+#define PTPD_LSBF
+#elif defined(_BIG_ENDIAN)
+#define PTPD_MSBF
+#endif
+
+#endif /* __sun */
+
 #define CLOCK_IDENTITY_LENGTH 8
 #define ADJ_FREQ_MAX 500000
 
--- old/src/dep/timer.c	Thu Feb 20 15:42:10 2014
+++ new/src/dep/timer.c	Thu Feb 20 15:42:10 2014
@@ -81,9 +81,14 @@
 
 	elapsed = 0;
 	itimer.it_value.tv_sec = itimer.it_interval.tv_sec = 0;
-	itimer.it_value.tv_usec = itimer.it_interval.tv_usec = US_TIMER_INTERVAL;
+	itimer.it_value.tv_usec = itimer.it_interval.tv_usec =
+	    US_TIMER_INTERVAL;
 
+#ifdef __sun
+	sigset(SIGALRM, catch_alarm);
+#else
 	signal(SIGALRM, catch_alarm);
+#endif
 	setitimer(ITIMER_REAL, &itimer, 0);
 }
 
--- old/src/dep/net.c	Thu Feb 20 15:42:11 2014
+++ new/src/dep/net.c	Thu Feb 20 15:42:11 2014
@@ -54,6 +54,20 @@
  *
  */
 
+#ifdef __sun
+/*
+ * These are needed to enable control messages on sendmsg().
+ * I'll save the commentary on why the bend-over-backwards old way of doing
+ * sendmsg() is still around.
+ *
+ * STRICTLY SPEAKING this program should be linked against libxnet instead
+ * of libsocket because of these interfaces, but we'll cross that bridge
+ * when we get to it.
+ */
+#define _XOPEN_SOURCE 500
+#define __EXTENSIONS__
+#endif
+
 #include "../ptpd.h"
 
 #ifdef PTPD_PCAP
@@ -306,8 +320,8 @@
     if(!strlen(ifaceName))
 	return 0;
 
+#if defined(AF_LINK) && !defined(__sun)
 /* BSD* - AF_LINK gives us access to the hw address via struct sockaddr_dl */
-#ifdef AF_LINK
 
     struct ifaddrs *ifaddr, *ifa;
 
@@ -347,8 +361,8 @@
     freeifaddrs(ifaddr);
     return ret;
 
-/* Linux, basically */
 #else
+/* Linux and Solarish systems have SIOCGIFHWADDR/SIOCGLIFHWADDR.  Use it. */
 
     int sockfd;
     struct ifreq ifr;
@@ -360,7 +374,7 @@
 	return -1;
     }
 
-    memset(&ifr, 0, sizeof(struct ifreq));
+    memset(&ifr, 0, sizeof (ifr));
 
     strncpy(ifr.ifr_name, ifaceName, IFACE_NAME_LENGTH);
 
@@ -371,7 +385,11 @@
     }
 
 
+#ifdef __sun
+    int af = ifr.ifr_addr.sa_family;
+#else
     int af = ifr.ifr_hwaddr.sa_family;
+#endif
 
     if (    af == ARPHRD_ETHER
 	 || af == ARPHRD_IEEE802
@@ -379,7 +397,11 @@
 	 || af == ARPHRD_INFINIBAND
 #endif
 	) {
+#ifdef __sun
+	    memcpy(hwAddr, ifr.ifr_addr.sa_data, hwAddrSize);
+#else
 	    memcpy(hwAddr, ifr.ifr_hwaddr.sa_data, hwAddrSize);
+#endif
 	    ret = 1;
 	} else {
 	    DBGV("Unsupported hardware address family on %s\n", ifaceName);
@@ -574,7 +596,7 @@
 static Boolean
 netSetMulticastTTL(int sockfd, int ttl) {
 
-#ifdef __OpenBSD__
+#if defined(__OpenBSD__) || defined(__sun)
 	uint8_t temp = (uint8_t) ttl;
 #else
 	int temp = ttl;
@@ -590,7 +612,7 @@
 
 static Boolean
 netSetMulticastLoopback(NetPath * netPath, Boolean value) {
-#ifdef __OpenBSD__
+#if defined(__OpenBSD__) || defined(__sun)
 	uint8_t temp = value ? 1 : 0;
 #else
 	int temp = value ? 1 : 0;
@@ -748,7 +770,11 @@
 	if (hostname[0]) {
 		/* Attempt a DNS lookup first. */
 		struct hostent *host;
+#ifdef __sun
+		host = getipnodebyname(hostname, AF_INET, AI_DEFAULT, &errno);
+#else
 		host = gethostbyname2(hostname, AF_INET);
+#endif
                 if (host != NULL) {
 			if (host->h_length != 4) {
 				PERROR("unicast host resolved to non ipv4"
