Append the follow up information TLV when enabled.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-08-09 20:34:57 +02:00
parent 226bd355af
commit d04deb8ba6
1 changed files with 15 additions and 0 deletions

15
port.c
View File

@ -265,6 +265,18 @@ static int add_foreign_master(struct port *p, struct ptp_message *m)
return broke_threshold || diff;
}
static int follow_up_info_append(struct port *p, struct ptp_message *m)
{
struct follow_up_info_tlv *fui;
fui = (struct follow_up_info_tlv *) m->follow_up.suffix;
fui->type = TLV_ORGANIZATION_EXTENSION;
fui->length = sizeof(*fui) - sizeof(fui->type) - sizeof(fui->length);
memcpy(fui->id, ieee8021_id, sizeof(ieee8021_id));
fui->subtype[2] = 1;
m->tlv_count = 1;
return sizeof(*fui);
}
static void free_foreign_masters(struct port *p)
{
struct foreign_clock *fc;
@ -616,6 +628,9 @@ static int port_tx_sync(struct port *p)
pdulen = sizeof(struct follow_up_msg);
fup->hwts.type = p->timestamping;
if (p->pod.follow_up_info)
pdulen += follow_up_info_append(p, fup);
fup->header.tsmt = FOLLOW_UP | p->transportSpecific;
fup->header.ver = PTP_VERSION;
fup->header.messageLength = pdulen;