Merge git://oss.sgi.com:8090/xfs/xfs-2.6
[linux-drm-fsl-dcu.git] / net / ipv4 / netfilter / ip_conntrack_proto_udp.c
index 70899868783bc1d7366037f3ff240dce8befb9b6..a99a7c75e5b5cd58745e5a68040503ce248bbc50 100644 (file)
@@ -18,8 +18,8 @@
 #include <linux/netfilter_ipv4.h>
 #include <linux/netfilter_ipv4/ip_conntrack_protocol.h>
 
-unsigned int ip_ct_udp_timeout = 30*HZ;
-unsigned int ip_ct_udp_timeout_stream = 180*HZ;
+unsigned int ip_ct_udp_timeout __read_mostly = 30*HZ;
+unsigned int ip_ct_udp_timeout_stream __read_mostly = 180*HZ;
 
 static int udp_pkt_to_tuple(const struct sk_buff *skb,
                             unsigned int dataoff,
@@ -70,7 +70,7 @@ static int udp_packet(struct ip_conntrack *conntrack,
        /* If we've seen traffic both ways, this is some kind of UDP
           stream.  Extend timeout. */
        if (test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)) {
-               ip_ct_refresh_acct(conntrack, ctinfo, skb, 
+               ip_ct_refresh_acct(conntrack, ctinfo, skb,
                                   ip_ct_udp_timeout_stream);
                /* Also, more likely to be important, and not a probe */
                if (!test_and_set_bit(IPS_ASSURED_BIT, &conntrack->status))
@@ -102,7 +102,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
                                  "ip_ct_udp: short packet ");
                return -NF_ACCEPT;
        }
-       
+
        /* Truncated/malformed packets */
        if (ntohs(hdr->len) > udplen || ntohs(hdr->len) < sizeof(*hdr)) {
                if (LOG_INVALID(IPPROTO_UDP))
@@ -110,24 +110,23 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
                                  "ip_ct_udp: truncated/malformed packet ");
                return -NF_ACCEPT;
        }
-       
+
        /* Packet with no checksum */
        if (!hdr->check)
                return NF_ACCEPT;
 
        /* Checksum invalid? Ignore.
         * We skip checking packets on the outgoing path
-        * because the semantic of CHECKSUM_HW is different there 
-        * and moreover root might send raw packets.
+        * because the checksum is assumed to be correct.
         * FIXME: Source route IP option packets --RR */
-       if (hooknum == NF_IP_PRE_ROUTING &&
+       if (ip_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING &&
            nf_ip_checksum(skb, hooknum, iph->ihl * 4, IPPROTO_UDP)) {
                if (LOG_INVALID(IPPROTO_UDP))
                        nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL,
                                  "ip_ct_udp: bad UDP checksum ");
                return -NF_ACCEPT;
        }
-       
+
        return NF_ACCEPT;
 }