All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6 3/6]: Add --log-uid option to ipt_LOG/ip6t_LOG
@ 2005-01-11 12:49 Patrick McHardy
  0 siblings, 0 replies; only message in thread
From: Patrick McHardy @ 2005-01-11 12:49 UTC (permalink / raw)
  To: David S. Miller; +Cc: Netfilter Development Mailinglist

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 03.diff --]
[-- Type: text/x-patch, Size: 3561 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/01/11 03:43:46+01:00 kaber@coreworks.de 
#   [NETFILTER]: Add --log-uid option to ipt_LOG/ip6t_LOG
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/ipv6/netfilter/ip6t_LOG.c
#   2005/01/11 03:43:38+01:00 kaber@coreworks.de +8 -0
#   [NETFILTER]: Add --log-uid option to ipt_LOG/ip6t_LOG
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/ipv4/netfilter/ipt_LOG.c
#   2005/01/11 03:43:38+01:00 kaber@coreworks.de +8 -0
#   [NETFILTER]: Add --log-uid option to ipt_LOG/ip6t_LOG
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# include/linux/netfilter_ipv6/ip6t_LOG.h
#   2005/01/11 03:43:38+01:00 kaber@coreworks.de +2 -1
#   [NETFILTER]: Add --log-uid option to ipt_LOG/ip6t_LOG
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# include/linux/netfilter_ipv4/ipt_LOG.h
#   2005/01/11 03:43:38+01:00 kaber@coreworks.de +2 -1
#   [NETFILTER]: Add --log-uid option to ipt_LOG/ip6t_LOG
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
diff -Nru a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/linux/netfilter_ipv4/ipt_LOG.h
--- a/include/linux/netfilter_ipv4/ipt_LOG.h	2005-01-11 13:39:48 +01:00
+++ b/include/linux/netfilter_ipv4/ipt_LOG.h	2005-01-11 13:39:48 +01:00
@@ -4,7 +4,8 @@
 #define IPT_LOG_TCPSEQ		0x01	/* Log TCP sequence numbers */
 #define IPT_LOG_TCPOPT		0x02	/* Log TCP options */
 #define IPT_LOG_IPOPT		0x04	/* Log IP options */
-#define IPT_LOG_MASK		0x07
+#define IPT_LOG_UID		0x08	/* Log UID owning local socket */
+#define IPT_LOG_MASK		0x0f
 
 struct ipt_log_info {
 	unsigned char level;
diff -Nru a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/linux/netfilter_ipv6/ip6t_LOG.h
--- a/include/linux/netfilter_ipv6/ip6t_LOG.h	2005-01-11 13:39:48 +01:00
+++ b/include/linux/netfilter_ipv6/ip6t_LOG.h	2005-01-11 13:39:48 +01:00
@@ -4,7 +4,8 @@
 #define IP6T_LOG_TCPSEQ		0x01	/* Log TCP sequence numbers */
 #define IP6T_LOG_TCPOPT		0x02	/* Log TCP options */
 #define IP6T_LOG_IPOPT		0x04	/* Log IP options */
-#define IP6T_LOG_MASK		0x07
+#define IP6T_LOG_UID		0x08	/* Log UID owning local socket */
+#define IP6T_LOG_MASK		0x0f
 
 struct ip6t_log_info {
 	unsigned char level;
diff -Nru a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c
--- a/net/ipv4/netfilter/ipt_LOG.c	2005-01-11 13:39:48 +01:00
+++ b/net/ipv4/netfilter/ipt_LOG.c	2005-01-11 13:39:48 +01:00
@@ -327,6 +327,14 @@
 		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 */
diff -Nru a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c
--- a/net/ipv6/netfilter/ip6t_LOG.c	2005-01-11 13:39:48 +01:00
+++ b/net/ipv6/netfilter/ip6t_LOG.c	2005-01-11 13:39:48 +01:00
@@ -347,6 +347,14 @@
 	default:
 		printk("PROTO=%u ", currenthdr);
 	}
+
+	/* Max length: 15 "UID=4294967295 " */
+	if ((info->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 ", skb->sk->sk_socket->file->f_uid);
+		read_unlock_bh(&skb->sk->sk_callback_lock);
+	}
 }
 
 static void

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-01-11 12:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-11 12:49 [PATCH 2.6 3/6]: Add --log-uid option to ipt_LOG/ip6t_LOG Patrick McHardy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.