extensions: libipt_LOG/libip6t_LOG: support macdecode option

Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/extensions/libipt_LOG.c b/extensions/libipt_LOG.c
index 9afb91d..73c8f32 100644
--- a/extensions/libipt_LOG.c
+++ b/extensions/libipt_LOG.c
@@ -25,7 +25,8 @@
 " --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-uid			Log UID owning the local socket.\n\n");
+" --log-uid			Log UID owning the local socket.\n\n"
+" --log-macdecode		Decode MAC addresses and protocol.\n\n");
 }
 
 static const struct option LOG_opts[] = {
@@ -35,6 +36,7 @@
 	{ .name = "log-tcp-options",  .has_arg = 0, .val = '2' },
 	{ .name = "log-ip-options",   .has_arg = 0, .val = '3' },
 	{ .name = "log-uid",          .has_arg = 0, .val = '4' },
+	{ .name = "log-macdecode",    .has_arg = 0, .val = '5' },
 	{ .name = NULL }
 };
 
@@ -96,6 +98,7 @@
 #define IPT_LOG_OPT_TCPOPT 0x08
 #define IPT_LOG_OPT_IPOPT 0x10
 #define IPT_LOG_OPT_UID 0x20
+#define IPT_LOG_OPT_MACDECODE 0x40
 
 static int LOG_parse(int c, char **argv, int invert, unsigned int *flags,
                      const void *entry, struct xt_entry_target **target)
@@ -179,6 +182,14 @@
 		*flags |= IPT_LOG_OPT_UID;
 		break;
 
+	case '5':
+		if (*flags & IPT_LOG_OPT_MACDECODE)
+			xtables_error(PARAMETER_PROBLEM,
+				      "Can't specifiy --log-macdecode twice");
+
+		loginfo->logflags |= IPT_LOG_MACDECODE;
+		*flags |= IPT_LOG_OPT_MACDECODE;
+		break;
 	default:
 		return 0;
 	}
@@ -213,6 +224,8 @@
 			printf("ip-options ");
 		if (loginfo->logflags & IPT_LOG_UID)
 			printf("uid ");
+		if (loginfo->logflags & IPT_LOG_MACDECODE)
+			printf("macdecode ");
 		if (loginfo->logflags & ~(IPT_LOG_MASK))
 			printf("unknown-flags ");
 	}
@@ -242,6 +255,8 @@
 		printf("--log-ip-options ");
 	if (loginfo->logflags & IPT_LOG_UID)
 		printf("--log-uid ");
+	if (loginfo->logflags & IPT_LOG_MACDECODE)
+		printf("--log-macdecode ");
 }
 
 static struct xtables_target log_tg_reg = {