diff -ur ipvs-1.0.6/ipvs/ip_vs_core.c ipvs-1.0.6-debug/ipvs/ip_vs_core.c --- ipvs-1.0.6/ipvs/ip_vs_core.c Sat Aug 10 04:32:35 2002 +++ ipvs-1.0.6-debug/ipvs/ip_vs_core.c Wed Oct 2 01:55:03 2002 @@ -83,6 +83,65 @@ } } +static void ip_vs_debug_packet(struct sk_buff *skb, char *msg) +{ + struct iphdr *iph = skb->nh.iph; + int len = skb->len; + union ip_vs_tphdr h; + u16 s1, s2; + + /* Many printk not good on SMP */ + printk("%s:", msg); + +loop: + if (len - sizeof(struct iphdr) < 0) goto end; + printk(" len=%d, IP(%u.%u.%u.%u->%u.%u.%u.%u, ihl=%d)", + len, NIPQUAD(iph->saddr), NIPQUAD(iph->daddr), iph->ihl); + + h.raw = (char *) iph + iph->ihl*4; + len -= iph->ihl * 4; + + switch (iph->protocol) { + case IPPROTO_TCP: + if (len - 4 < 0) goto end; + s1 = h.portp[0]; + s2 = h.portp[1]; + if (len - sizeof(struct tcphdr) < 0) + printk(" %s(%u->%u,XXX)", + ip_vs_proto_name(iph->protocol), + ntohs(s1), ntohs(s2)); + else + printk(" %s(%u->%u, doff=%d, %s%s%s%s)", + ip_vs_proto_name(iph->protocol), + ntohs(s1), ntohs(s2), h.th->doff, + h.th->syn? "S":"s", + h.th->ack? "A":"a", + h.th->fin? "F":"f", + h.th->rst? "R":"r"); + break; + case IPPROTO_UDP: + if (len - 4 < 0) goto end; + s1 = h.portp[0]; + s2 = h.portp[1]; + printk(" %s(%u->%u)", ip_vs_proto_name(iph->protocol), + ntohs(s1), ntohs(s2)); + break; + case IPPROTO_ICMP: + if (len - 2 < 0) goto end; + printk(" %s(t=%u,c=%u)", ip_vs_proto_name(iph->protocol), + h.icmph->type, h.icmph->code); + len -= sizeof(struct icmphdr); + iph = (struct iphdr *) (h.raw + sizeof(struct icmphdr)); + goto loop; + default: + printk(" proto %u", iph->protocol); + break; + } + +end: + printk("\n"); +} + static inline void ip_vs_in_stats(struct ip_vs_conn *cp, struct sk_buff *skb) @@ -908,8 +967,10 @@ /* Ensure the checksum is correct */ if (ip_compute_csum((unsigned char *) icmph, len)) { /* Failed checksum! */ - IP_VS_ERR_RL("incoming ICMP: failed checksum from " - "%d.%d.%d.%d!\n", NIPQUAD(iph->saddr)); + if (net_ratelimit()) { + ip_vs_debug_packet(skb, KERN_ERR + "IPVS: incoming ICMP: failed checksum"); + } return NF_DROP; }