All of lore.kernel.org
 help / color / mirror / Atom feed
* [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

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.