IPv6: fix race between cleanup and add/delete address
[linux-2.6.git] / net / netfilter / ipvs / ip_vs_proto.c
index d7ce4f1..0e58455 100644 (file)
@@ -13,6 +13,9 @@
  *
  */
 
+#define KMSG_COMPONENT "IPVS"
+#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/skbuff.h>
@@ -124,7 +127,8 @@ ip_vs_create_timeout_table(int *table, int size)
  *     Set timeout value for state specified by name
  */
 int
-ip_vs_set_state_timeout(int *table, int num, char **names, char *name, int to)
+ip_vs_set_state_timeout(int *table, int num, const char *const *names,
+                       const char *name, int to)
 {
        int i;
 
@@ -164,29 +168,24 @@ ip_vs_tcpudp_debug_packet_v4(struct ip_vs_protocol *pp,
        if (ih == NULL)
                sprintf(buf, "%s TRUNCATED", pp->name);
        else if (ih->frag_off & htons(IP_OFFSET))
-               sprintf(buf, "%s %u.%u.%u.%u->%u.%u.%u.%u frag",
-                       pp->name, NIPQUAD(ih->saddr),
-                       NIPQUAD(ih->daddr));
+               sprintf(buf, "%s %pI4->%pI4 frag",
+                       pp->name, &ih->saddr, &ih->daddr);
        else {
                __be16 _ports[2], *pptr
 ;
                pptr = skb_header_pointer(skb, offset + ih->ihl*4,
                                          sizeof(_ports), _ports);
                if (pptr == NULL)
-                       sprintf(buf, "%s TRUNCATED %u.%u.%u.%u->%u.%u.%u.%u",
-                               pp->name,
-                               NIPQUAD(ih->saddr),
-                               NIPQUAD(ih->daddr));
+                       sprintf(buf, "%s TRUNCATED %pI4->%pI4",
+                               pp->name, &ih->saddr, &ih->daddr);
                else
-                       sprintf(buf, "%s %u.%u.%u.%u:%u->%u.%u.%u.%u:%u",
+                       sprintf(buf, "%s %pI4:%u->%pI4:%u",
                                pp->name,
-                               NIPQUAD(ih->saddr),
-                               ntohs(pptr[0]),
-                               NIPQUAD(ih->daddr),
-                               ntohs(pptr[1]));
+                               &ih->saddr, ntohs(pptr[0]),
+                               &ih->daddr, ntohs(pptr[1]));
        }
 
-       printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf);
+       pr_debug("%s: %s\n", msg, buf);
 }
 
 #ifdef CONFIG_IP_VS_IPV6
@@ -203,7 +202,7 @@ ip_vs_tcpudp_debug_packet_v6(struct ip_vs_protocol *pp,
        if (ih == NULL)
                sprintf(buf, "%s TRUNCATED", pp->name);
        else if (ih->nexthdr == IPPROTO_FRAGMENT)
-               sprintf(buf, "%s %p6->%p6 frag",
+               sprintf(buf, "%s %pI6->%pI6 frag",
                        pp->name, &ih->saddr, &ih->daddr);
        else {
                __be16 _ports[2], *pptr;
@@ -211,16 +210,16 @@ ip_vs_tcpudp_debug_packet_v6(struct ip_vs_protocol *pp,
                pptr = skb_header_pointer(skb, offset + sizeof(struct ipv6hdr),
                                          sizeof(_ports), _ports);
                if (pptr == NULL)
-                       sprintf(buf, "%s TRUNCATED %p6->%p6",
+                       sprintf(buf, "%s TRUNCATED %pI6->%pI6",
                                pp->name, &ih->saddr, &ih->daddr);
                else
-                       sprintf(buf, "%s %p6:%u->%p6:%u",
+                       sprintf(buf, "%s %pI6:%u->%pI6:%u",
                                pp->name,
                                &ih->saddr, ntohs(pptr[0]),
                                &ih->daddr, ntohs(pptr[1]));
        }
 
-       printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf);
+       pr_debug("%s: %s\n", msg, buf);
 }
 #endif
 
@@ -258,13 +257,16 @@ int __init ip_vs_protocol_init(void)
 #ifdef CONFIG_IP_VS_PROTO_UDP
        REGISTER_PROTOCOL(&ip_vs_protocol_udp);
 #endif
+#ifdef CONFIG_IP_VS_PROTO_SCTP
+       REGISTER_PROTOCOL(&ip_vs_protocol_sctp);
+#endif
 #ifdef CONFIG_IP_VS_PROTO_AH
        REGISTER_PROTOCOL(&ip_vs_protocol_ah);
 #endif
 #ifdef CONFIG_IP_VS_PROTO_ESP
        REGISTER_PROTOCOL(&ip_vs_protocol_esp);
 #endif
-       IP_VS_INFO("Registered protocols (%s)\n", &protocols[2]);
+       pr_info("Registered protocols (%s)\n", &protocols[2]);
 
        return 0;
 }