port: constrain the master's logMinDelayReqInterval.
Buggy or mis-configured masters can place bogus logMessageInterval values in their delay response messages. This patch places reasonable limits on the range of values that we will accept. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
a8a3ddec6a
commit
0135e5344d
12
port.c
12
port.c
|
@ -1666,12 +1666,18 @@ static void process_delay_resp(struct port *p, struct ptp_message *m)
|
||||||
|
|
||||||
clock_path_delay(p->clock, t3, t4c);
|
clock_path_delay(p->clock, t3, t4c);
|
||||||
|
|
||||||
if (p->logMinDelayReqInterval != rsp->hdr.logMessageInterval) {
|
if (p->logMinDelayReqInterval == rsp->hdr.logMessageInterval) {
|
||||||
// TODO - validate the input.
|
return;
|
||||||
|
}
|
||||||
|
if (rsp->hdr.logMessageInterval < -10 ||
|
||||||
|
rsp->hdr.logMessageInterval > 22) {
|
||||||
|
pr_debug("port %hu: ignore bogus delay request interval 2^%d",
|
||||||
|
portnum(p), rsp->hdr.logMessageInterval);
|
||||||
|
return;
|
||||||
|
}
|
||||||
p->logMinDelayReqInterval = rsp->hdr.logMessageInterval;
|
p->logMinDelayReqInterval = rsp->hdr.logMessageInterval;
|
||||||
pr_notice("port %hu: minimum delay request interval 2^%d",
|
pr_notice("port %hu: minimum delay request interval 2^%d",
|
||||||
portnum(p), p->logMinDelayReqInterval);
|
portnum(p), p->logMinDelayReqInterval);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process_follow_up(struct port *p, struct ptp_message *m)
|
static void process_follow_up(struct port *p, struct ptp_message *m)
|
||||||
|
|
Loading…
Reference in New Issue