[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <OF5159F66B.5A5F01B8-ON6525735D.000FD530-6525735D.0010F45F@in.ibm.com>
Date: Fri, 21 Sep 2007 08:35:11 +0530
From: Krishna Kumar2 <krkumar2@...ibm.com>
To: Varun Chandramohan <varunc@...ux.vnet.ibm.com>
Cc: davem@...emloft.net, kaber@...sh.net, netdev@...r.kernel.org,
shemminger@...ux-foundation.org, socketcan@...tkopp.net,
tgraf@...g.ch, Varun Chandramohan <varuncha@...ibm.com>
Subject: Re: [PATCH 3/3 Rev4] Initialize and fill IPv6 route age
Varun Chandramohan <varunc@...ux.vnet.ibm.com> wrote on 09/20/2007 08:59:03
PM:
> @@ -2123,6 +2131,7 @@ static int rt6_fill_node(struct sk_buff
> {
> struct rtmsg *rtm;
> struct nlmsghdr *nlh;
> + struct timeval tv;
> long expires;
> u32 table;
>
> @@ -2186,6 +2195,11 @@ static int rt6_fill_node(struct sk_buff
> if (ipv6_get_saddr(&rt->u.dst, dst, &saddr_buf) == 0)
> NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf);
> }
> +
> + do_gettimeofday(&tv);
> + if (rt->rt6i_age) {
> + NLA_PUT_U32(skb, RTA_AGE, (tv.tv_sec - rt->rt6i_age));
> + }
Will rt6i_age ever be zero with this new patch? If it can be zero,
the code should really be keeping the "tv" declaration and
do_gettimeofday() inside the "if (rt->rt6i_age)" check.
And from your Patch2/3:
int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
- u32 tb_id, u8 type, u8 scope, __be32 dst, int
dst_len, u8 tos,
+ u32 tb_id, u8 type, u8 scope, __be32 dst, int
dst_len, u8 tos, time_t age,
struct fib_info *fi, unsigned int flags)
{
struct nlmsghdr *nlh;
struct rtmsg *rtm;
+ struct timeval tv;
nlh = nlmsg_put(skb, pid, seq, event, sizeof(*rtm), flags);
if (nlh == NULL)
@@ -985,6 +987,11 @@ int fib_dump_info(struct sk_buff *skb, u
NLA_PUT_U32(skb, RTA_FLOW,
fi->fib_nh[0].nh_tclassid);
#endif
}
+
+ do_gettimeofday(&tv);
+ if (age) {
+ NLA_PUT_U32(skb, RTA_AGE, (tv.tv_sec - age));
+ }
Don't you want to return time the first time (and get zero)? Otherwise
RTA_AGE is not returned to user. Something like:
do_gettimeofday(&tv);
NLA_PUT_U32(skb, RTA_AGE, (tv.tv_sec - age));
Once again, can age ever be zero?
- KK
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists