Merge changes from topic "b183485987" am: 90c8570e0b am: 74515b357f

Original change: https://android-review.googlesource.com/c/platform/external/iptables/+/1650938

Change-Id: Ib1ab493361b810c33224ab364a9756397f1210bf
diff --git a/extensions/libxt_IDLETIMER.c b/extensions/libxt_IDLETIMER.c
index 216b625..c414801 100644
--- a/extensions/libxt_IDLETIMER.c
+++ b/extensions/libxt_IDLETIMER.c
@@ -28,6 +28,7 @@
 	O_TIMEOUT = 0,
 	O_LABEL,
 	O_ALARM,
+	O_NETLINK,
 };
 
 #define s struct idletimer_tg_info
@@ -47,6 +48,7 @@
 	{.name = "label", .id = O_LABEL, .type = XTTYPE_STRING,
 	 .flags = XTOPT_MAND | XTOPT_PUT, XTOPT_POINTER(s, label)},
 	{.name = "alarm", .id = O_ALARM, .type = XTTYPE_NONE},
+	{.name = "send_nl_msg", .id = O_NETLINK, .type = XTTYPE_NONE},
 	XTOPT_TABLEEND,
 };
 #undef s
@@ -67,6 +69,7 @@
 " --timeout time	Timeout until the notification is sent (in seconds)\n"
 " --label string	Unique rule identifier\n"
 " --alarm	Use alarm instead of default timer\n"
+" --send_nl_msg		Enable netlink messages and show remaining time in sysfs.\n"
 "\n");
 }
 
@@ -92,6 +95,8 @@
 	printf(" label:%s", info->label);
 	if (info->timer_type == XT_IDLETIMER_ALARM)
 		printf(" alarm");
+	if (info->send_nl_msg)
+		printf(" send_nl_msg");
 }
 
 
@@ -115,6 +120,8 @@
 	printf(" --label %s", info->label);
 	if (info->timer_type == XT_IDLETIMER_ALARM)
 		printf(" --alarm");
+	if (info->send_nl_msg)
+		printf(" --send_nl_msg");
 }
 
 static void idletimer_tg_parse_v1(struct xt_option_call *cb)
@@ -124,6 +131,8 @@
 	xtables_option_parse(cb);
 	if (cb->entry->id == O_ALARM)
 		info->timer_type = XT_IDLETIMER_ALARM;
+	if (cb->entry->id == O_NETLINK)
+		info->send_nl_msg = 1;
 }
 
 static struct xtables_target idletimer_tg_reg[] = {
diff --git a/extensions/libxt_IDLETIMER.man b/extensions/libxt_IDLETIMER.man
index e3c91ce..bd4add9 100644
--- a/extensions/libxt_IDLETIMER.man
+++ b/extensions/libxt_IDLETIMER.man
@@ -18,3 +18,7 @@
 \fB\-\-label\fP \fIstring\fP
 This is a unique identifier for the timer.  The maximum length for the
 label string is 27 characters.
+.TP
+\fB\-\---send_nl_msg\fP
+Send netlink messages in addition to sysfs notifications and show remaining
+time.