159 Commits

Author SHA1 Message Date
PascalWithopf
c83e3ed216 correct codestyle in rsyslog part 2 2018-08-01 16:11:33 +02:00
PascalWithopf
19133327cc correct codestyle in rsyslog 2018-07-31 09:44:27 +02:00
Rainer Gerhards
fff09ac94d
core: replace errmsg object calling conventions
old interface still needs to be removed to fully finish
refactoring of this component.

see also https://github.com/rsyslog/rsyslog/issues/1684
2018-07-21 17:47:29 +02:00
Rainer Gerhards
84980e2883 omfwd: fix memory leak in never-released code
This is a regression from
https://github.com/rsyslog/rsyslog/commit/2bd0fb282df92962a9817b

PR https://github.com/rsyslog/rsyslog/pull/2651 introduced that commit.

Note: that commit was merged 17 days ago and is not part of any offically
released version.

Detected by Coverity Scan, CID 190071, 190072.
2018-05-04 10:05:28 +02:00
Mike Manning
2bd0fb282d omfwd: add support for bind-to-address for UDP
To allow the same source address to be used regardless of the egress
interface taken, an option is added for an address to bind the datagram
socket to. Similarly to imudp, it is necessary to add an ipfreebind
option which is set by default, so as to avoid an excess of errors at
startup before the network interface has come up. This enhancement
allows a usecase on networking devices, by which a source interface
that is typically a loopback is specified, on which an address to bind
to is configured. This is so that the same source address is used for
all packets from rsyslog. Support for the TCP case can be added later.

Signed-off-by: Mike Manning <mmanning@att.com>
2018-04-20 07:50:58 +01:00
Rainer Gerhards
48c397374d fix some __attribute__((unused)) and add missing ones
as it looks, some compiler versions (e.g. gcc 7) seem to be rather
picky on the position where this attribute is applied. So this
commit moves them to the position where they are properly detected.

We also add missing attributes. Some are missing due to conditional
compilation what we did not detect in our regular development
environments. This now comes up as we have enabled the corresponding
warning globally, and so they now also show up on those platforms.
2018-04-10 14:44:58 +02:00
PascalWithopf
79de51e4fc codestyle: reduce max line length to 125 2017-12-20 16:16:57 +01:00
PascalWithopf
e485c5c5bc codestyle: shorten lines to max 130 chars 2017-11-15 09:04:42 +01:00
Rainer Gerhards
9114c91d36 omfwd bugfix: ressource leak if namespace could not be set
could only happen if namespaces were used

Detected by Coverty scan, CID 185442.
2017-10-27 13:20:52 +02:00
Rainer Gerhards
5838aa6c77 omfwd bugfix: memory leak if network namespaces are used
very seldom used feature, occurs only during error case

found by Coverty scan.
2017-10-26 10:18:41 +02:00
Rainer Gerhards
77dace5856 omfwd: fix small nit
debug output speeded up by using more approriate macro
2017-10-06 12:40:39 +02:00
Rainer Gerhards
44f5412cb9 omfwd: fix some minor defects with error message emission and format 2017-10-05 13:32:07 +02:00
Rainer Gerhards
57a7c281ff omfwd bugfix: UDP oversize message not properly handled
When a message larger than supported by the UDP stack is to be sent,
EMSGSIZE is returned, but not specifically handled. That in turn
will lead to action suspension. However, this does not make sense
because messages over the UDP max message size simply cannot be sent.

This patch truncates the message in question and reports an error
message with the condition.

closes https://github.com/rsyslog/rsyslog/issues/1654
2017-09-11 12:53:54 +02:00
Rainer Gerhards
5bbd0a4b3c core: memory corruption during configuration parsing
when omfwd is used with the $streamdriverpermittedpeers legacy
parameter, a memory corruption can occur. This depends on the
length of the provided strings and probably the malloc subsystem.

Once config parsing succeeds, no problem can happen.

Thanks to Brent Douglas for initially reporting this issue and
providing great analysis.
Thanks to github user bwdoll for analyzing this bug and providing
a suggested fix (which is almost what this commit includes).

