Browse code

rtpengine: print warning message if setting TOS for socket fails

Daniel-Constantin Mierla authored on 21/06/2018 07:08:29
Showing 1 changed files
... ...
@@ -1696,14 +1696,15 @@ static int build_rtpp_socks() {
1696 1696
 			if((0 <= control_cmd_tos) && (control_cmd_tos < 256)) {
1697 1697
 				unsigned char tos = control_cmd_tos;
1698 1698
 				if (pnode->rn_umode == 6) {
1699
-					setsockopt(rtpp_socks[pnode->idx], IPPROTO_IPV6,
1699
+					if(setsockopt(rtpp_socks[pnode->idx], IPPROTO_IPV6,
1700 1700
 							IPV6_TCLASS, &control_cmd_tos,
1701
-							sizeof(control_cmd_tos));
1701
+							sizeof(control_cmd_tos)))
1702
+						LM_WARN("Failed to set IPv6 TOS socket option\n");
1702 1703
 
1703 1704
 				} else {
1704
-					setsockopt(rtpp_socks[pnode->idx], IPPROTO_IP,
1705
-							IP_TOS, &tos,
1706
-							sizeof(tos));
1705
+					if(setsockopt(rtpp_socks[pnode->idx], IPPROTO_IP,
1706
+							IP_TOS, &tos, sizeof(tos)))
1707
+						LM_WARN("Failed to set IPv4 TOS socket option\n");
1707 1708
 				}
1708 1709
 			}
1709 1710