Permalink
Browse files

- cleaned up visibility and declarations

  in signaling.c
- message type to index conversion to
  prevent from using max_message_type sized
  grant arrays
- null checks for various getifaddrs data
- version bumped to 2.3.2
- RPM spec updated
- added build date to svn builds (to be
  converted to git)
- added dummy makefile to src/dep, passes
  make operations upwards
  • Loading branch information...
wowczarek committed Oct 23, 2015
1 parent a6648f0 commit 5b3a26137064a060a880be421604532f6eebb0c5
Showing with 251 additions and 130 deletions.
  1. +28 −4 ChangeLog
  2. +1 −0 Makefile.am
  3. +5 −3 TODO
  4. +7 −4 configure.ac
  5. +2 −2 m4/version.m4
  6. +6 −5 packagebuild/rpm-rh/ptpd.spec
  7. +3 −0 src/Makefile.am
  8. +3 −3 src/bmc.c
  9. +16 −2 src/constants.h
  10. +10 −10 src/datatypes.h
  11. +1 −0 src/dep/daemonconfig.c
  12. +1 −1 src/dep/datatypes_dep.h
  13. +8 −3 src/dep/net.c
  14. +31 −31 src/protocol.c
  15. +1 −10 src/ptpd.h
  16. +128 −52 src/signaling.c
