diff --git a/clock.c b/clock.c index 14f35232..0c283a61 100644 --- a/clock.c +++ b/clock.c @@ -1615,6 +1615,7 @@ int clock_manage(struct clock *c, struct port *p, struct ptp_message *msg) { int changed = 0, res, answers; struct port *piter; + struct tlv_extra *extra; struct management_tlv *mgt; struct ClockIdentity *tcid, wildcard = { {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} @@ -1628,7 +1629,15 @@ int clock_manage(struct clock *c, struct port *p, struct ptp_message *msg) if (!cid_eq(tcid, &wildcard) && !cid_eq(tcid, &c->dds.clockIdentity)) { return changed; } - if (msg_tlv_count(msg) != 1) { + switch (msg_tlv_count(msg)) { + case 1: + break; + case 2: + extra = TAILQ_LAST(&msg->tlv_list, tlv_list); + if (extra->tlv->type == TLV_AUTHENTICATION) { + break; + } + default: return changed; } mgt = (struct management_tlv *) msg->management.suffix; diff --git a/pmc.c b/pmc.c index 6cdd7b03..c50d46f4 100644 --- a/pmc.c +++ b/pmc.c @@ -199,7 +199,15 @@ static void pmc_show(struct ptp_message *msg, FILE *fp) fprintf(fp, "\t%s seq %hu %s ", pid2str(&msg->header.sourcePortIdentity), msg->header.sequenceId, pmc_action_string(action)); - if (msg_tlv_count(msg) != 1) { + switch (msg_tlv_count(msg)) { + case 1: + break; + case 2: + extra = TAILQ_LAST(&msg->tlv_list, tlv_list); + if (extra->tlv->type == TLV_AUTHENTICATION) { + break; + } + default: goto out; } extra = TAILQ_FIRST(&msg->tlv_list); diff --git a/pmc_agent.c b/pmc_agent.c index fec6dea7..b6ed996a 100644 --- a/pmc_agent.c +++ b/pmc_agent.c @@ -72,14 +72,24 @@ static int check_clock_identity(struct pmc_agent *node, struct ptp_message *msg) static int is_msg_mgt(struct ptp_message *msg) { + struct tlv_extra *extra; struct TLV *tlv; if (msg_type(msg) != MANAGEMENT) return 0; if (management_action(msg) != RESPONSE) return 0; - if (msg_tlv_count(msg) != 1) + switch (msg_tlv_count(msg)) { + case 1: + break; + case 2: + extra = TAILQ_LAST(&msg->tlv_list, tlv_list); + if (extra->tlv->type == TLV_AUTHENTICATION) { + break; + } + default: return 0; + } tlv = (struct TLV *) msg->management.suffix; if (tlv->type == TLV_MANAGEMENT) return 1;