[prev in list] [next in list] [prev in thread] [next in thread] 

List:       keepalived-devel
Subject:    [Keepalived-devel] [PATCH 2/4] Use IP_TOS to support older kernels
From:       Eilon Greenstein <eilong () mellanox ! com>
Date:       2014-05-11 15:47:08
Message-ID: 1399823230-15448-3-git-send-email-eilong () mellanox ! com
[Download RAW message or body]

From: Dharmender Garg <dharmenderg@mellanox.com>

Setting the IP_TOS to support older kernels. A full support would include
adding the new IP_TOS flag to the configure script. So this patch is incomplete
by itself, but it is still helpful even as a comment for reference.

Signed-off-by: Dharmender Garg <dharmenderg@mellanox.com>
Signed-off-by: Eilon Greenstein <eilong@mellanox.com>
---
 keepalived/vrrp/vrrp_if.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/keepalived/vrrp/vrrp_if.c b/keepalived/vrrp/vrrp_if.c
index 12dda84..e5d90b0 100644
--- a/keepalived/vrrp/vrrp_if.c
+++ b/keepalived/vrrp/vrrp_if.c
@@ -637,6 +637,9 @@ if_setsockopt_priority(int *sd)
 {
 	int ret;
 	int priority = 6;
+#ifdef IP_TOS
+	int iptos_precedence = 0xc0 /*IPTOS_CLASS_CS6*/;
+#endif
 
 	if (*sd < 0)
 		return -1;
@@ -649,6 +652,15 @@ if_setsockopt_priority(int *sd)
 		*sd = -1;
 	}
 
+#ifdef IP_TOS
+	ret = setsockopt(*sd, IPPROTO_IP, IP_TOS, &iptos_precedence, sizeof(iptos_precedence));
+	if (ret < 0) {
+		log_message(LOG_INFO, "cant set IP_TOS IP option. errno=%d (%m)", errno);
+		close(*sd);
+		*sd = -1;
+	}
+#endif
+
 	return *sd;
 }
 
-- 
1.8.4.3


------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Keepalived-devel mailing list
Keepalived-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/keepalived-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic