Commit 2b038cd3 authored by Sven Meier's avatar Sven Meier

bmc: port id compare made architecture independent

Since the portnumber is a 16bit value, memcp is not given to be correct
on all architectures depending on the endines
parent 8249256f
...@@ -312,7 +312,13 @@ int bmc_idcmp(struct ClockIdentity *a, struct ClockIdentity *b) ...@@ -312,7 +312,13 @@ int bmc_idcmp(struct ClockIdentity *a, struct ClockIdentity *b)
int bmc_pidcmp(struct PortIdentity *a, struct PortIdentity *b) int bmc_pidcmp(struct PortIdentity *a, struct PortIdentity *b)
{ {
return memcmp(a, b, sizeof(*a)); int ret;
ret = bmc_idcmp(&a->clockIdentity, &b->clockIdentity);
if (ret != 0)
return ret;
return a->portNumber - b->portNumber;
} }
/* compare part2 of the datasets which is the topology, fig 27, page 89 */ /* compare part2 of the datasets which is the topology, fig 27, page 89 */
......
...@@ -133,9 +133,8 @@ int st_com_peer_handle_pres(struct pp_instance *ppi, void *buf, ...@@ -133,9 +133,8 @@ int st_com_peer_handle_pres(struct pp_instance *ppi, void *buf,
msg_unpack_pdelay_resp(buf, &resp); msg_unpack_pdelay_resp(buf, &resp);
if ((memcmp(&DSPOR(ppi)->portIdentity.clockIdentity, if ((bmc_idcmp(&DSPOR(ppi)->portIdentity.clockIdentity,
&resp.requestingPortIdentity.clockIdentity, &resp.requestingPortIdentity.clockIdentity) == 0) &&
PP_CLOCK_IDENTITY_LENGTH) == 0) &&
((ppi->sent_seq[PPM_PDELAY_REQ]) == ((ppi->sent_seq[PPM_PDELAY_REQ]) ==
hdr->sequenceId) && hdr->sequenceId) &&
(DSPOR(ppi)->portIdentity.portNumber == (DSPOR(ppi)->portIdentity.portNumber ==
...@@ -179,9 +178,8 @@ int st_com_peer_handle_pres_followup(struct pp_instance *ppi, ...@@ -179,9 +178,8 @@ int st_com_peer_handle_pres_followup(struct pp_instance *ppi,
msg_unpack_pdelay_resp_follow_up(buf, &respFllw); msg_unpack_pdelay_resp_follow_up(buf, &respFllw);
if ((memcmp(&DSPOR(ppi)->portIdentity.clockIdentity, if ((bmc_idcmp(&DSPOR(ppi)->portIdentity.clockIdentity,
&respFllw.requestingPortIdentity.clockIdentity, &respFllw.requestingPortIdentity.clockIdentity) == 0) &&
PP_CLOCK_IDENTITY_LENGTH) == 0) &&
((ppi->sent_seq[PPM_PDELAY_REQ]) == ((ppi->sent_seq[PPM_PDELAY_REQ]) ==
hdr->sequenceId) && hdr->sequenceId) &&
(DSPOR(ppi)->portIdentity.portNumber == (DSPOR(ppi)->portIdentity.portNumber ==
......
...@@ -35,9 +35,8 @@ static int passive_handle_announce(struct pp_instance *ppi, void *buf, int len) ...@@ -35,9 +35,8 @@ static int passive_handle_announce(struct pp_instance *ppi, void *buf, int len)
if (ret) if (ret)
return ret; return ret;
if (!memcmp(&hdr->sourcePortIdentity, if (!bmc_pidcmp(&hdr->sourcePortIdentity,
&erbest->sourcePortIdentity, &erbest->sourcePortIdentity)) {
sizeof(PortIdentity))) {
/* /*
* 9.2.6.11 d) reset timeout when an announce * 9.2.6.11 d) reset timeout when an announce
* is received from the clock putting it into passive (erbest) * is received from the clock putting it into passive (erbest)
......
...@@ -123,9 +123,8 @@ static int slave_handle_response(struct pp_instance *ppi, void *buf, ...@@ -123,9 +123,8 @@ static int slave_handle_response(struct pp_instance *ppi, void *buf,
msg_unpack_delay_resp(buf, &resp); msg_unpack_delay_resp(buf, &resp);
if ((memcmp(&DSPOR(ppi)->portIdentity.clockIdentity, if ((bmc_idcmp(&DSPOR(ppi)->portIdentity.clockIdentity,
&resp.requestingPortIdentity.clockIdentity, &resp.requestingPortIdentity.clockIdentity) != 0) ||
PP_CLOCK_IDENTITY_LENGTH) != 0) ||
((ppi->sent_seq[PPM_DELAY_REQ]) != ((ppi->sent_seq[PPM_DELAY_REQ]) !=
hdr->sequenceId) || hdr->sequenceId) ||
(DSPOR(ppi)->portIdentity.portNumber != (DSPOR(ppi)->portIdentity.portNumber !=
......
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