[radvd-devel-l] DecrementLifetimes option

Mark Smith radvd at 02a76c927861ca7413a122f2a73a0d37.nosense.org
Tue Apr 12 17:57:41 EDT 2011


Hi Reuben,

On Wed, 6 Apr 2011 21:46:29 +0930
Mark Smith <radvd at 02a76c927861ca7413a122f2a73a0d37.nosense.org> wrote:

> Hi Reuben,
> 
> On Mon, 4 Apr 2011 07:30:16 -0700
> Reuben Hawkins <reubenhwk at gmail.com> wrote:
> 
> > 
> > 
> > Hi Mark,
> > 
> > It looks like everything is working.  I applied the patch.  If you would
> > like to submit another patch with a some logging, I'll apply it too.
> 
> Happy to do that.
> 
<snip>

Here's what I've come up with.

The debug message for when a prefix will cease being advertised is -

[Apr 13 07:20:17] radvd: Will cease advertising 2001:db8::/64%dummy0,
preferred lifetime is 0

While the debug messages for when the prefix lifetimes is reset is -

[Apr 13 07:23:58] radvd: Resetting prefix lifetimes
[Apr 13 07:23:58] radvd: 2001:db8::/64%dummy0 plft reset from 0 to 10
secs
[Apr 13 07:23:58] radvd: 2001:db8::/64%dummy0 vlft reset from 14385 to
14400 secs

Patch shown below and attached. This should apply to cvs update 1.117

Regards,
Mark.


diff --git a/radvd.c b/radvd.c
index 3485c5a..3d8ece7 100644
--- a/radvd.c
+++ b/radvd.c
@@ -685,6 +685,7 @@ void reset_prefix_lifetimes(void)
 {
 	struct Interface *iface;
 	struct AdvPrefix *prefix;
+	char pfx_str[INET6_ADDRSTRLEN];
 
 
 	flog(LOG_INFO, "Resetting prefix lifetimes\n");
@@ -696,6 +697,9 @@ void reset_prefix_lifetimes(void)
 		{
 			if (prefix->DecrementLifetimesFlag)
 			{
+				print_addr(&prefix->Prefix, pfx_str);
+				dlog(LOG_DEBUG, 4, "%s/%u%%%s plft reset from %u to %u secs", pfx_str, prefix->PrefixLen, iface->Name, prefix->curr_preferredlft, prefix->AdvPreferredLifetime);
+				dlog(LOG_DEBUG, 4, "%s/%u%%%s vlft reset from %u to %u secs", pfx_str, prefix->PrefixLen, iface->Name, prefix->curr_validlft, prefix->AdvValidLifetime);
 				prefix->curr_validlft =
 						prefix->AdvValidLifetime;
 				prefix->curr_preferredlft =
diff --git a/send.c b/send.c
index 6d12ff6..d1ecc83 100644
--- a/send.c
+++ b/send.c
@@ -100,6 +100,16 @@ static void decrement_lifetime(const time_t secs, uint32_t *lifetime)
 	}
 }
 
+static void cease_adv_pfx_msg(const char *if_name, struct in6_addr *pfx, const int pfx_len)
+{
+	char pfx_str[INET6_ADDRSTRLEN];
+
+	print_addr(pfx, pfx_str);
+
+	dlog(LOG_DEBUG, 3, "Will cease advertising %s/%u%%%s, preferred lifetime 0", pfx_str, pfx_len, if_name);
+
+}
+
 int
 send_ra(struct Interface *iface, struct in6_addr *dest)
 {
@@ -239,6 +249,8 @@ send_ra(struct Interface *iface, struct in6_addr *dest)
 					
 					decrement_lifetime(secs_since_last_ra,
 								&prefix->curr_preferredlft);
+					if (prefix->curr_preferredlft == 0)
+						cease_adv_pfx_msg(iface->Name, &prefix->Prefix, prefix->PrefixLen);
 				}
 				pinfo->nd_opt_pi_valid_time	= htonl(prefix->curr_validlft);
 				pinfo->nd_opt_pi_preferred_time = htonl(prefix->curr_preferredlft);








-------------- next part --------------
A non-text attachment was scrubbed...
Name: decrementlft.log.patch
Type: text/x-patch
Size: 1810 bytes
Desc: not available
URL: <http://lists.litech.org/pipermail/radvd-devel-l/attachments/20110413/3ee15dd1/attachment.bin>


More information about the radvd-devel-l mailing list