Re: Ipv6 and preferred_lft

Frank Baalbergen <[email protected]>
Newsgroups gmane.linux.keepalived.devel
Message-ID <[email protected]>
Hi,

We tested the patch which can be found at 
`https://github.com/tuxis-ie/keepalived/commit/5c69b08e3bf01435929a86c5fd722dd7e1c0fa72`, 
all ipv6 addresses that are configured in keepalived.conf will be 
deprecated. I changed the patch made by tuxis-ie and tested it. This 
patch will only deprecate ipv6 addresses with a prefix length of 128.

--- a/keepalived/vrrp/vrrp_ipaddress.c
+++ b/keepalived/vrrp/vrrp_ipaddress.c
@@ -47,6 +47,22 @@
  	req.ifa = ipaddress->ifa;

  	if (IP_IS6(ipaddress)) {
+		if (ipaddress->ifa.ifa_prefixlen == 128) {
+			struct ifa_cacheinfo cinfo;
+			char *addr_str;
+
+			memset(&cinfo, 0, sizeof(cinfo));
+			cinfo.ifa_prefered = 0;
+			cinfo.ifa_valid = 0xFFFFFFFFU;
+
+			addr_str = ipaddresstos(ipaddress);
+			log_message(LOG_INFO, "%s has a prefix length of 128, setting 
preferred_lft to 0\n",
+				addr_str);
+			FREE(addr_str);
+
+			addattr_l(&req.n, sizeof(req), IFA_CACHEINFO, &cinfo,
+				sizeof(cinfo));
+		}
  		addattr_l(&req.n, sizeof(req), IFA_LOCAL,
  			  &ipaddress->u.sin6_addr, sizeof(ipaddress->u.sin6_addr));
  	} else {

Regards,

Frank
-- 
Frank Baalbergen - System / Network Engineer
T +31 (0)10 2760434 | [email protected] | www.mendix.com

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.