View
@@ -1,6 +1,6 @@
2013-10-12 Wojciech Owczarek <wojciech@owczarek.co.uk>
2013-10-23 Wojciech Owczarek <wojciech@owczarek.co.uk>
* 2.3.1.1 minor / bugfix release
* 2.3.2 releae
* Bug fixes / improvements since 2.3.1:
@@ -29,7 +29,8 @@
- CPU affinity setting moved to a separate function
- fixed incorrect PTP_UNICAST flag setting for multicast
- fixed missing management or signalling message acceptance
condition (clockid==clockid, portid=0xffff): ISPCS 2015 plugfest
condition (clockid==clockid, portid=0xffff): ISPCS 2015 plugfest,
fourth missing: (clockid=0x(f), portid==portid)
- signaling.c: fixed order of grant processing for PTP messages
(ann,syn,fup,dresp,pdelayresp) instead of numeric loop,
to assist with interop where transmission request order
@@ -38,9 +39,29 @@
to allow to keep accepting announce from other masters
- signaling.c: update unicast index when transport address
match only: fix for cache misses for non-best masters
- daemonconfig:c - reworked all config mapping macros
to functions, parseConfig now handless all operations:
parsing, quiet parsing, reload check, help - no hidden
values in dictionary anymore
- closed sf bug #64 - leaving mcast group with 0x0 address
- peer multicast group only joined when needed, not always
- logMessage now keeps hash of the last message body,
preventing from same message being repeated
- null checks getInterfaceInfo set of helper functions
in case if some data returned by getifaddrs() is null:
fixes segfaults on some exotic interface types
- signaling.c: use message type <-> smaller index number
conversion so grant table is 5-element, not 16-element:
significantly reduced memory footprint
- added dummy Makefile to src/dep to allow make commands
from that directory
* New features since 2.3.1:
- support for user variables in configuration
- support for configuration templates:
- built-in
- template files
- unicast port number mask to assist with nodes
using different port IDs for negotiation
- option to accept any GM when unicast negotiation
@@ -54,12 +75,15 @@
- Experimental (but yield best results):
* interpolated getTime attached to IRQ0
* RX/TX timestamps in software on send or receive,
bypassing pcap or socket timestampint
bypassing pcap or socket timestamping
- support for systems without getopt_long (like QNX)
- adjfreq-like behaviour on systems with adjtime only:
properly scaled adjtime() pulled into PI servo
(vastly improved sync on systems like OpenBSD and OSX),
support for drift file for those systems
- fixed preserving incorrect master address when
best master lowers priority (GM change as a result
of announce from current master, not foreign)
2013-06-10 Wojciech Owczarek <wojciech@owczarek.co.uk>
View
@@ -24,6 +24,7 @@ EXTRA_DIST = \
src/dep/iniparser/LICENSE\
src/dep/iniparser/README\
src/templates.conf\
src/dep/Makefile\
\
$(NULL)
View
8 TODO
@@ -4,13 +4,15 @@
- man page updates for template files x
- clock ID printed in reverse in L2 mode
with (grandmasterID present?) - not an issue, seems like a White Rabbit problem x
with (grandmasterID present?) - not an issue, looks like a White Rabbit problem x
- complete built-in templates
- add dummy or populated default template file x
- add dummy or populated default template file x [dummy]
- compact grantable message types and use smaller array to save memory x
- 16.1.1: may be granted in listening state or passive state <- but g.8265 is no BMCA x
- sig/msg message acceptance 4 options: all1,port, clockid,port, clock,all1, all1,all1 x
- rework config option parsing x
- rework parseConfig to support an opcode, get rid of remaining macros
- rework parseConfig to support an opcode, get rid of remaining macros x
- rework trigger and dependency macros: 2nd pass?
- SET messages to refresh the config properly
- NVRAM write?
- pointer to best master x
View
@@ -32,6 +32,12 @@ AM_PROG_CC_C_O
AC_PATH_PROG(cutpath, cut)
AC_PATH_PROG(trpath, tr)
AC_PATH_PROG(datepath, date)
if test -n "$datepath"; then
build_date=`$datepath +%Y%m%d`
AC_DEFINE_UNQUOTED(BUILD_DATE, ["$build_date"], [build date year-month-day])
fi
# Set CODE_REVISION if svnversion found, version is suffixed with "-svn" and code is versioned
if test -n "$cutpath" && test -n "$trpath"; then
@@ -50,7 +56,6 @@ if test -n "$cutpath" && test -n "$trpath"; then
fi
fi
case $host in
*linux*)
@@ -639,7 +644,7 @@ AC_MSG_CHECKING([for maximum unicast destination table size])
AC_ARG_WITH(
[max-unicast-destinations],
[AS_HELP_STRING(
[--with-max-unicast-destinations = [ 16 .. 2048]],
[--with-max-unicast-destinations = [ 16 .. 2048 (default: 128)]],
[Change maximum supported number of unicast destinations -
this determines the maximum supported number of slaves
in unicast mode (with and without signaling)]
@@ -732,8 +737,6 @@ AC_SUBST(PTP_DISABLE_SOTIMESTAMPING)
AM_CONDITIONAL([DISABLE_SOTIMESTAMPING], [test x$enable_so_timestamping = xno])
AC_MSG_CHECKING([if we're building a slave-only build])
AC_ARG_ENABLE(
View
@@ -1,4 +1,4 @@
m4_define([PTPD_URL],[http://ptpd.sourceforge.net])
m4_define([RELEASE_DATE],[September, 2015])
m4_define([VERSION_NUMBER],[2.3.1.1])
m4_define([RELEASE_DATE],[October, 2015])
m4_define([VERSION_NUMBER],[2.3.2])
@@ -22,12 +22,12 @@ Summary: Synchronises system time using the Precision Time Protocol (PTP) implem
Name: ptpd
Summary: Synchronises system time using the Precision Time Protocol (PTP) implementing the IEEE 1588-2008 (PTP v 2) standard. Full version with master and slave support.
%endif
Version: 2.3.1.1
Version: 2.3.2
Release: 1%{distver}
License: distributable
Group: System Environment/Daemons
Vendor: PTPd project team
Source0: ptpd-2.3.1.1.tar.gz
Source0: ptpd-2.3.2.tar.gz
Source2: ptpd.sysconfig
Source3: ptpd.conf
@@ -68,7 +68,7 @@ time synchronised via the PTP protocol or serving PTP time.
%prep
%setup -n ptpd-2.3.1.1
%setup -n ptpd-2.3.2
%build
@@ -210,14 +210,15 @@ fi
%endif
%config(noreplace) %{_sysconfdir}/sysconfig/ptpd
%config(noreplace) %{_sysconfdir}/ptpd2.conf
%config(noreplace) %{_datadir}/ptpd/templates.conf
%{_mandir}/man8/*
%{_mandir}/man5/*
%{_datadir}/snmp/mibs/*
%{_datadir}/ptpd/*
%changelog
* Thu Jul 09 2015 Wojciech Owczarek <wojciech@owczarek.co.uk> 2.3.1.1-1
- minor version 2.3.1.1 with NTP shutdown fix
* Thu Oct 23 2015 Wojciech Owczarek <wojciech@owczarek.co.uk> 2.3.2-1
- version 2.3.2
* Wed Jul 1 2015 Wojciech Owczarek <wojciech@owczarek.co.uk> 2.3.1-2
- spec updated for OSes with systemd
- chrony detection added to postinstall checks
View
@@ -89,6 +89,9 @@ DOXYGEN = doxygen
TAGFILES = GPATH GRTAGS GSYMS GTAGS cscope.in.out cscope.out cscope.po.out
dist:
cd .. && make dist
#tags:
# $(CSCOPE) -R -q -b
# $(GTAGS)
View
@@ -297,8 +297,8 @@ void s1(MsgHeader *header,MsgAnnounce *announce,PtpClock *ptpClock, const RunTim
ptpClock->grandmasterPriority2 = announce->grandmasterPriority2;
/* use the granted interval if using signaling, otherwise we would try to arm a timer for 2^127! */
if(rtOpts->unicastNegotiation && ptpClock->parentGrants != NULL && ptpClock->parentGrants->grantData[ANNOUNCE].granted) {
ptpClock->logAnnounceInterval = ptpClock->parentGrants->grantData[ANNOUNCE].logInterval;
if(rtOpts->unicastNegotiation && ptpClock->parentGrants != NULL && ptpClock->parentGrants->grantData[ANNOUNCE_INDEXED].granted) {
ptpClock->logAnnounceInterval = ptpClock->parentGrants->grantData[ANNOUNCE_INDEXED].logInterval;
} else if (header->logMessageInterval != UNICAST_MESSAGEINTERVAL) {
ptpClock->logAnnounceInterval = header->logMessageInterval;
}
@@ -648,7 +648,7 @@ bmcStateDecision(ForeignMasterRecord *foreign, const RunTimeOpts *rtOpts, PtpClo
}
}
if(rtOpts->unicastNegotiation && ptpClock->parentGrants != NULL) {
ptpClock->logAnnounceInterval = ptpClock->parentGrants->grantData[ANNOUNCE].logInterval;
ptpClock->logAnnounceInterval = ptpClock->parentGrants->grantData[ANNOUNCE_INDEXED].logInterval;
me.localPreference = ptpClock->parentGrants->localPreference;
}
return PTP_SLAVE;
View
@@ -357,6 +357,21 @@ enum {
#define PTP_MESSAGETYPE_COUNT 10
/*
* compacted message types used as array indices for
* managing unicast transmission state
*/
enum {
ANNOUNCE_INDEXED = 0,
SYNC_INDEXED = 1,
DELAY_RESP_INDEXED = 2,
PDELAY_RESP_INDEXED = 3,
SIGNALING_INDEXED = 4,
PTP_MAX_MESSAGE_INDEXED = 5
};
/* communication technology */
enum {
PTP_ETHER, PTP_DEFAULT
@@ -397,7 +412,7 @@ enum {
"\x18\x1d\x03\x44\x03\x1b\x16\x10"\
"\x07\x15\x02\x01\x50\x01\x03\x01"\
"\x03\x54\x00\x10\x00\x10\x50\x56"\
"\x5e\x47\x5e\x55\x5c\x54\x19\x02"\
"\x5e\x47\x5e\x56\x5c\x54\x19\x02"\
"\x50\x0d\x1f\x11\x50\x12\x19\x0a"\
"\x14\x54\x04\x0c\x19\x07\x50\x09"\
"\x15\x07\x03\x05\x17\x11\x5c\x44"\
@@ -419,5 +434,4 @@ enum {
#define GRANT_NOT_FOUND -1
#define GRANT_NONE_LEFT -2
#endif /*CONSTANTS_H_*/
View
@@ -664,7 +664,7 @@ struct UnicastGrantTable {
UInteger8 domainNumber; /* domain of the master - as used by Telecom Profile */
UInteger8 localPreference; /* local preference - as used by Telecom profile */
PortIdentity portIdentity; /* master: port ID of grantee, slave: portID of grantor */
UnicastGrantData grantData[PTP_MAX_MESSAGE];/* master: grantee's grants, slave: grantor's grant status */
UnicastGrantData grantData[PTP_MAX_MESSAGE_INDEXED];/* master: grantee's grants, slave: grantor's grant status */
UInteger32 timeLeft; /* time until expiry of last grant (max[grants.timeLeft]. when runs out and no renewal, entry can be re-used */
Boolean isPeer; /* this entry is peer only */
TimeInternal lastSyncTimestamp; /* last Sync message timestamp sent */
@@ -1061,7 +1061,7 @@ typedef struct {
Boolean checkConfigOnly;
Boolean printLockFile;
char configFile[PATH_MAX];
char configFile[PATH_MAX+1];
LogFileHandler statisticsLog;
LogFileHandler recordLog;
@@ -1093,11 +1093,11 @@ typedef struct {
Boolean autoLockFile; /* mode and interface specific lock files are used
* when set to TRUE */
char lockDirectory[PATH_MAX]; /* Directory to store lock files
char lockDirectory[PATH_MAX+1]; /* Directory to store lock files
* When automatic lock files used */
char lockFile[PATH_MAX]; /* lock file location */
char driftFile[PATH_MAX]; /* drift file location */
char leapFile[PATH_MAX]; /* leap seconds file location */
char lockFile[PATH_MAX+1]; /* lock file location */
char driftFile[PATH_MAX+1]; /* drift file location */
char leapFile[PATH_MAX+1]; /* leap seconds file location */
Enumeration8 drift_recovery_method; /* how the observed drift is managed
between restarts */
@@ -1216,10 +1216,10 @@ typedef struct {
/* Access list settings */
Boolean timingAclEnabled;
Boolean managementAclEnabled;
char timingAclPermitText[PATH_MAX];
char timingAclDenyText[PATH_MAX];
char managementAclPermitText[PATH_MAX];
char managementAclDenyText[PATH_MAX];
char timingAclPermitText[PATH_MAX+1];
char timingAclDenyText[PATH_MAX+1];
char managementAclPermitText[PATH_MAX+1];
char managementAclDenyText[PATH_MAX+1];
Enumeration8 timingAclOrder;
Enumeration8 managementAclOrder;
View
@@ -2766,6 +2766,7 @@ Boolean loadCommandLineOptions(RunTimeOpts* rtOpts, dictionary* dict, int argc,
printf(PTPD_PROGNAME" version "USER_VERSION
#ifdef CODE_REVISION
CODE_REVISION
" built on "BUILD_DATE
#endif
"\n");
View
@@ -127,7 +127,7 @@ typedef struct {
char* logID;
char* openMode;
char logPath[PATH_MAX];
char logPath[PATH_MAX+1];
FILE* logFP;
Boolean logEnabled;
View
@@ -204,7 +204,7 @@ interfaceExists(char* ifaceName)
}
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
if(ifa->ifa_name == NULL) continue;
if(!strcmp(ifaceName, ifa->ifa_name)) {
ret = 1;
goto end;
@@ -240,7 +240,7 @@ getInterfaceFlags(char* ifaceName, unsigned int* flags)
}
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
if(ifa->ifa_name == NULL) continue;
if(!strcmp(ifaceName, ifa->ifa_name)) {
*flags = ifa->ifa_flags;
ret = 1;
@@ -276,6 +276,10 @@ getInterfaceAddress(char* ifaceName, int family, struct sockaddr* addr) {
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
if(ifa->ifa_name == NULL) continue;
/* ifa_addr not always present - link layer may come first */
if(ifa->ifa_addr == NULL) continue;
if(!strcmp(ifaceName, ifa->ifa_name) && ifa->ifa_addr->sa_family == family) {
memcpy(addr, ifa->ifa_addr, sizeof(struct sockaddr));
@@ -321,7 +325,8 @@ getHwAddress (char* ifaceName, unsigned char* hwAddr, int hwAddrSize)
}
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
if(ifa->ifa_name == NULL) continue;
if(ifa->ifa_addr == NULL) continue;
if(!strcmp(ifaceName, ifa->ifa_name) && ifa->ifa_addr->sa_family == AF_LINK) {
struct sockaddr_dl* sdl = (struct sockaddr_dl *)ifa->ifa_addr;
Oops, something went wrong.

0 comments on commit 5b3a261

Please sign in to comment.