Import ptpd 1.0.0
The PTP daemon (PTPd) implements the Precision Time protocol (PTP) as defined by the IEEE 1588 standard. PTP was developed to provide very precise time coordination of LAN connected computers. with ckuethe@
This commit is contained in:
parent
c9a93f95c8
commit
093998e9e2
31
net/ptpd/Makefile
Normal file
31
net/ptpd/Makefile
Normal file
@ -0,0 +1,31 @@
|
||||
# $OpenBSD: Makefile,v 1.1.1.1 2009/01/20 19:05:23 naddy Exp $
|
||||
|
||||
COMMENT= Precision Time Protocol daemon
|
||||
|
||||
DISTNAME= ptpd-1.0.0
|
||||
CATEGORIES= net
|
||||
HOMEPAGE= http://ptpd.sourceforge.net/
|
||||
|
||||
MAINTAINER= Christian Weisgerber <naddy@openbsd.org>
|
||||
|
||||
# ISC
|
||||
PERMIT_PACKAGE_CDROM= Yes
|
||||
PERMIT_PACKAGE_FTP= Yes
|
||||
PERMIT_DISTFILES_CDROM= Yes
|
||||
PERMIT_DISTFILES_FTP= Yes
|
||||
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=ptpd/}
|
||||
|
||||
WANTLIB= c
|
||||
|
||||
WRKSRC= ${WRKDIST}/src
|
||||
MAKE_FLAGS= CFLAGS="${CFLAGS}"
|
||||
|
||||
do-install:
|
||||
${INSTALL_PROGRAM} ${WRKBUILD}/ptpd ${PREFIX}/sbin
|
||||
${INSTALL_DATA} ${WRKSRC}/ptpd.8 ${PREFIX}/man/man8
|
||||
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/ptpd
|
||||
${INSTALL_DATA} ${WRKDIST}/doc/* ${WRKDIST}/tools/* \
|
||||
${PREFIX}/share/doc/ptpd
|
||||
|
||||
.include <bsd.port.mk>
|
5
net/ptpd/distinfo
Normal file
5
net/ptpd/distinfo
Normal file
@ -0,0 +1,5 @@
|
||||
MD5 (ptpd-1.0.0.tar.gz) = sRKyvtx/bm4RqDhgi54DVw==
|
||||
RMD160 (ptpd-1.0.0.tar.gz) = 1LTLg40bzQyRSdP5eW96U5TdkvY=
|
||||
SHA1 (ptpd-1.0.0.tar.gz) = mQQIrfqwD3/NvuutEvVSX9XB/lM=
|
||||
SHA256 (ptpd-1.0.0.tar.gz) = isH9ytHiRrA5UJfdmvKZZsaCNTPX5piarpFQYEj7Ubw=
|
||||
SIZE (ptpd-1.0.0.tar.gz) = 382246
|
45
net/ptpd/patches/patch-src_dep_constants_dep_h
Normal file
45
net/ptpd/patches/patch-src_dep_constants_dep_h
Normal file
@ -0,0 +1,45 @@
|
||||
$OpenBSD: patch-src_dep_constants_dep_h,v 1.1.1.1 2009/01/20 19:05:23 naddy Exp $
|
||||
--- src/dep/constants_dep.h.orig Wed Mar 28 00:09:06 2007
|
||||
+++ src/dep/constants_dep.h Sun Oct 26 16:14:54 2008
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
/* platform dependent */
|
||||
|
||||
-#if !defined(linux) && !defined(__NetBSD__) && !defined(__FreeBSD__)
|
||||
+#if !defined(linux) && !defined(__NetBSD__) && !defined(__FreeBSD__) && \
|
||||
+ !defined(__OpenBSD__)
|
||||
#error Not ported to this architecture, please update.
|
||||
#endif
|
||||
|
||||
@@ -27,7 +28,7 @@
|
||||
#endif /* linux */
|
||||
|
||||
|
||||
-#if defined(__NetBSD__) || defined(__FreeBSD__)
|
||||
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
# include <sys/types.h>
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
@@ -37,14 +38,21 @@
|
||||
# if defined(__FreeBSD__)
|
||||
# include <net/ethernet.h>
|
||||
# include <sys/uio.h>
|
||||
-# else
|
||||
+# endif
|
||||
+# if defined(__NetBSD__)
|
||||
# include <net/if_ether.h>
|
||||
# endif
|
||||
+# if defined(__OpenBSD__)
|
||||
+# include <netinet/if_ether.h>
|
||||
+# include <sys/uio.h>
|
||||
+# endif
|
||||
# include <ifaddrs.h>
|
||||
# define IFACE_NAME_LENGTH IF_NAMESIZE
|
||||
# define NET_ADDRESS_LENGTH INET_ADDRSTRLEN
|
||||
|
||||
# define IFCONF_LENGTH 10
|
||||
+
|
||||
+# define BSD_INTERFACE_FUNCTIONS
|
||||
|
||||
# define adjtimex ntp_adjtime
|
||||
|
70
net/ptpd/patches/patch-src_dep_net_c
Normal file
70
net/ptpd/patches/patch-src_dep_net_c
Normal file
@ -0,0 +1,70 @@
|
||||
$OpenBSD: patch-src_dep_net_c,v 1.1.1.1 2009/01/20 19:05:23 naddy Exp $
|
||||
--- src/dep/net.c.orig Mon Apr 2 23:57:44 2007
|
||||
+++ src/dep/net.c Sun Oct 26 13:38:49 2008
|
||||
@@ -8,26 +8,26 @@ Boolean lookupSubdomainAddress(Octet *subdomainName, O
|
||||
|
||||
/* set multicast group address based on subdomainName */
|
||||
if (!memcmp(subdomainName, DEFAULT_PTP_DOMAIN_NAME, PTP_SUBDOMAIN_NAME_LENGTH))
|
||||
- memcpy(subdomainAddress, DEFAULT_PTP_DOMAIN_ADDRESS, NET_ADDRESS_LENGTH);
|
||||
+ strncpy(subdomainAddress, DEFAULT_PTP_DOMAIN_ADDRESS, NET_ADDRESS_LENGTH);
|
||||
else if(!memcmp(subdomainName, ALTERNATE_PTP_DOMAIN1_NAME, PTP_SUBDOMAIN_NAME_LENGTH))
|
||||
- memcpy(subdomainAddress, ALTERNATE_PTP_DOMAIN1_ADDRESS, NET_ADDRESS_LENGTH);
|
||||
+ strncpy(subdomainAddress, ALTERNATE_PTP_DOMAIN1_ADDRESS, NET_ADDRESS_LENGTH);
|
||||
else if(!memcmp(subdomainName, ALTERNATE_PTP_DOMAIN2_NAME, PTP_SUBDOMAIN_NAME_LENGTH))
|
||||
- memcpy(subdomainAddress, ALTERNATE_PTP_DOMAIN2_ADDRESS, NET_ADDRESS_LENGTH);
|
||||
+ strncpy(subdomainAddress, ALTERNATE_PTP_DOMAIN2_ADDRESS, NET_ADDRESS_LENGTH);
|
||||
else if(!memcmp(subdomainName, ALTERNATE_PTP_DOMAIN3_NAME, PTP_SUBDOMAIN_NAME_LENGTH))
|
||||
- memcpy(subdomainAddress, ALTERNATE_PTP_DOMAIN3_ADDRESS, NET_ADDRESS_LENGTH);
|
||||
+ strncpy(subdomainAddress, ALTERNATE_PTP_DOMAIN3_ADDRESS, NET_ADDRESS_LENGTH);
|
||||
else
|
||||
{
|
||||
h = crc_algorithm(subdomainName, PTP_SUBDOMAIN_NAME_LENGTH) % 3;
|
||||
switch(h)
|
||||
{
|
||||
case 0:
|
||||
- memcpy(subdomainAddress, ALTERNATE_PTP_DOMAIN1_ADDRESS, NET_ADDRESS_LENGTH);
|
||||
+ strncpy(subdomainAddress, ALTERNATE_PTP_DOMAIN1_ADDRESS, NET_ADDRESS_LENGTH);
|
||||
break;
|
||||
case 1:
|
||||
- memcpy(subdomainAddress, ALTERNATE_PTP_DOMAIN2_ADDRESS, NET_ADDRESS_LENGTH);
|
||||
+ strncpy(subdomainAddress, ALTERNATE_PTP_DOMAIN2_ADDRESS, NET_ADDRESS_LENGTH);
|
||||
break;
|
||||
case 2:
|
||||
- memcpy(subdomainAddress, ALTERNATE_PTP_DOMAIN3_ADDRESS, NET_ADDRESS_LENGTH);
|
||||
+ strncpy(subdomainAddress, ALTERNATE_PTP_DOMAIN3_ADDRESS, NET_ADDRESS_LENGTH);
|
||||
break;
|
||||
default:
|
||||
ERROR("handle out of range for '%s'!\n", subdomainName);
|
||||
@@ -229,6 +229,7 @@ Boolean netInit(NetPath *netPath, RunTimeOpts *rtOpts,
|
||||
struct in_addr interfaceAddr, netAddr;
|
||||
struct sockaddr_in addr;
|
||||
struct ip_mreq imr;
|
||||
+ unsigned char c;
|
||||
char addrStr[NET_ADDRESS_LENGTH];
|
||||
char *s;
|
||||
|
||||
@@ -332,18 +333,18 @@ Boolean netInit(NetPath *netPath, RunTimeOpts *rtOpts,
|
||||
}
|
||||
|
||||
/* set socket time-to-live to 1 */
|
||||
- temp = 1;
|
||||
- if( setsockopt(netPath->eventSock, IPPROTO_IP, IP_MULTICAST_TTL, &temp, sizeof(int)) < 0
|
||||
- || setsockopt(netPath->generalSock, IPPROTO_IP, IP_MULTICAST_TTL, &temp, sizeof(int)) < 0 )
|
||||
+ c = 1;
|
||||
+ if( setsockopt(netPath->eventSock, IPPROTO_IP, IP_MULTICAST_TTL, &c, sizeof(c)) < 0
|
||||
+ || setsockopt(netPath->generalSock, IPPROTO_IP, IP_MULTICAST_TTL, &c, sizeof(c)) < 0 )
|
||||
{
|
||||
PERROR("failed to set the multi-cast time-to-live");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* enable loopback */
|
||||
- temp = 1;
|
||||
- if( setsockopt(netPath->eventSock, IPPROTO_IP, IP_MULTICAST_LOOP, &temp, sizeof(int)) < 0
|
||||
- || setsockopt(netPath->generalSock, IPPROTO_IP, IP_MULTICAST_LOOP, &temp, sizeof(int)) < 0 )
|
||||
+ c = 1;
|
||||
+ if( setsockopt(netPath->eventSock, IPPROTO_IP, IP_MULTICAST_LOOP, &c, sizeof(c)) < 0
|
||||
+ || setsockopt(netPath->generalSock, IPPROTO_IP, IP_MULTICAST_LOOP, &c, sizeof(c)) < 0 )
|
||||
{
|
||||
PERROR("failed to enable multi-cast loopback");
|
||||
return FALSE;
|
22
net/ptpd/patches/patch-src_dep_ptpd_dep_h
Normal file
22
net/ptpd/patches/patch-src_dep_ptpd_dep_h
Normal file
@ -0,0 +1,22 @@
|
||||
$OpenBSD: patch-src_dep_ptpd_dep_h,v 1.1.1.1 2009/01/20 19:05:23 naddy Exp $
|
||||
--- src/dep/ptpd_dep.h.orig Mon Apr 2 23:57:44 2007
|
||||
+++ src/dep/ptpd_dep.h Sun Oct 26 13:13:21 2008
|
||||
@@ -13,7 +13,9 @@
|
||||
#include<sys/stat.h>
|
||||
#include<time.h>
|
||||
#include<sys/time.h>
|
||||
+#if !defined(__OpenBSD__)
|
||||
#include<sys/timex.h>
|
||||
+#endif
|
||||
#include<sys/socket.h>
|
||||
#include<sys/select.h>
|
||||
#include<sys/ioctl.h>
|
||||
@@ -22,7 +24,7 @@
|
||||
|
||||
/* system messages */
|
||||
#define ERROR(x, ...) fprintf(stderr, "(ptpd error) " x, ##__VA_ARGS__)
|
||||
-#define PERROR(x, ...) fprintf(stderr, "(ptpd error) " x ": %m\n", ##__VA_ARGS__)
|
||||
+#define PERROR(x, ...) fprintf(stderr, "(ptpd error) " x ": %s\n", ##__VA_ARGS__, strerror(errno))
|
||||
#define NOTIFY(x, ...) fprintf(stderr, "(ptpd notice) " x, ##__VA_ARGS__)
|
||||
|
||||
/* debug messages */
|
30
net/ptpd/patches/patch-src_dep_sys_c
Normal file
30
net/ptpd/patches/patch-src_dep_sys_c
Normal file
@ -0,0 +1,30 @@
|
||||
$OpenBSD: patch-src_dep_sys_c,v 1.1.1.1 2009/01/20 19:05:23 naddy Exp $
|
||||
--- src/dep/sys.c.orig Wed Mar 28 00:09:06 2007
|
||||
+++ src/dep/sys.c Tue Oct 28 12:46:32 2008
|
||||
@@ -98,16 +98,26 @@ UInteger16 getRand(UInteger32 *seed)
|
||||
|
||||
Boolean adjFreq(Integer32 adj)
|
||||
{
|
||||
+#if defined(__OpenBSD__)
|
||||
+ int64_t freq;
|
||||
+#else
|
||||
struct timex t;
|
||||
+#endif
|
||||
|
||||
if(adj > ADJ_FREQ_MAX)
|
||||
adj = ADJ_FREQ_MAX;
|
||||
else if(adj < -ADJ_FREQ_MAX)
|
||||
adj = -ADJ_FREQ_MAX;
|
||||
|
||||
+#if defined(__OpenBSD__)
|
||||
+ freq = (int64_t)adj << 32;
|
||||
+
|
||||
+ return !adjfreq(&freq, NULL);
|
||||
+#else
|
||||
t.modes = MOD_FREQUENCY;
|
||||
t.freq = adj*((1<<16)/1000);
|
||||
|
||||
return !adjtimex(&t);
|
||||
+#endif
|
||||
}
|
||||
|
3
net/ptpd/pkg/DESCR
Normal file
3
net/ptpd/pkg/DESCR
Normal file
@ -0,0 +1,3 @@
|
||||
The PTP daemon (PTPd) implements the Precision Time protocol (PTP) as
|
||||
defined by the IEEE 1588 standard. PTP was developed to provide very
|
||||
precise time coordination of LAN connected computers.
|
6
net/ptpd/pkg/MESSAGE
Normal file
6
net/ptpd/pkg/MESSAGE
Normal file
@ -0,0 +1,6 @@
|
||||
In order to start ptpd at boot time, add the following lines to
|
||||
/etc/rc.local:
|
||||
|
||||
if [ -x ${PREFIX}/sbin/ptpd ]; then
|
||||
echo -n ' ptpd'; ${PREFIX}/sbin/ptpd
|
||||
fi
|
12
net/ptpd/pkg/PLIST
Normal file
12
net/ptpd/pkg/PLIST
Normal file
@ -0,0 +1,12 @@
|
||||
@comment $OpenBSD: PLIST,v 1.1.1.1 2009/01/20 19:05:23 naddy Exp $
|
||||
@man man/man8/ptpd.8
|
||||
@bin sbin/ptpd
|
||||
share/doc/ptpd/
|
||||
share/doc/ptpd/clock_servo.svg
|
||||
share/doc/ptpd/data_paths.svg
|
||||
share/doc/ptpd/doc.html
|
||||
share/doc/ptpd/filter.svg
|
||||
share/doc/ptpd/filter_response.m
|
||||
share/doc/ptpd/offset_stats.m
|
||||
share/doc/ptpd/organization.svg
|
||||
share/doc/ptpd/ptpd_2005_1588_conference_paper.pdf
|
Loading…
Reference in New Issue
Block a user