* [PATCH] ulogd mysql fix
@ 2007-08-01 11:48 Eric Leblond
2007-08-01 13:06 ` Pablo Neira Ayuso
0 siblings, 1 reply; 4+ messages in thread
From: Eric Leblond @ 2007-08-01 11:48 UTC (permalink / raw)
To: Netfilter Developer Mailing List
[-- Attachment #1.1: Type: text/plain, Size: 328 bytes --]
Hi,
MySQL 5.0 has changed the default for database reconnection after
timeout. It is now not enabled by default. The following patch restores
the reconnection functionnality for the ulogd-mysql plugin.
BR,
--
Éric Leblond, eleblond@inl.fr
Téléphone : 01 44 89 46 39, Fax : 01 44 89 45 01
INL, http://www.inl.fr
[-- Attachment #1.2: ulogd_mysql.diff --]
[-- Type: text/x-patch, Size: 1028 bytes --]
Index: mysql/ulogd_MYSQL.c
===================================================================
--- mysql/ulogd_MYSQL.c (révision 6979)
+++ mysql/ulogd_MYSQL.c (copie de travail)
@@ -407,6 +407,9 @@
static int mysql_open_db(char *server, int port, char *user, char *pass,
char *db)
{
+#ifdef MYSQL_OPT_RECONNECT
+ my_bool trueval = 1;
+#endif
dbh = mysql_init(NULL);
if (!dbh)
return -1;
@@ -415,12 +418,25 @@
mysql_options(dbh, MYSQL_OPT_CONNECT_TIMEOUT,
(const char *) &connect_timeout_ce.u.value);
+#ifdef MYSQL_OPT_RECONNECT
+# if defined(MYSQL_VERSION_ID) && (MYSQL_VERSION_ID >= 50019)
+ mysql_options(dbh, MYSQL_OPT_RECONNECT, &trueval);
+# endif
+#endif
+
+
if (!mysql_real_connect(dbh, server, user, pass, db, port, NULL, 0))
{
_mysql_fini();
return -1;
}
+#ifdef MYSQL_OPT_RECONNECT
+# if defined(MYSQL_VERSION_ID) && (MYSQL_VERSION_ID < 50019)
+ mysql_options(dbh, MYSQL_OPT_RECONNECT, &trueval);
+# endif
+#endif
+
return 0;
}
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ulogd mysql fix
2007-08-01 11:48 [PATCH] ulogd mysql fix Eric Leblond
@ 2007-08-01 13:06 ` Pablo Neira Ayuso
2007-08-01 13:43 ` Eric Leblond
0 siblings, 1 reply; 4+ messages in thread
From: Pablo Neira Ayuso @ 2007-08-01 13:06 UTC (permalink / raw)
To: Eric Leblond; +Cc: Netfilter Developer Mailing List
Hi Eric,
Eric Leblond wrote:
> MySQL 5.0 has changed the default for database reconnection after
> timeout. It is now not enabled by default. The following patch restores
> the reconnection functionnality for the ulogd-mysql plugin.
Why don't we inconditionally enable it? I mean, we can just forget about
the version checking. If I understood well, mysql <= 5.0 enables
reconnection by default and >= 5.0 doesn't, so we can inconditionally
enable it and forget about future default behaviours. What do you think?
--
"Será preciso viajar a través de los ojos de los idiotas" -- Poeta en
Nueva York -- Federico García Lorca.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ulogd mysql fix
2007-08-01 13:06 ` Pablo Neira Ayuso
@ 2007-08-01 13:43 ` Eric Leblond
2007-08-06 8:54 ` Pablo Neira Ayuso
0 siblings, 1 reply; 4+ messages in thread
From: Eric Leblond @ 2007-08-01 13:43 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: Netfilter Developer Mailing List
[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]
Hi,
Le mercredi 01 août 2007 à 15:06 +0200, Pablo Neira Ayuso a écrit :
> Hi Eric,
>
> Eric Leblond wrote:
> > MySQL 5.0 has changed the default for database reconnection after
> > timeout. It is now not enabled by default. The following patch restores
> > the reconnection functionnality for the ulogd-mysql plugin.
>
> Why don't we inconditionally enable it? I mean, we can just forget about
> the version checking. If I understood well, mysql <= 5.0 enables
> reconnection by default and >= 5.0 doesn't, so we can inconditionally
> enable it and forget about future default behaviours. What do you think?
In fact, MYSQL_OPT_RECONNECT option has been introduced in MySQL 5.0.13
to restore the capability to reconnect to server after inactivity.
Furthermore, the functionnality was partially broken before 5.0.19 and
this explains the two calls to mysql_option.
BR,
--
Éric Leblond, eleblond@inl.fr
Téléphone : 01 44 89 46 39, Fax : 01 44 89 45 01
INL, http://www.inl.fr
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ulogd mysql fix
2007-08-01 13:43 ` Eric Leblond
@ 2007-08-06 8:54 ` Pablo Neira Ayuso
0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2007-08-06 8:54 UTC (permalink / raw)
To: Eric Leblond; +Cc: Netfilter Developer Mailing List
Eric Leblond wrote:
> In fact, MYSQL_OPT_RECONNECT option has been introduced in MySQL 5.0.13
> to restore the capability to reconnect to server after inactivity.
> Furthermore, the functionnality was partially broken before 5.0.19 and
> this explains the two calls to mysql_option.
Ick! scary thing. Two point less for the mysql guys... Applied, thanks Eric.
--
"Será preciso viajar a través de los ojos de los idiotas" -- Poeta en
Nueva York -- Federico García Lorca.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-08-06 8:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-01 11:48 [PATCH] ulogd mysql fix Eric Leblond
2007-08-01 13:06 ` Pablo Neira Ayuso
2007-08-01 13:43 ` Eric Leblond
2007-08-06 8:54 ` 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.