]> Pileus Git - ~andy/linux/blobdiff - net/ipv4/netfilter/ipt_LOG.c
[NETFILTER]: annotate xtables targets with const and remove casts
[~andy/linux] / net / ipv4 / netfilter / ipt_LOG.c
index f8c613a6eb04e47fc06a343d9b162b2ce380ec91..0af14137137b6c836263ee386b234a60e02e4585 100644 (file)
 #include <linux/netfilter.h>
 #include <linux/netfilter/x_tables.h>
 #include <linux/netfilter_ipv4/ipt_LOG.h>
+#include <net/netfilter/nf_log.h>
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
-MODULE_DESCRIPTION("iptables syslog logging module");
+MODULE_DESCRIPTION("Xtables: IPv4 packet logging to syslog");
 
 /* Use lock to serialize, so printks don't overlap */
 static DEFINE_SPINLOCK(log_lock);
@@ -75,7 +76,8 @@ static void dump_packet(const struct nf_loginfo *info,
 
        if ((logflags & IPT_LOG_IPOPT)
            && ih->ihl * 4 > sizeof(struct iphdr)) {
-               unsigned char _opt[4 * 15 - sizeof(struct iphdr)], *op;
+               const unsigned char *op;
+               unsigned char _opt[4 * 15 - sizeof(struct iphdr)];
                unsigned int i, optsize;
 
                optsize = ih->ihl * 4 - sizeof(struct iphdr);
@@ -337,12 +339,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 */
@@ -464,7 +470,7 @@ static struct xt_target log_tg_reg __read_mostly = {
        .me             = THIS_MODULE,
 };
 
-static struct nf_logger ipt_log_logger ={
+static const struct nf_logger ipt_log_logger ={
        .name           = "ipt_LOG",
        .logfn          = &ipt_log_packet,
        .me             = THIS_MODULE,