Giter Site home page Giter Site logo

gptp's People

Contributors

afx00 avatar aholzinger avatar asitom avatar avinash-palleti avatar bdthomsen avatar cboiger avatar christopher-s-hall avatar davidcemin avatar ethan-stewart-iol avatar freddeng avatar intel-ethernet avatar itrandafir avatar jfornal avatar k-gupta avatar kencarlino avatar lhoward avatar m10k avatar marcinmiklas avatar mprinn avatar mwasko avatar pawelmodrzejewski avatar pinealservo avatar psow avatar rhii avatar simet avatar sugnanprabhu avatar tgorochowik avatar tnishiok avatar vvacharya avatar zeerd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gptp's Issues

PortInit_t index - possible issue (crash)

Hi,

I was investigating random crash in our application and found that in daemon_cl.cpp we initialize
portInit.index = 0; and this value is ussed to register port in clock:

void registerPort(CommonPort* port, uint16_t index) {
		if (index < MAX_PORTS) {
			port_list[index - 1] = port;
		}
		++number_ports;
	}

This cause that we modify port_list at index '-1' and increase number_ports.
In constructor I set all port_list to the NULL which help me to found this issue.

After that port_list is used in CommonPort::processStateChange(Event e)

Here we try to get some values from port which was registered in the wrong way.
If there is NULL j index is 33 and we get some garbage values. If port_list was not initialized with NULLs we also get some garbage. Here we get the crash.

Potential fixes is to not allow to registerPort with index less then 1 or do not substract 1.

I'll be very glad to get some feedback if this is the issue of the daemon_cl sample.

Travis

The gPTP Travis (sanity) build (and icon) seems to have gone missing when this repo was split from the main OpenAvnu repo. Can someone please put it back?

Static code analysis _027 (Uninitialized Variable)

Short summary (details in attached file):

Event 3:  recvmsg() does not initialize reflected_bytes.

Uninitialized Variable help
*gptpCommonHeader was not initialized.

*gptpCommonHeader references reflected_bytes.
reflected_bytes was defined at linux_hal_generic.cpp:290.

gptp_027.txt

Compiling gPTP for 'ARCH=I210'

Hi, some steps over from my last question.
Now, I'm facing an other problem:
I'm trying to compile for ARCH=I210, but I have the following error:

In file included from ../src/linux_hal_generic.cpp:34:0:
../src/linux_hal_generic_tsprivate.hpp:42:10: fatal error: igb.h: File or directory not found
 #include <igb.h>

Then, I put all "igb_avb/lib" content in "gptp/linux/src"
and I had as follow:

g++ -Wall -g -I. -I../../common -I../src -I/home/iemai/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -std=c++0x -Wnon-virtual-dtor  obj/ptp_message.o obj/ap_message.o obj/avbts_osnet.o obj/ether_port.o obj/common_port.o obj/ieee1588clock.o obj/linux_hal_common.o obj/linux_hal_persist_file.o obj/gptp_log.o obj/platform.o obj/ini.o obj/gptp_cfg.o obj/linux_hal_generic.o obj/linux_hal_generic_adj.o obj/linux_hal_i210.o ../src/daemon_cl.cpp -o obj/daemon_cl  -lz -ligb -lpci -L../../../../lib/igb/ -lpthread -lrt
/usr/bin/ld: unable to found -ligb
collect2: error: ld returned 1 exit status
Makefile:141: recipe for target 'obj/daemon_cl' failed
make: *** [obj/daemon_cl] Error 1

Please, how can I resolve this issue?
Many thanks and regards

Problem with I210 on Windows 7

Hello, I'm facing a problem using I210 on Windows 7.

Environment:
Windows 7 Enterprise
Intel(R) Ethernet I210-T1 GbE NIC
Driver version: 12.13.27.0

I have also added TimeSync to the registry.

But when I run the executable I get the following output:
INFO : GPTP [11:52:00:962] Starting IPC listener thread succeeded
Opening: rpcap://\Device\NPF_{797A8B7A-26A9-4B74-AB0B-3B0F7DC508D7}
ERROR : GPTP [11:52:01:009] Unable to determine clock rate for interface Intel(R) Ethernet I210-T1 GbE NIC
ERROR : GPTP [11:52:01:025] Failed to initialize hardware timestamper, falling back to software timestamping
STATUS : GPTP [11:52:01:025] Starting PDelay
Error is: 6
Error is: 6
Error is: 6
Error is: 6
Error is: 6
Error is: 6
ERROR : GPTP [11:52:01:212] Error (TX) timestamping PDelay request (Retrying-0), error=-1
Error is: 6
ERROR : GPTP [11:52:01:212] Error (TX) timestamping PDelay request, error=-1

