Restrict SET actions to UDS port.

Setting GRANDMASTER_SETTINGS_NP is allowed only from UDS, but
PORT_DATA_SET can be set from any port. Move the port check to
clock_manage(), so all clock and port SET actions are restricted
to the UDS port.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
master
Miroslav Lichvar 2014-02-21 16:50:13 +01:00 committed by Richard Cochran
parent c0fd772974
commit 91e240679b
1 changed files with 5 additions and 4 deletions

View File

@ -320,10 +320,6 @@ static int clock_management_set(struct clock *c, struct port *p,
switch (id) {
case GRANDMASTER_SETTINGS_NP:
if (p != c->port[c->nports]) {
/* Sorry, only allowed on the UDS port. */
break;
}
gsn = (struct grandmaster_settings_np *) tlv->data;
c->dds.clockQuality = gsn->clockQuality;
c->utc_offset = gsn->utc_offset;
@ -843,6 +839,11 @@ int clock_manage(struct clock *c, struct port *p, struct ptp_message *msg)
clock_management_send_error(p, msg, WRONG_LENGTH);
return changed;
}
if (p != c->port[c->nports]) {
/* Sorry, only allowed on the UDS port. */
clock_management_send_error(p, msg, NOT_SUPPORTED);
return changed;
}
if (clock_management_set(c, p, mgt->id, msg, &changed))
return changed;
break;