* [PATCH] ulogd2 / DBI / table name
@ 2012-02-12 22:56 Harald Welte
2012-02-13 22:16 ` Pablo Neira Ayuso
2012-02-24 17:59 ` Pablo Neira Ayuso
0 siblings, 2 replies; 3+ messages in thread
From: Harald Welte @ 2012-02-12 22:56 UTC (permalink / raw)
To: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 844 bytes --]
Hi!
I've tried to use the DBI plugin of ulogd2 for NFCT based accounting,
and 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 temrmination after strncpy).
As I've been absent from ulogd and netfilter hacking for some time, I
tohught I'd post it here rather than pushing something to the git
repo...
Regards,
Harald
--
- Harald Welte <laforge@netfilter.org> http://netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie
[-- Attachment #2: ulogd2-dbi-table.diff --]
[-- Type: text/x-diff, Size: 773 bytes --]
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) {
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ulogd2 / DBI / table name
2012-02-12 22:56 [PATCH] ulogd2 / DBI / table name Harald Welte
@ 2012-02-13 22:16 ` Pablo Neira Ayuso
2012-02-24 17:59 ` Pablo Neira Ayuso
1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2012-02-13 22:16 UTC (permalink / raw)
To: Harald Welte; +Cc: netfilter-devel
Hi Harald!
On Sun, Feb 12, 2012 at 11:56:27PM +0100, Harald Welte wrote:
> Hi!
>
> I've tried to use the DBI plugin of ulogd2 for NFCT based accounting,
> and 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 temrmination after strncpy).
>
> As I've been absent from ulogd and netfilter hacking for some time, I
> tohught I'd post it here rather than pushing something to the git
> repo...
Please, feel free to push it!
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ulogd2 / DBI / table name
2012-02-12 22:56 [PATCH] ulogd2 / DBI / table name Harald Welte
2012-02-13 22:16 ` Pablo Neira Ayuso
@ 2012-02-24 17:59 ` Pablo Neira Ayuso
1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2012-02-24 17:59 UTC (permalink / raw)
To: Harald Welte; +Cc: netfilter-devel
On Sun, Feb 12, 2012 at 11:56:27PM +0100, Harald Welte wrote:
> Hi!
>
> I've tried to use the DBI plugin of ulogd2 for NFCT based accounting,
> and 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 temrmination after strncpy).
>
> As I've been absent from ulogd and netfilter hacking for some time, I
> tohught I'd post it here rather than pushing something to the git
> repo...
Applied, thanks Harald!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-02-24 17:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-12 22:56 [PATCH] ulogd2 / DBI / table name Harald Welte
2012-02-13 22:16 ` Pablo Neira Ayuso
2012-02-24 17:59 ` Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.