Probably, the caller should not set RTF_EXPIRES when allocating new one. Instead, set rt6i_expires and RTF_EXPIRES afterwards (as your patch does).
It makes sense.
And, please make your patch so that we can apply it by "patch -p1" at the top directory of the tree; e.g. % diff -u linux-2.6.15.{orig,fix}/net/ipv6/route.c > fix.patch
Here it is. Signed-off-by: [EMAIL PROTECTED] --
--- linux-2.6.15-orig/net/ipv6/ndisc.c 2006-01-03 04:21:10.000000000 +0100 +++ linux-2.6.15/net/ipv6/ndisc.c 2006-01-26 17:51:49.811283931 +0100 @@ -1119,8 +1119,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; --- linux-2.6.15-orig/net/ipv6/route.c 2006-01-03 04:21:10.000000000 +0100 +++ linux-2.6.15/net/ipv6/route.c 2006-01-26 17:51:21.606054467 +0100 @@ -832,7 +832,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 { @@ -954,6 +957,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]); @@ -1307,7 +1313,7 @@ rtmsg.rtmsg_type = RTMSG_NEWROUTE; ipv6_addr_copy(&rtmsg.rtmsg_gateway, gwaddr); rtmsg.rtmsg_metric = 1024; - rtmsg.rtmsg_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT | RTF_UP | RTF_EXPIRES; + rtmsg.rtmsg_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT | RTF_UP; rtmsg.rtmsg_ifindex = dev->ifindex;