closes https://github.com/rsyslog/rsyslog/issues/1408
closes https://github.com/rsyslog/rsyslog/issues/1474
2017-09-06 13:20:51 +02:00
Rainer Gerhards
cbd00f8e2d Merge pull request #1707 from PascalWithopf/i-1093
omfwd, imtcp: add possibility to use priority string
2017-08-08 16:48:02 +02:00
PascalWithopf
717092d93e gnutls: add possibility to use priority string 2017-08-08 14:57:15 +02:00
Rainer Gerhards
97c3634c9e Merge pull request #1686 from CodeHarsh/master
omfwd: Use compression level from config
2017-08-01 17:30:04 +02:00
Harshvardhan.s
4f70bc5b5f omfwd: Use compression level from config 2017-07-21 13:51:18 +05:30
Rainer Gerhards
ef411c7d06 omfwd refactor: use new-style errmsg object API
see also https://github.com/rsyslog/rsyslog/issues/1684
2017-07-20 14:55:41 +02:00
Rainer Gerhards
85d12f295d omfwd: always give reason for suspension
In many cases, no error message were emitted when omfwd
went into action suspension, which was confusing for end
users. This patch enables explicit error messages in all
those cases.

closes https://github.com/rsyslog/rsyslog/issues/782
2017-07-20 14:52:31 +02:00
Rainer Gerhards
20c374b231 imudp: fix (cosmetic) unitialized data error 2017-07-12 14:43:00 +02:00
Rainer Gerhards
2401385a48 Merge branch 'i-1665-v8.25.0' into i-1655 2017-07-12 14:03:01 +02:00
Rainer Gerhards
35ae24c8a6 omfwd/udp: improve error reporting, depricate maxerrormessages parameter
Generally improved udp-related error messages (e.g. they now contain the
socket number, which makes it easier to related them to errors reported by
net.c subsystem).

We also depricated (removed) the "maxerrormessages" configuration parameters.
It provided some very rough rate-limiting capabilities and was introduced
before we had native rate-limiters. The default was that only the first 5
error messages were actually reported. For long-running instances, that
meant that in many cases no errors were ever reported. We now use the default
internal message rate limter, which works far better and ensures that also
long-running instances will be able to emit error messages after prolonged
runtime. In contrast, this also means that users will see more error
messages from rsyslog, but that should actually improve the end user
experience.
2017-07-12 13:55:11 +02:00
Rainer Gerhards
79032d68ca imudp: add "udp.sendbuf" parameter 2017-07-12 13:30:46 +02:00
Jan Gerhards
4b4dc81f91 omfwd: add parameter "tcp_frameDelimiter"
closes https://github.com/rsyslog/rsyslog/issues/1602
2017-06-10 16:28:45 +02:00
Bastian Stender
c5998d81fb fixup! omfwd: add support for network namespaces
- returnToOriginalNs: fix setting original namespace in instance data
- doTryResume: reset to original namespace even in case of an error
2017-03-27 10:47:01 +02:00
Bastian Stender
df17a40c7f omfwd: add support for network namespaces
Network namespaces are part of the linux kernel since v2.6.24. This
enables forwarding output into a configurable network namespace. E.g.,

action(type="omfwd" networknamespace="my_ns" target="192.168.1.23"
port="10514")

Signed-off-by: Bastian Stender <bst@pengutronix.de>
2017-03-20 14:30:57 +01:00
Pascal Withopf
b63a6b9010 codestyle: line length adjusted 2017-01-17 08:54:37 +01:00
David Ahern
19e5d06f66 omfwd imudp: Add support for bind-to-device
Add support for bind-to-device option to omfwd and imudp modules.
Configured using device="name". Only new syntax format is supported.
e.g.,

