X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fipv4%2Fipvs%2Fip_vs_proto.c;h=253c46252bd5b1dfeae6382c94a2eaf7340278ae;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=caf24e3754c6ff025306cf7c8812a8d02288fee5;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/net/ipv4/ipvs/ip_vs_proto.c b/net/ipv4/ipvs/ip_vs_proto.c index caf24e375..253c46252 100644 --- a/net/ipv4/ipvs/ip_vs_proto.c +++ b/net/ipv4/ipvs/ip_vs_proto.c @@ -45,7 +45,7 @@ static struct ip_vs_protocol *ip_vs_proto_table[IP_VS_PROTO_TAB_SIZE]; /* * register an ipvs protocol */ -int register_ip_vs_protocol(struct ip_vs_protocol *pp) +static int register_ip_vs_protocol(struct ip_vs_protocol *pp) { unsigned hash = IP_VS_PROTO_HASH(pp->protocol); @@ -62,7 +62,7 @@ int register_ip_vs_protocol(struct ip_vs_protocol *pp) /* * unregister an ipvs protocol */ -int unregister_ip_vs_protocol(struct ip_vs_protocol *pp) +static int unregister_ip_vs_protocol(struct ip_vs_protocol *pp) { struct ip_vs_protocol **pp_p; unsigned hash = IP_VS_PROTO_HASH(pp->protocol); @@ -166,27 +166,33 @@ ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp, const char *msg) { char buf[128]; - __u16 ports[2]; - struct iphdr iph; + struct iphdr _iph, *ih; - if (skb_copy_bits(skb, offset, &iph, sizeof(iph)) < 0) + ih = skb_header_pointer(skb, offset, sizeof(_iph), &_iph); + if (ih == NULL) sprintf(buf, "%s TRUNCATED", pp->name); - else if (iph.frag_off & __constant_htons(IP_OFFSET)) + else if (ih->frag_off & __constant_htons(IP_OFFSET)) sprintf(buf, "%s %u.%u.%u.%u->%u.%u.%u.%u frag", - pp->name, NIPQUAD(iph.saddr), - NIPQUAD(iph.daddr)); - else if (skb_copy_bits(skb, offset + iph.ihl*4, ports, sizeof(ports)) < 0) - sprintf(buf, "%s TRUNCATED %u.%u.%u.%u->%u.%u.%u.%u", - pp->name, - NIPQUAD(iph.saddr), - NIPQUAD(iph.daddr)); - else - sprintf(buf, "%s %u.%u.%u.%u:%u->%u.%u.%u.%u:%u", - pp->name, - NIPQUAD(iph.saddr), - ntohs(ports[0]), - NIPQUAD(iph.daddr), - ntohs(ports[1])); + pp->name, NIPQUAD(ih->saddr), + NIPQUAD(ih->daddr)); + else { + __u16 _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)); + else + sprintf(buf, "%s %u.%u.%u.%u:%u->%u.%u.%u.%u:%u", + pp->name, + NIPQUAD(ih->saddr), + ntohs(pptr[0]), + NIPQUAD(ih->daddr), + ntohs(pptr[1])); + } printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); }