On Mon, Apr 22, 2019 at 03:08:49PM -0400, Charles Curley wrote:
> I have a problem where sometimes due to network issues that some Rockwell
> PLC's in my environment will start trying to fill in for the the master PTP
> server. These devices are serving time that is from 1993. The real fix
> would be to stop them from acting as servers but I'm not sure that will get
> done. I was thinking I could just put some fairly simple filtering by add
> options for whitelist/blacklist and start ignoring packets. I've been
> looking at the code and wondering where would be the appropriate place to
> put such filtering. Without spending a lot of time trying to follow all the
> code, I found 3 calls to recvmsg(3P) .Would someone who knows the code and
> structure like to comment on whether it would be appropriate to perform
> such filtering at the recvmsg() level or should it be done elsewhere?

So you want ptp4l to ignore bad Rockwell masters, right?

I would put your blacklist into add_foreign_master(), something like this:

        static int add_foreign_master(struct port *p, struct ptp_message *m)
        {
                struct foreign_clock *fc;
                struct ptp_message *tmp;
                int broke_threshold = 0, diff = 0;
        
                LIST_FOREACH(fc, &p->blacklist, list) {
                        if (msg_source_equal(m, fc)) {
                                return 0;
                        }
                }
                ...
        }

That would ignore the bad Announce messages. Of course you'll have to
populate blacklist first.

Possibly you could also avoid hacking ptp4l and use BPF rules to drop
Announce messages from the bad sources.

HTH,
Richard



_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to