input(type="imudp" port=["10514"] device="eth0" name="udp")
action(type="omfwd" Target="192.168.1.23" Port="10514" Device="eth0")

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
2016-11-15 17:55:56 -07:00
David Ahern
7e9944037b omfwd bugfix: bIsConnected should only be set on success
doTryResume uses bIsConnected to know if socket initializations need
to be done. It should only be set if pWrkrData->pSockArray is non-NULL
meaning create_udp_socket succeeded. As it stands the re-init is
attempted only once and if it fails never tried again.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
2016-11-15 17:55:54 -07:00
Rainer Gerhards
448f16495c remove "inline" attribute from excessivly long functions 2016-10-26 11:50:15 +02:00
Rainer Gerhards
8abfb8117f fix potential misadressing
found by clang static analyzer
2016-06-21 14:19:57 +02:00
Rainer Gerhards
9c0b5d6aad add some debug output 2016-06-21 11:28:09 +02:00
Rainer Gerhards
624a80830a Merge branch 'fix-omfwd-memleak' of https://github.com/rgerhards/rsyslog into master-candidate 2016-03-31 08:56:50 +02:00
Rainer Gerhards
a08ebd46ba omfwd: fix cosmetic memleak
A very small leak that manifests itself only on rsyslogd
termination. However, it affects QA tools including CI.
2016-03-30 17:22:28 +02:00
Rainer Gerhards
9d839634d9 omfwd bugfix: keepalive action parameters did not work
due to being inconsistently spelled. This lead to an internal
program error, which unfortunately was only reported to the
debug log.

This patch both fixes the problem and also emits the internal
program error message to the regular log stream (in case a similar
problem re-occurs in the future). A testbench test is also added.

closes https://github.com/rsyslog/rsyslog/issues/916
2016-03-30 16:07:07 +02:00
Nirmoy Das
5f12c9b57e imudp: add config option for IP_FREEBIND socket option
ipfreebind config option by default enables IP_FREEBIND socket
option with warn message on success.
2016-03-22 15:42:53 +01:00
Rainer Gerhards
07a074dd88 cleanup: remove dbgprintf's not intended to stay
those starting at column 0 are temporary debug aids during development.
Some of them I intend to keep in for a version or two. Some of them
I tend to forget later. This is a cleanup of those. Most are removed,
some are promoted to be permanently there - now indicated by proper
indention.
2016-01-13 09:20:07 -05:30
Rainer Gerhards
6395e5ce38 fix clang static analyzer issue
unfortunately, there is no real "fix" for this border case. It
is unlikely to cause real trouble, but we now at least emit an
indictor message to the debug log. If for some reason a real
fix is needed, we need to redesign the core action API.
2015-11-30 09:17:39 +01:00
Reed Morrison
b300ba1467 Fixing tabs. 2015-08-20 10:29:27 -07:00
Reed Morrison
62391aaff2 Adding config options for client side keep-alives. 2015-08-20 10:24:21 -07:00
Rainer Gerhards
1203a26cd1 Merge branch 'clang' of https://github.com/rgerhards/rsyslog into master-candidate 2015-07-10 11:45:01 +02:00
Michael Biebl
91b6954331 typo fix: paramter → parameter
Followup fix for 6fbacdc41d37ce3091709e71f6f0e66912237606
2015-06-30 18:07:09 +02:00
Rainer Gerhards
71cbd456cb help generate a bit better code by using "const" keyword
The general question remains if it is good practice to use
const for dynamically allocted memory (as free takes a non-const
and, in a sense, modifies the object).

In this case, no harm can happen from that.
2015-06-26 10:53:27 +02:00
Rainer Gerhards
a99a06f5a2 bugfix: omfwd: setting the default template always fails
closes https://github.com/rsyslog/rsyslog/issues/385
2015-06-26 10:53:27 +02:00
Rainer Gerhards
e7e5366573 omfwd: cleanup error handling
see also https://github.com/rsyslog/rsyslog/issues/78
2015-02-24 13:06:34 +01:00
Rainer Gerhards
0caa468d94 imudp: more precise error message in case of send failure
It now contains the errno as numerical value in order to be
able to more precisely nail down the problem cause. The
strerror() generated message sometimes seems to be a bit
questionable.

Also refactored error processing a bit to take advantage of
the improved error reporting subsystem.
2015-02-03 17:49:37 +01:00
Rainer Gerhards
a5f9a2be73 remove debug left-over 2015-01-06 15:43:13 +01:00
Rainer Gerhards
793ec4b923 omfwd: add new "udp.senddelay" parameter 2014-12-11 12:52:28 +01:00
Rainer Gerhards
7902f04ea7 deprecate -A command line option 2014-11-27 13:10:37 +01:00