This scenario will only be encountered when the clock transitions to the
slave state without knowing who the master is.
This will result in a segfault for BMCA with designated master and slave
states (to be added in upcoming patches).
Signed-off-by: Vedang Patel <vedang.patel@intel.com>
If foreign clock is NULL, both the clocks are obviously not equal. So,
return 0 in that case.
The above condition (fc == NULL) is not currently encountered. It will
be encoutered in the next few patches which implement static roles for
master and slave.
Signed-off-by: Vedang Patel <vedang.patel@intel.com>
Remove > from beginning of lines specified in the *.conf sections in
order to allow a ptp4l-specific section (e.g. [unicast_master_table]) to
be included there.
After inserting the lines to the generated ptp4l.conf, switch back to
the [global] section.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Don't postpone processing of a timeout if it is equal to the current
time. This prevents an infinite loop with a simulated clock.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Currently the clockIdentity is generated from the mac address of the first
interface/port in config file. This patch add the possibility to set it in
config file.
The reason is if the stack is restarted with a different set of ports, it
may be circumstances when clockIdentity needs to be equal as before
restart even if the port setup is different.
Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
Add attribute maxStepsRemoved which is included in IEEE1588-2017 (v2.1)
It is an optional attribute which can decide if an Announce message is
considered in the operation of the BMCA or not.
Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
Add global option for the hardware time stamp setting.
The function could:
Normally set the filters as the PTP daemon require.
Check that the filters are proper but do not change them.
Full, set the RX filter to all and the TX filter as the PTP daemon require.
[ RC: added missing extern keyword and fixed indentation. ]
Signed-off-by: Erez Geva <erez.geva.ext@siemens.com>
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
The sub agent use net-snmp library and AgentX protocol for the
communication towards the snmp master agent.
snmpd.c should only include general setup needed for handling snmp.
Supported MIBs should be implemented in separate files.
Makefile will include snmpd if libsnmp is available during compilation.
configs/snmpd.conf should be placed in /etc/snmp/
Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
In port_management_fill_response() the TLV descriptor leaked when
not responding.
In port_open() the port would leak with the unsupported management clock
type.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
When using peer to peer one step mode, the normal time stamp handling
of peer delay request messages is bypassed. The hardware subtracts
the ingress time stamp from the correction field and then adds the
egress time into the correction of the response. The configured
latency values are never applied since the hardware has no knowledge
of them. This patch adds in the correction values in this special
case.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
The default initial value for logAnnounceInterval should be 0 (once per second).
See chapter 10.6.2.2 of IEEE 802.1AS standard.
Signed-off-by: Christoph Seifert <christoph.seifert@posteo.me>
These functions are just wrappers. Make it possible for the compiler to
optimize the calls when compiled with optimization.
Signed-off-by: Michael Walle <michael@walle.cc>
The field is redundant with the length tlv_list. Replace it with a
function msg_tlv_count() instead. This iterates over the tlv_list. The
computational overhead should be small, because the lists are very short
and the tlv_count is only used in management paths (yet).
Signed-off-by: Michael Walle <michael@walle.cc>
Since commit 7fe69e7ba0 management
messages are dropped in some cases because the tlv_count isn't 1.
Further analysis shows that this is the case when the message is
forwarded in clock_forward_mgmt_msg(). This is because msg_post_recv()
will append TLVs and - in the forwarding case - there is already one TLV
in the list, which results in tlv_count being 2 and thus dropped in
subsequent code.
msg_post_recv() is intended to be the cleanup code for msg_pre_send()
which is called earlier. Therefore, make msg_post_recv() and
msg_pre_send() symmetrical and cleanup the tlv_list and tlv_count.
Signed-off-by: Michael Walle <michael@walle.cc>
TRUE and FALSE is also defined in net-snmp library. Without this check,
compilation and includes must be made in a certain order.
Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
This patch adds new code that handles unicast service contracts,
sending messages according the negotiated schedule.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
There are two aspects. First, on the receive path, we reply to
unicast peer delay requests in kind. That is, if the peer sends a
unicast delay request, then reply with unicast, too, since this is
obviously what the peer expects.
Second, if configured, we transmit peer delay requests to the
specified unicast peer address.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch adds new code that runs the state machine and handles the
TLVs for requesting unicast service from a remote master.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
In order to implement client side unicast negotiation, state is needed
per port and master. This patch adds the needed state machines.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch adds configuration file support for a table of unicast
masters. Each table lives in its own section and has a unique,
positive numerical ID. Entries in the table are a pair of transport
type and protocol address.
Each port may specify a table id to be used for unicast negotiation.
Tables may not be shared between ports, but nothing prevents table
entries from appearing in more than table.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
All of the callers of transport_peer() use hard coded magic numbers.
This patch fixes them to use the corresponding enumerated values instead.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>