vserver 1.9.3
[linux-2.6.git] / net / core / netfilter.c
index 3aabe12..91b3bb2 100644 (file)
@@ -286,7 +286,7 @@ void nf_debug_ip_finish_output2(struct sk_buff *skb)
 
 /* Call get/setsockopt() */
 static int nf_sockopt(struct sock *sk, int pf, int val, 
-                     char *opt, int *len, int get)
+                     char __user *opt, int *len, int get)
 {
        struct list_head *i;
        struct nf_sockopt_ops *ops;
@@ -329,13 +329,13 @@ static int nf_sockopt(struct sock *sk, int pf, int val,
        return ret;
 }
 
-int nf_setsockopt(struct sock *sk, int pf, int val, char *opt,
+int nf_setsockopt(struct sock *sk, int pf, int val, char __user *opt,
                  int len)
 {
        return nf_sockopt(sk, pf, val, opt, &len, 0);
 }
 
-int nf_getsockopt(struct sock *sk, int pf, int val, char *opt, int *len)
+int nf_getsockopt(struct sock *sk, int pf, int val, char __user *opt, int *len)
 {
        return nf_sockopt(sk, pf, val, opt, len, 1);
 }
@@ -504,14 +504,6 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
        unsigned int verdict;
        int ret = 0;
 
-       if (skb->ip_summed == CHECKSUM_HW) {
-               if (outdev == NULL) {
-                       skb->ip_summed = CHECKSUM_NONE;
-               } else {
-                       skb_checksum_help(skb);
-               }
-       }
-
        /* We may already have this, but read-locks nest anyway */
        rcu_read_lock();
 
@@ -703,11 +695,12 @@ int skb_ip_make_writable(struct sk_buff **pskb, unsigned int writable_len)
        /* DaveM says protocol headers are also modifiable. */
        switch ((*pskb)->nh.iph->protocol) {
        case IPPROTO_TCP: {
-               struct tcphdr hdr;
-               if (skb_copy_bits(*pskb, (*pskb)->nh.iph->ihl*4,
-                                 &hdr, sizeof(hdr)) != 0)
+               struct tcphdr _hdr, *hp;
+               hp = skb_header_pointer(*pskb, (*pskb)->nh.iph->ihl*4,
+                                       sizeof(_hdr), &_hdr);
+               if (hp == NULL)
                        goto copy_skb;
-               if (writable_len <= (*pskb)->nh.iph->ihl*4 + hdr.doff*4)
+               if (writable_len <= (*pskb)->nh.iph->ihl*4 + hp->doff*4)
                        goto pull_skb;
                goto copy_skb;
        }
@@ -791,13 +784,12 @@ void nf_log_packet(int pf,
        nf_logfn *logfn;
        
        rcu_read_lock();
-       logfn = nf_logging[pf];
+       logfn = rcu_dereference(nf_logging[pf]);
        if (logfn) {
                va_start(args, fmt);
                vsnprintf(prefix, sizeof(prefix), fmt, args);
                va_end(args);
                /* We must read logging before nf_logfn[pf] */
-               smp_read_barrier_depends();
                logfn(hooknum, skb, in, out, prefix);
        } else if (!reported) {
                printk(KERN_WARNING "nf_log_packet: can\'t log yet, "
@@ -814,7 +806,7 @@ EXPORT_SYMBOL(nf_log_packet);
    tracking in use: without this, connection may not be in hash table,
    and hence manufactured ICMP or RST packets will not be associated
    with it. */
-void (*ip_ct_attach)(struct sk_buff *, struct nf_ct_info *);
+void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *);
 
 void __init netfilter_init(void)
 {