Also a window pops up with the message:
the variable "ret" is being used without being initialized

Is anyone having the same error? If so, do you have any idea of what the cause is or how to solve it?

Thanks and regards.

Static code analysis _036 (Null Pointer Dereference)

Short summary (details in attached file):

LinuxGPTPPersistFile::triggerWriteStorage()
.../linux/src/linux_hal_persist_file.cpp

    bool triggerWriteStorage(void)
    {
            if (!writeCB) {
            	
event Event 2:  Considering the case where writeCB must have been equal to 0.
                    GPTP_LOG_ERROR("Persistent write callback not registered");
            }
            bool result = false;
            if (memoryDataLength > storedDataLength) {
            ...
            }
            writeCB((char *)restoredata, storedDataLength);
            	
Null Pointer Dereference: writeCB is dereferenced here, but it is NULL.

gptp_036.txt

Received PDelay FUP has different seqID than the PDelay request

Hi Everyone,

This is an issue I have already posted but on the Open Avnu TSN and AVB repository. This problem is not solved for me.

I was executing my gPTP deamon for the server and the client . I could see that the AsCapable: Enabled in both the system but still i get the following error "Received PDelay FUP has different seqID than the PDelay request".

This might have happened because the Pdelay Response follow up message came earlier than the Pdelay Request message or it might have come too late that already another Pdelay Request message have triggered in between. As a result the sequence id of both is not matching.

I checked with the wireshark and found that there is no unexpected Pdelay Request interfering in between a Pdelay Request and Pdelay Response Follow up message. In that case, why does my Sequence id not matching? and what should I do to solve this error?

I have attched the images of gPTP executed on my server and client. Please do help me.
TSN Server:
tsn server

TSN Client:
tsn client

Thanks in advance!

Static code analysis _028 (Uninitialized Variable)

Short summary (details in attached file):

in case of pthread_create() failure in OSTimerQueue *LinuxTimerQueueFactory::createOSTimerQueue (linux_hal_common.cpp), destructor LinuxTimerQueue::~LinuxTimerQueue() is invoked on delete (ret) and there pthread_join(_private->signal_thread, NULL) is called but signal_thread seems to be uninitialized/undefined according to pthread_create() return value description:

On success, pthread_create() returns 0; on error, it returns an error number, and the contents of *thread are undefined.

gptp_028.txt

gptp release

Now that the gptp is separated out of the OpenAvnu code, can we have a separate release for the gptp starting with the versioning v1.0

Static code analysis _029 (No Space For Null Terminator)

Short summary (details in attached file):

InterfaceName::InterfaceName()
.../common/avbts_osnet.hpp

InterfaceName(char *name, int length) {
	this->name = new char[length + 1];
	PLAT_strncpy(this->name, name, length);
}
strncpy() may write a non-null value into the very last byte of the string.
The string's capacity is length + 1, which is bounded above by 1073741824 and the length of the string pointed to by name and below by 1. The last character written by strncpy() could be character length + 1 - 1, which evaluates to length, which is bounded above by 1073741823 and the length of the string pointed to by name, minus 1 and below by 0.
If a subsequent statement definitely null-terminates the string, you can safely ignore this warning.

gptp_029.txt

gptp support for Beaglebone black

Hello There,

I tried to run gptp daemon in my Linux system connected to one more Linux system through Ethernet cable. But I am getting the following error

INFO     : GPTP [10:14:31:177] gPTP starting
ERROR    : GPTP [10:14:31:178] Group ptp not found, will try root (0) instead
ERROR    : GPTP [10:14:31:178] Failed to configure timestamping: Operation not supported
ERROR    : GPTP [10:14:31:178] post_init failed

ERROR    : GPTP [10:14:31:178] failed to initialize port

Using ethtool -T eth0 command I got the following information.

Time stamping parameters for eth0:

Capabilities:
	software-transmit     (SOF_TIMESTAMPING_TX_SOFTWARE)
	software-receive      (SOF_TIMESTAMPING_RX_SOFTWARE)
	software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
PTP Hardware Clock: none
Hardware Transmit Timestamp Modes: none
Hardware Receive Filter Modes: none

As per my understanding gptp required HardwareTimeStamp.So my system is not supporting it. I am planning to buy Beaglebone black to run gptp.Does Beaglebone supports the gptp ?

Compiling gPTP for 'generic' Linux

Hi,
I am new to Open AVB and interested to understand this tech.
First, I had a look to documentation and issues on this git and found, in order to have a running AVB demo on my Linux host PC, I need to:

  1. compile gPTP (following related README.rst file);
  2. compile OpenAvnu code by following "wiki-Getting the source"
  3. run gPTP (daemon_cl)
  4. run simple_talker (or simple listner)

Compilation is ok.
I'm a bit confused: many issues report mandatory Intel I210, but in gPTP README.rst is:

To build for I210:

ARCH=I210 make clean all

To build for 'generic' Linux:

make clean all

Then, could I run a demo on host PC with any kind of NIC card, no matter about hardware timestamping?
Please, any hints for me?
Thanks a lot

Static code analysis _003 (The resource was not freed)

Short summary (details in attached file):

Event 22:  net_iface_l->sd_event has gone out of scope and no longer references the resource of interest.
There are no remaining references to the resource socket(17, SOCK_DGRAM, 0) from linux_hal_common.cpp:1058.

The resource was allocated at linux_hal_common.cpp:1058.
The last reference was lost at linux_hal_common.cpp:1071.
The resource was not freed.

gptp_003.txt

Static code analysis _044/_045 (Coercion Alters Value) - wrong type of Signalling intervals

Short summary (details in attached file):

event Event 11:  linkDelayInterval is set to -128. See related event 10.   Jump to previous message Jump to next message hide
                this->linkDelayInterval = linkDelayInterval;
            	
Coercion Alters Value help
linkDelayInterval is coerced from signed char to unsigned char.


event Event 11:  announceInterval is set to -128. See related event 10.   Jump to previous message Jump to next message hide
                this->announceInterval = announceInterval;
            	
Coercion Alters Value help
announceInterval is coerced from signed char to unsigned char.

gptp_044.txt
gptp_045.txt

No threads sync during shutdown results in segmentation fault

Currently there is no threads synchronization during daemon shutdown. On Linux two sources of segmentation fault were identified (for slave only) so far:

  • ipc - deleted at the end of main thread and accessed while processing FollowUp message (in IEEE1588Clock::setMasterOffset function, ipc->update());
  • ether_phy_delay - created/destroyed in the main thread and still accessed while trying to process messages (in CommonPort::getRxPhyDelay, could be also in CommonPort::getTxPhyDelay, phy_delay->count())

It is quite sporadic (1/X00) and it has been fixed (and well tested in slave mode) on our side by adding/calling pthread_cancel() and _join() for "watchNetLink" and "openPort" threads at the end of main thread. Those threads should be "cancelled" at POSIX.1 cancellation points, which are recv() and select() functions in those cases.

Is there someone interested in pull request with mentioned changes or do you see other (better) ways to fix it? Any comments appreciated.

cannot build for arch I210 on Ubuntu 18.04

../../../../lib/igb/igb.h:30:10: fatal error: linux/kobject.h: can't find that file or directory
 #include <linux/kobject.h>
          ^~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:150: recipe for target 'obj/linux_hal_generic.o' failed
make: *** [obj/linux_hal_generic.o] Error 1

After I locate that and add it to include directory, I would get a lot more error message which I think may be a compiler-related problem.
What should I prepare before compiling for I210?

Setting sync interval

Currently, the sync interval is set either through the configuration file (including the default value) or through the signaling message. This is correct behavior in the master role.

For the slave role, the sync interval is used to set the sync timeout and should be taken from ingress sync message header (logMessageInterval field). The sync timeout is set, by default, to 3x the sync interval.

Alternatively, a second ingress sync interval could be added, but it's probably OK to re-use for slave.

Static code analysis _013 (The resource was not freed)

Short summary (details in file attached):

Event 17:  result has gone out of scope and no longer references the resource of interest.
There are no remaining references to the resource new () from linux_hal_common.hpp:382.

The resource was allocated at linux_hal_common.hpp:382.
The last reference was lost at linux_hal_common.hpp:383.
The resource was not freed.

gptp_013.txt

Static code analysis _002 (The resource was not freed)

Short summary (details in file attached):

Event 18:  net_iface_l->sd_general has gone out of scope and no longer references the resource of interest.
There are no remaining references to the resource socket(17, SOCK_DGRAM, 0) from linux_hal_common.cpp:1053.

The resource was allocated at linux_hal_common.cpp:1053.
The last reference was lost at linux_hal_common.cpp:1062.
The resource was not freed.

gptp_002.txt

Static code analysis _010 (The resource was not freed)

Short summary (details in attached file):

Event 13:  lock_factory has gone out of scope and no longer references the resource of interest.
There are no remaining references to the resource new () from daemon_cl.cpp:213.

The resource was allocated at daemon_cl.cpp:213.
The last reference was lost at daemon_cl.cpp:221.
The resource was not freed.

gptp_010.txt

Static code analysis _005 (The resource was not freed)

Short summary (details in attached file):

Event 14:  thread_factory has gone out of scope and no longer references the resource of interest.
There are no remaining references to the resource new () from daemon_cl.cpp:165.

The resource was allocated at daemon_cl.cpp:165.
The last reference was lost at daemon_cl.cpp:174.
The resource was not freed.

gptp_005.txt

Static code analysis _009 (The resource was not freed)

Short summary (details in attached file):

Event 13:  timerq_factory has gone out of scope and no longer references the resource of interest.
There are no remaining references to the resource new () from daemon_cl.cpp:212.

The resource was allocated at daemon_cl.cpp:212.
The last reference was lost at daemon_cl.cpp:221.
The resource was not freed.

gptp_009.txt

Static code analysis _004 (The resource was not freed)

Short summary (details in attached file):

Event 15:  _private has gone out of scope and no longer references the resource of interest.
There are no remaining references to the resource new () from linux_hal_common.cpp:802.

The resource was allocated at linux_hal_common.cpp:802.
The last reference was lost at daemon_cl.cpp:122.
The resource was not freed.

gptp_004.txt

Intel 8260: Failed to initialize hardware timestamper

Hi, I have two 8269 adapters and I'd like to test its time sync function.

I've followed the README to install the latest intel driver and switch the driver to the intel version in device manager, setup registry(reboot), and connect two PCs directly via p2p mode.

But when I start gPTP, it tolds me "Failed to initialize hardware timestamper, falling..."

$ ./gptp -w 2A-16-XX-XX-XX-39 2A-16-XX-XX-XX-39 2A-16-XX-XX-XX-F2
INFO     : GPTP [22:24:19:433] Starting IPC listener thread succeeded
STATUS   : GPTP [22:24:19:438] AsCapable: Enabled
Opening: rpcap://\Device\NPF_{B6A3CA4D-3AAD-4653-9E16-302C78475C15}
ERROR    : GPTP [22:24:19:481] Failed to initialize hardware timestamper, falling back to software timestamping
STATUS   : GPTP [22:24:22:484] *** Announce Timeout Expired - Becoming Master
STATUS   : GPTP [22:24:22:486] New Grandmaster "2A:16:XX:XX:XX:XX:XX:39" (previous "00:00:00:00:00:00:00:00")

Could you please help me resolving this? Thanks!

Additional:

It's Windows 10 1803 (OS Build 17134.1006) x64
The driver is Intel 20.70.11.3 (6/29/2019)

Static code analysis _016 (The resource was not freed)

Short summary (details in attached file):

Event 26:  default_factory has gone out of scope and no longer references the resource of interest.
There are no remaining references to the resource new () from daemon_cl.cpp:209.

The resource was allocated at daemon_cl.cpp:209.
The last reference was lost at daemon_cl.cpp:221.
The resource was not freed.

gptp_016.txt

Vetting an idea to implement gPTP for switch devices.

Currently we have gPTP which is capable of synchronizing endstations, if I want to scale the implementation, so that it will work on switch devices too, how difficult it would be?

Current implementation has the functionalities specific to a single port, so will it be just a task of having the same running on multiple ports? Is there any limitation for the current achitecture, that I should be aware of?

Unable to assign current timestamp and sequenceID during live capturing.

Brief description:

Using pyshark, we are able to capture the live logs. But here, current timestamp and sequenceID parameter values are getting assigned inappropriately from server side to the client side, due to the delay of live capturing.

Server side, we are running gptp daemon_cl.
Client side, we are pumping the dummy packets.

Environment:

Scapy version: 2.4.0
Python version: 3.6.6
Operating System: Ubuntu18.04

Expected Result:

Server side timestamp and sequenceID should match with the Client side timestamp and sequenceID parameters

Compiling error on ubuntu 20.04 for __cmsg_data

Hello!

Anyone knows about this?

I checked this structs and find those codes at ../src/linux_hal_generic.cpp:293.

        struct {
                struct cmsghdr cm;
                char control[256];
        } control;

The last element of cmsghdr is a __flexarr. So , a char control[256] after a __flexarr. This cause an error.

Full logs at below:

user@user-Lenovo-Product:~/AVnu/gptp/linux/build$ ARCH=I210 make all
g++ -Wall -g -I. -I../../common -I../src -I/home/user/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -std=c++0x -Wnon-virtual-dtor  -c ../src/linux_hal_generic.cpp -o obj/linux_hal_generic.o
In file included from /usr/include/x86_64-linux-gnu/sys/socket.h:33,
                 from ../src/linux_hal_generic.cpp:38:
/usr/include/x86_64-linux-gnu/bits/socket.h: In member function ‘virtual net_result LinuxNetworkInterface::nrecv(LinkLayerAddress*, uint8_t*, size_t&)’:
/usr/include/x86_64-linux-gnu/bits/socket.h:285:33: error: flexible array member ‘cmsghdr::__cmsg_data’ not at end of ‘struct LinuxNetworkInterface::nrecv(LinkLayerAddress*, uint8_t*, size_t&)::<unnamed>’
  285 |     __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.  */
      |                                 ^~~~~~~~~~~
../src/linux_hal_generic.cpp:64:8: note: next member ‘char LinuxNetworkInterface::nrecv(LinkLayerAddress*, uint8_t*, size_t&)::<unnamed struct>::control [256]’ declared here
   64 |   char control[256];
      |        ^~~~~~~
../src/linux_hal_generic.cpp:62:9: note: in the definition of ‘struct LinuxNetworkInterface::nrecv(LinkLayerAddress*, uint8_t*, size_t&)::<unnamed>’
   62 |  struct {
      |         ^
In file included from /usr/include/x86_64-linux-gnu/sys/socket.h:33,
                 from ../src/linux_hal_generic.cpp:38:
/usr/include/x86_64-linux-gnu/bits/socket.h: In member function ‘virtual int LinuxTimestamperGeneric::HWTimestamper_txtimestamp(PortIdentity*, PTPMessageId, Timestamp&, unsigned int&, bool)’:
/usr/include/x86_64-linux-gnu/bits/socket.h:285:33: error: flexible array member ‘cmsghdr::__cmsg_data’ not at end of ‘struct LinuxTimestamperGeneric::HWTimestamper_txtimestamp(PortIdentity*, PTPMessageId, Timestamp&, unsigned int&, bool)::<unnamed>’
  285 |     __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.  */
      |                                 ^~~~~~~~~~~
../src/linux_hal_generic.cpp:295:8: note: next member ‘char LinuxTimestamperGeneric::HWTimestamper_txtimestamp(PortIdentity*, PTPMessageId, Timestamp&, unsigned int&, bool)::<unnamed struct>::control [256]’ declared here
  295 |   char control[256];
      |        ^~~~~~~
../src/linux_hal_generic.cpp:293:9: note: in the definition of ‘struct LinuxTimestamperGeneric::HWTimestamper_txtimestamp(PortIdentity*, PTPMessageId, Timestamp&, unsigned int&, bool)::<unnamed>’
  293 |  struct {
      |         ^
make: *** [Makefile:150:obj/linux_hal_generic.o] Error 1

there is an error in commom/ptp_message.cpp

Line 433 : int tlv_length = size - PTP_COMMON_HDR_LENGTH + PTP_ANNOUNCE_LENGTH;

should be changed to
int tlv_length = size - (PTP_COMMON_HDR_LENGTH + PTP_ANNOUNCE_LENGTH);

kernel 5.2.17-rt9 unable to locate correct ethtool.h: ethtool_ops->get_settings not found

Hi *,

I am trying to update the kernel I use with my AVB project.

Kernel 4.8.6-rt5 is working very well.
The same code (with adjustments for the new kernel) compiles under 5.2.17-rt9, but the synchronization resets repeatedly.
The sequence id of the FUP msg is wrong.

I tried ptp4l as well. no sync at all.
I have no two ptp daemons running, as propsed in another issue.

It is no network setup problem, since 5/6 servers with kernel 4.8.6-rt5 work flawlessly.

Any idea?
Any changes to the kernel, that break the code?
Some new or colliding kernel options?

Thanks and BR,
Ck

In C++ it will not work

In the file 'common/ieee1588.hpp' default constructor for Timestamp looks as follows:

	Timestamp() {
		Timestamp( 0, 0, 0 );
	}

This will not work in C++. Could you please correct that in next releases.

By the way, I started to play with this project recently and found some more places, where some improvements/corrections could be applied. Is there a change that I could contribute to this (gptp) project?

Static code analysis _032 (Coercion Alters Value - offsetScaledLogVariance)

Short summary (details in attached file):

buildPTPMessage()
.../common/ptp_message.cpp

PTPMessageCommon *buildPTPMessage
( char *buf, int size, LinkLayerAddress *remote,
  CommonPort *port )
{
...
                    annc->
                      grandmasterClockQuality->offsetScaledLogVariance =
                      	
Coercion Alters Value help
PLAT_ntohs(...) is coerced from unsigned short to short.

                      PLAT_ntohs 
                      ( annc->grandmasterClockQuality->
                        offsetScaledLogVariance );

PLAT_ntohs()
.../linux/src/platform.cpp
uint16_t PLAT_ntohs( uint16_t s ) {
        return ntohs( s );
}        	

SCA complains here about ntohs() but I believe the real issue is the type of offsetScaledLogVariance in struct ClockQuality, which currently in the code is int16_t. There seems to be inconsistency in IEEE 802.1AS-2011:

  • in 6.3.3.8 ClockQuality offsetScaledLogVariance is defined as UInteger16;
  • later in the document it's used as Integer16 (Table 14-1, code examples etc.);

This inconsistency has been corrected in IEEE 802.1AS-2011/Cor 1-2013 where UInteger16 was specified in the Table 14-1 and later in the code examples.

gptp_032.txt

Static code analysis _008 (The resource was not freed)

Short summary (details in attached file):

Event 13:  timer_factory has gone out of scope and no longer references the resource of interest.
There are no remaining references to the resource new () from daemon_cl.cpp:214.

The resource was allocated at daemon_cl.cpp:214.
The last reference was lost at daemon_cl.cpp:221.
The resource was not freed.

gptp_008.txt

Static code analysis _039/_040/_041/_042 (Coercion Alters Value)

Short summary (details in attached file):

SignallingTLV::SignallingTLV()
.../common/avbts_message.hpp
expand/collapse
        SignallingTLV() {
                tlvType = PLAT_htons(0x3);
                lengthField = PLAT_htons(12);
                organizationId[0] = '\x00';
                organizationId[1] = '\x80';
                organizationId[2] = '\xC2';

Coercion Alters Value help
-128 is coerced from char to unsigned char.
-62 is coerced from char to unsigned char.
Negative values cannot be stored as unsigned char.  Coercing them to unsigned char can cause data loss or sign change.

gptp_039.txt
gptp_040.txt
gptp_041.txt
gptp_042.txt

compiling with ARCH=I210 does not work out of the box

Compilation of the repository with ARCH=I210 does not work out of the box.
Is this intended or should i normally do something different?

log of make with ARCH=I210

mgnad@pc1:~/gptp/linux/build$ ARCH=I210 make clean all
rm -f *~ obj/*.o  obj/daemon_cl
g++ -Wall -g -I. -I../../common -I../src -I/home/mgnad/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -std=c++0x -Wnon-virtual-dtor  -c ../../common/ptp_message.cpp -o obj/ptp_message.o
../../common/ptp_message.cpp: In function ‘PTPMessageCommon* buildPTPMessage(char*, int, LinkLayerAddress*, CommonPort*)’:
../../common/ptp_message.cpp:244:31: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘class FollowUpTLV’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
  244 |     sizeof(followup_msg->tlv) );
      |                               ^
In file included from ../../common/common_port.hpp:38,
                 from ../../common/avbts_clock.hpp:39,
                 from ../../common/ptp_message.cpp:35:
../../common/avbts_message.hpp:730:7: note: ‘class FollowUpTLV’ declared here
  730 | class FollowUpTLV {
      |       ^~~~~~~~~~~
g++ -Wall -g -I. -I../../common -I../src -I/home/mgnad/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -std=c++0x -Wnon-virtual-dtor  -c ../../common/ap_message.cpp -o obj/ap_message.o
g++ -Wall -g -I. -I../../common -I../src -I/home/mgnad/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -std=c++0x -Wnon-virtual-dtor  -c ../../common/avbts_osnet.cpp -o obj/avbts_osnet.o
g++ -Wall -g -I. -I../../common -I../src -I/home/mgnad/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -std=c++0x -Wnon-virtual-dtor  -c ../../common/ether_port.cpp -o obj/ether_port.o
g++ -Wall -g -I. -I../../common -I../src -I/home/mgnad/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -std=c++0x -Wnon-virtual-dtor  -c ../../common/common_port.cpp -o obj/common_port.o
g++ -Wall -g -I. -I../../common -I../src -I/home/mgnad/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -std=c++0x -Wnon-virtual-dtor  -c ../../common/ieee1588clock.cpp -o obj/ieee1588clock.o
../../common/ieee1588clock.cpp: In constructor ‘IEEE1588Clock::IEEE1588Clock(bool, bool, uint8_t, OSTimerQueueFactory*, OS_IPC*, OSLockFactory*)’:
../../common/ieee1588clock.cpp:112:64: warning: ‘void* memset(void*, int, size_t)’ writing to an object of non-trivial type ‘class ClockIdentity’; use assignment instead [-Wclass-memaccess]
  112 |   memset( &LastEBestIdentity, 0xFF, sizeof( LastEBestIdentity ));
      |                                                                ^
In file included from ../../common/ieee1588clock.cpp:34:
../../common/ieee1588.hpp:125:7: note: ‘class ClockIdentity’ declared here
  125 | class ClockIdentity {
      |       ^~~~~~~~~~~~~
g++ -Wall -g -I. -I../../common -I../src -I/home/mgnad/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -std=c++0x -Wnon-virtual-dtor  -c ../src/linux_hal_common.cpp -o obj/linux_hal_common.o
g++ -Wall -g -I. -I../../common -I../src -I/home/mgnad/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -std=c++0x -Wnon-virtual-dtor  -c ../src/linux_hal_persist_file.cpp -o obj/linux_hal_persist_file.o
g++ -Wall -g -I. -I../../common -I../src -I/home/mgnad/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -std=c++0x -Wnon-virtual-dtor  -c ../../common/gptp_log.cpp -o obj/gptp_log.o
g++ -Wall -g -I. -I../../common -I../src -I/home/mgnad/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -std=c++0x -Wnon-virtual-dtor  -c ../src/platform.cpp -o obj/platform.o
cc -Wall -g -I. -I../../common -I../src -I/home/mgnad/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -c ../../common/ini.c -o obj/ini.o
g++ -Wall -g -I. -I../../common -I../src -I/home/mgnad/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -std=c++0x -Wnon-virtual-dtor  -c ../../common/gptp_cfg.cpp -o obj/gptp_cfg.o
g++ -Wall -g -I. -I../../common -I../src -I/home/mgnad/header/include/ -DPTP_HW_CROSSTSTAMP -I../../../../lib/igb/ -DWITH_IGBLIB -std=c++0x -Wnon-virtual-dtor  -c ../src/linux_hal_generic.cpp -o obj/linux_hal_generic.o
In file included from ../src/linux_hal_generic.cpp:34:
../src/linux_hal_generic_tsprivate.hpp:42:10: fatal error: igb.h: No such file or directory
   42 | #include <igb.h>
      |          ^~~~~~~
compilation terminated.
make: *** [Makefile:150: obj/linux_hal_generic.o] Error 1

To make it work I had to:

  1. clone https://github.com/Avnu/OpenAvnu and put this repository into OpenAvnu/daemons
  2. edit Makefile in gptp/linux/build:
diff --git a/linux/build/Makefile b/linux/build/Makefile
index 1e00b1a..5201ca5 100644
--- a/linux/build/Makefile
+++ b/linux/build/Makefile
@@ -90,8 +90,8 @@ HEADER_FILES = $(COMMON_DIR)/ether_port.hpp\
                $(SRC_DIR)/platform.hpp
 
 ifeq ($(ARCH),I210)
-       IGB_LIB_INCPATH=../../../../lib/igb/
-       IGB_LIB_PATH=../../../../lib/igb/
+       IGB_LIB_INCPATH=../../../../lib/igb_avb/lib
+       IGB_LIB_PATH=../../../../lib/igb_avb/lib
        CFLAGS_G += -I$(IGB_LIB_INCPATH) -DWITH_IGBLIB
        LDFLAGS_G += -lz -ligb -lpci -L$(IGB_LIB_PATH)
        OBJ_FILES += $(OBJ_DIR)/linux_hal_generic.o \

Static code analysis _020 (Negative Character Value)

Short summary (details in attached file):

Negative Character Value help at ini.c:47
isspace() is invoked here with an argument of signed type char, but only has defined behavior for int arguments that are either representable as unsigned char or equal to the value of macro EOF(-1).

gptp_020.txt

Static code analysis _007 (The resource was not freed)

Short summary (details in attached file):

Event 13:  condition_factory has gone out of scope and no longer references the resource of interest.
There are no remaining references to the resource new () from daemon_cl.cpp:215.

The resource was allocated at daemon_cl.cpp:215.
The last reference was lost at daemon_cl.cpp:221.
The resource was not freed.

gptp_007.txt

Static code analysis _015 (The resource was not freed)

Short summary (details in attached file):

Event 32:  ifname has gone out of scope and no longer references the resource of interest.
There are no remaining references to the resource new () from daemon_cl.cpp:223.

The resource was allocated at daemon_cl.cpp:223.
The last reference was lost at daemon_cl.cpp:390.
The resource was not freed.

gptp_015.txt

GPTP Local to Master Clock

Hi,

I am testing GPTP on a TI board which has CPSW driver. I am running gptp daemons on two separate TI boards using a Point-To-Point connection. I have written an application which will read the GPTP daemon shared memory and will try to calculate the synchronized master clock using the parameters defined in that shared memory.

I am doing the calculations in the below way:
Local Clock = System Clock - Local-To-System Phase Offset
Master Clock = Local Clock - Master-To-Local Phase Offset

Kindly let me know if this is the right way of calculating the Master Clock/Timestamp.

If there is some flaw in my understanding, please let me know the correct way.

Thanks in Advance.

Regards,
Mandar

Static code analysis _014 (The resource was not freed)

Short summary (details in attached file):

Event 31:  name has gone out of scope and no longer references the resource of interest.
There are no remaining references to the resource new[length + 1] () from avbts_osnet.hpp:173.

The resource was allocated at avbts_osnet.hpp:173.
The last reference was lost at daemon_cl.cpp:390.
The resource was not freed.

gptp_014.txt

Static code analysis _011 (The resource was not freed)

Short summary (details in file attached):

Event 13:  ipc has gone out of scope and no longer references the resource of interest.
There are no remaining references to the resource new () from daemon_cl.cpp:216.

The resource was allocated at daemon_cl.cpp:216.
The last reference was lost at daemon_cl.cpp:221.
The resource was not freed.

gptp_011.txt

Static code analysis _019 (Negative Character Value)

Short summary (details in attached file):

Negative Character Value help at ini.c:35
isspace() is invoked here with an argument of signed type char, but only has defined behavior for int arguments that are either representable as unsigned char or equal to the value of macro EOF(-1).

gptp_019.txt

Static code analysis _037 (Coercion Alters Value - phdly)

Short summary (details in attached file):

GptpIniParser::iniCallBack()
.../common/gptp_cfg.cpp
            parser->_config.phy_delay[LINKSPEED_1G].set_tx_delay( phdly );

phdly is coerced from int to unsigned short.
phdly evaluates to strtoul(value, &pEnd, 10)gptp_cfg.cpp:158.
Coercing them to unsigned short can cause data loss or sign change.

gptp_037.txt

Phy delays for Intel 82574L

I am working on supporting gPTP for One of the Intel 82574L chip.

But i could not find the Phy delays for particular chip in the Datasheet "https://www.intel.com/content/dam/doc/datasheet/82574l-gbe-controller-datasheet.pdf".

I found that the PHY delays (PHY_DELAY_MB_TX_I20, PHY_DELAY_MB_RX_I20) for i210 are derived from "https://www.intel.com/content/www/us/en/embedded/products/networking/i210-ethernet-controller-datasheet.html".

Is there any common derived Phy delays for all the NIC's.

Static code analysis _018 (Negative Character Value)

Short summary (details in attached file):

Negative Character Value help at ini.c:27
isspace() is invoked here with an argument of signed type char, but only has defined behavior for int arguments that are either representable as unsigned char or equal to the value of macro EOF(-1).

gptp_018.txt

Static code analysis _017 (The resource was not freed)

Short summary (details in attached file):

Event 29:  net_iface_l has gone out of scope and no longer references the resource of interest.
There are no remaining references to the resource new () from linux_hal_common.cpp:1040.

The resource was allocated at linux_hal_common.cpp:1040.
The last reference was lost at linux_hal_common.cpp:1044.
The resource was not freed.

gptp_017.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.