|
From: <wow...@us...> - 2015-10-23 02:18:44
|
Revision: 600
http://sourceforge.net/p/ptpd/code/600
Author: wowczarek
Date: 2015-10-23 02:18:41 +0000 (Fri, 23 Oct 2015)
Log Message:
-----------
- 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
Modified Paths:
--------------
trunk/ChangeLog
trunk/Makefile.am
trunk/TODO
trunk/configure.ac
trunk/m4/version.m4
trunk/packagebuild/rpm-rh/ptpd.spec
trunk/src/Makefile.am
trunk/src/bmc.c
trunk/src/constants.h
trunk/src/datatypes.h
trunk/src/dep/daemonconfig.c
trunk/src/dep/datatypes_dep.h
trunk/src/dep/net.c
trunk/src/protocol.c
trunk/src/ptpd.h
trunk/src/signaling.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/ChangeLog 2015-10-23 02:18:41 UTC (rev 600)
@@ -1,6 +1,6 @@
-2013-10-12 Wojciech Owczarek <woj...@ow...>
+2013-10-23 Wojciech Owczarek <woj...@ow...>
- * 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 <woj...@ow...>
Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/Makefile.am 2015-10-23 02:18:41 UTC (rev 600)
@@ -24,6 +24,7 @@
src/dep/iniparser/LICENSE\
src/dep/iniparser/README\
src/templates.conf\
+ src/dep/Makefile\
\
$(NULL)
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/TODO 2015-10-23 02:18:41 UTC (rev 600)
@@ -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
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/configure.ac 2015-10-23 02:18:41 UTC (rev 600)
@@ -32,7 +32,13 @@
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
ver_prefix=`echo VERSION_NUMBER | $cutpath -s -d- -f2`
@@ -50,7 +56,6 @@
fi
fi
-
case $host in
*linux*)
@@ -639,7 +644,7 @@
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 @@
AM_CONDITIONAL([DISABLE_SOTIMESTAMPING], [test x$enable_so_timestamping = xno])
-
-
AC_MSG_CHECKING([if we're building a slave-only build])
AC_ARG_ENABLE(
Modified: trunk/m4/version.m4
===================================================================
--- trunk/m4/version.m4 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/m4/version.m4 2015-10-23 02:18:41 UTC (rev 600)
@@ -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])
Modified: trunk/packagebuild/rpm-rh/ptpd.spec
===================================================================
--- trunk/packagebuild/rpm-rh/ptpd.spec 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/packagebuild/rpm-rh/ptpd.spec 2015-10-23 02:18:41 UTC (rev 600)
@@ -22,12 +22,12 @@
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 @@
%prep
-%setup -n ptpd-2.3.1.1
+%setup -n ptpd-2.3.2
%build
@@ -210,14 +210,15 @@
%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 <woj...@ow...> 2.3.1.1-1
-- minor version 2.3.1.1 with NTP shutdown fix
+* Thu Oct 23 2015 Wojciech Owczarek <woj...@ow...> 2.3.2-1
+- version 2.3.2
* Wed Jul 1 2015 Wojciech Owczarek <woj...@ow...> 2.3.1-2
- spec updated for OSes with systemd
- chrony detection added to postinstall checks
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/src/Makefile.am 2015-10-23 02:18:41 UTC (rev 600)
@@ -89,6 +89,9 @@
TAGFILES = GPATH GRTAGS GSYMS GTAGS cscope.in.out cscope.out cscope.po.out
+dist:
+ cd .. && make dist
+
#tags:
# $(CSCOPE) -R -q -b
# $(GTAGS)
Modified: trunk/src/bmc.c
===================================================================
--- trunk/src/bmc.c 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/src/bmc.c 2015-10-23 02:18:41 UTC (rev 600)
@@ -297,8 +297,8 @@
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 @@
}
}
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;
Modified: trunk/src/constants.h
===================================================================
--- trunk/src/constants.h 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/src/constants.h 2015-10-23 02:18:41 UTC (rev 600)
@@ -357,6 +357,21 @@
#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 @@
"\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 @@
#define GRANT_NOT_FOUND -1
#define GRANT_NONE_LEFT -2
-
#endif /*CONSTANTS_H_*/
Modified: trunk/src/datatypes.h
===================================================================
--- trunk/src/datatypes.h 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/src/datatypes.h 2015-10-23 02:18:41 UTC (rev 600)
@@ -664,7 +664,7 @@
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 @@
Boolean checkConfigOnly;
Boolean printLockFile;
- char configFile[PATH_MAX];
+ char configFile[PATH_MAX+1];
LogFileHandler statisticsLog;
LogFileHandler recordLog;
@@ -1093,11 +1093,11 @@
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 @@
/* 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;
Modified: trunk/src/dep/daemonconfig.c
===================================================================
--- trunk/src/dep/daemonconfig.c 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/src/dep/daemonconfig.c 2015-10-23 02:18:41 UTC (rev 600)
@@ -2766,6 +2766,7 @@
printf(PTPD_PROGNAME" version "USER_VERSION
#ifdef CODE_REVISION
CODE_REVISION
+ " built on "BUILD_DATE
#endif
"\n");
Modified: trunk/src/dep/datatypes_dep.h
===================================================================
--- trunk/src/dep/datatypes_dep.h 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/src/dep/datatypes_dep.h 2015-10-23 02:18:41 UTC (rev 600)
@@ -127,7 +127,7 @@
char* logID;
char* openMode;
- char logPath[PATH_MAX];
+ char logPath[PATH_MAX+1];
FILE* logFP;
Boolean logEnabled;
Modified: trunk/src/dep/net.c
===================================================================
--- trunk/src/dep/net.c 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/src/dep/net.c 2015-10-23 02:18:41 UTC (rev 600)
@@ -204,7 +204,7 @@
}
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 @@
}
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 @@
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 @@
}
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;
Modified: trunk/src/protocol.c
===================================================================
--- trunk/src/protocol.c 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/src/protocol.c 2015-10-23 02:18:41 UTC (rev 600)
@@ -315,16 +315,16 @@
if(rtOpts->unicastNegotiation && rtOpts->ipMode==IPMODE_UNICAST && ptpClock->parentGrants != NULL) {
/* do not cancel, just start re-requesting so we can still send a cancel on exit */
- ptpClock->parentGrants->grantData[ANNOUNCE].timeLeft = 0;
- ptpClock->parentGrants->grantData[SYNC].timeLeft = 0;
+ ptpClock->parentGrants->grantData[ANNOUNCE_INDEXED].timeLeft = 0;
+ ptpClock->parentGrants->grantData[SYNC_INDEXED].timeLeft = 0;
if(ptpClock->delayMechanism == E2E) {
- ptpClock->parentGrants->grantData[DELAY_RESP].timeLeft = 0;
+ ptpClock->parentGrants->grantData[DELAY_RESP_INDEXED].timeLeft = 0;
}
ptpClock->parentGrants = NULL;
if(ptpClock->delayMechanism == P2P) {
- cancelUnicastTransmission(&ptpClock->peerGrants.grantData[PDELAY_RESP], rtOpts, ptpClock);
+ cancelUnicastTransmission(&ptpClock->peerGrants.grantData[PDELAY_RESP_INDEXED], rtOpts, ptpClock);
cancelAllGrants(&ptpClock->peerGrants, 1, rtOpts, ptpClock);
}
}
@@ -852,7 +852,7 @@
/* if unicast negotiation is enabled, only request if granted */
if(!rtOpts->unicastNegotiation ||
(ptpClock->parentGrants &&
- ptpClock->parentGrants->grantData[DELAY_RESP].granted)) {
+ ptpClock->parentGrants->grantData[DELAY_RESP_INDEXED].granted)) {
issueDelayReq(rtOpts,ptpClock);
}
}
@@ -861,7 +861,7 @@
DBGV("event PDELAYREQ_INTERVAL_TIMEOUT_EXPIRES\n");
/* if unicast negotiation is enabled, only request if granted */
if(!rtOpts->unicastNegotiation ||
- ( ptpClock->peerGrants.grantData[PDELAY_RESP].granted)) {
+ ( ptpClock->peerGrants.grantData[PDELAY_RESP_INDEXED].granted)) {
issuePdelayReq(rtOpts,ptpClock);
}
}
@@ -999,7 +999,7 @@
DBGV("event PDELAYREQ_INTERVAL_TIMEOUT_EXPIRES\n");
/* if unicast negotiation is enabled, only request if granted */
if(!rtOpts->unicastNegotiation ||
- ( ptpClock->peerGrants.grantData[PDELAY_RESP].granted)) {
+ ( ptpClock->peerGrants.grantData[PDELAY_RESP_INDEXED].granted)) {
issuePdelayReq(rtOpts,ptpClock);
}
}
@@ -1452,7 +1452,7 @@
nodeTable = findUnicastGrants(&header->sourcePortIdentity, 0,
ptpClock->unicastGrants, &ptpClock->grantIndex, UNICAST_MAX_DESTINATIONS,
FALSE);
- if(nodeTable == NULL || !(nodeTable->grantData[ANNOUNCE].granted)) {
+ if(nodeTable == NULL || !(nodeTable->grantData[ANNOUNCE_INDEXED].granted)) {
if(!rtOpts->unicastAcceptAny) {
DBG("Ignoring announce from master: unicast transmission not granted\n");
ptpClock->counters.discardedMessages++;
@@ -1460,7 +1460,7 @@
}
} else {
localPreference = nodeTable->localPreference;
- nodeTable->grantData[ANNOUNCE].receiving = header->sequenceId;
+ nodeTable->grantData[ANNOUNCE_INDEXED].receiving = header->sequenceId;
}
}
@@ -1695,7 +1695,7 @@
ptpClock->unicastGrants, &ptpClock->grantIndex, UNICAST_MAX_DESTINATIONS,
FALSE);
if(nodeTable != NULL) {
- nodeTable->grantData[SYNC].receiving = header->sequenceId;
+ nodeTable->grantData[SYNC_INDEXED].receiving = header->sequenceId;
}
}
@@ -1759,8 +1759,8 @@
/* this will be 0x7F for unicast so if we have a grant, use the granted value */
if(rtOpts->unicastNegotiation && ptpClock->parentGrants
- && ptpClock->parentGrants->grantData[SYNC].granted) {
- ptpClock->logSyncInterval = ptpClock->parentGrants->grantData[SYNC].logInterval;
+ && ptpClock->parentGrants->grantData[SYNC_INDEXED].granted) {
+ ptpClock->logSyncInterval = ptpClock->parentGrants->grantData[SYNC_INDEXED].logInterval;
}
@@ -1933,8 +1933,8 @@
ptpClock->logSyncInterval = header->logMessageInterval;
/* this will be 0x7F for unicast so if we have a grant, use the granted value */
if(rtOpts->unicastNegotiation && ptpClock->parentGrants
- && ptpClock->parentGrants->grantData[SYNC].granted) {
- ptpClock->logSyncInterval = ptpClock->parentGrants->grantData[SYNC].logInterval;
+ && ptpClock->parentGrants->grantData[SYNC_INDEXED].granted) {
+ ptpClock->logSyncInterval = ptpClock->parentGrants->grantData[SYNC_INDEXED].logInterval;
}
if (ptpClock->waitingForFollow) {
@@ -2018,7 +2018,7 @@
nodeTable = findUnicastGrants(&header->sourcePortIdentity, 0,
ptpClock->unicastGrants, &ptpClock->grantIndex, UNICAST_MAX_DESTINATIONS,
FALSE);
- if(nodeTable == NULL || !(nodeTable->grantData[DELAY_RESP].granted)) {
+ if(nodeTable == NULL || !(nodeTable->grantData[DELAY_RESP_INDEXED].granted)) {
DBG("Ignoring Delay Request from slave: unicast transmission not granted\n");
ptpClock->counters.discardedMessages++;
return;
@@ -2152,7 +2152,7 @@
ptpClock->unicastGrants, &ptpClock->grantIndex, UNICAST_MAX_DESTINATIONS,
FALSE);
if(nodeTable != NULL) {
- nodeTable->grantData[DELAY_RESP].receiving = header->sequenceId;
+ nodeTable->grantData[DELAY_RESP_INDEXED].receiving = header->sequenceId;
} else {
DBG("delayResp - unicast master not identified\n");
}
@@ -2241,12 +2241,12 @@
if(header->logMessageInterval == UNICAST_MESSAGEINTERVAL &&
rtOpts->autoDelayReqInterval) {
- if(rtOpts->unicastNegotiation && ptpClock->parentGrants && ptpClock->parentGrants->grantData[DELAY_RESP].granted) {
+ if(rtOpts->unicastNegotiation && ptpClock->parentGrants && ptpClock->parentGrants->grantData[DELAY_RESP_INDEXED].granted) {
if(ptpClock->delayRespWaiting) {
NOTICE("Received Delay Interval %d from master\n",
- ptpClock->parentGrants->grantData[DELAY_RESP].logInterval);
+ ptpClock->parentGrants->grantData[DELAY_RESP_INDEXED].logInterval);
}
- ptpClock->logMinDelayReqInterval = ptpClock->parentGrants->grantData[DELAY_RESP].logInterval;
+ ptpClock->logMinDelayReqInterval = ptpClock->parentGrants->grantData[DELAY_RESP_INDEXED].logInterval;
} else {
if(ptpClock->delayRespWaiting) {
@@ -2311,12 +2311,12 @@
nodeTable = findUnicastGrants(&header->sourcePortIdentity, 0,
ptpClock->unicastGrants, &ptpClock->grantIndex, UNICAST_MAX_DESTINATIONS,
FALSE);
- if(nodeTable == NULL || !(nodeTable->grantData[PDELAY_RESP].granted)) {
+ if(nodeTable == NULL || !(nodeTable->grantData[PDELAY_RESP_INDEXED].granted)) {
DBG("Ignoring Peer Delay Request from peer: unicast transmission not granted\n");
ptpClock->counters.discardedMessages++;
return;
} else {
- nodeTable->grantData[PDELAY_RESP].receiving = header->sequenceId;
+ nodeTable->grantData[PDELAY_RESP_INDEXED].receiving = header->sequenceId;
}
}
@@ -2477,12 +2477,12 @@
if(header->logMessageInterval == UNICAST_MESSAGEINTERVAL &&
rtOpts->autoDelayReqInterval) {
- if(rtOpts->unicastNegotiation && ptpClock->peerGrants.grantData[PDELAY_RESP].granted) {
+ if(rtOpts->unicastNegotiation && ptpClock->peerGrants.grantData[PDELAY_RESP_INDEXED].granted) {
if(ptpClock->delayRespWaiting) {
NOTICE("Received Peer Delay Interval %d from peer\n",
- ptpClock->peerGrants.grantData[PDELAY_RESP].logInterval);
+ ptpClock->peerGrants.grantData[PDELAY_RESP_INDEXED].logInterval);
}
- ptpClock->logMinPdelayReqInterval = ptpClock->peerGrants.grantData[PDELAY_RESP].logInterval;
+ ptpClock->logMinPdelayReqInterval = ptpClock->peerGrants.grantData[PDELAY_RESP_INDEXED].logInterval;
} else {
if(ptpClock->delayRespWaiting) {
@@ -2616,12 +2616,12 @@
if(header->logMessageInterval == UNICAST_MESSAGEINTERVAL &&
rtOpts->autoDelayReqInterval) {
- if(rtOpts->unicastNegotiation && ptpClock->peerGrants.grantData[PDELAY_RESP].granted) {
+ if(rtOpts->unicastNegotiation && ptpClock->peerGrants.grantData[PDELAY_RESP_INDEXED].granted) {
if(ptpClock->delayRespWaiting) {
NOTICE("Received Peer Delay Interval %d from peer\n",
- ptpClock->peerGrants.grantData[PDELAY_RESP].logInterval);
+ ptpClock->peerGrants.grantData[PDELAY_RESP_INDEXED].logInterval);
}
- ptpClock->logMinPdelayReqInterval = ptpClock->peerGrants.grantData[PDELAY_RESP].logInterval;
+ ptpClock->logMinPdelayReqInterval = ptpClock->peerGrants.grantData[PDELAY_RESP_INDEXED].logInterval;
} else {
if(ptpClock->delayRespWaiting) {
@@ -3021,7 +3021,7 @@
/* send to granted only */
if(rtOpts->unicastNegotiation) {
for(i = 0; i < UNICAST_MAX_DESTINATIONS; i++) {
- grant = &(ptpClock->unicastGrants[i].grantData[ANNOUNCE]);
+ grant = &(ptpClock->unicastGrants[i].grantData[ANNOUNCE_INDEXED]);
okToSend = TRUE;
if(grant->logInterval > ptpClock->logAnnounceInterval ) {
grant->intervalCounter %= (UInteger32)(pow(2,grant->logInterval - ptpClock->logAnnounceInterval));
@@ -3041,7 +3041,7 @@
} else {
for(i = 0; i < ptpClock->unicastDestinationCount; i++) {
issueAnnounceSingle(ptpClock->unicastDestinations[i].transportAddress,
- &(ptpClock->unicastGrants[i].grantData[ANNOUNCE].sentSeqId),
+ &(ptpClock->unicastGrants[i].grantData[ANNOUNCE_INDEXED].sentSeqId),
rtOpts, ptpClock);
}
}
@@ -3091,7 +3091,7 @@
/* send to granted only */
if(rtOpts->unicastNegotiation) {
for(i = 0; i < UNICAST_MAX_DESTINATIONS; i++) {
- grant = &(ptpClock->unicastGrants[i].grantData[SYNC]);
+ grant = &(ptpClock->unicastGrants[i].grantData[SYNC_INDEXED]);
okToSend = TRUE;
/* handle different intervals */
if(grant->logInterval > ptpClock->logSyncInterval ) {
@@ -3116,7 +3116,7 @@
for(i = 0; i < ptpClock->unicastDestinationCount; i++) {
ptpClock->unicastDestinations[i].lastSyncTimestamp =
issueSyncSingle(ptpClock->unicastDestinations[i].transportAddress,
- &(ptpClock->unicastGrants[i].grantData[SYNC].sentSeqId),
+ &(ptpClock->unicastGrants[i].grantData[SYNC_INDEXED].sentSeqId),
rtOpts, ptpClock);
}
}
Modified: trunk/src/ptpd.h
===================================================================
--- trunk/src/ptpd.h 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/src/ptpd.h 2015-10-23 02:18:41 UTC (rev 600)
@@ -363,19 +363,10 @@
*/
UnicastGrantTable* findUnicastGrants(const PortIdentity* portIdentity, Integer32 TransportAddress, UnicastGrantTable *grantTable, UnicastGrantIndex *index, int nodeCount, Boolean update);
void initUnicastGrantTable(UnicastGrantTable *grantTable, Enumeration8 delayMechanism, int nodeCount, UnicastDestination *destinations, const RunTimeOpts *rtOpts, PtpClock *ptpClock);
-void handleSMRequestUnicastTransmission(MsgSignaling*, MsgSignaling*, Integer32, const RunTimeOpts*, PtpClock*);
-Boolean handleSMCancelUnicastTransmission(MsgSignaling*, MsgSignaling*, Integer32, PtpClock*);
-void handleSMAcknowledgeCancelUnicastTransmission(MsgSignaling*, Integer32, PtpClock*);
-void handleSMGrantUnicastTransmission(MsgSignaling*, Integer32 , UnicastGrantTable*, int, PtpClock*);
-Boolean prepareSMRequestUnicastTransmission(MsgSignaling*,UnicastGrantData*,PtpClock*);
-Boolean prepareSMCancelUnicastTransmission(MsgSignaling*,UnicastGrantData*,PtpClock*);
-void requestUnicastTransmission(UnicastGrantData*, UInteger32, const RunTimeOpts*, PtpClock*);
void cancelUnicastTransmission(UnicastGrantData*, const RunTimeOpts*, PtpClock*);
-void cancelNodeGrants(UnicastGrantTable *nodeTable, const RunTimeOpts *rtOpts, PtpClock *ptpClock);
void cancelAllGrants(UnicastGrantTable *grantTable, int nodeCount, const RunTimeOpts *rtOpts, PtpClock *ptpClock);
-void issueSignaling(MsgSignaling *outgoing, Integer32 destination, const RunTimeOpts *rtOpts, PtpClock *ptpClock);
void handleSignaling(MsgHeader*, Boolean, Integer32, const RunTimeOpts*,PtpClock*);
void refreshUnicastGrants(UnicastGrantTable *grantTable, int nodeCount, const RunTimeOpts *rtOpts, PtpClock *ptpClock);
Modified: trunk/src/signaling.c
===================================================================
--- trunk/src/signaling.c 2015-10-22 04:31:10 UTC (rev 599)
+++ trunk/src/signaling.c 2015-10-23 02:18:41 UTC (rev 600)
@@ -46,7 +46,63 @@
static void updateUnicastIndex(UnicastGrantTable *table, UnicastGrantIndex *index);
static UnicastGrantTable* lookupUnicastIndex(PortIdentity *portIdentity, Integer32 transportAddress, UnicastGrantIndex *index);
+static int msgIndex(Enumeration8 messageType);
+static Enumeration8 msgXedni(int messageIndex);
+static void initOutgoingMsgSignaling(PortIdentity* targetPortIdentity, MsgSignaling* outgoing, PtpClock *ptpClock);
+static void handleSMRequestUnicastTransmission(MsgSignaling* incoming, MsgSignaling* outgoing, Integer32 sourceAddress, const RunTimeOpts *rtOpts, PtpClock *ptpClock);
+static void handleSMGrantUnicastTransmission(MsgSignaling* incoming, Integer32 sourceAddress, UnicastGrantTable *grantTable, int nodeCount, PtpClock *ptpClock);
+static Boolean handleSMCancelUnicastTransmission(MsgSignaling* incoming, MsgSignaling* outgoing, Integer32 sourceAddress, PtpClock* ptpClock);
+static void handleSMAcknowledgeCancelUnicastTransmission(MsgSignaling* incoming, Integer32 sourceAddress, PtpClock* ptpClock);
+static Boolean prepareSMRequestUnicastTransmission(MsgSignaling* outgoing, UnicastGrantData *grant, PtpClock* ptpClock);
+static Boolean prepareSMCancelUnicastTransmission(MsgSignaling* outgoing, UnicastGrantData* grant, PtpClock* ptpClock);
+static void requestUnicastTransmission(UnicastGrantData *grant, UInteger32 duration, const RunTimeOpts* rtOpts, PtpClock* ptpClock);
+static void issueSignaling(MsgSignaling *outgoing, Integer32 destination, const const RunTimeOpts *rtOpts, PtpClock *ptpclock);
+static void cancelNodeGrants(UnicastGrantTable *nodeTable, const RunTimeOpts *rtOpts, PtpClock *ptpClock);
+/* Return unicast grant array index for given message type */
+int
+msgIndex(Enumeration8 messageType)
+{
+
+ switch(messageType) {
+
+ case ANNOUNCE:
+ return ANNOUNCE_INDEXED;
+ case SYNC:
+ return SYNC_INDEXED;
+ case DELAY_RESP:
+ return DELAY_RESP_INDEXED;
+ case PDELAY_RESP:
+ return PDELAY_RESP_INDEXED;
+ case SIGNALING:
+ return SIGNALING_INDEXED;
+ default:
+ return -1;
+
+ }
+
+}
+/* xedni yarra ot gnidnopserroc epyt egassem PTP eht nruteR */
+static Enumeration8
+msgXedni(int messageIndex)
+{
+ switch(messageIndex) {
+ case ANNOUNCE_INDEXED:
+ return ANNOUNCE;
+ case SYNC_INDEXED:
+ return SYNC;
+ case DELAY_RESP_INDEXED:
+ return DELAY_RESP;
+ case PDELAY_RESP_INDEXED:
+ return PDELAY_RESP;
+ case SIGNALING_INDEXED:
+ return SIGNALING;
+ default:
+ return 0xFF;
+ }
+
+}
+
/* update index table */
static void
updateUnicastIndex(UnicastGrantTable *table, UnicastGrantIndex *index)
@@ -197,7 +253,7 @@
firstFree->transportAddress = transportAddress;
updateUnicastIndex(firstFree, index);
/* new set of grants - reset sequence numbers */
- for(i=0; i < PTP_MAX_MESSAGE; i++) {
+ for(i=0; i < PTP_MAX_MESSAGE_INDEXED; i++) {
firstFree->grantData[i].sentSeqId = 0;
}
@@ -213,7 +269,8 @@
/**\brief Initialise outgoing signaling message fields*/
-void initOutgoingMsgSignaling(PortIdentity* targetPortIdentity, MsgSignaling* outgoing, PtpClock *ptpClock)
+static void
+initOutgoingMsgSignaling(PortIdentity* targetPortIdentity, MsgSignaling* outgoing, PtpClock *ptpClock)
{
/* set header fields */
outgoing->header.transportSpecific = ptpClock->transportSpecific;
@@ -244,7 +301,8 @@
/**\brief Handle incoming REQUEST_UNICAST_TRANSMISSION signaling TLV type*/
-void handleSMRequestUnicastTransmission(MsgSignaling* incoming, MsgSignaling* outgoing, Integer32 sourceAddress, const RunTimeOpts *rtOpts, PtpClock *ptpClock)
+static void
+handleSMRequestUnicastTransmission(MsgSignaling* incoming, MsgSignaling* outgoing, Integer32 sourceAddress, const RunTimeOpts *rtOpts, PtpClock *ptpClock)
{
char portId[PATH_MAX];
@@ -287,9 +345,14 @@
goto finaliseResponse;
}
- myGrant = &nodeTable->grantData[messageType];
+ if(msgIndex(messageType) < 0) {
+ DBG("Received unicast request from %s for unsupported message type %d\n", inet_ntoa(tmpAddr), messageType);
+ goto finaliseResponse;
+ }
+ myGrant = &nodeTable->grantData[msgIndex(messageType)];
+
myGrant->requested = TRUE;
/* We assume the request is denied */
@@ -364,8 +427,8 @@
/* If we've granted once, we're likely to grant again */
grantData->renewal_invited = 1;
- outgoing->header.sequenceId = myGrant->parent->grantData[SIGNALING].sentSeqId;
- myGrant->parent->grantData[SIGNALING].sentSeqId++;
+ outgoing->header.sequenceId = myGrant->parent->grantData[SIGNALING_INDEXED].sentSeqId;
+ myGrant->parent->grantData[SIGNALING_INDEXED].sentSeqId++;
} else {
ptpClock->counters.unicastGrantsDenied++;
@@ -382,7 +445,8 @@
}
/**\brief Handle incoming GRANT_UNICAST_TRANSMISSION signaling message type*/
-void handleSMGrantUnicastTransmission(MsgSignaling* incoming, Integer32 sourceAddress, UnicastGrantTable *grantTable, int nodeCount, PtpClock *ptpClock)
+static void
+handleSMGrantUnicastTransmission(MsgSignaling* incoming, Integer32 sourceAddress, UnicastGrantTable *grantTable, int nodeCount, PtpClock *ptpClock)
{
char portId[PATH_MAX];
@@ -407,8 +471,13 @@
return;
}
- myGrant = &nodeTable->grantData[messageType];
+ if(msgIndex(messageType) < 0) {
+ DBG("Received unicast grant from %s for unsupported message type %d\n", inet_ntoa(tmpAddr), messageType);
+ return;
+ }
+ myGrant = &nodeTable->grantData[msgIndex(messageType)];
+
if(!myGrant->requestable) {
DBG("received unicat grant for non-requestable message %s from %s(%s)\n",
getMessageTypeName(messageType), portId, inet_ntoa(tmpAddr));
@@ -459,7 +528,8 @@
}
/**\brief Handle incoming CANCEL_UNICAST_TRANSMISSION signaling message type*/
-Boolean handleSMCancelUnicastTransmission(MsgSignaling* incoming, MsgSignaling* outgoing, Integer32 sourceAddress, PtpClock* ptpClock)
+static Boolean
+handleSMCancelUnicastTransmission(MsgSignaling* incoming, MsgSignaling* outgoing, Integer32 sourceAddress, PtpClock* ptpClock)
{
DBGV("Received CANCEL_UNICAST_TRANSMISSION message\n");
@@ -496,8 +566,13 @@
return FALSE;
}
- myGrant = &nodeTable->grantData[messageType];
+ if(msgIndex(messageType) < 0) {
+ DBG("Received cancel unicast request from %s for unsupported message type %d\n", inet_ntoa(tmpAddr), messageType);
+ return FALSE;
+ }
+ myGrant = &nodeTable->grantData[msgIndex(messageType)];
+
if(!myGrant->requestable) {
DBG("cancel grant attempt for non-requestable message %s from %s(%s)\n",
getMessageTypeName(messageType), portId, inet_ntoa(tmpAddr));
@@ -519,8 +594,8 @@
myGrant->granted = FALSE;
myGrant->requested = FALSE;
- outgoing->header.sequenceId = myGrant->parent->grantData[SIGNALING].sentSeqId;
- myGrant->parent->grantData[SIGNALING].sentSeqId++;
+ outgoing->header.sequenceId = myGrant->parent->grantData[SIGNALING_INDEXED].sentSeqId;
+ myGrant->parent->grantData[SIGNALING_INDEXED].sentSeqId++;
myGrant->sentSeqId = 0;
myGrant->cancelCount = 0;
@@ -538,7 +613,8 @@
}
/**\brief Handle incoming ACKNOWLEDGE_CANCEL_UNICAST_TRANSMISSION signaling message type*/
-void handleSMAcknowledgeCancelUnicastTransmission(MsgSignaling* incoming, Integer32 sourceAddress, PtpClock* ptpClock)
+static void
+handleSMAcknowledgeCancelUnicastTransmission(MsgSignaling* incoming, Integer32 sourceAddress, PtpClock* ptpClock)
{
char portId[PATH_MAX];
@@ -564,8 +640,13 @@
DBG("ACKNOWLEDGE_CANCEL_UNICAST_TRANSMISSION: did not find node in slave table: %s\n", portId);
}
- myGrant = &nodeTable->grantData[messageType];
+ if(msgIndex(messageType) < 0) {
+ DBG("Received unicast acknowledge ancer from %s for unsupported message type %d\n", inet_ntoa(tmpAddr), messageType);
+ return;
+ }
+ myGrant = &nodeTable->grantData[msgIndex(messageType)];
+
if(!myGrant->requestable) {
DBG("acknowledge cancel grant attempt for non-requestable message %s from %s(%s)\n",
getMessageTypeName(messageType), portId, inet_ntoa(tmpAddr));
@@ -592,7 +673,8 @@
}
-Boolean prepareSMRequestUnicastTransmission(MsgSignaling* outgoing, UnicastGrantData *grant, PtpClock* ptpClock)
+static Boolean
+prepareSMRequestUnicastTransmission(MsgSignaling* outgoing, UnicastGrantData *grant, PtpClock* ptpClock)
{
DBGV("Preparing CANCEL_UNICAST_TRANSMISSION message\n");
@@ -621,14 +703,15 @@
DBG(" prepared request unicast transmission request for message type 0x%0x\n",
grant->messageType);
- outgoing->header.sequenceId = grant->parent->grantData[SIGNALING].sentSeqId;
- grant->parent->grantData[SIGNALING].sentSeqId++;
+ outgoing->header.sequenceId = grant->parent->grantData[SIGNALING_INDEXED].sentSeqId;
+ grant->parent->grantData[SIGNALING_INDEXED].sentSeqId++;
return TRUE;
}
-Boolean prepareSMCancelUnicastTransmission(MsgSignaling* outgoing, UnicastGrantData* grant, PtpClock* ptpClock)
+static Boolean
+prepareSMCancelUnicastTransmission(MsgSignaling* outgoing, UnicastGrantData* grant, PtpClock* ptpClock)
{
DBGV("Preparing CANCEL_UNICAST_TRANSMISSION message\n");
@@ -669,8 +752,8 @@
cancelData->reserved0 = 0;
cancelData->reserved1 = 0;
- outgoing->header.sequenceId = grant->parent->grantData[SIGNALING].sentSeqId;
- grant->parent->grantData[SIGNALING].sentSeqId++;
+ outgoing->header.sequenceId = grant->parent->grantData[SIGNALING_INDEXED].sentSeqId;
+ grant->parent->grantData[SIGNALING_INDEXED].sentSeqId++;
return TRUE;
@@ -713,14 +796,14 @@
memset(&nodeTable->portIdentity.clockIdentity, 0xFF, CLOCK_IDENTITY_LENGTH);
}
- for(i=0; i<PTP_MAX_MESSAGE; i++) {
+ for(i=0; i< PTP_MAX_MESSAGE_INDEXED; i++) {
grantData = &nodeTable->grantData[i];
memset(grantData, 0, sizeof(UnicastGrantData));
grantData->parent = nodeTable;
- grantData->messageType = i;
+ grantData->messageType = msgXedni(i);
switch(grantData->messageType) {
@@ -786,7 +869,7 @@
for(j=0; j<nodeCount; j++) {
nodeTable = &grantTable[j];
- for(i=0; i<PTP_MAX_MESSAGE; i++) {
+ for(i=0; i < PTP_MAX_MESSAGE_INDEXED; i++) {
grantData = &nodeTable->grantData[i];
@@ -842,7 +925,8 @@
}
-void requestUnicastTransmission(UnicastGrantData *grant, UInteger32 duration, const RunTimeOpts* rtOpts, PtpClock* ptpClock)
+static void
+requestUnicastTransmission(UnicastGrantData *grant, UInteger32 duration, const RunTimeOpts* rtOpts, PtpClock* ptpClock)
{
if(duration == 0) {
@@ -876,7 +960,8 @@
freeSignalingTLV(&ptpClock->outgoingSignalingTmp);
}
-void cancelUnicastTransmission(UnicastGrantData* grant, const const RunTimeOpts* rtOpts, PtpClock* ptpClock)
+void
+cancelUnicastTransmission(UnicastGrantData* grant, const const RunTimeOpts* rtOpts, PtpClock* ptpClock)
{
/* todo: dbg sending */
@@ -895,7 +980,8 @@
freeSignalingTLV(&ptpClock->outgoingSignalingTmp);
}
-void issueSignaling(MsgSignaling *outgoing, Integer32 destination, const const RunTimeOpts *rtOpts,
+static void
+issueSignaling(MsgSignaling *outgoing, Integer32 destination, const const RunTimeOpts *rtOpts,
PtpClock *ptpClock)
{
@@ -921,14 +1007,14 @@
}
/* cancel all given or requested grants for a given clock node */
-void
+static void
cancelNodeGrants(UnicastGrantTable *nodeTable, const RunTimeOpts *rtOpts, PtpClock *ptpClock)
{
int i;
UnicastGrantData *grantData;
- for(i=0; i<PTP_MAX_MESSAGE; i++) {
+ for(i=0; i< PTP_MAX_MESSAGE_INDEXED; i++) {
grantData = &nodeTable->grantData[i];
if(!grantData->requestable) {
@@ -951,7 +1037,7 @@
int i;
- for(i=0; i<nodeCount; i++) {
+ for(i=0; i<nodeCount; i++) {
cancelNodeGrants(&grantTable[i], rtOpts, ptpClock);
}
@@ -1114,16 +1200,8 @@
{
static int everyN = 0;
- int i,j,msgnum;
+ int i,j;
- /*
- * forced order of grant checks, to influence order of requests, to help with interop with implementations
- * where messages have to be requested in the order of Announce, Sync, Delay
- */
- static const Enumeration8 messageOrder[PTP_MESSAGETYPE_COUNT] = {
- ANNOUNCE, SYNC, FOLLOW_UP, DELAY_RESP, PDELAY_RESP, PDELAY_RESP_FOLLOW_UP, DELAY_REQ, PDELAY_REQ, SIGNALING, MANAGEMENT
- };
-
UnicastGrantData *grantData = NULL;
UnicastGrantTable *nodeTable = NULL;
Boolean actionRequired;
@@ -1146,8 +1224,7 @@
nodeTable = &grantTable[j];
maxTime = 0;
- for(msgnum=0; msgnum < PTP_MESSAGETYPE_COUNT; msgnum++) {
- i = messageOrder[msgnum];
+ for(i=0; i < PTP_MAX_MESSAGE_INDEXED; i++) {
grantData = &nodeTable->grantData[i];
if(grantData->granted && !grantData->expired) {
maxTime = grantData->timeLeft;
@@ -1155,8 +1232,7 @@
}
}
- for(msgnum=0; msgnum < PTP_MESSAGETYPE_COUNT; msgnum++) {
- i = messageOrder[msgnum];
+ for(i=0; i < PTP_MAX_MESSAGE_INDEXED; i++) {
grantData = &nodeTable->grantData[i];
@@ -1251,9 +1327,9 @@
}
/* we have some old requests to cancel, we changed the GM - keep the Announce coming though */
if(ptpClock->previousGrants != NULL) {
- cancelUnicastTransmission(&(ptpClock->previousGrants->grantData[SYNC]), rtOpts, ptpClock);
- cancelUnicastTransmission(&(ptpClock->previousGrants->grantData[DELAY_RESP]), rtOpts, ptpClock);
- cancelUnicastTransmission(&(ptpClock->previousGrants->grantData[PDELAY_RESP]), rtOpts, ptpClock);
+ cancelUnicastTransmission(&(ptpClock->previousGrants->grantData[SYNC_INDEXED]), rtOpts, ptpClock);
+ cancelUnicastTransmission(&(ptpClock->previousGrants->grantData[DELAY_RESP_INDEXED]), rtOpts, ptpClock);
+ cancelUnicastTransmission(&(ptpClock->previousGrants->grantData[PDELAY_RESP_INDEXED]), rtOpts, ptpClock);
/* do not reset the other master's clock ID! ...you little bollocks you */
/*
ptpClock->previousGrants->portIdentity.portNumber = 0xFFFF;
@@ -1266,25 +1342,25 @@
nodeTable = ptpClock->parentGrants;
- if (!nodeTable->grantData[SYNC].requested) {
- grantData=&nodeTable->grantData[SYNC];
+ if (!nodeTable->grantData[SYNC_INDEXED].requested) {
+ grantData=&nodeTable->grantData[SYNC_INDEXED];
requestUnicastTransmission(grantData,
rtOpts->unicastGrantDuration, rtOpts, ptpClock);
}
- if (nodeTable->grantData[SYNC].granted) {
+ if (nodeTable->grantData[SYNC_INDEXED].granted) {
switch(ptpClock->delayMechanism) {
case E2E:
- if(!nodeTable->grantData[DELAY_RESP].requested) {
- grantData=&nodeTable->grantData[DELAY_RESP];
+ if(!nodeTable->grantData[DELAY_RESP_INDEXED].requested) {
+ grantData=&nodeTable->grantData[DELAY_RESP_INDEXED];
requestUnicastTransmission(grantData,
rtOpts->unicastGrantDuration, rtOpts, ptpClock);
}
break;
case P2P:
- if(!nodeTable->grantData[PDELAY_RESP].requested) {
- grantData=&nodeTable->grantData[PDELAY_RESP];
+ if(!nodeTable->grantData[PDELAY_RESP_INDEXED].requested) {
+ grantData=&nodeTable->grantData[PDELAY_RESP_INDEXED];
requestUnicastTransmission(grantData,
rtOpts->unicastGrantDuration, rtOpts, ptpClock);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|