[NETFILTER]: {ip,ip6}t_LOG: print MARK value in log output
authorPatrick McHardy <kaber@trash.net>
Thu, 20 Mar 2008 14:15:45 +0000 (15:15 +0100)
committerPatrick McHardy <kaber@trash.net>
Mon, 14 Apr 2008 07:56:01 +0000 (09:56 +0200)
Dump the mark value in log messages similar to nfnetlink_log. This
is useful for debugging complex setups where marks are used for
routing or traffic classification.

Signed-off-by: Patrick McHardy <kaber@trash.net>
net/ipv4/netfilter/ipt_LOG.c
net/ipv6/netfilter/ip6t_LOG.c

index b38d7850f506999f84691977ea4e6379a92cd34d..c40e233e271b5668af1175f2e45f1c9c40955401 100644 (file)
@@ -338,12 +338,16 @@ static void dump_packet(const struct nf_loginfo *info,
        if ((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 GID=%u",
+                       printk("UID=%u GID=%u ",
                                skb->sk->sk_socket->file->f_uid,
                                skb->sk->sk_socket->file->f_gid);
                read_unlock_bh(&skb->sk->sk_callback_lock);
        }
 
+       /* Max length: 16 "MARK=0xFFFFFFFF " */
+       if (!iphoff && skb->mark)
+               printk("MARK=0x%x ", skb->mark);
+
        /* Proto    Max log string length */
        /* IP:      40+46+6+11+127 = 230 */
        /* TCP:     10+max(25,20+30+13+9+32+11+127) = 252 */
index 86a613810b6993a4699d8e53de1e03ba4e6ed3d5..3a2316974f835b86921fe2b63296992558a9c251 100644 (file)
@@ -363,11 +363,15 @@ static void dump_packet(const struct nf_loginfo *info,
        if ((logflags & IP6T_LOG_UID) && recurse && skb->sk) {
                read_lock_bh(&skb->sk->sk_callback_lock);
                if (skb->sk->sk_socket && skb->sk->sk_socket->file)
-                       printk("UID=%u GID=%u",
+                       printk("UID=%u GID=%u ",
                                skb->sk->sk_socket->file->f_uid,
                                skb->sk->sk_socket->file->f_gid);
                read_unlock_bh(&skb->sk->sk_callback_lock);
        }
+
+       /* Max length: 16 "MARK=0xFFFFFFFF " */
+       if (!recurse && skb->mark)
+               printk("MARK=0x%x ", skb->mark);
 }
 
 static struct nf_loginfo default_loginfo = {