diff options
author | Harald Welte <laforge@netfilter.org> | 2012-02-12 23:56:27 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-02-24 18:58:55 +0100 |
commit | ae77bf25af848e7c1db76a254e7ef4cdfa91c285 (patch) | |
tree | 807f72d75fde38714e1396c935f254fc710981ab /output | |
parent | 59a71256945df0645a3b91bbd1c305516af82b40 (diff) |
ulogd2 / DBI / table name
DBI: allow to define table name via table config option
While using the DBI plugin of ulogd2 for NFCT based accounting, despite
using table="conntrack", it always insisted in using the table "ulog"
for deriving the keys/columns to be stored.
I've hacked up a quick fix, and it seems to work as expected (though no
proper null termination after strncpy).
Signed-off-by: Harald Welte <laforge@netfilter.org>
Diffstat (limited to 'output')
-rw-r--r-- | output/dbi/ulogd_output_DBI.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/output/dbi/ulogd_output_DBI.c b/output/dbi/ulogd_output_DBI.c index 88730e6..4b3ec16 100644 --- a/output/dbi/ulogd_output_DBI.c +++ b/output/dbi/ulogd_output_DBI.c @@ -102,7 +102,8 @@ static void str_tolower(char *s) static int get_columns_dbi(struct ulogd_pluginstance *upi) { struct dbi_instance *pi = (struct dbi_instance *) upi->private; - char query[256] = "SELECT * FROM ulog\0"; + char *table = table_ce(upi->config_kset).u.string; + char query[256]; unsigned int ui; if (!pi->dbh) { @@ -110,6 +111,8 @@ static int get_columns_dbi(struct ulogd_pluginstance *upi) return 1; } + snprintf(query, 256, "SELECT * FROM %s", table); + ulogd_log(ULOGD_DEBUG, "%s\n", query); pi->result = dbi_conn_query(pi->dbh,query); if (!pi->result) { |