When adding a route, expiration attribute may be 0. In my understanding,
it means the route never expires and rt6i_expires should be 0, and not
the current time. If right, attached patch should fix the issue.
Well, please drop RTF_EXPIRES also. Thanks.
Following patch drops this flag. As you can see, it requires to set the
flag back to RTF_EXPIRES in ndisc_router_discovery(), because
rt6_add_dflt_router() asks a new route with RTF_EXPIRES flag set and
rtmsg_info = 0.
The issue is ndisc_router_discovery() sets itself rt6i_expires itself
with the router lifetime found in RA.
A better fix could be to pass the lifetime in nb HZ to
rt6_add_dflt_router(), what do you think ?
Regards,
Jean-Mickael
Signed-off-by: [EMAIL PROTECTED]
--- route.c.orig Wed Jan 25 16:12:52 2006
+++ route.c Thu Jan 26 15:49:23 2006
@@ -948,7 +948,10 @@
}
rt->u.dst.obsolete = -1;
- rt->rt6i_expires = jiffies + clock_t_to_jiffies(rtmsg->rtmsg_info);
+ if (rtmsg->rtmsg_info == 0)
+ rt->rt6i_expires = 0;
+ else
+ rt->rt6i_expires = jiffies +
clock_t_to_jiffies(rtmsg->rtmsg_info);
if (nlh && (r = NLMSG_DATA(nlh))) {
rt->rt6i_protocol = r->rtm_protocol;
} else {
@@ -1070,6 +1073,9 @@
rt->rt6i_flags = rtmsg->rtmsg_flags;
install_route:
+ if (rt->rt6i_expires == 0)
+ rt->rt6i_flags &= ~RTF_EXPIRES;
+
if (rta && rta[RTA_METRICS-1]) {
int attrlen = RTA_PAYLOAD(rta[RTA_METRICS-1]);
struct rtattr *attr = RTA_DATA(rta[RTA_METRICS-1]);
--- ndisc.c.orig Thu Jan 26 16:29:03 2006
+++ ndisc.c Thu Jan 26 16:29:40 2006
@@ -1151,8 +1151,10 @@
neigh->flags |= NTF_ROUTER;
}
- if (rt)
+ if (rt) {
rt->rt6i_expires = jiffies + (HZ * lifetime);
+ rt->rt6i_flags |= RTF_EXPIRES;
+ }
if (ra_msg->icmph.icmp6_hop_limit) {
in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit;