[netfilter-cvslog] r3994 - trunk/iptables/extensions

kaber at netfilter.org kaber at netfilter.org
Fri Jun 24 04:15:32 CEST 2005


Author: kaber at netfilter.org
Date: 2005-06-24 04:15:31 +0200 (Fri, 24 Jun 2005)
New Revision: 3994

Modified:
   trunk/iptables/extensions/libip6t_LOG.c
   trunk/iptables/extensions/libip6t_LOG.man
Log:
Add --log-uid support to libip6t_LOG (Patrick McHardy <kaber at trash.net>)


Modified: trunk/iptables/extensions/libip6t_LOG.c
===================================================================
--- trunk/iptables/extensions/libip6t_LOG.c	2005-06-23 09:10:27 UTC (rev 3993)
+++ trunk/iptables/extensions/libip6t_LOG.c	2005-06-24 02:15:31 UTC (rev 3994)
@@ -21,7 +21,8 @@
 " --log-prefix prefix		Prefix log messages with this prefix.\n\n"
 " --log-tcp-sequence		Log TCP sequence numbers.\n\n"
 " --log-tcp-options		Log TCP options.\n\n"
-" --log-ip-options		Log IP options.\n\n",
+" --log-ip-options		Log IP options.\n\n"
+" --log-uid			Log UID owning the local socket.\n\n",
 IPTABLES_VERSION);
 }
 
@@ -31,6 +32,7 @@
 	{ .name = "log-tcp-sequence", .has_arg = 0, .flag = 0, .val = '1' },
 	{ .name = "log-tcp-options",  .has_arg = 0, .flag = 0, .val = '2' },
 	{ .name = "log-ip-options",   .has_arg = 0, .flag = 0, .val = '3' },
+	{ .name = "log-uid",          .has_arg = 0, .flag = 0, .val = '4' },
 	{ .name = 0 }
 };
 
@@ -96,6 +98,7 @@
 #define IP6T_LOG_OPT_TCPSEQ 0x04
 #define IP6T_LOG_OPT_TCPOPT 0x08
 #define IP6T_LOG_OPT_IPOPT 0x10
+#define IP6T_LOG_OPT_UID 0x20
 
 /* Function which parses command options; returns true if it
    ate an option */
@@ -170,6 +173,15 @@
 		*flags |= IP6T_LOG_OPT_IPOPT;
 		break;
 
+	case '4':
+		if (*flags & IP6T_LOG_OPT_UID)
+			exit_error(PARAMETER_PROBLEM,
+				   "Can't specify --log-uid twice");
+
+		loginfo->logflags |= IP6T_LOG_UID;
+		*flags |= IP6T_LOG_OPT_UID;
+		break;
+
 	default:
 		return 0;
 	}
@@ -213,6 +225,8 @@
 			printf("tcp-options ");
 		if (loginfo->logflags & IP6T_LOG_IPOPT)
 			printf("ip-options ");
+		if (loginfo->logflags & IP6T_LOG_UID)
+			printf("uid ");
 		if (loginfo->logflags & ~(IP6T_LOG_MASK))
 			printf("unknown-flags ");
 	}
@@ -240,6 +254,8 @@
 		printf("--log-tcp-options ");
 	if (loginfo->logflags & IP6T_LOG_IPOPT)
 		printf("--log-ip-options ");
+	if (loginfo->logflags & IP6T_LOG_UID)
+		printf("--log-uid ");
 }
 
 static

Modified: trunk/iptables/extensions/libip6t_LOG.man
===================================================================
--- trunk/iptables/extensions/libip6t_LOG.man	2005-06-23 09:10:27 UTC (rev 3993)
+++ trunk/iptables/extensions/libip6t_LOG.man	2005-06-24 02:15:31 UTC (rev 3994)
@@ -26,3 +26,6 @@
 .TP
 .B --log-ip-options
 Log options from the IPv6 packet header.
+.TP
+.B --log-uid
+Log the userid of the process which generated the packet.




More information about the netfilter-cvslog mailing list