]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Add --log-uid support to libip6t_LOG (Patrick McHardy <kaber@trash.net>)
authorPatrick McHardy <kaber@trash.net>
Fri, 24 Jun 2005 02:15:31 +0000 (02:15 +0000)
committerPatrick McHardy <kaber@trash.net>
Fri, 24 Jun 2005 02:15:31 +0000 (02:15 +0000)
extensions/libip6t_LOG.c
extensions/libip6t_LOG.man

index 7ca58e55ba4c72f108305e3e4ef0c6d7a14a6c43..5386057386637e4c7f07837de626d542fec54c41 100644 (file)
@@ -21,7 +21,8 @@ help(void)
 " --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 @@ static struct option opts[] = {
        { .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 @@ parse_level(const char *level)
 #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 @@ parse(int c, char **argv, int invert, unsigned int *flags,
                *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 @@ print(const struct ip6t_ip6 *ip,
                        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 @@ save(const struct ip6t_ip6 *ip, const struct ip6t_entry_target *target)
                printf("--log-tcp-options ");
        if (loginfo->logflags & IP6T_LOG_IPOPT)
                printf("--log-ip-options ");
+       if (loginfo->logflags & IP6T_LOG_UID)
+               printf("--log-uid ");
 }
 
 static
index 9eb5a6abf7dcb530c367a06415876908a84b1547..9d51fd410486e77dbd79f41276990b26cb04f071 100644 (file)
@@ -26,3 +26,6 @@ Log options from the TCP packet header.
 .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.