[IPV6] ROUTE: Use macros to format /proc/net/ipv6_route.
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Fri, 13 Oct 2006 17:00:56 +0000 (02:00 +0900)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:22:05 +0000 (21:22 -0800)
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
net/ipv6/route.c

index e3eab1529633a60b92176d5c05977cdc8958ffc7..c86ee3adddcc86dcad86b81dcef736aecbcc2d0b 100644 (file)
@@ -2246,7 +2246,6 @@ struct rt6_proc_arg
 static int rt6_info_route(struct rt6_info *rt, void *p_arg)
 {
        struct rt6_proc_arg *arg = (struct rt6_proc_arg *) p_arg;
-       int i;
 
        if (arg->skip < arg->offset / RT6_INFO_LEN) {
                arg->skip++;
@@ -2256,38 +2255,28 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg)
        if (arg->len >= arg->length)
                return 0;
 
-       for (i=0; i<16; i++) {
-               sprintf(arg->buffer + arg->len, "%02x",
-                       rt->rt6i_dst.addr.s6_addr[i]);
-               arg->len += 2;
-       }
-       arg->len += sprintf(arg->buffer + arg->len, " %02x ",
+       arg->len += sprintf(arg->buffer + arg->len,
+                           NIP6_SEQFMT " %02x ",
+                           NIP6(rt->rt6i_dst.addr),
                            rt->rt6i_dst.plen);
 
 #ifdef CONFIG_IPV6_SUBTREES
-       for (i=0; i<16; i++) {
-               sprintf(arg->buffer + arg->len, "%02x",
-                       rt->rt6i_src.addr.s6_addr[i]);
-               arg->len += 2;
-       }
-       arg->len += sprintf(arg->buffer + arg->len, " %02x ",
+       arg->len += sprintf(arg->buffer + arg->len,
+                           NIP6_SEQFMT " %02x ",
+                           NIP6(rt->rt6i_src.addr),
                            rt->rt6i_src.plen);
 #else
-       sprintf(arg->buffer + arg->len,
-               "00000000000000000000000000000000 00 ");
-       arg->len += 36;
+       arg->len += sprintf(arg->buffer + arg->len,
+                           "00000000000000000000000000000000 00 ");
 #endif
 
        if (rt->rt6i_nexthop) {
-               for (i=0; i<16; i++) {
-                       sprintf(arg->buffer + arg->len, "%02x",
-                               rt->rt6i_nexthop->primary_key[i]);
-                       arg->len += 2;
-               }
+               arg->len += sprintf(arg->buffer + arg->len,
+                                   NIP6_SEQFMT,
+                                   NIP6(*((struct in6_addr *)rt->rt6i_nexthop->primary_key)));
        } else {
-               sprintf(arg->buffer + arg->len,
-                       "00000000000000000000000000000000");
-               arg->len += 32;
+               arg->len += sprintf(arg->buffer + arg->len,
+                                   "00000000000000000000000000000000");
        }
        arg->len += sprintf(arg->buffer + arg->len,
                            " %08x %08x %08x %08x %8s\n",