> -----Original Message-----
> From: Richard Cochran <richardcoch...@gmail.com>
> Sent: Friday, April 03, 2020 7:30 AM
> To: linuxptp-devel@lists.sourceforge.net
> Subject: [Linuxptp-devel] [PATCH 5/5] pmc: Allow multiple local subscribers.
>
> If more than one local UDS client subscribes to push notifications,
> only the last one receives data from the ptp4l service. This happens
> because ptp4l uses the PortIdentity as a unique key to track client
> subscriptions. As a result, it is not possible for both phc2sys and
> pmc to receive push notifications at the same time, for example.
>
> This patch sets the PortIdentity.portNumber attribute of UDS clients
> to the local process ID, making each such client subscription unique.
>
> Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
> ---
> pmc_common.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/pmc_common.c b/pmc_common.c
> index f89d87c..822dd6d 100644
> --- a/pmc_common.c
> +++ b/pmc_common.c
> @@ -18,8 +18,10 @@
> * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> */
> #include <errno.h>
> -#include <string.h>
> #include <stdlib.h>
> +#include <string.h>
> +#include <sys/types.h>
> +#include <unistd.h>
>
> #include "notification.h"
> #include "print.h"
> @@ -353,13 +355,16 @@ struct pmc *pmc_create(struct config *cfg, enum
> transport_type transport_type,
> if (!pmc)
> return NULL;
>
> - if (transport_type != TRANS_UDS &&
> - generate_clock_identity(&pmc->port_identity.clockIdentity,
> - iface_name)) {
> - pr_err("failed to generate a clock identity");
> - goto failed;
> + if (transport_type == TRANS_UDS) {
> + pmc->port_identity.portNumber = getpid();
> + } else {
> + if (generate_clock_identity(&pmc->port_identity.clockIdentity,
> + iface_name)) {
> + pr_err("failed to generate a clock identity");
> + goto failed;
> + }
> + pmc->port_identity.portNumber = 1;
Ah, so previously we always set them to 1, but now we use the pid for local
UDS, and a clock identity for remote ones. Nice
> }
> - pmc->port_identity.portNumber = 1;
> pmc_target_all(pmc);
>
> pmc->boundary_hops = boundary_hops;
> --
> 2.20.1
>
>
>
> _______________________________________________
> Linuxptp-devel mailing list
> Linuxptp-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel