Varun Chandramohan <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to