Commit 78f90b18 authored by Sven Meier's avatar Sven Meier Committed by Adam Wujek

p2p: only answer peer delay messages when in p2p mode

changed peer delay handling so p2p messages are only answered when in this mode
added p2p messages to some states where it was missing
parent 53cb49ff
......@@ -94,6 +94,10 @@ int st_com_peer_handle_pres(struct pp_instance *ppi, unsigned char *buf,
MsgHeader *hdr = &ppi->received_ptp_header;
int e = 0;
/* if not in P2P mode, just return */
if (!CONFIG_HAS_P2P || ppi->mech != PP_P2P_MECH)
return 0;
msg_unpack_pdelay_resp(buf, &resp);
if ((memcmp(&DSPOR(ppi)->portIdentity.clockIdentity,
......@@ -136,6 +140,10 @@ int st_com_peer_handle_pres_followup(struct pp_instance *ppi,
MsgPDelayRespFollowUp respFllw;
int e = 0;
/* if not in P2P mode, just return */
if (!CONFIG_HAS_P2P || ppi->mech != PP_P2P_MECH)
return 0;
msg_unpack_pdelay_resp_follow_up(buf, &respFllw);
if ((memcmp(&DSPOR(ppi)->portIdentity.clockIdentity,
......@@ -164,6 +172,10 @@ int st_com_peer_handle_preq(struct pp_instance *ppi, unsigned char *buf,
{
int e = 0;
/* if not in P2P mode, just return */
if (!CONFIG_HAS_P2P || ppi->mech != PP_P2P_MECH)
return 0;
if (pp_hooks.handle_preq)
e = pp_hooks.handle_preq(ppi);
if (e)
......
......@@ -34,6 +34,9 @@ int pp_listening(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (e)
goto out;
/* when the clock is using peer-delay, listening must send it too */
if (CONFIG_HAS_P2P && ppi->mech == PP_P2P_MECH)
e = pp_lib_may_issue_request(ppi);
/*
* The management of messages is now table-driven
*/
......
......@@ -56,7 +56,7 @@ int pp_passive(struct pp_instance *ppi, unsigned char *pkt, int plen)
pp_timeout_set(ppi, PP_TO_FAULT); /* no fault as long as we are
* passive */
/* when the clock is using peer-delay, listening must send it too */
/* when the clock is using peer-delay, passive must send it too */
if (CONFIG_HAS_P2P && ppi->mech == PP_P2P_MECH)
e = pp_lib_may_issue_request(ppi);
......
......@@ -227,6 +227,7 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
goto out;
}
/* do a delay mesurement either in p2p or e2e delay mode */
pp_lib_may_issue_request(ppi);
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment