Commit Graph

375 Commits

Author SHA1 Message Date
bda0c0b013 Fixed dbfwfilter rule parser build failure
The rule parser used old log manager initialization calls
and looked for the source files in the wrong place.
2016-04-15 11:35:00 +03:00
b683a5dcf4 Fixed typo in dbfwfilter's CMakeLists.txt
`mesage` was used instead of `message`.
2016-04-15 11:34:08 +03:00
3c8bba26c9 MXS-646: Namedserverfilter ignores user and source
The namedserverfilter did not check if it was active for the session
before adding a routing hint to it.
2016-03-23 14:00:55 +02:00
fd34cd4014 Fixed luafilter build failures
The luafilter referred to the old session client DCB name and linked against
log_manager and utils but not maxscale-common.
2016-03-08 10:35:36 +02:00
3973ba36be Simplified tee filter packet handling logic
Inverting the default action of not routing packets to always routing packets
makes the code simpler to understand. Removing some of the not so useful debug
logging also makes the code more readable and easier to understand.
2016-03-07 16:21:48 +02:00
60714135c4 Merge branch 'develop-MXS-544-merge' into develop 2016-03-07 10:17:17 +02:00
59edee26c6 Fix misses in slavelag.c formatting.
astyle is more thorough.
2016-03-04 09:01:43 +02:00
6b4ffc8506 Cleanup slavelag.c
Untabification, indentation, Allman, etc.
2016-03-04 08:43:35 +02:00
d3da98b58f Merge branch 'MXS-544' into develop-MXS-544-merge 2016-03-03 21:39:39 +02:00
1a2bd8b234 Added FindLua.cmake from KitWare's repo for CMake 3.4.3
Some platforms did not have the FindLua.cmake file which caused errors on
configuration. Moved the invocation of find_package to the filter CMakeLists.txt
so that it is only called if the luafilter is built.
2016-03-03 16:42:48 +02:00
e1a8a6f373 Luafilter is not built by default
The luafilter requires the lua development libraries so it isn't built
by default.
2016-03-02 13:37:00 +02:00
b2742f02b9 More formatting of code
Code formatting.
2016-03-02 13:28:12 +02:00
2204a245c9 General cleaning up of the luafilter
Renamed variables to make their use more clear and cmake now looks for the Lua
libraries.
2016-03-02 13:28:12 +02:00
140d284eed Updated documentation for luafilter
Added more documentation to functions about how, when and with what parameters
the Lua functions are called with. Also adjusted the module version to experimental.
2016-03-02 13:27:24 +02:00
1c74ca0ec7 Cleaned up the luafilter. 2016-03-02 13:27:24 +02:00
3f3c553736 Finalized query blocking. 2016-03-02 13:26:50 +02:00
5d0f3eb467 Added a simple test for Lua return values from fuction calls. If the Lua function returns a string, the current query is replaced with it. 2016-03-02 13:26:50 +02:00
7e24d4c88b Added missing calls to the global script 2016-03-02 13:26:49 +02:00
61ec8458d3 Initial implementation of a Lua filter 2016-03-02 13:26:49 +02:00
2a2fdb2cc6 testing of Lua 2016-03-02 13:26:10 +02:00
cb3213af63 server/include/poll.h renamed to server/include/maxscale/poll.h
Due to an include conflict between /usr/include/poll.h and
maxscale/server/include/poll.h the latter was moved to
maxscale/server/include/maxscale/poll.h.

Once 1.4 is out, all maxscale header files will be moved to that
same sub-directory. That will prevent include conflicts and also
make it easy to see which include files belong to maxscale and
which do not.
2016-03-01 12:56:39 +02:00
2990c3b25f Fixed wrong variable being freed in qlafilter
The match parameter was freed twice.
2016-02-29 16:17:55 +02:00
bf24f18805 Merge branch 'develop' into MXS-544 2016-02-29 10:40:33 +02:00
87ccff097d Minor fix to token processing of dbfwfilter
The yylineno was manually simulated even though it can be automated by enabling
the yylineno option.
2016-02-26 12:30:56 +02:00
784166ad0b Added missing check for fopen return value
This would have led to a crash when a NULL pointer would have been used as
a valid FILE handle.
2016-02-25 20:10:37 +02:00
2c28d8c5de Removed unused functions and variables from dbfwfilter
Removed the old parsing functions which are no longer used.
2016-02-25 20:09:10 +02:00
7b8200eec0 Fixed build failures with older versions of Bison
Older versions of Bison don't include the yyparse function in the generated
header and use deprecated options.
2016-02-25 09:32:04 +02:00
57af3e3e24 Added support for older Bison versions
The older versions of Bison use the deprecated versions of various options.
The automatic prefixing of tokens is not present in older versions so to
accommodate for this, all tokens were manually prefixed.
2016-02-25 09:32:04 +02:00
cb2e3b898e Cleaned up qlafilter, topfilter and namedserverfilter instance creation
The change fixes a crash when no filebase parameter is given for the filter.

The instance creation functions of these filters had spossible memory leaks in
case errors in the configuration occurred. In addition to these, they would be
successfully created even if unexpected parameters were given.
2016-02-23 21:45:31 +02:00
aec1310c52 MXS-580: Added more options for filters
The tee, qlafilter, namedserverfilter and topfilter now support the same filter
options: case, ignorecase and extended. The extended filter option enables
the Extended Regular Expression syntax for the filters which is used when
matching queries.
2016-02-23 20:52:53 +02:00
19356be848 Updated documentation about Bison and Flex dependency
The dbfwfilter now requires Bison and Flex to be built
2016-02-23 20:52:52 +02:00
395cbdc103 Simplify handling of "client data" by having a pointer to it only in DCB and not in session structure. Change name of session->client to session->client_dcb for greater clarity. Temporary free of client data in DCB, to be moved to authenticator when it becomes a module. Fix incorrect name of listener_alloc. 2016-02-23 11:13:21 +00:00
1adbe3b23a No user definitions in dbfwfilter rules is treated as an error again
The lack of user definition lines in the dbfwfilter rule file was ignored
previously but this change makes the lack of users an error again. Also
added function documentation to some of the functions.
2016-02-23 10:34:12 +02:00
effa2dbdae Set dbfwfilter maturity to GA and set the version to 1.1.0
The module has been GA for a while and it has also changed so the version
should be updated.
2016-02-17 10:59:26 +02:00
497a72d42f Added extra logging to dbfwfilter output
The real username and host is now logged in addition to the user definition
that it matched. The messages also have the service name to distinct
connections to two different services which both use the same filter.
2016-02-17 10:45:21 +02:00
eaddc4ea9d Fixed dbfwfilter build failure on Ubuntu
The bison executable didn't generate the headers even though it was instructed
to generate them. This was caused by an older CMake version.
2016-02-09 16:35:51 +02:00
9e33f300b0 Added flex/bison based parsing of rules to dbfwfilter
The dbfwfilter now uses flex to tokenize the rules and bison to process those
tokens into a language. This will make the syntax checks more robust and
the rule language easier to maintain. It also makes the processing of rules
easier to understand and removes most of the C language side checks for
correctness.

The old rule processing functions are still left intact and will be removed
at a later point.
2016-02-09 11:00:27 +02:00
6055ba25bf Added logging of matching and non-matching queries to dbfwfilter
When configured to log matching queries, the dbfwfilter will log all queries
that match a rule. The rule name, user name and the query itself are logged.

It is also possible to match all queries that do not match a rule. Only the user
name and query is logged in this mode.
2016-02-09 11:00:27 +02:00
5efd5d8927 Added user configurable actions to dbfwfilter
The dbfwfilter can now either allow, block or ignore queries that match the
configured rules.
2016-02-09 11:00:27 +02:00
4a4f22c9a7 Make query_classifier part of core.
The query classifier interface is now built as an integral
part of MaxScale core.
2016-02-08 11:44:07 +02:00
834d04ed6c Merge branch 'MXS-517' into develop 2016-02-08 11:03:31 +02:00
0d51f78a2a Dbfwfilter now uses PCRE2 regular expressions
Switched from the POSIX regex implementation to PCRE2. This should improve the
filter's performance as well as make the code more manageable.
2016-02-02 12:38:44 +02:00
7bac2f8fab Moved the applying of rules to users to its own function
This makes the function easier to understand as a whole.
2016-02-02 12:38:44 +02:00
fc6f49fe8a Link against Connector-C.
Now, qc_mysqlembedded is linked against MySQL's embedded library,
and MaxScale itself against Connector-C.

So, in order to build MaxScale, Connector-C must be installed.
This has been tested with Connector-C 2.2.1.

The build variable MYSQLCLIENT_LIBRARIES is no longer used.
2016-02-01 15:43:05 +02:00
42b1722e49 Make query classifier self-contained.
Only the query classifier needs the functionality of the embedded
server, while the rest of MaxScale is content with the client
library or Connector/C.

This have now been rearranged so that query-classifier links with
the embedded static library and then explicitly exports its own
functions using the query_classifier.map linker script. That way
query classifier will use the embedded library, while the rest of
maxscale use the client library, and this without conflicts.

Currently, query_classifier is not linked to maxscale-common,
but executables must link to maxscale-common and query_classifier.
2016-01-25 21:43:49 +02:00
1f241a5ed1 Rearrange libraries and build files.
This is the first change in an attempt to arrange the linking so that
more errors are detected at link-time.

- All files in server/core but for gateway.c are linked to one shared
  library called maxscale-common.
- The files log_manager/log_manager.cc and utils/skygw_utils.cc are
  built into maxscale-common as well.
- MaxScale itself consists now only of gateway.c and is linked with
  maxscale-common.
- All plugins link with maxscale-common.
- All executables link in addition with {EMBEDDED_LIB}.

After this change, the change (MXS-517) where query_classifier is the
only component that uses ${EMBEDDED_LIB} and the rest mysqlclient can
be made much cleaner.

After a few additional steps, all shared libraries can be linked with
the linker flags "-Wl,-z,defs", which directs the linker to resolve
all symbols. That will require that all shared libraries list all the
libraries they need, but will at the same time ensure that any
missing symbols are detected at link-time and not at run-time.
2016-01-22 23:26:17 +02:00
a2bc15c870 Removed obsolete functions from dbfwfilter
The filter defined its own hashing and string comparison functions even though
there are common functions for both.
2016-01-15 16:22:18 +02:00
0a3e6b4352 MXS-498: Username and source address added to QLA filter output
The filter now logs the username and remote address of each client. This will
make tracking of users and their queries a lot easier.
2016-01-12 09:30:03 +02:00
23a7562d3a Replace skygw_ type prefix with qc_.
- skygw_query_type_t renamed to qc_query_type_t.
- skygw_query_op_t renamed to qc_query_op_t.
2016-01-11 12:06:21 +02:00
2f42246880 Rename query classifier functions consistently.
All public query classifier functions now have the prefix qc_.
2016-01-11 12:04:52 +02:00