Index: config.c
===================================================================
--- config.c	(Revision 827)
+++ config.c	(Revision 830)
@@ -236,6 +236,8 @@
 	GLOB_ITEM_INT("use_syslog", 1, 0, 1),
 	GLOB_ITEM_STR("userDescription", ""),
 	GLOB_ITEM_INT("verbose", 0, 0, 1),
+	GLOB_ITEM_INT("tosEventMessage", 56, 0, 63),
+	GLOB_ITEM_INT("tosGeneralMessage", 46, 0, 46)
 };
 
 static enum parser_result
Index: udp.c
===================================================================
--- udp.c	(Revision 827)
+++ udp.c	(Revision 830)
@@ -149,6 +149,29 @@
 	return -1;
 }
 
+// setting IP DSCP value here
+static int set_priority(int sock_fd, uint8_t dscp) {
+    int tos;
+    socklen_t tos_len;
+
+    if (!sock_fd) {
+        return 0;
+    }
+
+    tos_len = sizeof(tos);
+    if (getsockopt(sock_fd, SOL_IP, IP_TOS, &tos, &tos_len) < 0) {
+        tos = 0;
+    }
+
+    tos |= dscp<<2;
+    tos_len = sizeof(tos);
+    if (setsockopt(sock_fd, SOL_IP, IP_TOS, &tos, tos_len) < 0) {
+        return -1;
+    }
+
+    return 0;
+}
+
 enum { MC_PRIMARY, MC_PDELAY };
 
 static struct in_addr mcast_addr[2];
@@ -176,11 +199,23 @@
 	if (efd < 0)
 		goto no_event;
 
+    // set DSCP priority for event messages
+    uint8_t event_dscp = config_get_int(t->cfg, NULL, "tosEventMessage");
+    if(set_priority(efd, event_dscp) < 0) {
+        pr_warning("Could not set COS value for PTP event messages.");
+    }
+
 	gfd = open_socket(name, mcast_addr, GENERAL_PORT, ttl);
 	if (gfd < 0)
 		goto no_general;
 
-	if (sk_timestamping_init(efd, name, ts_type, TRANS_UDP_IPV4))
+    // set DSCP priority for general messages
+    uint8_t general_dscp = config_get_int(t->cfg, NULL, "tosGeneralMessage");
+    if(set_priority(efd, general_dscp) < 0) {
+        pr_warning("Could not set DHCP value for PTP general messages.");
+    }
+
+    if (sk_timestamping_init(efd, name, ts_type, TRANS_UDP_IPV4))
 		goto no_timestamping;
 
 	if (sk_general_init(gfd))
Index: udp6.c
===================================================================
--- udp6.c	(Revision 827)
+++ udp6.c	(Revision 830)
@@ -157,6 +157,29 @@
 	return -1;
 }
 
+// setting IP DSCP value here
+static int set_priority(int sock_fd, uint8_t dscp) {
+    int tos;
+    socklen_t tos_len;
+
+    if (!sock_fd) {
+        return 0;
+    }
+
+    tos_len = sizeof(tos);
+    if (getsockopt(sock_fd, SOL_IP, IP_TOS, &tos, &tos_len) < 0) {
+        tos = 0;
+    }
+
+    tos |= dscp<<2;
+    tos_len = sizeof(tos);
+    if (setsockopt(sock_fd, SOL_IP, IP_TOS, &tos, tos_len) < 0) {
+        return -1;
+    }
+
+    return 0;
+}
+
 enum { MC_PRIMARY, MC_PDELAY };
 
 static struct in6_addr mc6_addr[2];
@@ -186,11 +209,23 @@
 	if (efd < 0)
 		goto no_event;
 
+	// set DSCP priority for event messages
+    uint8_t event_dscp = config_get_int(t->cfg, NULL, "tosEventMessage");
+    if(set_priority(efd, event_dscp) < 0) {
+        pr_warning("Could not set COS value for PTP event messages.");
+    }
+
 	gfd = open_socket_ipv6(name, mc6_addr, GENERAL_PORT, &udp6->index, hop_limit);
 	if (gfd < 0)
 		goto no_general;
 
-	if (sk_timestamping_init(efd, name, ts_type, TRANS_UDP_IPV6))
+    // set DSCP priority for general messages
+    uint8_t general_dscp = config_get_int(t->cfg, NULL, "tosGeneralMessage");
+    if(set_priority(efd, general_dscp) < 0) {
+        pr_warning("Could not set DHCP value for PTP general messages.");
+    }
+
+    if (sk_timestamping_init(efd, name, ts_type, TRANS_UDP_IPV6))
 		goto no_timestamping;
 
 	if (sk_general_init(gfd))
