[PATCH 2/4] Use IP_TOS to support older kernels
Eilon Greenstein <[email protected]>
| Newsgroups | gmane.linux.keepalived.devel |
|---|---|
| Message-ID | <[email protected]> |
From: Dharmender Garg <[email protected]> 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 <[email protected]> Signed-off-by: Eilon Greenstein <[email protected]> --- 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: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce