Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid rogue peer delay request error #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions port.c
Original file line number Diff line number Diff line change
Expand Up @@ -1843,6 +1843,7 @@ static void flush_peer_delay(struct port *p)
if (p->peer_delay_req) {
msg_put(p->peer_delay_req);
p->peer_delay_req = NULL;
p->peer_delay_req_flushed = 1;
}
if (p->peer_delay_resp) {
msg_put(p->peer_delay_resp);
Expand Down Expand Up @@ -2478,9 +2479,17 @@ int process_pdelay_resp(struct port *p, struct ptp_message *m)
}
}
if (!p->peer_delay_req) {
if (p->peer_delay_req_flushed) {
pr_notice("%s: peer delay response ignored because of previous flush", p->log_name);
p->peer_delay_req_flushed = 0;
return 0;
}
pr_err("%s: rogue peer delay response", p->log_name);
return -1;
} else {
p->peer_delay_req_flushed = 0;
}

if (p->peer_portid_valid) {
if (!pid_eq(&p->peer_portid, &m->header.sourcePortIdentity)) {
pr_err("%s: received pdelay_resp msg with "
Expand Down
1 change: 1 addition & 0 deletions port_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ struct port {
struct ptp_message *last_syncfup;
TAILQ_HEAD(delay_req, ptp_message) delay_req;
struct ptp_message *peer_delay_req;
unsigned int peer_delay_req_flushed;
struct ptp_message *peer_delay_resp;
struct ptp_message *peer_delay_fup;
int peer_portid_valid;
Expand Down