vserver 1.9.5.x5
[linux-2.6.git] / net / ipv4 / netfilter / ipt_LOG.c
index 2a3e3eb..3713b5b 100644 (file)
@@ -38,7 +38,7 @@ MODULE_PARM_DESC(nflog, "register as internal netfilter logging module");
 #endif
 
 /* Use lock to serialize, so printks don't overlap */
-static spinlock_t log_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(log_lock);
 
 /* One level of recursion won't kill us */
 static void dump_packet(const struct ipt_log_info *info,
@@ -327,6 +327,14 @@ static void dump_packet(const struct ipt_log_info *info,
                printk("PROTO=%u ", ih->protocol);
        }
 
+       /* Max length: 15 "UID=4294967295 " */
+       if ((info->logflags & IPT_LOG_UID) && !iphoff && skb->sk) {
+               read_lock_bh(&skb->sk->sk_callback_lock);
+               if (skb->sk->sk_socket && skb->sk->sk_socket->file)
+                       printk("UID=%u ", skb->sk->sk_socket->file->f_uid);
+               read_unlock_bh(&skb->sk->sk_callback_lock);
+       }
+
        /* Proto    Max log string length */
        /* IP:      40+46+6+11+127 = 230 */
        /* TCP:     10+max(25,20+30+13+9+32+11+127) = 252 */