aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2023-10-21 19:43:59 -0700
committerMaciej Żenczykowski <maze@google.com>2023-10-23 11:04:56 -0700
commit97823ea15ca277ec723a02bc9d4081be5dc3037c (patch)
treea6f49cca60c8c3bcde085d3891c23dd5c68ec7e6
parent0b40e0cb0eaaeb50db17a4b31dfa18b2673334bb (diff)
downloadiptables-97823ea15ca277ec723a02bc9d4081be5dc3037c.tar.gz
ANDROID: extensions/libxt_LOG.c: manually define prioritynames[]
This is based on looking at: https://git.netfilter.org/iptables/commit/?h=v1.8.10&id=87e4f1bf0b87b23f0fe29e5f9976d64843de8785 Test: builds, but the following fail: $ atest NetdBinderTest IptablesRestoreControllerTest NetdBinderTest#TetherGetStats NetdBinderTest#StrictSetUidCleartextPenalty NetdBinderTest#FirewallSetFirewallType NetdBinderTest#FirewallSetInterfaceRule NetdBinderTest#TetherForwardAddRemove IptablesRestoreControllerTest#TestCommandTimeout Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: Id55f855d05c8f0e9b7a01a881da3cc4b211341ae
-rw-r--r--extensions/libxt_LOG.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/extensions/libxt_LOG.c b/extensions/libxt_LOG.c
index b6fe0b2e..d930bb97 100644
--- a/extensions/libxt_LOG.c
+++ b/extensions/libxt_LOG.c
@@ -1,7 +1,34 @@
#include <stdio.h>
#include <string.h>
+#ifndef __BIONIC__
#define SYSLOG_NAMES
#include <syslog.h>
+#else /* __BIONIC__ */
+#include <syslog.h>
+/* 'prioritynames[]' should come from syslog.h, but bionic doesn't provide it...
+ * It is a lookup array from a string name to a non unique LOG_* value,
+ * but it can also be used in reverse (in which case first match wins),
+ * so the order matters.
+ * iptables 1.8.9 only uses it for the level -> name lookup.
+ */
+static const struct {
+ const char * const c_name;
+ const int c_val;
+} prioritynames[] = {
+ { .c_name = "emerg", .c_val = LOG_EMERG, },
+ { .c_name = "panic", .c_val = LOG_EMERG, },
+ { .c_name = "alert", .c_val = LOG_ALERT, },
+ { .c_name = "crit", .c_val = LOG_CRIT, },
+ { .c_name = "err", .c_val = LOG_ERR, },
+ { .c_name = "error", .c_val = LOG_ERR, },
+ { .c_name = "warn", .c_val = LOG_WARNING, },
+ { .c_name = "warning", .c_val = LOG_WARNING, },
+ { .c_name = "notice", .c_val = LOG_NOTICE, },
+ { .c_name = "info", .c_val = LOG_INFO, },
+ { .c_name = "debug", .c_val = LOG_DEBUG, },
+ { .c_name = NULL, .c_val = -1, },
+};
+#endif /* __BIONIC__ */
#include <xtables.h>
#include <linux/netfilter/xt_LOG.h>