dcavalca / rpms / linuxptp

Forked from rpms/linuxptp 2 years ago
Clone

Blame SOURCES/linuxptp-udsmgt.patch

c1aeb8
commit 303b08cbf55096aba55bd08a314e0701e5c33482
c1aeb8
Author: Miroslav Lichvar <mlichvar@redhat.com>
c1aeb8
Date:   Mon Dec 11 14:21:25 2017 +0100
c1aeb8
c1aeb8
    clock: Don't forward management requests to UDS port.
c1aeb8
    
c1aeb8
    The UDS port is not expected to be used by PTP clocks and forwarding of
c1aeb8
    management messages to the port can be limited to responses.
c1aeb8
    
c1aeb8
    This prevents ptp4l from printing error messages when a management
c1aeb8
    request is received from a non-UDS port and the last client which used
c1aeb8
    the UDS port is no longer listening.
c1aeb8
    
c1aeb8
    Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
c1aeb8
c1aeb8
diff --git a/clock.c b/clock.c
c1aeb8
index 41c8f81..6dbc45e 100644
c1aeb8
--- a/clock.c
c1aeb8
+++ b/clock.c
c1aeb8
@@ -1243,6 +1243,17 @@ static int clock_do_forward_mgmt(struct clock *c,
c1aeb8
 {
c1aeb8
 	if (in == out || !forwarding(c, out))
c1aeb8
 		return 0;
c1aeb8
+
c1aeb8
+	/* Don't forward any requests to the UDS port. */
c1aeb8
+	if (out == c->uds_port) {
c1aeb8
+		switch (management_action(msg)) {
c1aeb8
+		case GET:
c1aeb8
+		case SET:
c1aeb8
+		case COMMAND:
c1aeb8
+			return 0;
c1aeb8
+		}
c1aeb8
+	}
c1aeb8
+
c1aeb8
 	if (!*pre_sent) {
c1aeb8
 		/* delay calling msg_pre_send until
c1aeb8
 		 * actually forwarding */