From 0695d483323f3be2344394ae418f6961292f373f Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Mon, 13 Apr 2020 19:05:16 -0700 Subject: [PATCH] port: Export the value of the wildcard port identity. Code in other modules will need this special port ID value. This patch makes it available through the port header file. Signed-off-by: Richard Cochran --- port.h | 3 +++ port_signaling.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/port.h b/port.h index e347e36..80c543e 100644 --- a/port.h +++ b/port.h @@ -33,6 +33,9 @@ struct clock; /** Opaque type. */ struct port; +/** The port identity that matches any port. */ +extern const struct PortIdentity wildcard_pid; + /** * Returns the dataset from a port's best foreign clock record, if any * has yet been discovered. This function does not bring the returned diff --git a/port_signaling.c b/port_signaling.c index c4d5469..cbd0cf4 100644 --- a/port_signaling.c +++ b/port_signaling.c @@ -23,7 +23,7 @@ #include "unicast_client.h" #include "unicast_service.h" -static struct PortIdentity wildcard = { +const struct PortIdentity wildcard_pid = { .clockIdentity = { {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} }, @@ -126,7 +126,7 @@ int process_signaling(struct port *p, struct ptp_message *m) /* Ignore signaling messages not addressed to this port. */ if (!pid_eq(&m->signaling.targetPortIdentity, &p->portIdentity) && - !pid_eq(&m->signaling.targetPortIdentity, &wildcard)) { + !pid_eq(&m->signaling.targetPortIdentity, &wildcard_pid)) { return 0; }