[IPV4]: Use NIPQUAD_FMT to format ipv4 addresses.
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Mon, 14 Apr 2008 11:09:00 +0000 (04:09 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Apr 2008 11:09:00 +0000 (04:09 -0700)
And use %u to format port.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 files changed:
net/ipv4/af_inet.c
net/ipv4/arp.c
net/ipv4/fib_trie.c
net/ipv4/icmp.c
net/ipv4/ip_fragment.c
net/ipv4/ip_input.c
net/ipv4/ipcomp.c
net/ipv4/ipconfig.c
net/ipv4/route.c
net/ipv4/tcp_input.c
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_probe.c
net/ipv4/tcp_timer.c
net/ipv4/udp.c

index 72ae8ed5a3d7143342b1a8fd2a9b2ce599671964..f2b5270efdaaa4e056cff85624662fc853e79775 100644 (file)
@@ -1077,7 +1077,7 @@ static int inet_sk_reselect_saddr(struct sock *sk)
 
        if (sysctl_ip_dynaddr > 1) {
                printk(KERN_INFO "%s(): shifting inet->"
-                                "saddr from %d.%d.%d.%d to %d.%d.%d.%d\n",
+                                "saddr from " NIPQUAD_FMT " to " NIPQUAD_FMT "\n",
                       __func__,
                       NIPQUAD(old_saddr),
                       NIPQUAD(new_saddr));
index 3ce2e137e7bc134d6397c278e8994e8804df84be..68b72a7a180606e1e3469e6c6ece800aaab089d7 100644 (file)
@@ -1310,7 +1310,7 @@ static void arp_format_neigh_entry(struct seq_file *seq,
 #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
        }
 #endif
-       sprintf(tbuf, "%u.%u.%u.%u", NIPQUAD(*(u32*)n->primary_key));
+       sprintf(tbuf, NIPQUAD_FMT, NIPQUAD(*(u32*)n->primary_key));
        seq_printf(seq, "%-16s 0x%-10x0x%-10x%s     *        %s\n",
                   tbuf, hatype, arp_state_to_flags(n), hbuffer, dev->name);
        read_unlock(&n->lock);
@@ -1323,7 +1323,7 @@ static void arp_format_pneigh_entry(struct seq_file *seq,
        int hatype = dev ? dev->type : 0;
        char tbuf[16];
 
-       sprintf(tbuf, "%u.%u.%u.%u", NIPQUAD(*(u32*)n->key));
+       sprintf(tbuf, NIPQUAD_FMT, NIPQUAD(*(u32*)n->key));
        seq_printf(seq, "%-16s 0x%-10x0x%-10x%s     *        %s\n",
                   tbuf, hatype, ATF_PUBL | ATF_PERM, "00:00:00:00:00:00",
                   dev ? dev->name : "*");
index 1ada5a6b03ea2b49ba281d5373e397453031d1f2..ea294fffb9cef37c621fec8c9e14485d98475f83 100644 (file)
@@ -2424,7 +2424,7 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v)
                __be32 prf = htonl(mask_pfx(tn->key, tn->pos));
 
                seq_indent(seq, iter->depth-1);
-               seq_printf(seq, "  +-- %d.%d.%d.%d/%d %d %d %d\n",
+               seq_printf(seq, "  +-- " NIPQUAD_FMT "/%d %d %d %d\n",
                           NIPQUAD(prf), tn->pos, tn->bits, tn->full_children,
                           tn->empty_children);
 
@@ -2435,7 +2435,7 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v)
                __be32 val = htonl(l->key);
 
                seq_indent(seq, iter->depth);
-               seq_printf(seq, "  |-- %d.%d.%d.%d\n", NIPQUAD(val));
+               seq_printf(seq, "  |-- " NIPQUAD_FMT "\n", NIPQUAD(val));
 
                hlist_for_each_entry_rcu(li, node, &l->list, hlist) {
                        struct fib_alias *fa;
index 3e14d9cd29b3cb65dab4cbf238bbe90ae58120d5..f064031f2031468c3563e9b1720313e625abc160 100644 (file)
@@ -685,7 +685,7 @@ static void icmp_unreach(struct sk_buff *skb)
                        break;
                case ICMP_FRAG_NEEDED:
                        if (ipv4_config.no_pmtu_disc) {
-                               LIMIT_NETDEBUG(KERN_INFO "ICMP: %u.%u.%u.%u: "
+                               LIMIT_NETDEBUG(KERN_INFO "ICMP: " NIPQUAD_FMT ": "
                                                         "fragmentation needed "
                                                         "and DF set.\n",
                                               NIPQUAD(iph->daddr));
@@ -697,7 +697,7 @@ static void icmp_unreach(struct sk_buff *skb)
                        }
                        break;
                case ICMP_SR_FAILED:
-                       LIMIT_NETDEBUG(KERN_INFO "ICMP: %u.%u.%u.%u: Source "
+                       LIMIT_NETDEBUG(KERN_INFO "ICMP: " NIPQUAD_FMT ": Source "
                                                 "Route Failed.\n",
                                       NIPQUAD(iph->daddr));
                        break;
@@ -730,9 +730,9 @@ static void icmp_unreach(struct sk_buff *skb)
        if (!net->ipv4.sysctl_icmp_ignore_bogus_error_responses &&
            inet_addr_type(net, iph->daddr) == RTN_BROADCAST) {
                if (net_ratelimit())
-                       printk(KERN_WARNING "%u.%u.%u.%u sent an invalid ICMP "
+                       printk(KERN_WARNING NIPQUAD_FMT " sent an invalid ICMP "
                                            "type %u, code %u "
-                                           "error to a broadcast: %u.%u.%u.%u on %s\n",
+                                           "error to a broadcast: " NIPQUAD_FMT " on %s\n",
                               NIPQUAD(ip_hdr(skb)->saddr),
                               icmph->type, icmph->code,
                               NIPQUAD(iph->daddr),
@@ -953,8 +953,8 @@ static void icmp_address_reply(struct sk_buff *skb)
                                break;
                }
                if (!ifa && net_ratelimit()) {
-                       printk(KERN_INFO "Wrong address mask %u.%u.%u.%u from "
-                                        "%s/%u.%u.%u.%u\n",
+                       printk(KERN_INFO "Wrong address mask " NIPQUAD_FMT " from "
+                                        "%s/" NIPQUAD_FMT "\n",
                               NIPQUAD(*mp), dev->name, NIPQUAD(rt->rt_src));
                }
        }
index 02ae470fe60c6c6ddc694220ee4208121fc03b0d..cd6ce6ac635843e4598e5332c32256bb0ff93926 100644 (file)
@@ -557,7 +557,7 @@ out_nomem:
 out_oversize:
        if (net_ratelimit())
                printk(KERN_INFO
-                       "Oversized IP packet from %d.%d.%d.%d.\n",
+                       "Oversized IP packet from " NIPQUAD_FMT ".\n",
                        NIPQUAD(qp->saddr));
 out_fail:
        IP_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
index 4be00959b74893f1846a4ffd08f422836c007587..7b4bad6d572ffe4093b9b4bed126fc02fd274f0b 100644 (file)
@@ -303,7 +303,7 @@ static inline int ip_rcv_options(struct sk_buff *skb)
                                if (IN_DEV_LOG_MARTIANS(in_dev) &&
                                    net_ratelimit())
                                        printk(KERN_INFO "source route option "
-                                              "%u.%u.%u.%u -> %u.%u.%u.%u\n",
+                                              NIPQUAD_FMT " -> " NIPQUAD_FMT "\n",
                                               NIPQUAD(iph->saddr),
                                               NIPQUAD(iph->daddr));
                                in_dev_put(in_dev);
index 58b60b2fb01175fb4c02fb72598619dfb38df716..fb53ddfea5b5b77e09a1a6372ed93aee6fc87209 100644 (file)
@@ -179,7 +179,7 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info)
                              spi, IPPROTO_COMP, AF_INET);
        if (!x)
                return;
-       NETDEBUG(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/%u.%u.%u.%u\n",
+       NETDEBUG(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/" NIPQUAD_FMT "\n",
                 spi, NIPQUAD(iph->daddr));
        xfrm_state_put(x);
 }
index 08e8fb60d3159e4e8543217f621851ed027894a8..0b859d46ea74066aa1a28cc7ee9db646ff26b741 100644 (file)
@@ -376,7 +376,7 @@ static int __init ic_defaults(void)
         */
 
        if (!ic_host_name_set)
-               sprintf(init_utsname()->nodename, "%u.%u.%u.%u", NIPQUAD(ic_myaddr));
+               sprintf(init_utsname()->nodename, NIPQUAD_FMT, NIPQUAD(ic_myaddr));
 
        if (root_server_addr == NONE)
                root_server_addr = ic_servaddr;
@@ -389,11 +389,11 @@ static int __init ic_defaults(void)
                else if (IN_CLASSC(ntohl(ic_myaddr)))
                        ic_netmask = htonl(IN_CLASSC_NET);
                else {
-                       printk(KERN_ERR "IP-Config: Unable to guess netmask for address %u.%u.%u.%u\n",
+                       printk(KERN_ERR "IP-Config: Unable to guess netmask for address " NIPQUAD_FMT "\n",
                                NIPQUAD(ic_myaddr));
                        return -1;
                }
-               printk("IP-Config: Guessing netmask %u.%u.%u.%u\n", NIPQUAD(ic_netmask));
+               printk("IP-Config: Guessing netmask " NIPQUAD_FMT "\n", NIPQUAD(ic_netmask));
        }
 
        return 0;
@@ -981,9 +981,9 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
                                ic_myaddr = b->your_ip;
                                ic_servaddr = server_id;
 #ifdef IPCONFIG_DEBUG
-                               printk("DHCP: Offered address %u.%u.%u.%u",
+                               printk("DHCP: Offered address " NIPQUAD_FMT,
                                       NIPQUAD(ic_myaddr));
-                               printk(" by server %u.%u.%u.%u\n",
+                               printk(" by server " NIPQUAD_FMT "\n",
                                       NIPQUAD(ic_servaddr));
 #endif
                                /* The DHCP indicated server address takes
@@ -1179,11 +1179,11 @@ static int __init ic_dynamic(void)
                return -1;
        }
 
-       printk("IP-Config: Got %s answer from %u.%u.%u.%u, ",
+       printk("IP-Config: Got %s answer from " NIPQUAD_FMT ", ",
                ((ic_got_reply & IC_RARP) ? "RARP"
                 : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"),
                NIPQUAD(ic_servaddr));
-       printk("my address is %u.%u.%u.%u\n", NIPQUAD(ic_myaddr));
+       printk("my address is " NIPQUAD_FMT "\n", NIPQUAD(ic_myaddr));
 
        return 0;
 }
@@ -1209,12 +1209,12 @@ static int pnp_seq_show(struct seq_file *seq, void *v)
        for (i = 0; i < CONF_NAMESERVERS_MAX; i++) {
                if (ic_nameservers[i] != NONE)
                        seq_printf(seq,
-                                  "nameserver %u.%u.%u.%u\n",
+                                  "nameserver " NIPQUAD_FMT "\n",
                                   NIPQUAD(ic_nameservers[i]));
        }
        if (ic_servaddr != NONE)
                seq_printf(seq,
-                          "bootserver %u.%u.%u.%u\n",
+                          "bootserver " NIPQUAD_FMT "\n",
                           NIPQUAD(ic_servaddr));
        return 0;
 }
@@ -1389,13 +1389,13 @@ static int __init ip_auto_config(void)
         */
        printk("IP-Config: Complete:");
        printk("\n     device=%s", ic_dev->name);
-       printk(", addr=%u.%u.%u.%u", NIPQUAD(ic_myaddr));
-       printk(", mask=%u.%u.%u.%u", NIPQUAD(ic_netmask));
-       printk(", gw=%u.%u.%u.%u", NIPQUAD(ic_gateway));
+       printk(", addr=" NIPQUAD_FMT, NIPQUAD(ic_myaddr));
+       printk(", mask=" NIPQUAD_FMT, NIPQUAD(ic_netmask));
+       printk(", gw=" NIPQUAD_FMT, NIPQUAD(ic_gateway));
        printk(",\n     host=%s, domain=%s, nis-domain=%s",
               utsname()->nodename, ic_domain, utsname()->domainname);
-       printk(",\n     bootserver=%u.%u.%u.%u", NIPQUAD(ic_servaddr));
-       printk(", rootserver=%u.%u.%u.%u", NIPQUAD(root_server_addr));
+       printk(",\n     bootserver=" NIPQUAD_FMT, NIPQUAD(ic_servaddr));
+       printk(", rootserver=" NIPQUAD_FMT, NIPQUAD(root_server_addr));
        printk(", rootpath=%s", root_server_path);
        printk("\n");
 #endif /* !SILENT */
index 139799f8a8a125f9113e7fed020c87ac0947f4e8..780e9484c825e96c9994bf7ea2ac8cb96026c400 100644 (file)
@@ -1059,10 +1059,10 @@ restart:
 #if RT_CACHE_DEBUG >= 2
        if (rt->u.dst.rt_next) {
                struct rtable *trt;
-               printk(KERN_DEBUG "rt_cache @%02x: %u.%u.%u.%u", hash,
+               printk(KERN_DEBUG "rt_cache @%02x: " NIPQUAD_FMT, hash,
                       NIPQUAD(rt->rt_dst));
                for (trt = rt->u.dst.rt_next; trt; trt = trt->u.dst.rt_next)
-                       printk(" . %u.%u.%u.%u", NIPQUAD(trt->rt_dst));
+                       printk(" . " NIPQUAD_FMT, NIPQUAD(trt->rt_dst));
                printk("\n");
        }
 #endif
@@ -1275,9 +1275,9 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
 reject_redirect:
 #ifdef CONFIG_IP_ROUTE_VERBOSE
        if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit())
-               printk(KERN_INFO "Redirect from %u.%u.%u.%u on %s about "
-                       "%u.%u.%u.%u ignored.\n"
-                       "  Advised path = %u.%u.%u.%u -> %u.%u.%u.%u\n",
+               printk(KERN_INFO "Redirect from " NIPQUAD_FMT " on %s about "
+                       NIPQUAD_FMT " ignored.\n"
+                       "  Advised path = " NIPQUAD_FMT " -> " NIPQUAD_FMT "\n",
                       NIPQUAD(old_gw), dev->name, NIPQUAD(new_gw),
                       NIPQUAD(saddr), NIPQUAD(daddr));
 #endif
@@ -1299,7 +1299,7 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
                                                rt->fl.oif);
 #if RT_CACHE_DEBUG >= 1
                        printk(KERN_DEBUG "ipv4_negative_advice: redirect to "
-                                         "%u.%u.%u.%u/%02x dropped\n",
+                                         NIPQUAD_FMT "/%02x dropped\n",
                                NIPQUAD(rt->rt_dst), rt->fl.fl4_tos);
 #endif
                        rt_del(hash, rt);
@@ -1364,8 +1364,8 @@ void ip_rt_send_redirect(struct sk_buff *skb)
                if (IN_DEV_LOG_MARTIANS(in_dev) &&
                    rt->u.dst.rate_tokens == ip_rt_redirect_number &&
                    net_ratelimit())
-                       printk(KERN_WARNING "host %u.%u.%u.%u/if%d ignores "
-                               "redirects for %u.%u.%u.%u to %u.%u.%u.%u.\n",
+                       printk(KERN_WARNING "host " NIPQUAD_FMT "/if%d ignores "
+                               "redirects for " NIPQUAD_FMT " to " NIPQUAD_FMT ".\n",
                                NIPQUAD(rt->rt_src), rt->rt_iif,
                                NIPQUAD(rt->rt_dst), NIPQUAD(rt->rt_gateway));
 #endif
@@ -1552,7 +1552,7 @@ static void ipv4_link_failure(struct sk_buff *skb)
 
 static int ip_rt_bug(struct sk_buff *skb)
 {
-       printk(KERN_DEBUG "ip_rt_bug: %u.%u.%u.%u -> %u.%u.%u.%u, %s\n",
+       printk(KERN_DEBUG "ip_rt_bug: " NIPQUAD_FMT " -> " NIPQUAD_FMT ", %s\n",
                NIPQUAD(ip_hdr(skb)->saddr), NIPQUAD(ip_hdr(skb)->daddr),
                skb->dev ? skb->dev->name : "?");
        kfree_skb(skb);
@@ -1730,8 +1730,8 @@ static void ip_handle_martian_source(struct net_device *dev,
                 *      RFC1812 recommendation, if source is martian,
                 *      the only hint is MAC header.
                 */
-               printk(KERN_WARNING "martian source %u.%u.%u.%u from "
-                       "%u.%u.%u.%u, on dev %s\n",
+               printk(KERN_WARNING "martian source " NIPQUAD_FMT " from "
+                       NIPQUAD_FMT", on dev %s\n",
                        NIPQUAD(daddr), NIPQUAD(saddr), dev->name);
                if (dev->hard_header_len && skb_mac_header_was_set(skb)) {
                        int i;
@@ -2040,8 +2040,8 @@ martian_destination:
        RT_CACHE_STAT_INC(in_martian_dst);
 #ifdef CONFIG_IP_ROUTE_VERBOSE
        if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit())
-               printk(KERN_WARNING "martian destination %u.%u.%u.%u from "
-                       "%u.%u.%u.%u, dev %s\n",
+               printk(KERN_WARNING "martian destination " NIPQUAD_FMT " from "
+                       NIPQUAD_FMT ", dev %s\n",
                        NIPQUAD(daddr), NIPQUAD(saddr), dev->name);
 #endif
 
index bd0ee8ca8b21ac0eec9c2183f8513460efff525b..3c6c7d7a7b0abbeaed332d6c7b4aea15d1302ffb 100644 (file)
@@ -2309,7 +2309,7 @@ static void DBGUNDO(struct sock *sk, const char *msg)
        struct tcp_sock *tp = tcp_sk(sk);
        struct inet_sock *inet = inet_sk(sk);
 
-       printk(KERN_DEBUG "Undo %s %u.%u.%u.%u/%u c%u l%u ss%u/%u p%u\n",
+       printk(KERN_DEBUG "Undo %s " NIPQUAD_FMT "/%u c%u l%u ss%u/%u p%u\n",
               msg,
               NIPQUAD(inet->daddr), ntohs(inet->dport),
               tp->snd_cwnd, tcp_left_out(tp),
index 02519730e0d5a129e8e3f752167cfed1ae560f93..776615180b93b3747d0c9207dde73bb8223c9503 100644 (file)
@@ -1369,7 +1369,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
                         * to the moment of synflood.
                         */
                        LIMIT_NETDEBUG(KERN_DEBUG "TCP: drop open "
-                                      "request from %u.%u.%u.%u/%u\n",
+                                      "request from " NIPQUAD_FMT "/%u\n",
                                       NIPQUAD(saddr),
                                       ntohs(tcp_hdr(skb)->source));
                        goto drop_and_release;
index 87dd5bff315fcede15cb1bd88f072a48d4df4ca9..1c509592574a79d6ee53a6104e8cfe6466058a5c 100644 (file)
@@ -153,7 +153,7 @@ static int tcpprobe_sprint(char *tbuf, int n)
                = ktime_to_timespec(ktime_sub(p->tstamp, tcp_probe.start));
 
        return snprintf(tbuf, n,
-                       "%lu.%09lu %d.%d.%d.%d:%u %d.%d.%d.%d:%u"
+                       "%lu.%09lu " NIPQUAD_FMT ":%u " NIPQUAD_FMT ":%u"
                        " %d %#x %#x %u %u %u %u\n",
                        (unsigned long) tv.tv_sec,
                        (unsigned long) tv.tv_nsec,
index 160d16f9f4fcd3c690ad600223d8e8ff3bf49fd5..e588d6dc2a8175480a53a8c186aef62f02ed87d8 100644 (file)
@@ -301,7 +301,7 @@ static void tcp_retransmit_timer(struct sock *sk)
 #ifdef TCP_DEBUG
                if (1) {
                        struct inet_sock *inet = inet_sk(sk);
-                       LIMIT_NETDEBUG(KERN_DEBUG "TCP: Treason uncloaked! Peer %u.%u.%u.%u:%u/%u shrinks window %u:%u. Repaired.\n",
+                       LIMIT_NETDEBUG(KERN_DEBUG "TCP: Treason uncloaked! Peer " NIPQUAD_FMT ":%u/%u shrinks window %u:%u. Repaired.\n",
                               NIPQUAD(inet->daddr), ntohs(inet->dport),
                               inet->num, tp->snd_una, tp->snd_nxt);
                }
index 7b7fcacec4a024fed80b20e5c9f4bbba81d89b34..b053ac795275a56c7a88f89c5b9b748aa81acda3 100644 (file)
@@ -1221,7 +1221,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
        return 0;
 
 short_packet:
-       LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: short packet: From %u.%u.%u.%u:%u %d/%d to %u.%u.%u.%u:%u\n",
+       LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: short packet: From " NIPQUAD_FMT ":%u %d/%d to " NIPQUAD_FMT ":%u\n",
                       proto == IPPROTO_UDPLITE ? "-Lite" : "",
                       NIPQUAD(saddr),
                       ntohs(uh->source),
@@ -1236,7 +1236,7 @@ csum_error:
         * RFC1122: OK.  Discards the bad packet silently (as far as
         * the network is concerned, anyway) as per 4.1.3.4 (MUST).
         */
-       LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: bad checksum. From %d.%d.%d.%d:%d to %d.%d.%d.%d:%d ulen %d\n",
+       LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: bad checksum. From " NIPQUAD_FMT ":%u to " NIPQUAD_FMT ":%u ulen %d\n",
                       proto == IPPROTO_UDPLITE ? "-Lite" : "",
                       NIPQUAD(saddr),
                       ntohs(uh->source),